Open Little-Wallace opened 3 years ago
I am very interested in this project and I will first take the time to understand the existing logic!
Roadmap after offline nigotiation:
GcManager
For Takedown GcManager
, we need more details for the methods.
@Little-Wallace Hi, is there any advice for keeping this task going further?
I think we shall merge the GcManagerContext
,GcManager
, GcWorker
and GcRunner
into two module.
A GcManager
holder GcManagerContext
and Worker<GcTask>
. GcRunner
will run in worker of GcManager
.
You can see some change in https://github.com/tikv/tikv/pull/8989/files. But not all of it are suitable. I think server.rs
shall never hold an object named GcWorker
. It is only hold an object Arc<GcManager>
and most interface of GcWorker
will move to GcManager
.
At first, you can keep GcManager
and GcWorker
but just cancel the thread in GcManager
. You can see that the Worker
has supplied a method named on_timeout
which means that you can do something in period. So we can just set a period task, every time refresh the safe point just like what TiKV currently does in GcManager::wait_for_next_safe_point
.
Then we can move the method gc_a_round
to GcRunner
and just replace GcManager::sync_gc
with the method GcRunner::gc
Hi, I'm busy with my work last two weeks. I'm reading the logic about GcManager
and GcWorker
for now.
In the next two weeks, I will try to cancel the thread in GcManager
first.
At first, you can keep
GcManager
andGcWorker
but just cancel the thread inGcManager
. You can see that theWorker
has supplied a method namedon_timeout
which means that you can do something in period. So we can just set a period task, every time refresh the safe point just like what TiKV currently does inGcManager::wait_for_next_safe_point
.
I tried following methods:
RunnableWithTimer
Task called UpdateSafePointTask
, but I can't schedule it in GcManager
, because our task_scheduler
only accept GcTask
.GcTask
, we need to add S: GcSafePointProvider, R: RegionInfoProvider + 'static, E: KvEngine
for GcTask, It's too complex.GcSafePointProvider
or AutoGcConfig
in GcRunner
directly. It looks like the correct way, but there are many changes to do.Please guide me the correct way before I going further. :smile:
Feature Request
Is your feature request related to a problem? Please describe:
Now we use two thread for gc_worker and gc_manager. But in actually, gc manager does not cost much CPU, we can merge them into one thread.
Describe the feature you'd like:
I hope most of threads in TiKV shall be implemented with
tikv_util::worker::pool::Worker
so that someday we may merge some threads into one thread pool.Describe alternatives you've considered:
Teachability, Documentation, Adoption, Migration Strategy:
You may need to know something about GC and threadpool.