Skip to content
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

Support build & parse RawKV keys #13

Merged
merged 3 commits into from
Sep 20, 2023
Merged

Conversation

pingyu
Copy link
Contributor

@pingyu pingyu commented Sep 20, 2023

Close #14

Preview readme.md.

Unit tests:

go test -timeout 30s github.com/disksing/mok

ok  	github.com/disksing/mok	0.484s	coverage: 42.2% of statements

Manual tests:

❯ go build
❯ ./mok 7200000074657374ff0000000000000000f7
"7200000074657374ff0000000000000000f7"
└─## decode hex key
  └─"r\000\000\000test\377\000\000\000\000\000\000\000\000\367"
    ├─## decode mvcc key
    │ └─"r\000\000\000test"
    │   └─## decode keyspace
    │     ├─key mode: rawkv
    │     ├─keyspace: 0
    │     └─"test"
    └─## decode keyspace
      ├─key mode: rawkv
      ├─keyspace: 0
      └─"test\377\000\000\000\000\000\000\000\000\367"
❯ ./mok --keyspace-id 0 --key-mode rawkv --raw-key test
built key: 7200000074657374FF0000000000000000F7

Manual regression tests:

❯ ./mok 7A7480000000000007FF8F5F728000000000FF083BBA0000000000FAFA6C400A6673FFFE
"7A7480000000000007FF8F5F728000000000FF083BBA0000000000FAFA6C400A6673FFFE"
└─## decode hex key
  └─"zt\200\000\000\000\000\000\007\377\217_r\200\000\000\000\000\377\010;\272\000\000\000\000\000\372\372l@\nfs\377\376"
    └─## decode rocksdb data key
      └─"t\200\000\000\000\000\000\007\377\217_r\200\000\000\000\000\377\010;\272\000\000\000\000\000\372\372l@\nfs\377\376"
        ├─## decode mvcc key
        │ ├─"t\200\000\000\000\000\000\007\217_r\200\000\000\000\000\010;\272"
        │ │ ├─## table prefix
        │ │ │ └─table: 1935
        │ │ └─## table row key
        │ │   ├─table: 1935
        │ │   └─row: 539578
        │ └─ts: 401875853330087937 (2018-07-31 18:58:38.819 +0800 CST)
        └─## table prefix
          └─table: 2047
❯ ./mok --table-id 43 --row-value 81934
built key: 7480000000000000FF2B5F728000000000FF01400E0000000000FA
❯ ./mok --table-id 43 --index-id 50 --index-value 81934
built key: 7480000000000000FF2B5F698000000000FF0000328000000000FF01400E0000000000FA
❯ ./mok --keyspace-id 255 --table-id 43 --row-value 81934
built key: 780000FF74800000FF000000002B5F7280FF0000000001400E00FE

Signed-off-by: Ping Yu <yuping@pingcap.com>
Signed-off-by: Ping Yu <yuping@pingcap.com>
Signed-off-by: Ping Yu <yuping@pingcap.com>
@disksing disksing merged commit b57f221 into oh-my-tidb:master Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support build & parse RawKV API v2 keys
2 participants