@@ -1393,7 +1393,7 @@ aqo_data_store(uint64 fs, int fss, OkNNrdata *data, List *reloids)
13931393if (!found ) {
13941394LWLockAcquire (& 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 );
13971397if (!found )
13981398{
13991399entry -> list .prev = NULL ;
@@ -1754,7 +1754,7 @@ _aqo_data_clean(uint64 fs)
17541754dsa_free (data_dsa ,entry -> data_dp );
17551755entry -> data_dp = InvalidDsaPointer ;
17561756
1757- /* fixfs list */
1757+ /* fixneighbour list */
17581758if (entry -> list .next )
17591759has_next = true;
17601760if (entry -> list .prev )
@@ -2099,11 +2099,14 @@ aqo_neighbours_reset(void)
20992099elog (ERROR ,"[AQO] hash table corrupted" );
21002100num_remove ++ ;
21012101}
2102- aqo_state -> neighbours_changed = true;
2102+
2103+ if (num_remove > 0 )
2104+ aqo_state -> neighbours_changed = true;
2105+
21032106LWLockRelease (& aqo_state -> neighbours_lock );
21042107
21052108if (num_remove != num_entries )
2106- elog (ERROR ,"[AQO]Neighbour memory storage is corrupted or parallel access without a lockwas detected." );
2109+ elog (ERROR ,"[AQO]Neighbours memory storage is corrupted or parallel access without a lockhas detected." );
21072110
21082111return num_remove ;
21092112}
@@ -2231,7 +2234,7 @@ cleanup_aqo_database(bool gentle, int *fs_num, int *fss_num)
22312234DataEntry * entry ;
22322235NeighboursEntry * fss_htab_entry ;
22332236
2234- /* fixfs list */
2237+ /* fixneighbours list */
22352238entry = (DataEntry * )hash_search (data_htab ,& key ,HASH_FIND ,& found );
22362239if (found )
22372240{