Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Centralize the logic of choosing worker for table into one place #268

Closed
ShiKaiWi opened this issue Sep 23, 2022 · 4 comments
Closed

Centralize the logic of choosing worker for table into one place #268

ShiKaiWi opened this issue Sep 23, 2022 · 4 comments
Assignees
Labels
feature New feature or request good first issue Good for newcomers

Comments

@ShiKaiWi
Copy link
Member

Describe This Problem

When carry on operations (write, flush etc.) on one table, a specific worker should be chosen. However, the logic for choosing such a worker distributes across the codebase:

https://github.com/CeresDB/ceresdb/blob/ccf988f5629436927479721b63df53b220967160/analytic_engine/src/instance/write_worker.rs#L307

https://github.com/CeresDB/ceresdb/blob/ccf988f5629436927479721b63df53b220967160/analytic_engine/src/instance/write_worker.rs#L669

https://github.com/CeresDB/ceresdb/blob/ccf988f5629436927479721b63df53b220967160/analytic_engine/src/table/data.rs#L541

Proposal

We hope the logic of choosing the worker for a specific table should be centralized in one place (one function).

Additional Context

No response

@ShiKaiWi ShiKaiWi added feature New feature or request good first issue Good for newcomers labels Sep 23, 2022
@QuintinTao
Copy link
Contributor

could I ?
I want add a function in sst_util.rs
pub fn find_worker(table_id: usize, worker_num: usize) -> usize {
table_id % worker_num
}

replace the three lines you mentioned.
if find_worker(table_id, worker_num) != worker_id {

@ShiKaiWi
Copy link
Member Author

could I ? I want add a function in sst_util.rs pub fn find_worker(table_id: usize, worker_num: usize) -> usize { table_id % worker_num }

replace the three lines you mentioned. if find_worker(table_id, worker_num) != worker_id {

@QuintinTao Thanks. Any contributions are welcome. The proposal is nice, and is it better to put the function find_worker in writer_worker.rs?

@ShiKaiWi ShiKaiWi assigned ShiKaiWi and QuintinTao and unassigned ShiKaiWi Oct 17, 2022
@QuintinTao
Copy link
Contributor

could I ? I want add a function in sst_util.rs pub fn find_worker(table_id: usize, worker_num: usize) -> usize { table_id % worker_num }
replace the three lines you mentioned. if find_worker(table_id, worker_num) != worker_id {

@QuintinTao Thanks. Any contributions are welcome. The proposal is nice, and is it better to put the function find_worker in writer_worker.rs?

OK

@archerny
Copy link
Contributor

issue was closed by this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants