[PATCH 12/13] gc: call gc_run unconditionally when consumer is advanced
Vladimir Davydov
vdavydov.dev at gmail.com
Thu Oct 4 20:20:14 MSK 2018
gc_consumer_unregister and gc_consumer_advance don't call gc_run in case
the consumer in question isn't leftmost. This code was written back when
gc_run was kinda heavy and would call engine/wal callbacks even if it
wouldn't really need to. Today gc_run will bail out shortly, without
making any complex computation, let alone invoking garbage collection
callbacks, in case it has nothing to do so those optimizations are
pointless. Let's remove them.
---
src/box/gc.c | 19 ++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/src/box/gc.c b/src/box/gc.c
index f8100e3f..6322bc67 100644
--- a/src/box/gc.c
+++ b/src/box/gc.c
@@ -263,18 +263,9 @@ gc_consumer_register(const struct vclock *vclock, const char *format, ...)
void
gc_consumer_unregister(struct gc_consumer *consumer)
{
- int64_t signature = vclock_sum(&consumer->vclock);
-
gc_tree_remove(&gc.consumers, consumer);
free(consumer);
-
- /*
- * Rerun garbage collection after removing the consumer
- * if it referenced the oldest vclock.
- */
- struct gc_consumer *leftmost = gc_tree_first(&gc.consumers);
- if (leftmost == NULL || vclock_sum(&leftmost->vclock) > signature)
- gc_run();
+ gc_run();
}
void
@@ -303,13 +294,7 @@ gc_consumer_advance(struct gc_consumer *consumer, const struct vclock *vclock)
if (update_tree)
gc_tree_insert(&gc.consumers, consumer);
- /*
- * Rerun garbage collection after advancing the consumer
- * if it referenced the oldest vclock.
- */
- struct gc_consumer *leftmost = gc_tree_first(&gc.consumers);
- if (leftmost == NULL || vclock_sum(&leftmost->vclock) > prev_signature)
- gc_run();
+ gc_run();
}
struct gc_consumer *
--
2.11.0
More information about the Tarantool-patches
mailing list