DAOS-18625 utils: interpret key based to object's type for ddb output#17617
DAOS-18625 utils: interpret key based to object's type for ddb output#17617
Conversation
|
Ticket title is 'Confused ddb ls ouput for integer keys' |
23588dd to
847df11
Compare
|
Test stage Functional on EL 8.8 completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-17617/6/execution/node/1078/log |
847df11 to
2fe1617
Compare
|
Test stage NLT on EL 8.8 completed with status UNSTABLE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net/job/daos-stack/job/daos//view/change-requests/job/PR-17617/8/testReport/ |
2fe1617 to
7e0a598
Compare
Current ddb logic may print some integer keys' output as not-readable,
for example dkey 10, 60 will be printed as following:
DKEY: (/[4]/[2]/[0]) /b2b37b1a-2894-4970-b51c-1a964526bb02/948289433254841843.256.535.2/ {8}
DKEY: (/[4]/[2]/[2]) /b2b37b1a-2894-4970-b51c-1a964526bb02/948289433254841843.256.535.2/<{8}
That is very confused. The patch defines new ddb_key_to_printable_buf()
interface that will interpret key based to object's type and generate
more readable ddb output.
Test-tag: recovery
Signed-off-by: Xuezhao Liu <xuezhao.liu@hpe.com>
Signed-off-by: Fan Yong <fan.yong@hpe.com>
7e0a598 to
4c0e467
Compare
|
Test stage Functional Hardware Large MD on SSD completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-17617/9/execution/node/1352/log |
|
looks better to backport to 2.6 when convenient, thx |
Yes, the patch for release/2.6 is #17618. |
knard38
left a comment
There was a problem hiding this comment.
I am probably missing something, but do not see new tests checking print improvements of this PR.
src/utils/ddb/ddb_tree_path.c
Outdated
| d_iov_t *key_iov = &key_part->itp_key; | ||
| itp_print_part_key(struct ddb_ctx *ctx, struct indexed_tree_path_part *part) | ||
| { | ||
| char buf[DDB_MAX_PRITABLE_KEY]; |
There was a problem hiding this comment.
NIT
| char buf[DDB_MAX_PRITABLE_KEY]; | |
| char buf[DDB_MAX_PRINTABLE_KEY]; |
There was a problem hiding this comment.
OK, it was typo in original implementation. I will fix it.
src/utils/ddb/ddb_tree_path.c
Outdated
|
|
||
| len = ddb_key_to_printable_buf(key_iov, part->itp_otype, buf, ARRAY_SIZE(buf)); | ||
| if (len > ARRAY_SIZE(buf)) { | ||
| len += 2; /* +2 for escape character if needed and null terminator. */ |
There was a problem hiding this comment.
Not sure to fully understand this +2: I am probably missing something.
From my understanding, escape character need 2 printable characters.
Do not see why we could only have one escape character.
If I am true, then +2 should be evaluated according to the number of escape characters.
There was a problem hiding this comment.
You are right, +2 is for the escape character.
src/utils/ddb/ddb_tree_path.c
Outdated
| (!ddb_key_is_int(part->itp_otype) && ddb_can_print(key_iov))) { | ||
| /* +1 to make sure there's room for a null terminator */ | ||
| char key_str[key_part->itp_key.iov_len + 1]; | ||
| char key_str[key_iov->iov_len + 1]; |
There was a problem hiding this comment.
Are we sure that this size will stay reasonable to allocate key_str on the stack ?
There was a problem hiding this comment.
Generally, we should dynamically allocate the buffer instead of static on stack. Current patch just reused original implementation. I will refresh it.
| uint32_t len; | ||
|
|
||
| len = ddb_key_to_printable_buf(key_iov, part->itp_otype, buf, ARRAY_SIZE(buf)); | ||
| if (len > ARRAY_SIZE(buf)) { |
There was a problem hiding this comment.
Why the following +2 should not take into account into this test ?
| if (len > ARRAY_SIZE(buf)) { | |
| if (len + 2 > ARRAY_SIZE(buf)) { |
There was a problem hiding this comment.
Because else len = ARRAY_SIZE(buf);
| /* print the size with the string key if the size isn't strlen. That way | ||
| * parsing the string into a valid key will work | ||
| */ | ||
| if (key_iov->iov_len != strlen(key_str)) |
There was a problem hiding this comment.
Not sure to understand how this test could fail
There was a problem hiding this comment.
The key_str content maybe not all visible character, instead, maybe some '\0' internally.
Added new test case in check If without the patch, the out will be something like: Please note the invisible output ' ' before |
Test-tag: recovery Signed-off-by: Fan Yong <fan.yong@hpe.com>
|
Test stage Functional Hardware Medium Verbs Provider MD on SSD completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-17617/11/execution/node/1311/log |
|
CR leader switch cased CR test failure, not related with the ddb patch, to be retested. |
Current ddb logic may print some integer keys' output as not-readable, for example dkey 10, 60 will be printed as following: DKEY: (/[4]/[2]/[0]) /b2b37b1a-2894-4970-b51c-1a964526bb02/948289433254841843.256.535.2/ {8} DKEY: (/[4]/[2]/[2]) /b2b37b1a-2894-4970-b51c-1a964526bb02/948289433254841843.256.535.2/<{8}
That is very confused. The patch defines new ddb_key_to_printable_buf() interface that will interpret key based to object's type and generate more readable ddb output.
Test-tag: recovery
Steps for the author:
After all prior steps are complete: