@@ -1586,7 +1586,8 @@ load_aqo_data(uint64 fs, int fss, OkNNrdata *data, List **reloids,
1586
1586
1587
1587
found = false;
1588
1588
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));
1590
1591
entry = found ? neighbour_entry -> data : NULL ;
1591
1592
1592
1593
/*
@@ -1595,10 +1596,10 @@ load_aqo_data(uint64 fs, int fss, OkNNrdata *data, List **reloids,
1595
1596
while (entry != NULL )
1596
1597
{
1597
1598
List * tmp_oids = NIL ;
1598
-
1599
+ elog ( NOTICE , "ЗАШЛИ К СОСЕДЯМ entry %d data %d" , entry -> cols , data -> cols );
1599
1600
if (entry -> cols != data -> cols )
1600
1601
continue ;
1601
-
1602
+ elog ( NOTICE , "Я нашел соседа fss %d" , fss );
1602
1603
temp_data = _fill_knn_data (entry , & tmp_oids );
1603
1604
1604
1605
if (data -> rows > 0 && list_length (tmp_oids ) != noids )
@@ -2109,7 +2110,7 @@ _deform_neighbours_record_cb(void *data, size_t size)
2109
2110
2110
2111
fss = ((NeighboursEntry * ) data )-> fss ;
2111
2112
entry = (NeighboursEntry * ) hash_search (fss_neighbours , & fss , HASH_ENTER , & found );
2112
- Assert (!found );
2113
+ Assert (!found && entry );
2113
2114
memcpy (entry , data , sizeof (NeighboursEntry ));
2114
2115
return true;
2115
2116
}
@@ -2121,13 +2122,8 @@ aqo_neighbours_load(void)
2121
2122
2122
2123
LWLockAcquire (& aqo_state -> neighbours_lock , LW_EXCLUSIVE );
2123
2124
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 );
2131
2127
2132
2128
data_load (PGAQO_NEIGHBOURS_FILE , _deform_neighbours_record_cb , NULL );
2133
2129
0 commit comments