This repository has been archived by the owner on Jun 23, 2022. It is now read-only.
feat(split): replica add validate_partition_hash #747
Merged
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.
As pr #745 shows, we adds an app_env called
SPLIT_VALIDATE_PARTITION_HASH
, when partition split started, it will be set as true, this pr adds how replica handle it, including:update_app_envs_internal
, update replica's_validate_partition_hash
valueon_client_read
andon_client_write
, check if reject all requestsAs previous pr feat(split): register child partition #391 shows, when parent partition is registering child partition, requests should be rejected during this stage (partition_version = -1)
on_client_read
andon_client_write
, check if read from correct partition, write into correct partitionAs previous pr feat(split): add partition_version #394 shows, we adds
partition_version
to do this check, partition_version valid value is partition_count - 1. Let me take an example to explain the check:When partition split finishs, the request whose partition_hash is 9 should not sent to parent partition, its should be sent to write to the child partition.
When client receives error ERR_PARENT_PARTITION_MISUSED, it should trigger query_meta to let client learned the newest partition_count, this will be added in client.