commit 18e79a83874d1e94514f4eba3321718ba97fde9a from: Nikolay Shirokovskiy via: Vladimir Davydov date: Wed Sep 04 10:24:59 2024 UTC box: free replication on exit Part-of #10211 NO_TEST=internal NO_CHANGELOG=internal NO_DOC=internal commit - 9245750c559a7ba179ce356489a4b77c65f51e68 commit + 18e79a83874d1e94514f4eba3321718ba97fde9a blob - 7ab2df9f312491186e925401c0ee5b96655d76f6 blob + e7fc201d86eec5b47f068d3f553466e002052f55 --- src/box/gc.c +++ src/box/gc.c @@ -396,6 +396,8 @@ gc_delay_unref(void) static void gc_schedule_cleanup(void) { + if (gc.cleanup_fiber == NULL) + return; /* * Do not wake up the background fiber if it's executing * the garbage collection procedure right now, because blob - 0d3006463e97dd9f707946d7132ded0a578bff00 blob + e50fc0c637d14a23f3b2c27f0d50adafe277044a --- src/box/replication.cc +++ src/box/replication.cc @@ -80,6 +80,10 @@ enum bootstrap_strategy bootstrap_strategy = BOOTSTRAP enum replicaset_state replicaset_state = REPLICASET_BOOTSTRAP; +/** Free replica resources. */ +static void +replica_delete(struct replica *replica); + static int replica_compare_by_uuid(const struct replica *a, const struct replica *b) { @@ -240,6 +244,16 @@ replication_shutdown(void) void replication_free(void) { + struct replica *replica, *next; + while (!rlist_empty(&replicaset.anon)) { + replica = rlist_shift_entry(&replicaset.anon, + typeof(*replica), in_anon); + replica_delete(replica); + } + replica_hash_foreach_safe(&replicaset.hash, replica, next) { + replica_hash_remove(&replicaset.hash, replica); + replica_delete(replica); + } diag_destroy(&replicaset.applier.diag); trigger_destroy(&replicaset.on_ack); trigger_destroy(&replicaset.on_relay_thread_start); @@ -310,9 +324,10 @@ replica_new(void) static void replica_delete(struct replica *replica) { - assert(replica_is_orphan(replica)); if (replica->relay != NULL) relay_delete(replica->relay); + if (replica->applier != NULL) + applier_delete(replica->applier); if (replica->gc != NULL) gc_consumer_unregister(replica->gc); TRASH(replica);