-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[chore](cloud) ms http util supports versioned keys -- encode decode #58953
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
[chore](cloud) ms http util supports versioned keys -- encode decode #58953
Conversation
|
run buildall |
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Cloud UT Coverage ReportIncrement line coverage Increment coverage report
|
|
run buildall |
Cloud UT Coverage ReportIncrement line coverage Increment coverage report
|
|
add several examples in description to show how it is used |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
…pache#58953) encode versioned key (versionstamp is optional): ``` $ curl 'localhost:5000/MetaService/http/encode_key?token=greedisgood9999&key_type=VersionedPartitionVersionKey&instance_id=gavin-instance&partition_id=10086' ┌───────────────────────────────────────────────────────────────────────────────── 0. key space: 3 │ ┌─────────────────────────────────────────────────────────────────────────────── 1. version │ │ ┌─────────────────────────────────────────────────────────── 2. gavin-instance │ │ │ ┌───────────────────────── 3. partition │ │ │ │ ┌─ 4. 10086 │ │ │ │ │ ▼ ▼ ▼ ▼ ▼ 031076657273696f6e000110676176696e2d696e7374616e6365000110706172746974696f6e0001120000000000002766 \x03\x10\x76\x65\x72\x73\x69\x6f\x6e\x00\x01\x10\x67\x61\x76\x69\x6e\x2d\x69\x6e\x73\x74\x61\x6e\x63\x65\x00\x01\x10\x70\x61\x72\x74\x69\x74\x69\x6f\x6e\x00\x01\x12\x00\x00\x00\x00\x00\x00\x27\x66 ``` encode versioned key with versionstamp: ``` $ curl 'localhost:5000/MetaService/http/encode_key?token=greedisgood9999&key_type=VersionedPartitionVersionKey&instance_id=gavin-instance&partition_id=10086&versionstamp=00000000000000001010' ┌─────────────────────────────────────────────────────────────────────────────────────────────────── 0. key space: 3 │ ┌───────────────────────────────────────────────────────────────────────────────────────────────── 1. version │ │ ┌───────────────────────────────────────────────────────────────────────────── 2. gavin-instance │ │ │ ┌─────────────────────────────────────────── 3. partition │ │ │ │ ┌─────────────────── 4. 10086 │ │ │ │ │ ┌─ 5. versionstamp: 00000000000000001010 │ │ │ │ │ │ ▼ ▼ ▼ ▼ ▼ ▼ 031076657273696f6e000110676176696e2d696e7374616e6365000110706172746974696f6e00011200000000000027661300000000000000001010ff \x03\x10\x76\x65\x72\x73\x69\x6f\x6e\x00\x01\x10\x67\x61\x76\x69\x6e\x2d\x69\x6e\x73\x74\x61\x6e\x63\x65\x00\x01\x10\x70\x61\x72\x74\x69\x74\x69\x6f\x6e\x00\x01\x12\x00\x00\x00\x00\x00\x00\x27\x66\x13\x00\x00\x00\x00\x00\x00\x00\x00\x10\x10\xff ``` decode a key with versionstamp: ``` $ curl 'localhost:5000/MetaService/http/decode_key?token=greedisgood9999&key_type=VersionedPartitionVersionKey&key=031076657273696f6e000110676176696e2d696e7374616e6365000110706172746974696f6e00011200000000000027661300000000000000001010ff' ┌─────────────────────────────────────────────────────────────────────────────────────────────────── 0. key space: 3 │ ┌───────────────────────────────────────────────────────────────────────────────────────────────── 1. version │ │ ┌───────────────────────────────────────────────────────────────────────────── 2. gavin-instance │ │ │ ┌─────────────────────────────────────────── 3. partition │ │ │ │ ┌─────────────────── 4. 10086 │ │ │ │ │ ┌─ 5. versionstamp: 00000000000000001010 │ │ │ │ │ │ ▼ ▼ ▼ ▼ ▼ ▼ 031076657273696f6e000110676176696e2d696e7374616e6365000110706172746974696f6e00011200000000000027661300000000000000001010ff ``` For get/set_value, if the versionstamp is not set, get the max version or put it with auto allocated versionstamp.
…pache#58953) encode versioned key (versionstamp is optional): ``` $ curl 'localhost:5000/MetaService/http/encode_key?token=greedisgood9999&key_type=VersionedPartitionVersionKey&instance_id=gavin-instance&partition_id=10086' ┌───────────────────────────────────────────────────────────────────────────────── 0. key space: 3 │ ┌─────────────────────────────────────────────────────────────────────────────── 1. version │ │ ┌─────────────────────────────────────────────────────────── 2. gavin-instance │ │ │ ┌───────────────────────── 3. partition │ │ │ │ ┌─ 4. 10086 │ │ │ │ │ ▼ ▼ ▼ ▼ ▼ 031076657273696f6e000110676176696e2d696e7374616e6365000110706172746974696f6e0001120000000000002766 \x03\x10\x76\x65\x72\x73\x69\x6f\x6e\x00\x01\x10\x67\x61\x76\x69\x6e\x2d\x69\x6e\x73\x74\x61\x6e\x63\x65\x00\x01\x10\x70\x61\x72\x74\x69\x74\x69\x6f\x6e\x00\x01\x12\x00\x00\x00\x00\x00\x00\x27\x66 ``` encode versioned key with versionstamp: ``` $ curl 'localhost:5000/MetaService/http/encode_key?token=greedisgood9999&key_type=VersionedPartitionVersionKey&instance_id=gavin-instance&partition_id=10086&versionstamp=00000000000000001010' ┌─────────────────────────────────────────────────────────────────────────────────────────────────── 0. key space: 3 │ ┌───────────────────────────────────────────────────────────────────────────────────────────────── 1. version │ │ ┌───────────────────────────────────────────────────────────────────────────── 2. gavin-instance │ │ │ ┌─────────────────────────────────────────── 3. partition │ │ │ │ ┌─────────────────── 4. 10086 │ │ │ │ │ ┌─ 5. versionstamp: 00000000000000001010 │ │ │ │ │ │ ▼ ▼ ▼ ▼ ▼ ▼ 031076657273696f6e000110676176696e2d696e7374616e6365000110706172746974696f6e00011200000000000027661300000000000000001010ff \x03\x10\x76\x65\x72\x73\x69\x6f\x6e\x00\x01\x10\x67\x61\x76\x69\x6e\x2d\x69\x6e\x73\x74\x61\x6e\x63\x65\x00\x01\x10\x70\x61\x72\x74\x69\x74\x69\x6f\x6e\x00\x01\x12\x00\x00\x00\x00\x00\x00\x27\x66\x13\x00\x00\x00\x00\x00\x00\x00\x00\x10\x10\xff ``` decode a key with versionstamp: ``` $ curl 'localhost:5000/MetaService/http/decode_key?token=greedisgood9999&key_type=VersionedPartitionVersionKey&key=031076657273696f6e000110676176696e2d696e7374616e6365000110706172746974696f6e00011200000000000027661300000000000000001010ff' ┌─────────────────────────────────────────────────────────────────────────────────────────────────── 0. key space: 3 │ ┌───────────────────────────────────────────────────────────────────────────────────────────────── 1. version │ │ ┌───────────────────────────────────────────────────────────────────────────── 2. gavin-instance │ │ │ ┌─────────────────────────────────────────── 3. partition │ │ │ │ ┌─────────────────── 4. 10086 │ │ │ │ │ ┌─ 5. versionstamp: 00000000000000001010 │ │ │ │ │ │ ▼ ▼ ▼ ▼ ▼ ▼ 031076657273696f6e000110676176696e2d696e7374616e6365000110706172746974696f6e00011200000000000027661300000000000000001010ff ``` For get/set_value, if the versionstamp is not set, get the max version or put it with auto allocated versionstamp.
encode versioned key (versionstamp is optional):
encode versioned key with versionstamp:
decode a key with versionstamp:
For get/set_value, if the versionstamp is not set, get the max version or put it with auto allocated versionstamp.