Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MB-45917: Use correct "diskSize" for compaction after an upgrade
The collection diskSize does not exist in 6.5 couchstore files, so the code uses dbinfo.space_used (as only the default collection exists, this is a reasonable over-estimate). During 7.0 compaction the collection diskSize stat must be updated if tombstones are purged and MB-45917 identified a problem in compaction where the collection stats are read from the new file, which is generally fine except in the case where an upgrade just occurred, because the disk-size is set to the space_used of the compacted file. If compaction has just purged many tombstones the space_used can be small and the purged-byte counter large -> underflow. Fix this by updating couchstore so that both source/target Db& are passed to the precommit hook and then read the stats from the source. Now we will subtract from a large size and not underflow the disk size. A second fix is included that was found in the added unit-test where the on_disk_prepares was accessed but not present. This could be an issue with the unit test hooks, but the code is now more robust if a path is possible where we get to 7.0 without that field present in vbstate. Change-Id: I7b00f75738c024b91acbefb8b4eb7f739fa185cd Reviewed-on: http://review.couchbase.org/c/kv_engine/+/152195 Tested-by: Build Bot <build@couchbase.com> Reviewed-by: Paolo Cocchi <paolo.cocchi@couchbase.com>
- Loading branch information
1 parent
3a5a7aa
commit 0917f06
Showing
3 changed files
with
104 additions
and
52 deletions.
There are no files selected for viewing
This file contains 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 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 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