8000 Unify elog messages for the case of corrupted hash table. · postgrespro/aqo@de8cb2a · GitHub
[go: up one dir, main page]

Skip to content

Commit de8cb2a

Browse files
committed
Unify elog messages for the case of corrupted hash table.
1 parent e49f2fd commit de8cb2a

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

learn_cache.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ lc_flush_data(void)
293293
aqo_data_store(hdr->key.fs, hdr->key.fss, &data, reloids);
294294

295295
if (!hash_search(fss_htab, (void *) &hdr->key, HASH_REMOVE, NULL))
296-
elog(ERROR, "[AQO] Flush: local ML cache is corrupted.");
296+
elog(PANIC, "[AQO] Flush: local ML cache is corrupted.");
297297
}
298298

299299
reset_dsm_cache();
@@ -323,7 +323,7 @@ lc_assign_hook(bool newval, void *extra)
323323
while ((entry = (htab_entry *) hash_seq_search(&status)) != NULL)
324324
{
325325
if (!hash_search(fss_htab, (void *) &entry->key, HASH_REMOVE, NULL))
326-
elog(ERROR, "[AQO] The local ML cache is corrupted.");
326+
elog(PANIC, "[AQO] The local ML cache is corrupted.");
327327
}
328328
LWLockRelease(&aqo_state->lock);
329329
}

storage.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,8 @@ aqo_stat_reset(void)
388388
hash_seq_init(&hash_seq, stat_htab);
389389
while ((entry = hash_seq_search(&hash_seq)) != NULL)
390390
{
391-
if (hash_search(stat_htab, &entry->queryid, HASH_REMOVE, NULL) == NULL)
392-
elog(ERROR, "[AQO] hash table corrupted");
391+
if (!hash_search(stat_htab, &entry->queryid, HASH_REMOVE, NULL))
392+
elog(PANIC, "[AQO] hash table corrupted");
393393
num_remove++;
394394
}
395395
aqo_state->stat_changed = true;
@@ -1225,7 +1225,7 @@ _aqo_data_remove(data_key *key)
12251225
dsa_free(data_dsa, entry->data_dp);
12261226
entry->data_dp = InvalidDsaPointer;
12271227

1228-
if (hash_search(data_htab, key, HASH_REMOVE, NULL) == NULL)
1228+
if (!hash_search(data_htab, key, HASH_REMOVE, NULL))
12291229
elog(PANIC, "[AQO] Inconsistent data hash table");
12301230

12311231
aqo_state->data_changed = true;
@@ -1256,8 +1256,8 @@ aqo_qtexts_reset(void)
12561256

12571257
Assert(DsaPointerIsValid(entry->qtext_dp));
12581258
dsa_free(qtext_dsa, entry->qtext_dp);
1259-
if (hash_search(qtexts_htab, &entry->queryid, HASH_REMOVE, NULL) == NULL)
1260-
elog(ERROR, "[AQO] hash table corrupted");
1259+
if (!hash_search(qtexts_htab, &entry->queryid, HASH_REMOVE, NULL))
1260+
elog(PANIC, "[AQO] hash table corrupted");
12611261
num_remove++;
12621262
}
12631263
aqo_state->qtexts_changed = true;
@@ -1718,8 +1718,8 @@ _aqo_data_clean(uint64 fs)
17181718
Assert(DsaPointerIsValid(entry->data_dp));
17191719
dsa_free(data_dsa, entry->data_dp);
17201720
entry->data_dp = InvalidDsaPointer;
1721-
if (hash_search(data_htab, &entry->key, HASH_REMOVE, NULL) == NULL)
1722-
elog(ERROR, "[AQO] hash table corrupted");
1721+
if (!hash_search(data_htab, &entry->key, HASH_REMOVE, NULL))
1722+
elog(PANIC, "[AQO] hash table corrupted");
17231723
removed++;
17241724
}
17251725

@@ -1745,8 +1745,8 @@ aqo_data_reset(void)
17451745
{
17461746
Assert(DsaPointerIsValid(entry->data_dp));
17471747
dsa_free(data_dsa, entry->data_dp);
1748-
if (hash_search(data_htab, &entry->key, HASH_REMOVE, NULL) == NULL)
1749-
elog(ERROR, "[AQO] hash table corrupted");
1748+
if (!hash_search(data_htab, &entry->key, HASH_REMOVE, NULL))
1749+
elog(PANIC, "[AQO] hash table corrupted");
17501750
num_remove++;
17511751
}
17521752

@@ -1885,8 +1885,8 @@ aqo_queries_reset(void)
18851885
/* Don't remove default feature space */
18861886
continue;
18871887

1888-
if (hash_search(queries_htab, &entry->queryid, HASH_REMOVE, NULL) == NULL)
1889-
elog(ERROR, "[AQO] hash table corrupted");
1888+
if (!hash_search(queries_htab, &entry->queryid, HASH_REMOVE, NULL))
1889+
elog(PANIC, "[AQO] hash table corrupted");
18901890
num_remove++;
18911891
}
18921892

0 commit comments

Comments
 (0)
0