-
Notifications
You must be signed in to change notification settings - Fork 593
HDDS-11423. Implement equals operation for --filter option to ozone ldb scan #7167
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d683ac6
HDDS-11423. Implement equals operation for --filter option to ozone l…
7dcf552
Add test case in TestLDBCli
a0821b5
Check for NPE and fix handling of map/list
f00f0e4
return false with exception=true for field related errors
fe58286
add robot test coverage for ldb scan
843f8a9
add 2 more tests
2cf4d8b
Change implementation of how filter map is stored
7ed5e38
Remove unnecessary messages
eab8d24
Merge branch 'apache:master' into HDDS-11423
Tejaskriya 6e848b6
Simplify filter logic and add restrictions for overriding filter values
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
93 changes: 93 additions & 0 deletions
93
hadoop-ozone/dist/src/main/smoketest/debug/ozone-debug-ldb.robot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with | ||
| # the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| *** Settings *** | ||
| Documentation Test ozone debug ldb CLI | ||
| Library OperatingSystem | ||
| Resource ../lib/os.robot | ||
| Test Timeout 5 minute | ||
| Suite Setup Write keys | ||
|
|
||
| *** Variables *** | ||
| ${PREFIX} ${EMPTY} | ||
| ${VOLUME} cli-debug-volume${PREFIX} | ||
| ${BUCKET} cli-debug-bucket | ||
| ${DEBUGKEY} debugKey | ||
| ${TESTFILE} testfile | ||
|
|
||
| *** Keywords *** | ||
| Write keys | ||
| Run Keyword if '${SECURITY_ENABLED}' == 'true' Kinit test user testuser testuser.keytab | ||
| Execute ozone sh volume create ${VOLUME} | ||
| Execute ozone sh bucket create ${VOLUME}/${BUCKET} -l OBJECT_STORE | ||
| Execute dd if=/dev/urandom of=${TEMP_DIR}/${TESTFILE} bs=100000 count=15 | ||
| Execute ozone sh key put ${VOLUME}/${BUCKET}/${TESTFILE}1 ${TEMP_DIR}/${TESTFILE} | ||
| Execute ozone sh key put ${VOLUME}/${BUCKET}/${TESTFILE}2 ${TEMP_DIR}/${TESTFILE} | ||
| Execute ozone sh key put ${VOLUME}/${BUCKET}/${TESTFILE}3 ${TEMP_DIR}/${TESTFILE} | ||
| Execute ozone sh key addacl -a user:systest:a ${VOLUME}/${BUCKET}/${TESTFILE}3 | ||
|
|
||
| *** Test Cases *** | ||
| Test ozone debug ldb ls | ||
| ${output} = Execute ozone debug ldb --db=/data/metadata/om.db ls | ||
| Should contain ${output} keyTable | ||
|
|
||
| Test ozone debug ldb scan | ||
| # test count option | ||
| ${output} = Execute ozone debug ldb --db=/data/metadata/om.db scan --cf=keyTable --count | ||
| Should Not Be Equal ${output} 0 | ||
| # test valid json for scan command | ||
| ${output} = Execute ozone debug ldb --db=/data/metadata/om.db scan --cf=keyTable | jq -r '.' | ||
| Should contain ${output} keyName | ||
| Should contain ${output} testfile1 | ||
| Should contain ${output} testfile2 | ||
| Should contain ${output} testfile3 | ||
| # test startkey option | ||
| ${output} = Execute ozone debug ldb --db=/data/metadata/om.db scan --cf=keyTable --startkey="/cli-debug-volume/cli-debug-bucket/testfile2" | ||
| Should not contain ${output} testfile1 | ||
| Should contain ${output} testfile2 | ||
| Should contain ${output} testfile3 | ||
| # test endkey option | ||
| ${output} = Execute ozone debug ldb --db=/data/metadata/om.db scan --cf=keyTable --endkey="/cli-debug-volume/cli-debug-bucket/testfile2" | ||
| Should contain ${output} testfile1 | ||
| Should contain ${output} testfile2 | ||
| Should not contain ${output} testfile3 | ||
| # test fields option | ||
| ${output} = Execute ozone debug ldb --db=/data/metadata/om.db scan --cf=keyTable --fields="volumeName,bucketName,keyName" | ||
| Should contain ${output} volumeName | ||
| Should contain ${output} bucketName | ||
| Should contain ${output} keyName | ||
| Should not contain ${output} objectID | ||
| Should not contain ${output} dataSize | ||
| Should not contain ${output} keyLocationVersions | ||
| # test filter option with one filter | ||
| ${output} = Execute ozone debug ldb --db=/data/metadata/om.db scan --cf=keyTable --filter="keyName:equals:testfile2" | ||
| Should not contain ${output} testfile1 | ||
| Should contain ${output} testfile2 | ||
| Should not contain ${output} testfile3 | ||
| # test filter option with one multi-level filter | ||
| ${output} = Execute ozone debug ldb --db=/data/metadata/om.db scan --cf=keyTable --filter="acls.name:equals:systest" | ||
| Should not contain ${output} testfile1 | ||
| Should not contain ${output} testfile2 | ||
| Should contain ${output} testfile3 | ||
| # test filter option with multiple filter | ||
| ${output} = Execute ozone debug ldb --db=/data/metadata/om.db scan --cf=keyTable --filter="keyName:equals:testfile3,acls.name:equals:systest" | ||
| Should not contain ${output} testfile1 | ||
| Should not contain ${output} testfile2 | ||
| Should contain ${output} testfile3 | ||
| # test filter option with no records match both filters | ||
| ${output} = Execute ozone debug ldb --db=/data/metadata/om.db scan --cf=keyTable --filter="acls.name:equals:systest,keyName:equals:testfile2" | ||
| Should not contain ${output} testfile1 | ||
| Should not contain ${output} testfile2 | ||
| Should not contain ${output} testfile3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
How does multiple matches work? If we have multiple fields called
sizeorversionorname, how will the visual representation tell me which field is being filtered? How doesMINandMAXwork with strings?Uh oh!
There was an error while loading. Please reload this page.
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.
As a class can't have 2 fields of the same name, we won't encounter this at the same level of the hierarchy. If you mean something like this:
Then we would be passing the option like this for the full name of the field:
--filter="name:equals:xyz"and--filter="acls.name:equals:xyz"In the result, the full record will be shown (same as how a normal scan command without the filter is seen).