-
Notifications
You must be signed in to change notification settings - Fork 77
Fix: Replication of large documents breaches the size limit (2GB) of ReleasableBytesStreamOutput #1580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Replication of large documents breaches the size limit (2GB) of ReleasableBytesStreamOutput #1580
Conversation
…ReleasableBytesStreamOutput Signed-off-by: Sagar Darji <[email protected]>
| val fromSeq = seqNoAlreadyRequested.getAndAdd(batchSize.toLong()) + 1 | ||
| val toSeq = fromSeq + batchSize - 1 | ||
| logDebug("Fetching the batch $fromSeq-$toSeq") | ||
| val currentBatchSize = batchSizeSettings.getEffectiveBatchSize() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we gate this dynamic batch size feature behind a cluster/index setting? We can enable it by default based on testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think another setting is needed as the test coverage is good.
src/main/kotlin/org/opensearch/replication/task/shard/BatchSizeSettings.kt
Show resolved
Hide resolved
|
|
||
| // Handle 2GB limit exception specifically | ||
| if (e is IllegalArgumentException && | ||
| e.message?.equals("ReleasableBytesStreamOutput cannot hold more than 2GB of data") == true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we just check for ReleasableBytesStreamOutput cannot hold more than? If the 2GB limit changes in future, this exception will start failing again
src/main/kotlin/org/opensearch/replication/task/shard/BatchSizeSettings.kt
Show resolved
Hide resolved
| const val REPLICATION_EXECUTOR_NAME_FOLLOWER = "replication_follower" | ||
| val REPLICATED_INDEX_SETTING: Setting<String> = Setting.simpleString("index.plugins.replication.follower.leader_index", | ||
| Setting.Property.InternalIndex, Setting.Property.IndexScope) | ||
| // Node-level batch size setting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Cluster level
| // For dynamic batch size adjustment (2GB fix) | ||
| @Volatile | ||
| private var dynamicBatchSize: Int? = null | ||
| private val minBatchSize = 16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets define this as a constant and reuse the value here and also in the settings definition in ReplicationPlugin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have added a constant in ReplicationPlugin class
| */ | ||
| fun reduceBatchSize() { | ||
| batchSizeSettings.reduceBatchSize() | ||
| logDebug("Batch size reduced to ${batchSizeSettings.getEffectiveBatchSize()}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log as INFO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
| */ | ||
| fun resetBatchSize() { | ||
| batchSizeSettings.resetBatchSize() | ||
| logDebug("Batch size reset to ${batchSizeSettings.getEffectiveBatchSize()}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log as INFO
| val fromSeq = seqNoAlreadyRequested.getAndAdd(batchSize.toLong()) + 1 | ||
| val toSeq = fromSeq + batchSize - 1 | ||
| logDebug("Fetching the batch $fromSeq-$toSeq") | ||
| val currentBatchSize = batchSizeSettings.getEffectiveBatchSize() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think another setting is needed as the test coverage is good.
Signed-off-by: Sagar Darji <[email protected]>
|
The backport to To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.7 2.7
# Navigate to the new working tree
cd .worktrees/backport-2.7
# Create a new branch
git switch --create backport/backport-1580-to-2.7
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 5bbe925d91816b998b9a472d2218f9102367b843
# Push it to GitHub
git push --set-upstream origin backport/backport-1580-to-2.7
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.7Then, create a pull request where the |
|
The backport to To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.17 2.17
# Navigate to the new working tree
cd .worktrees/backport-2.17
# Create a new branch
git switch --create backport/backport-1580-to-2.17
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 5bbe925d91816b998b9a472d2218f9102367b843
# Push it to GitHub
git push --set-upstream origin backport/backport-1580-to-2.17
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.17Then, create a pull request where the |
|
The backport to To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.19 2.19
# Navigate to the new working tree
cd .worktrees/backport-2.19
# Create a new branch
git switch --create backport/backport-1580-to-2.19
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 5bbe925d91816b998b9a472d2218f9102367b843
# Push it to GitHub
git push --set-upstream origin backport/backport-1580-to-2.19
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.19Then, create a pull request where the |
|
The backport to To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-3.1.0 3.1.0
# Navigate to the new working tree
cd .worktrees/backport-3.1.0
# Create a new branch
git switch --create backport/backport-1580-to-3.1.0
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 5bbe925d91816b998b9a472d2218f9102367b843
# Push it to GitHub
git push --set-upstream origin backport/backport-1580-to-3.1.0
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-3.1.0Then, create a pull request where the |
Description
When the follower cluster fetches the data from the leader node it breaches the 2GB limit for a single call. This PR handles that issue in the following ways
Related Issues
Resolves #1568
Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.