You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by sa...@apache.org on 2020/07/10 12:48:32 UTC
[hadoop-ozone] 07/08: HDDS-3944. OM StateMachine unpause fails with
NPE (#1183)
This is an automated email from the ASF dual-hosted git repository.
sammichen pushed a commit to branch ozone-0.6.0
in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git
commit 311845661cf56fe9a9a5c8085d6a9d9042441ce7
Author: Doroszlai, Attila <64...@users.noreply.github.com>
AuthorDate: Fri Jul 10 01:26:33 2020 +0200
HDDS-3944. OM StateMachine unpause fails with NPE (#1183)
(cherry picked from commit 55a7bc8cf3eb7464d55136238305073523569cb1)
---
.../hadoop/ozone/om/TestOMRatisSnapshots.java | 2 --
.../ozone/om/ratis/OzoneManagerStateMachine.java | 26 ++++++++++------------
2 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOMRatisSnapshots.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOMRatisSnapshots.java
index 2ddd289..ea422e1 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOMRatisSnapshots.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOMRatisSnapshots.java
@@ -40,7 +40,6 @@ import org.apache.ratis.server.protocol.TermIndex;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -49,7 +48,6 @@ import org.junit.rules.Timeout;
/**
* Tests the Ratis snaphsots feature in OM.
*/
-@Ignore
public class TestOMRatisSnapshots {
private MiniOzoneHAClusterImpl cluster = null;
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerStateMachine.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerStateMachine.java
index 518094f..3aff87a 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerStateMachine.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerStateMachine.java
@@ -107,13 +107,7 @@ public class OzoneManagerStateMachine extends BaseStateMachine {
this.snapshotInfo = ozoneManager.getSnapshotInfo();
loadSnapshotInfoFromDB();
- this.ozoneManagerDoubleBuffer = new OzoneManagerDoubleBuffer.Builder()
- .setOmMetadataManager(ozoneManager.getMetadataManager())
- .setOzoneManagerRatisSnapShot(this::updateLastAppliedIndex)
- .enableRatis(true)
- .enableTracing(isTracingEnabled)
- .setIndexToTerm(this::getTermForIndex)
- .build();
+ this.ozoneManagerDoubleBuffer = buildDoubleBufferForRatis();
this.handler = new OzoneManagerRequestHandler(ozoneManager,
ozoneManagerDoubleBuffer);
@@ -329,19 +323,23 @@ public class OzoneManagerStateMachine extends BaseStateMachine {
public void unpause(long newLastAppliedSnaphsotIndex,
long newLastAppliedSnapShotTermIndex) {
getLifeCycle().startAndTransition(() -> {
- this.ozoneManagerDoubleBuffer =
- new OzoneManagerDoubleBuffer.Builder()
- .setOmMetadataManager(ozoneManager.getMetadataManager())
- .setOzoneManagerRatisSnapShot(this::updateLastAppliedIndex)
- .enableRatis(true)
- .enableTracing(isTracingEnabled)
- .build();
+ this.ozoneManagerDoubleBuffer = buildDoubleBufferForRatis();
handler.updateDoubleBuffer(ozoneManagerDoubleBuffer);
this.setLastAppliedTermIndex(TermIndex.newTermIndex(
newLastAppliedSnapShotTermIndex, newLastAppliedSnaphsotIndex));
});
}
+ public OzoneManagerDoubleBuffer buildDoubleBufferForRatis() {
+ return new OzoneManagerDoubleBuffer.Builder()
+ .setOmMetadataManager(ozoneManager.getMetadataManager())
+ .setOzoneManagerRatisSnapShot(this::updateLastAppliedIndex)
+ .setIndexToTerm(this::getTermForIndex)
+ .enableRatis(true)
+ .enableTracing(isTracingEnabled)
+ .build();
+ }
+
/**
* Take OM Ratis snapshot is a dummy operation as when double buffer
* flushes the lastAppliedIndex is flushed to DB and that is used as
---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-commits-help@hadoop.apache.org