Commit 2990689
committed
MB-71428: Fix datatype validation and handling in stat collection
Refactor KVBucket::appendDatatypeStats to eliminate code duplication
by extracting common logic into a lambda function. The method now
validates each datatype value using cb::mcbp::datatype::is_valid()
before processing, preventing invalid datatype indices from being
included in statistics collection.
Additionally, fix the datatypeValues() helper to filter invalid
datatype values, ensuring only valid datatypes are included in test
operations.
Fix createWithFactory() to explicitly set the datatype on the newly
created StoredValue, ensuring the datatype is properly initialized
when the stored value is created with a specified type.
These changes improve datatype handling consistency and prevent
potential issues with invalid or uninitialized datatype values in
statistics and test scenarios.
Change-Id: Ief6b6c400b3a0867f33cfe45fe5d3c2ff46550bf
Reviewed-on: https://review.couchbase.org/c/kv_engine/+/243364
Reviewed-by: Jim Walker <jim@couchbase.com>
Tested-by: Build Bot <build@couchbase.com>1 parent 652bdf5 commit 2990689
2 files changed
Lines changed: 16 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1525 | 1525 | | |
1526 | 1526 | | |
1527 | 1527 | | |
1528 | | - | |
1529 | | - | |
1530 | | - | |
1531 | | - | |
1532 | | - | |
1533 | | - | |
1534 | | - | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
1535 | 1537 | | |
1536 | | - | |
1537 | | - | |
1538 | | - | |
1539 | | - | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
1540 | 1541 | | |
1541 | | - | |
1542 | | - | |
| 1542 | + | |
| 1543 | + | |
1543 | 1544 | | |
1544 | 1545 | | |
1545 | 1546 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
484 | 484 | | |
485 | 485 | | |
486 | 486 | | |
487 | | - | |
| 487 | + | |
488 | 488 | | |
489 | 489 | | |
490 | 490 | | |
| |||
557 | 557 | | |
558 | 558 | | |
559 | 559 | | |
| 560 | + | |
560 | 561 | | |
561 | 562 | | |
562 | 563 | | |
| |||
0 commit comments