Skip to content

Commit 8c5bc59

Browse files
committed
Remove custom lock tags from the AQO storage.
1 parent 48f6df1 commit 8c5bc59

File tree

4 files changed

+0
-42
lines changed

4 files changed

+0
-42
lines changed

‎aqo.c

-16
Original file line numberDiff line numberDiff line change
@@ -304,22 +304,6 @@ get_aqo_schema(void)
304304
return result;
305305
}
306306

307-
/*
308-
* Init userlock
309-
*/
310-
void
311-
init_lock_tag(LOCKTAG *tag, uint64 key1, int32 key2)
312-
{
313-
uint32 key = key1 % UINT32_MAX;
314-
315-
tag->locktag_field1 = AQO_MODULE_MAGIC;
316-
tag->locktag_field2 = key;
317-
tag->locktag_field3 = (uint32) key2;
318-
tag->locktag_field4 = 0;
319-
tag->locktag_type = LOCKTAG_USERLOCK;
320-
tag->locktag_lockmethodid = USER_LOCKMETHOD;
321-
}
322-
323307
/*
324308
* AQO is really needed for any activity?
325309
*/

‎aqo.h

-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ extern double *selectivity_cache_find_global_relid(int clause_hash,
294294
extern void selectivity_cache_clear(void);
295295

296296
extern Oid get_aqo_schema(void);
297-
extern void init_lock_tag(LOCKTAG *tag, uint64 key1, int32 key2);
298297
extern bool IsQueryDisabled(void);
299298

300299
extern List *cur_classes;

‎postprocessing.c

-15
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,11 @@ atomic_fss_learn_step(uint64 fs, int fss, OkNNrdata *data,
8787
double *features, double target, double rfactor,
8888
List *reloids, bool isTimedOut)
8989
{
90-
LOCKTAG tag;
91-
92-
init_lock_tag(&tag, fs, fss);
93-
LockAcquire(&tag, ExclusiveLock, false, false);
94-
9590
if (!load_fss_ext(fs, fss, data, NULL, !isTimedOut))
9691
data->rows = 0;
9792

9893
data->rows = OkNNr_learn(data, features, target, rfactor);
9994
update_fss_ext(fs, fss, data, reloids, isTimedOut);
100-
101-
LockRelease(&tag, ExclusiveLock, false);
10295
}
10396

10497
static void
@@ -719,7 +712,6 @@ aqo_ExecutorEnd(QueryDesc *queryDesc)
719712
StatEntry *stat;
720713
instr_time endtime;
721714
EphemeralNamedRelation enr = get_ENR(queryDesc->queryEnv, PlanStateInfo);
722-
LOCKTAG tag;
723715

724716
cardinality_sum_errors = 0.;
725717
cardinality_num_objects = 0;
@@ -773,10 +765,6 @@ aqo_ExecutorEnd(QueryDesc *queryDesc)
773765
else
774766
cardinality_error = -1;
775767

776-
/* Prevent concurrent updates. */
777-
init_lock_tag(&tag, query_context.query_hash, query_context.fspace_hash);
778-
LockAcquire(&tag, ExclusiveLock, false, false);
779-
780768
if (query_context.collect_stat)
781769
{
782770
/* Write AQO statistics to the aqo_query_stat table */
@@ -795,9 +783,6 @@ aqo_ExecutorEnd(QueryDesc *queryDesc)
795783
}
796784
}
797785

798-
/* Allow concurrent queries to update this feature space. */
799-
LockRelease(&tag, ExclusiveLock, false);
800-
801786
selectivity_cache_clear();
802787
cur_classes = ldelete_uint64(cur_classes, query_context.query_hash);
803788

‎preprocessing.c

-10
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ aqo_planner(Query *parse,
127127
ParamListInfo boundParams)
128128
{
129129
bool query_is_stored = false;
130-
LOCKTAG tag;
131130
MemoryContext oldCxt;
132131

133132
/*
@@ -291,13 +290,6 @@ aqo_planner(Query *parse,
291290
ignore_query_settings:
292291
if (!query_is_stored && (query_context.adding_query || force_collect_stat))
293292
{
294-
/*
295-
* find-add query and query text must be atomic operation to prevent
296-
* concurrent insertions.
297-
*/
298-
init_lock_tag(&tag, query_context.query_hash, 0);
299-
LockAcquire(&tag, ExclusiveLock, false, false);
300-
301293
/*
302294
* Add query into the AQO knowledge base. To process an error with
303295
* concurrent addition from another backend we will try to restart
@@ -312,8 +304,6 @@ aqo_planner(Query *parse,
312304
* analysis. In the case of cached plans we may have NULL query text.
313305
*/
314306
aqo_qtext_store(query_context.query_hash, query_string);
315-
316-
LockRelease(&tag, ExclusiveLock, false);
317307
}
318308

319309
if (force_collect_stat)

0 commit comments

Comments
 (0)