forked from cockroachdb/pebble
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sstable: adjust sizeEstimate logic for forthcoming value blocks
sizeEstimate is used for two purposes: estimating the total compressed size of the data blocks, and estimating the size of the index block. The commentary around sizeEstimate was incomplete in terms of how these use cases behave, which is now clarified (and the "written", "inflight" and "compressed" terms clarified, since they map to different concepts for the index block case). Additionally, the size estimation of the total compressed data blocks can count a block as "written" once compression is complete, and does not need to wait until the write. This simplification is made now, so there is no need for the mutex to update sizeEstimate in the writeQueue. The mutex path is kept to allow for easy merging of the pending code for parallel compression. The interface is also simplified to not separately pass a finalEntrySize when we know the total size. This will fix the peculiarity with compression ratio 1 for the index block case -- the estimaton there has nothing to do with compression and has to do with the fact that we don't know the key-value size upfront, and we should be properly using the ratio in that case. The interface now has two methods writtenWithTotal and writtenWithDelta, and the caller can use whichever one is more convenient. The writtenWithTotal is more convenient for the index block writing case. This cleanup is worthwhile in itself, and it also sets us up for the value blocks change where the compressed value blocks will be held in-memory until late in the sstable construction (since the value blocks are written after all the index blocks). We do want to accurately account for their compressed size. That code path will use the writtenWithDelta similar to how we use it now after compressing a data block.
- Loading branch information
1 parent
0090519
commit 5ed983e
Showing
4 changed files
with
110 additions
and
80 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
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