This repository has been archived by the owner on Jun 23, 2022. It is now read-only.
feat(split): re-implement function split_replica_exec #399
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request is re-implementing function
split_replica_exec
. During partition split, parent/child may want child/parent to execute another function,split_replica_exec
is used for such function.To simplify description, we assume that parent want child to execute function A. Parent replica calls function
split_replica_exec
directly, if child replica can be found on this replica_stub, child will execute function A, otherwise, parent will execute another function, usually is an error handler.In current design, replica should execute functions in a same thread, whose id is calculated by its pid. However,
split_replica_exec
will let child replica execute function A in parent's thread, whose id is usually different from child's.As a result, I re-implement
split_replica_exec
. Parent replica still calls functionsplit_replica_exec
directly, if child replica can be found on this replica_stub, replica_stub usetasking::enqueue
to guarantee child replica execute function A in its own thread, and return ERR_OK, otherwise, return ERR_OBJECT_NOT_FOUND. Parent will execute the error handler if it gotERR_OBJECT_NOT_FOUND
fromsplit_replica_exec
.This pull request also updates unit tests and removes some useless cases.