-
Notifications
You must be signed in to change notification settings - Fork 587
HDDS-6064. Print proper JSON from ozone debug ldb scan
#4420
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
Conversation
…ys=true` Change-Id: I088ab07543c75cfa0cda22b0dd348827938fbc90
Change-Id: I65f79b8f858b2010c53a69def485db01291b785f
Change-Id: Iee2567ea81bb6559215ac320db14cc9356b68228
Change-Id: I684e555c8b0daf7f1973eea741e69d54dc4d158d
Change-Id: Ic0a52a9787c5ea93d061ad7bcbbc7dd30a060ac1
Change-Id: I65611172095301c1bfda418d0e977a8c0a40a204
Change-Id: Ifebbe6ad81c657813a77f89534f7613f1e7debe1
Change-Id: I8adf7aeef4d9f263bd7675f3bc52fd7a2173c2d5
Change-Id: I282a732fa9de5959f121b9cff24c42a9f7990228
…le()` which should not have been there) Change-Id: I27915374e08cba3b858c564f8aaf87e2ddfc3eaa
Change-Id: Idab9a301d48e67ee00a9b668ebdc2b847e72e8ea
Change-Id: I439b0a9dad511073ee60b1c6f6f7309b65026971
Change-Id: I74656163dde8e004b08f839e4769e79687abb65a
Change-Id: Ie574e1ca4c6b38aa8277a301454f6373f753a5ad
Change-Id: I92f8c6a2d969d3bdc35818080dae6d2668a55edc
Change-Id: I22ed04646f742e4ac6913eb5430511688383d313
Change-Id: Icd0f3235f3da50f795d1a595abb1afe025cece30
Change-Id: I0c753f4f68b4ae0696b65767039bc7dfbbdb44ec
Change-Id: If590813c4131f75dfcb3fb45d30a367e9ad11f53
Change-Id: Ie8ef793a28758596887be7be9598f48f568392c5
Change-Id: Id71b963cd1e9c1d5fe3f81875c1f752f75322b32
Change-Id: I3020e5b02a0f7360a038b4955963c4fb652008e9
Change-Id: I31e074c618b852e8c73023a312f17e66eb9cd434
| columnFamilyDefinition.getTableName().getBytes(UTF_8), | ||
| columnFamilyHandleList); | ||
| if (columnFamilyHandle == null) { | ||
| throw new IllegalStateException("columnFamilyHandle is null"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fyi, rationale behind the switch from IllegalArgumentException to IllegalStateException:
|
@swamirishi @tanvipenumudy @DaveTeng0 can you please take a look |
hemantk-12
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @smengcl for the patch and upgrading to Junit-5.
Overall patch looks good. Left some minor comments.
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestLDBCli.java
Show resolved
Hide resolved
...ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/OMRequestTestUtils.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBScanner.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBScanner.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBScanner.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBScanner.java
Outdated
Show resolved
Hide resolved
Change-Id: Ie64c5f9ca93e9c6049d1b5fb92e245ef3f68845e
hemantk-12
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1.
Thanks @smengcl for working on this.
errose28
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for refactoring and improvements @smengcl. I just have one comment on the key format.
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBScanner.java
Outdated
Show resolved
Hide resolved
Conflicts: hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBScanner.java Change-Id: Ia0526717f5996e76c1aba681cb2212162208d2a4
Change-Id: I567ebeca3cc65955e5435c59169a695b6bd895ab
Change-Id: I887f7b9b8c1cbbcfb159ae315d644588b82393b4
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBScanner.java
Show resolved
Hide resolved
|
Thanks for the improvement @smengcl |
|
Thanks @hemantk-12 and @errose28 for reviewing this |
What changes were proposed in this pull request?
{ }) if--with-keys=true.[ ]) if--with-keys=false.--with-keysnow defaults totrue. Tweak some option names. Improve error messages. Should have no compatiblity concern what-so-ever as this is intended to be a debug tool.TestLDBCli. New test cases are added.DBScannerfor readability and maintainability.DatanodeConfigurationfor DB key (currently|)Note
Regarding the core serialization logic in
DBScanner, I've chosen to stick to the currentGsonapproach that serializes each entry and immediately printing it. It should consume less memory than gathering all entries then serializing and printing it (could OOM if batch limit is too high like a few billion entries, while the current approach should work just fine).What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-6064
How was this patch tested?
TestLDBCliand added new test cases.Named.of()to describe each parameter for maintainability.keyTabletests, which is heavily inspired by @adoroszlai 's change in HDDS-6064.ozone debug ldbshould print proper JSON with--with-keys=true#2917 (in whichtestOMDBis split into multiple test cases).block_datatable schema V3 and V2 tests are completely rewritten.DBScanner:DFuture potential improvement
block_datatable, we could further nest entries inside another map. With the outer-most layer beingcontainerId.e.g. Currently (with the separator change in this PR), the JSON key for an entry inside V3
block_dataiscontainerId|blockId:{ "2|3": { "blockID": { "containerBlockID": { "containerID": 2, "localID": 3 }, "blockCommitSequenceId": 0 }, "metadata": {}, "size": 0 }, "2|4": { "blockID": { "containerBlockID": { "containerID": 2, "localID": 4 }, "blockCommitSequenceId": 0 }, "metadata": {}, "size": 0 } }With another layer, the output could become even cleaner, making it easier to be filtered using
jq:{ "2": { "3": { "blockID": { "containerBlockID": { "containerID": 2, "localID": 3 }, "blockCommitSequenceId": 0 }, "metadata": {}, "size": 0 }, "4": { "blockID": { "containerBlockID": { "containerID": 2, "localID": 4 }, "blockCommitSequenceId": 0 }, "metadata": {}, "size": 0 } } }Example output with this PR
Outputs are mostly from integration test's
stdoutwith dummy data for demo purpose. Command lines are reconstructed from test parameters. Actual CLI output can differ.ozone debug ldb --db=/data/metadata/om.db scan --column-family=keyTable --limit=1{ "key1": { "volumeName": "vol1", "bucketName": "buck1", "keyName": "key1", "dataSize": 1000, "keyLocationVersions": [ { "version": 0, "locationVersionMap": { "0": [] }, "isMultipartKey": false } ], "creationTime": 1679105144793, "modificationTime": 1679105144793, "replicationConfig": { "replicationFactor": "ONE" }, "isFile": false, "fileName": "key1", "acls": [], "parentObjectID": 0, "objectID": 0, "updateID": 0, "metadata": {} } }ozone debug ldb --db=/data/metadata/om.db scan --column-family=keyTable{ "key1": { "volumeName": "vol1", "bucketName": "buck1", "keyName": "key1", "dataSize": 1000, "keyLocationVersions": [ { "version": 0, "locationVersionMap": { "0": [] }, "isMultipartKey": false } ], "creationTime": 1679102602165, "modificationTime": 1679102602166, "replicationConfig": { "replicationFactor": "ONE" }, "isFile": false, "fileName": "key1", "acls": [], "parentObjectID": 0, "objectID": 0, "updateID": 0, "metadata": {} }, "key2": { "volumeName": "vol1", "bucketName": "buck1", "keyName": "key2", "dataSize": 1000, "keyLocationVersions": [ { "version": 0, "locationVersionMap": { "0": [] }, "isMultipartKey": false } ], "creationTime": 1679102602279, "modificationTime": 1679102602279, "replicationConfig": { "replicationFactor": "ONE" }, "isFile": false, "fileName": "key2", "acls": [], "parentObjectID": 0, "objectID": 0, "updateID": 0, "metadata": {} }, "key3": { "volumeName": "vol1", "bucketName": "buck1", "keyName": "key3", "dataSize": 1000, "keyLocationVersions": [ { "version": 0, "locationVersionMap": { "0": [] }, "isMultipartKey": false } ], "creationTime": 1679102602282, "modificationTime": 1679102602282, "replicationConfig": { "replicationFactor": "ONE" }, "isFile": false, "fileName": "key3", "acls": [], "parentObjectID": 0, "objectID": 0, "updateID": 0, "metadata": {} }, "key4": { "volumeName": "vol1", "bucketName": "buck1", "keyName": "key4", "dataSize": 1000, "keyLocationVersions": [ { "version": 0, "locationVersionMap": { "0": [] }, "isMultipartKey": false } ], "creationTime": 1679102602284, "modificationTime": 1679102602284, "replicationConfig": { "replicationFactor": "ONE" }, "isFile": false, "fileName": "key4", "acls": [], "parentObjectID": 0, "objectID": 0, "updateID": 0, "metadata": {} }, "key5": { "volumeName": "vol1", "bucketName": "buck1", "keyName": "key5", "dataSize": 1000, "keyLocationVersions": [ { "version": 0, "locationVersionMap": { "0": [] }, "isMultipartKey": false } ], "creationTime": 1679102602286, "modificationTime": 1679102602286, "replicationConfig": { "replicationFactor": "ONE" }, "isFile": false, "fileName": "key5", "acls": [], "parentObjectID": 0, "objectID": 0, "updateID": 0, "metadata": {} } }ozone debug ldb --db=/data/metadata/om.db scan --column-family=keyTable --limit=2 --with-keys=false[ { "volumeName": "vol1", "bucketName": "buck1", "keyName": "key1", "dataSize": 1000, "keyLocationVersions": [ { "version": 0, "locationVersionMap": { "0": [] }, "isMultipartKey": false } ], "creationTime": 1679102602165, "modificationTime": 1679102602166, "replicationConfig": { "replicationFactor": "ONE" }, "isFile": false, "fileName": "key1", "acls": [], "parentObjectID": 0, "objectID": 0, "updateID": 0, "metadata": {} }, { "volumeName": "vol1", "bucketName": "buck1", "keyName": "key2", "dataSize": 1000, "keyLocationVersions": [ { "version": 0, "locationVersionMap": { "0": [] }, "isMultipartKey": false } ], "creationTime": 1679102602279, "modificationTime": 1679102602279, "replicationConfig": { "replicationFactor": "ONE" }, "isFile": false, "fileName": "key2", "acls": [], "parentObjectID": 0, "objectID": 0, "updateID": 0, "metadata": {} } ]ozone debug ldb --db=/data/hdds/hdds/CID-UUID1/DS-UUID2/container.db scan --column-family=block_data --dn-schema=V3 --container-id=2 --limit=2{ "2|3": { "blockID": { "containerBlockID": { "containerID": 2, "localID": 3 }, "blockCommitSequenceId": 0 }, "metadata": {}, "size": 0 }, "2|4": { "blockID": { "containerBlockID": { "containerID": 2, "localID": 4 }, "blockCommitSequenceId": 0 }, "metadata": {}, "size": 0 } }ozone debug ldb --db=/data/hdds/hdds/CID-UUID1/DS-UUID2/container.db scan --column-family=block_data --dn-schema=V2 --limit=4{ "1": { "blockID": { "containerBlockID": { "containerID": 1, "localID": 1 }, "blockCommitSequenceId": 0 }, "metadata": {}, "size": 0 }, "2": { "blockID": { "containerBlockID": { "containerID": 1, "localID": 2 }, "blockCommitSequenceId": 0 }, "metadata": {}, "size": 0 }, "3": { "blockID": { "containerBlockID": { "containerID": 2, "localID": 3 }, "blockCommitSequenceId": 0 }, "metadata": {}, "size": 0 }, "4": { "blockID": { "containerBlockID": { "containerID": 2, "localID": 4 }, "blockCommitSequenceId": 0 }, "metadata": {}, "size": 0 } }