8000 fix key size · postgrespro/aqo@a547fab · GitHub
[go: up one dir, main page]

Skip to content

Commit a547fab

Browse files
author
Alexandra Pervushina
committed
fix key size
1 parent 40ceb51 commit a547fab

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

aqo_shared.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ aqo_init_shmem(void)
242242
&info, HASH_ELEM | HASH_BLOBS);
243243

244244
/* Shared memory hash table for fss neighbours */
245-
info.keysize = sizeof(int);
245+
info.keysize = sizeof(int64);
246246
info.entrysize = sizeof(DataEntry *);
247247
fss_neighbours = ShmemInitHash("AQO fss neighbours HTAB", fss_max_items, fss_max_items,
248248
&info, HASH_ELEM | HASH_BLOBS);

storage.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,7 +1393,7 @@ aqo_data_store(uint64 fs, int fss, OkNNrdata *data, List *reloids)
13931393
if (!found) {
13941394
LWLockAcquire(&aqo_state->neighbours_lock, LW_EXCLUSIVE);
13951395

1396-
prev = (NeighboursEntry *) hash_search(fss_neighbours, &fss, HASH_ENTER, &found);
1396+
prev = (NeighboursEntry *) hash_search(fss_neighbours, &key.fss, HASH_ENTER, &found);
13971397
if (!found)
13981398
{
13991399
entry->list.prev = NULL;
@@ -1754,7 +1754,7 @@ _aqo_data_clean(uint64 fs)
17541754
dsa_free(data_dsa, entry->data_dp);
17551755
entry->data_dp = InvalidDsaPointer;
17561756

1757-
/* fix fs list */
1757+
/* fix neighbour list */
17581758
if (entry->list.next)
17591759
has_next = true;
17601760
if (entry->list.prev)
@@ -2099,11 +2099,14 @@ aqo_neighbours_reset(void)
20992099
elog(ERROR, "[AQO] hash table corrupted");
21002100
num_remove++;
21012101
}
2102-
aqo_state->neighbours_changed = true;
2102+
2103+
if (num_remove > 0)
2104+
aqo_state->neighbours_changed = true;
2105+
21032106
LWLockRelease(&aqo_state->neighbours_lock);
21042107

21052108
if (num_remove != num_entries)
2106-
elog(ERROR, "[AQO] Neighbour memory storage is corrupted or parallel access without a lock was detected.");
2109+
elog(ERROR, "[AQO] Neighbours memory storage is corrupted or parallel access without a lock has detected.");
21072110

21082111
return num_remove;
21092112
}
@@ -2231,7 +2234,7 @@ cleanup_aqo_database(bool gentle, int *fs_num, int *fss_num)
22312234
DataEntry *entry;
22322235
NeighboursEntry *fss_htab_entry;
22332236

2234-
/* fix fs list */
2237+
/* fix neighbours list */
22352238
entry = (DataEntry *) hash_search(data_htab, &key, HASH_FIND, &found);
22362239
if (found)
22372240
{

0 commit comments

Comments
 (0)
0