@@ -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 )
@@ -2100,11 +2100,14 @@ aqo_neighbours_reset(void)
21002100elog (ERROR ,"[AQO] hash table corrupted" );
21012101num_remove ++ ;
21022102}
2103- aqo_state -> neighbours_changed = true;
2103+
2104+ if (num_remove > 0 )
2105+ aqo_state -> neighbours_changed = true;
2106+
21042107LWLockRelease (& aqo_state -> neighbours_lock );
21052108
21062109if (num_remove != num_entries )
2107- elog (ERROR ,"[AQO]Neighbour memory storage is corrupted or parallel access without a lockwas detected." );
2110+ elog (ERROR ,"[AQO]Neighbours memory storage is corrupted or parallel access without a lockhas detected." );
21082111
21092112return num_remove ;
21102113}
@@ -2232,7 +2235,7 @@ cleanup_aqo_database(bool gentle, int *fs_num, int *fss_num)
22322235DataEntry * entry ;
22332236NeighboursEntry * fss_htab_entry ;
22342237
2235- /* fixfs list */
2238+ /* fixneighbours list */
22362239entry = (DataEntry * )hash_search (data_htab ,& key ,HASH_FIND ,& found );
22372240if (found )
22382241{