Skip to content

Conversation

@swamirishi
Copy link
Contributor

@swamirishi swamirishi commented Dec 24, 2025

What changes were proposed in this pull request?

The PrepareBatchOperation looping was very convoluted in HDDS-13415 (#8774) implementation. It also misses a case where a putKey/deleteKey can get added even though a deleteRange has been executed in the next batch after the following continuousDeleteRange batch. The following example will explain the scenario better.

  1. Put Key1

  2. DeleteRange Key2 - Key5

  3. Put Key2

  4. DeleteRange Key1 - Key4

Here the operation 1 should ideally be cancelled by Op4. But currently both Op1 & OP4 gets executed however it would be more optimal to just execute Op4 & Op1 is redundant.
Initially while implementing the deleteRangeWithBatch I had plans to optimize this the deleteRange search by sorting the continuous ranges and do a binary search to figure out the range matching the entry to reduce overall complexity. However we saw the code was getting more complex and not giving us much returns since deleteRange as an op was going to be infrequent and was only going to be used by snapshot create.
But the deleteRange is also going to be used by DirectoryPurgeRequest removing entries from the file table and directory table. This optimization would help reduce complexity of rocksdb compactions if a key is committed and also deleted within the same double buffer batch.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-14239

How was this patch tested?

Updated unit tests. I intend to add another unit test suggested in this comment
#8774 (comment)

@swamirishi swamirishi force-pushed the HDDS-14239 branch 3 times, most recently from ed26f71 to b0b4c8b Compare December 25, 2025 05:42
Change-Id: I1cc243d0dadbe647ad9dc7b94822ba7dc6a83e1c
…by abstracting out implementation of each operation

Change-Id: Idf5b9a4b9f66eae41a9d832ddbf22e43d1027344
…on for optimization

Change-Id: Ia7655ff5148197be488a2c1151ec7fd1d6f9d452
…Operation

Change-Id: I4a7c62d8cc91173a1374ba5f3515f3c9ac99376f
…nges and simple logic

Change-Id: If659fd2cf71d76909cb81c4362e2e02d85930635
…ucture

Change-Id: I704dab8380d1dd35faa2b9453ef90b439937e95b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant