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)

@github-actions
Copy link

This PR has been marked as stale due to 21 days of inactivity. Please comment or remove the stale label to keep it open. Otherwise, it will be automatically closed in 7 days.

@github-actions github-actions bot added the stale label Jan 17, 2026
@aryangupta1998
Copy link
Contributor

@swamirishi, are you working on this?

@swamirishi
Copy link
Contributor Author

@swamirishi, are you working on this?
I have a branch ready locally. I would push the code in some time after resolving some merge conflicts.

…nges and simple logic

Change-Id: I7a06f5a427ba7d1c4f760ff70fcb4093abaa3cbd
@swamirishi
Copy link
Contributor Author

@szetszwo @jojochuang Can you take a look at this change?

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.

2 participants