Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3df20b3

Browse files
author
Alexandra Pervushina
committed
fix fss type
1 parent f838720 commit 3df20b3

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

storage.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,7 +1586,8 @@ load_aqo_data(uint64 fs, int fss, OkNNrdata *data, List **reloids,
15861586

15871587
found = false;
15881588
LWLockAcquire(&aqo_state->neighbours_lock, LW_EXCLUSIVE);
1589-
neighbour_entry = (NeighboursEntry *) hash_search(fss_neighbours, &fss, HASH_FIND, &found);
1589+
neighbour_entry = (NeighboursEntry *) hash_search(fss_neighbours, &key.fss, HASH_FIND, &found);
1590+
// elog(NOTICE, "neighbours num %ld", hash_get_num_entries(fss_neighbours));
15901591
entry = found ? neighbour_entry->data : NULL;
15911592

15921593
/*
@@ -1595,10 +1596,10 @@ load_aqo_data(uint64 fs, int fss, OkNNrdata *data, List **reloids,
15951596
while (entry != NULL)
15961597
{
15971598
List *tmp_oids = NIL;
1598-
1599+
elog(NOTICE, "ЗАШЛИ К СОСЕДЯМ entry %d data %d", entry->cols, data->cols);
15991600
if (entry->cols != data->cols)
16001601
continue;
1601-
1602+
elog(NOTICE, "Я нашел соседа fss %d", fss);
16021603
temp_data = _fill_knn_data(entry, &tmp_oids);
16031604

16041605
if (data->rows > 0 && list_length(tmp_oids) != noids)
@@ -2109,7 +2110,7 @@ _deform_neighbours_record_cb(void *data, size_t size)
21092110

21102111
fss = ((NeighboursEntry *) data)->fss;
21112112
entry = (NeighboursEntry *) hash_search(fss_neighbours, &fss, HASH_ENTER, &found);
2112-
Assert(!found);
2113+
Assert(!found && entry);
21132114
memcpy(entry, data, sizeof(NeighboursEntry));
21142115
return true;
21152116
}
@@ -2121,13 +2122,8 @@ aqo_neighbours_load(void)
21212122

21222123
LWLockAcquire(&aqo_state->neighbours_lock, LW_EXCLUSIVE);
21232124

2124-
if (hash_get_num_entries(fss_neighbours) != 0)
2125-
{
2126-
/* Someone have done it concurrently. */
2127-
elog(LOG, "[AQO] Another backend have loaded neighbours data concurrently.");
2128-
LWLockRelease(&aqo_state->neighbours_lock);
2129-
return;
2130-
}
2125+
/* Load on postmaster sturtup. So no any concurrent actions possible here. */
2126+
Assert(hash_get_num_entries(fss_neighbours) == 0);
21312127

21322128
data_load(PGAQO_NEIGHBOURS_FILE, _deform_neighbours_record_cb, NULL);
21332129

0 commit comments

Comments
 (0)