swamirishi opened a new pull request, #9508: URL: https://github.com/apache/ozone/pull/9508
## What changes were proposed in this pull request? [HDDS-14027](https://issues.apache.org/jira/browse/HDDS-14027) introduced usage of CodecBuffers in creation of RDBSstFileWriter. However when adding a tombstone entry in the SST file a ManagedDirectSlice is used because of unavailability of ByteBuffer direct API. The usage of DirectSlice differs where the rocksdb doesn't read the position and limit of the passed ByteBuffer instance and always performs on the entire ByteBuffer by default. This can have wrong results in flushing the sst file since the key written would be wrong. Consider this case: CodecBuffer initialized with Key_Renamed entry in the byte Array [pos: 0, limit : 12] CodecBuffer is cleared and entry Key entry in the byte Array [pos: 0, limit: 3] Write this value as delete entry in sst file. Here with the existing implementation Key_Renamed would be written into sst file instead of Key which is wrong because of the ManagedDirectSlice misuse. CodecBuffer is cleared and entry Key_Renamed entry is added.[pos: 0, limit : 12] Adding this entry to sst file will fail since it has the value needs to increase monotonically since Key_Renamed was already added erroneously thus fetching wrong results. The patch focuses on making ManagedDirectSlice a ManagedRocksObject so that it becomes easier to use it as mere wrapper for ByteBuffer making it easy to use with CodecBuffers. Rocksdb Source Code for reference: https://github.com/facebook/rocksdb/blob/06c8afeff5b9fd38a79bdd4ba1bbb9df572c8096/java/rocksjni/slice.cc#L292-L308 https://github.com/facebook/rocksdb/blob/1001bc01c9ea06785c2d5261ca9fe7ac0eac0625/java/src/main/java/org/rocksdb/DirectSlice.java#L70-L80 ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-14185 ## How was this patch tested? Added unit tests -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
