Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc431bc6

Browse files
committed
Improvement. Clean a list of deactivated queries during the call of
the aqo_reset() routine: we want to clean all the AQO internal state on reset.
1 parente7c2cad commitc431bc6

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

‎storage.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ init_deactivated_queries_storage(void)
195195
MemSet(&hash_ctl,0,sizeof(hash_ctl));
196196
hash_ctl.keysize=sizeof(uint64);
197197
hash_ctl.entrysize=sizeof(uint64);
198-
deactivated_queries=hash_create("aqo_deactivated_queries",
198+
deactivated_queries=hash_create("AQO deactivated queries",
199199
128,/* start small and extend */
200200
&hash_ctl,
201201
HASH_ELEM |HASH_BLOBS);
@@ -207,15 +207,29 @@ query_is_deactivated(uint64 queryid)
207207
{
208208
boolfound;
209209

210-
hash_search(deactivated_queries,&queryid,HASH_FIND,&found);
210+
(void)hash_search(deactivated_queries,&queryid,HASH_FIND,&found);
211211
returnfound;
212212
}
213213

214214
/* Adds given query hash into the set of hashes of deactivated queries */
215215
void
216216
add_deactivated_query(uint64queryid)
217217
{
218-
hash_search(deactivated_queries,&queryid,HASH_ENTER,NULL);
218+
(void)hash_search(deactivated_queries,&queryid,HASH_ENTER,NULL);
219+
}
220+
221+
staticvoid
222+
reset_deactivated_queries(void)
223+
{
224+
HASH_SEQ_STATUShash_seq;
225+
uint64*queryid;
226+
227+
hash_seq_init(&hash_seq,deactivated_queries);
228+
while ((queryid=hash_seq_search(&hash_seq))!=NULL)
229+
{
230+
if (!hash_search(deactivated_queries,queryid,HASH_REMOVE,NULL))
231+
elog(PANIC,"[AQO] hash table corrupted");
232+
}
219233
}
220234

221235
/*
@@ -2179,7 +2193,6 @@ aqo_queries_update(PG_FUNCTION_ARGS)
21792193
{PG_ARGISNULL(AQ_FS),PG_ARGISNULL(AQ_LEARN_AQO),
21802194
PG_ARGISNULL(AQ_USE_AQO),PG_ARGISNULL(AQ_AUTO_TUNING) };
21812195

2182-
21832196
if (PG_ARGISNULL(AQ_QUERYID))
21842197
PG_RETURN_BOOL(false);
21852198

@@ -2211,6 +2224,10 @@ aqo_reset(PG_FUNCTION_ARGS)
22112224
counter+=aqo_qtexts_reset();
22122225
counter+=aqo_data_reset();
22132226
counter+=aqo_queries_reset();
2227+
2228+
/* Cleanup cache of deactivated queries */
2229+
reset_deactivated_queries();
2230+
22142231
PG_RETURN_INT64(counter);
22152232
}
22162233

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp