Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

feat: adapt partition split #165

Merged
merged 2 commits into from
Aug 30, 2021
Merged

feat: adapt partition split #165

merged 2 commits into from
Aug 30, 2021

Conversation

hycdong
Copy link
Contributor

@hycdong hycdong commented Aug 16, 2021

This pull request contains java client partition split related implementation, including:

  1. handle split related error code: ERR_SPLITTING, ERR_PARENT_PARTITION_MISUSED
  • when parent partition is registering child partition, it will reject read write requests by return ERR_SPLITTING, client won't query meta and will retry in remaining time
  • when child partition is active, the request should be sent to child, parent will return ERR_PARENT_PARTITION_MISUSED, client should update all partitions config to update both parent and child config
  1. handle the condition that client query config for a splitting table
  • when client query config for a splitting table, it will get child partition config, if child is not ready, its requests should be redirected to parent, in fucntion getGpidByHash
  1. handle app partition_count changed while query meta
  • in pervious implementation, if partition_count changed, client won't update config. Now server support split (new_count = old_count*2) and cancel split (new_count = old_count / 2), client should update configurations in those cases.

public gpid getGpidByHash(long hashValue) {
int index = (int) remainder_unsigned(hashValue, getPartitionCount());
final ReplicaConfiguration replicaConfiguration = tableConfig_.get().replicas.get(index);
// table is partition split, and child partition is not ready
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment is useless, one can get information from the log in L140

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's okay to remain the duplicated log. In this function, child request DO redirected to its parent partition. For L140, it's called after querying meta server and updating configuration, the log is to explained that why the child partition configuration is not updated.

@hycdong hycdong merged commit b31c506 into XiaoMi:master Aug 30, 2021
@hycdong hycdong deleted the split_patch branch August 30, 2021 08:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants