Skip to content

Commit 9a8d822

Browse files
addressing review commits
1 parent d7781df commit 9a8d822

3 files changed

Lines changed: 4 additions & 21 deletions

File tree

hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/RatisUtil.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@
5454
*/
5555
public final class RatisUtil {
5656

57-
public static final long SCM_RAFT_SNAPSHOT_GAP = 1L;
58-
5957
private RatisUtil() {
6058
}
6159

@@ -233,7 +231,6 @@ private static void setRaftSnapshotProperties(
233231
Snapshot.setAutoTriggerThreshold(properties,
234232
ozoneConf.getLong(ScmConfigKeys.OZONE_SCM_HA_RATIS_SNAPSHOT_THRESHOLD,
235233
ScmConfigKeys.OZONE_SCM_HA_RATIS_SNAPSHOT_THRESHOLD_DEFAULT));
236-
Snapshot.setCreationGap(properties, SCM_RAFT_SNAPSHOT_GAP);
237234
}
238235

239236
public static void checkRatisException(IOException e, String port,

hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMHAManagerImpl.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ private void createStartTransactionBufferMonitor() {
142142
OZONE_SCM_HA_DBTRANSACTIONBUFFER_FLUSH_INTERVAL_DEFAULT,
143143
TimeUnit.MILLISECONDS);
144144
SCMHATransactionBufferMonitorTask monitorTask
145-
= new SCMHATransactionBufferMonitorTask(
146-
transactionBuffer, ratisServer, interval);
145+
= new SCMHATransactionBufferMonitorTask(transactionBuffer, interval);
147146
trxBufferMonitorService =
148147
new BackgroundSCMService.Builder().setClock(scm.getSystemClock())
149148
.setScmContext(scm.getScmContext())

hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMHATransactionBufferMonitorTask.java

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
package org.apache.hadoop.hdds.scm.ha;
1919

2020
import java.io.IOException;
21-
import org.apache.ratis.statemachine.SnapshotInfo;
2221
import org.slf4j.Logger;
2322
import org.slf4j.LoggerFactory;
2423

@@ -29,38 +28,26 @@
2928
public class SCMHATransactionBufferMonitorTask implements Runnable {
3029
private static final Logger LOG =
3130
LoggerFactory.getLogger(SCMHATransactionBufferMonitorTask.class);
32-
private final SCMRatisServer server;
3331
private final SCMHADBTransactionBuffer transactionBuffer;
3432
private final long flushInterval;
3533

3634
/**
3735
* SCMService related variables.
3836
*/
3937
public SCMHATransactionBufferMonitorTask(
40-
SCMHADBTransactionBuffer transactionBuffer,
41-
SCMRatisServer server, long flushInterval) {
38+
SCMHADBTransactionBuffer transactionBuffer, long flushInterval) {
4239
this.flushInterval = flushInterval;
4340
this.transactionBuffer = transactionBuffer;
44-
this.server = server;
4541
}
4642

4743
@Override
4844
public void run() {
4945
if (transactionBuffer.shouldFlush(flushInterval)) {
5046
LOG.debug("Running TransactionFlushTask");
51-
// set latest snapshot to null for force snapshot
52-
// the value will be reset again when snapshot is taken
53-
final SnapshotInfo lastSnapshot = transactionBuffer
54-
.getLatestSnapshotRef().getAndSet(null);
5547
try {
56-
server.triggerSnapshot();
48+
transactionBuffer.flush();
5749
} catch (IOException e) {
58-
LOG.error("Snapshot request is failed", e);
59-
} finally {
60-
// under failure case, if unable to take snapshot, its value
61-
// is reset to previous known value
62-
transactionBuffer.getLatestSnapshotRef().compareAndSet(
63-
null, lastSnapshot);
50+
LOG.error("TransactionFlushTask is failed", e);
6451
}
6552
}
6653
}

0 commit comments

Comments
 (0)