Skip to content

Conversation

@w41ter
Copy link
Contributor

@w41ter w41ter commented Dec 11, 2025

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.

@w41ter w41ter requested a review from gavinchou as a code owner December 11, 2025 07:16
@w41ter w41ter added the cloud label Dec 11, 2025
@w41ter w41ter requested a review from dataroaring as a code owner December 11, 2025 07:16
@w41ter
Copy link
Contributor Author

w41ter commented Dec 11, 2025

run buildall

@Thearas
Copy link
Contributor

Thearas commented Dec 11, 2025

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@doris-robot
Copy link

Cloud UT Coverage Report

Increment line coverage 58.11% (129/222) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 79.91% (1750/2190)
Line Coverage 65.89% (30702/46599)
Region Coverage 66.59% (15335/23028)
Branch Coverage 56.91% (8153/14326)

@w41ter
Copy link
Contributor Author

w41ter commented Dec 11, 2025

run buildall

@doris-robot
Copy link

Cloud UT Coverage Report

Increment line coverage 58.11% (129/222) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 79.93% (1752/2192)
Line Coverage 65.82% (30730/46685)
Region Coverage 66.59% (15356/23062)
Branch Coverage 56.89% (8159/14342)

@gavinchou
Copy link
Contributor

add several examples in description to show how it is used

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Dec 12, 2025
@github-actions
Copy link
Contributor

PR approved by at least one committer and no changes requested.

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

@gavinchou gavinchou merged commit 1e5b338 into apache:master Dec 15, 2025
31 of 32 checks passed
@gavinchou gavinchou changed the title [chore](cloud) ms http util supports versioned keys [chore](cloud) ms http util supports versioned keys -- encode decode Dec 15, 2025
@w41ter w41ter deleted the snapshot/chore/http_support_versioned_keys branch December 15, 2025 11:11
w41ter added a commit to w41ter/incubator-doris that referenced this pull request Dec 30, 2025
…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.
w41ter added a commit to w41ter/incubator-doris that referenced this pull request Jan 8, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. cloud reviewed snapshot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants