Uh oh!
There was an error while loading. Please reload this page.
HDDS-15065. Replace Ratis Snapshot Trigger with DB Flush for Periodic Flush Operations - #10100
Conversation
@sumitagrawl , for HDDS-8508(#4683), what was the consideration at that time, that triggers snapshot instead of calls transactionBuffer.flush() in SCMHATransactionBufferMonitorTask.run() ? |
sumitagrawl
commented
Apr 23, 2026
There is a discussion for setting up to '1' but after discussion with @szetszwo , its not practical scenario to have less than 1024 transaction to be flushed as it keeps having updated. @szetszwo Please share your opinion |
priyeshkaratha
commented
Apr 23, 2026
@sumitagrawl@ChenSammi@szetszwo The The fix is to either:
|
ChenSammi
commented
Apr 28, 2026
@priyeshkaratha , can you try call transactionBuffer.flush() in SCMHATransactionBufferMonitorTask.run()? per the offline discussion with Sumit. |
@sumitagrawl , What was the discussion? Could you remind me? |
ChenSammi
commented
Apr 30, 2026
@sumitagrawl , are we OK to go with this " transactionBuffer.flush()" approach? The CI is passed. |
sumitagrawl
left a comment
There was a problem hiding this comment.
@priyeshkaratha Below things to be checked,
- DB flush is done in monitor thread, earlier is synchronized via ratis call in takeSnapshot(). This may have some impact of partial flush.
- Need recheck idompotency of all operation in SCM
@priyeshkaratha , please check and make sure that flush call is thread safe. I'm not very sure about the goal of SCMHATransactionBufferMonitorTask, but with the current default |
sumitagrawl
commented
May 6, 2026
@szetszwo Shall we set ozone.scm.ha.ratis.server.snapshot.creation.gap to "1" ? when snapshot is taken via timer ?
|
priyeshkaratha
commented
May 8, 2026
@ChenSammi@sumitagrawl The current change with use of DB flush will impact of partial flush. |
There was a problem hiding this comment.
Pull request overview
This PR targets SCM HA DB flush latency by removing reliance on Apache Ratis snapshot triggering (which was previously impacted by a minimum snapshot-creation gap) and by eliminating the Ozone-side configuration knob for the snapshot creation gap.
Changes:
- Remove
ozone.scm.ha.ratis.server.snapshot.creation.gapfrom Ozone configuration (key + default.xml entry) and stop propagating it into Ratis properties. - Change SCM HA transaction buffer monitoring to flush the buffered DB operations directly rather than triggering a Ratis snapshot.
- Update integration tests to stop setting the removed config key.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestStorageContainerManagerHA.java | Removes usage of the deleted snapshot-gap config in HA SCM integration test setup. |
| hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestDatanodeSCMNodesReconfiguration.java | Removes usage of the deleted snapshot-gap config in reconfiguration test setup. |
| hadoop-ozone/integration-test-recon/src/test/java/org/apache/hadoop/ozone/recon/AbstractTestStorageDistributionEndpoint.java | Drops static import + config set for the removed snapshot-gap key. |
| hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMHATransactionBufferMonitorTask.java | Switches the periodic monitor from snapshot triggering to direct DB transaction-buffer flush. |
| hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMHAManagerImpl.java | Updates monitor task construction to no longer require SCMRatisServer. |
| hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/RatisUtil.java | Stops setting Ratis snapshot creation gap via Ozone config propagation. |
| hadoop-hdds/common/src/main/resources/ozone-default.xml | Removes the snapshot creation gap property from default configuration. |
| hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ScmConfigKeys.java | Removes the snapshot creation gap config constant and default value. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| private static void setRaftSnapshotProperties( | ||
| final RaftProperties properties, | ||
| final ConfigurationSource ozoneConf) { | ||
| Snapshot.setAutoTriggerEnabled(properties, true); | ||
| Snapshot.setAutoTriggerThreshold(properties, | ||
| ozoneConf.getLong(ScmConfigKeys.OZONE_SCM_HA_RATIS_SNAPSHOT_THRESHOLD, | ||
| ScmConfigKeys.OZONE_SCM_HA_RATIS_SNAPSHOT_THRESHOLD_DEFAULT)); | ||
| Snapshot.setCreationGap(properties, | ||
| ozoneConf.getLong(ScmConfigKeys.OZONE_SCM_HA_RATIS_SNAPSHOT_GAP, | ||
| ScmConfigKeys.OZONE_SCM_HA_RATIS_SNAPSHOT_GAP_DEFAULT)); | ||
| } |
| // is reset to previous known value | ||
| transactionBuffer.getLatestSnapshotRef().compareAndSet( | ||
| null, lastSnapshot); | ||
| LOG.error("TransactionFlushTask is failed", e); |
What will cause partial flush? |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
hadoop-hdds/common/src/main/resources/ozone-default.xml:4176
- PR description says the snapshot creation gap is reduced from 1024 to 1, but the code change here removes the
ozone.scm.ha.ratis.server.snapshot.creation.gapproperty entirely (and RatisUtil no longer sets it). Please update the PR description to match the implemented approach, or reintroduce a default/value of 1 if that was still intended.
<property>
<name>ozone.scm.ha.dbtransactionbuffer.flush.interval</name>
<value>60s</value>
<tag>SCM, OZONE</tag>
<description>Wait duration for flush of buffered transaction.</description>
</property>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
What changes were proposed in this pull request?
This change addresses the SCM flush delay caused by the minimum transaction gap enforced in Apache Ratis.
Previously, even with the timer-based flush mechanism, DB updates were effectively delayed due to the default snapshot creation gap (~1024 transactions).
Changes:
Impact:
What is the link to the Apache JIRA
HDDS-15065
How was this patch tested?
Tested using modified testcases.