Murtadha Hubail has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/2027

Change subject: [NO ISSUE][CLUS] Unexport Metadata Node Stub on NC Stop
......................................................................

[NO ISSUE][CLUS] Unexport Metadata Node Stub on NC Stop

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
- Unexport metadata node stub on NC stop to avoid
  java.rmi.server.ExportException on subsequent NC
  startup on save JVM.

Change-Id: If7f1b7a294968e871465900b04c05cf388b776e4
---
M 
asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCAppRuntimeContext.java
M 
asterixdb/asterix-app/src/test/java/org/apache/asterix/test/logging/CheckpointingTest.java
2 files changed, 43 insertions(+), 35 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/27/2027/1

diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCAppRuntimeContext.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCAppRuntimeContext.java
index 3591bf0..50eba63 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCAppRuntimeContext.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCAppRuntimeContext.java
@@ -286,6 +286,9 @@
     @Override
     public void preStop() throws Exception {
         activeManager.shutdown();
+        if (metadataNodeStub != null) {
+            unexportMetadataNodeStub();
+        }
     }
 
     @Override
@@ -466,6 +469,7 @@
     @Override
     public void unexportMetadataNodeStub() throws RemoteException {
         UnicastRemoteObject.unexportObject(MetadataNode.INSTANCE, false);
+        metadataNodeStub = null;
     }
 
     public NCExtensionManager getNcExtensionManager() {
diff --git 
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/logging/CheckpointingTest.java
 
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/logging/CheckpointingTest.java
index 370205b..41b3d38 100644
--- 
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/logging/CheckpointingTest.java
+++ 
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/logging/CheckpointingTest.java
@@ -218,41 +218,45 @@
         try {
             TestNodeController nc = new TestNodeController(new 
File(TEST_CONFIG_FILE_PATH).getAbsolutePath(), false);
             nc.init();
-            final ITransactionSubsystem txnSubsystem = 
nc.getTransactionSubsystem();
-            final AbstractCheckpointManager checkpointManager =
-                    (AbstractCheckpointManager) 
txnSubsystem.getCheckpointManager();
-            // Make a checkpoint with the current minFirstLSN
-            final long minFirstLSN = 
txnSubsystem.getRecoveryManager().getMinFirstLSN();
-            checkpointManager.tryCheckpoint(minFirstLSN);
-            // Get the just created checkpoint
-            final Checkpoint validCheckpoint = checkpointManager.getLatest();
-            // Make sure the valid checkout wouldn't force full recovery
-            Assert.assertTrue(validCheckpoint.getMinMCTFirstLsn() >= 
minFirstLSN);
-            // Add a corrupted (empty) checkpoint file with a timestamp > than 
current checkpoint
-            Path corruptedCheckpointPath = 
checkpointManager.getCheckpointPath(validCheckpoint.getTimeStamp() + 1);
-            File corruptedCheckpoint = corruptedCheckpointPath.toFile();
-            corruptedCheckpoint.createNewFile();
-            // Make sure the corrupted checkpoint file was created
-            Assert.assertTrue(corruptedCheckpoint.exists());
-            // Try to get the latest checkpoint again
-            Checkpoint cpAfterCorruption = checkpointManager.getLatest();
-            // Make sure the valid checkpoint was returned
-            Assert.assertEquals(validCheckpoint.getTimeStamp(), 
cpAfterCorruption.getTimeStamp());
-            // Make sure the corrupted checkpoint file was deleted
-            Assert.assertFalse(corruptedCheckpoint.exists());
-            // Corrupt the valid checkpoint by replacing its content
-            final Path validCheckpointPath = 
checkpointManager.getCheckpointPath(validCheckpoint.getTimeStamp());
-            File validCheckpointFile = validCheckpointPath.toFile();
-            Assert.assertTrue(validCheckpointFile.exists());
-            // Delete the valid checkpoint file and create it as an empty file
-            validCheckpointFile.delete();
-            validCheckpointFile.createNewFile();
-            // Make sure the returned checkpoint (the forged checkpoint) will 
enforce full recovery
-            Checkpoint forgedCheckpoint = checkpointManager.getLatest();
-            Assert.assertTrue(forgedCheckpoint.getMinMCTFirstLsn() < 
minFirstLSN);
-            // Make sure the forged checkpoint recovery will start from the 
first available log
-            final long readableSmallestLSN = 
txnSubsystem.getLogManager().getReadableSmallestLSN();
-            Assert.assertTrue(forgedCheckpoint.getMinMCTFirstLsn() <= 
readableSmallestLSN);
+            try {
+                final ITransactionSubsystem txnSubsystem = 
nc.getTransactionSubsystem();
+                final AbstractCheckpointManager checkpointManager =
+                        (AbstractCheckpointManager) 
txnSubsystem.getCheckpointManager();
+                // Make a checkpoint with the current minFirstLSN
+                final long minFirstLSN = 
txnSubsystem.getRecoveryManager().getMinFirstLSN();
+                checkpointManager.tryCheckpoint(minFirstLSN);
+                // Get the just created checkpoint
+                final Checkpoint validCheckpoint = 
checkpointManager.getLatest();
+                // Make sure the valid checkout wouldn't force full recovery
+                Assert.assertTrue(validCheckpoint.getMinMCTFirstLsn() >= 
minFirstLSN);
+                // Add a corrupted (empty) checkpoint file with a timestamp > 
than current checkpoint
+                Path corruptedCheckpointPath = 
checkpointManager.getCheckpointPath(validCheckpoint.getTimeStamp() + 1);
+                File corruptedCheckpoint = corruptedCheckpointPath.toFile();
+                corruptedCheckpoint.createNewFile();
+                // Make sure the corrupted checkpoint file was created
+                Assert.assertTrue(corruptedCheckpoint.exists());
+                // Try to get the latest checkpoint again
+                Checkpoint cpAfterCorruption = checkpointManager.getLatest();
+                // Make sure the valid checkpoint was returned
+                Assert.assertEquals(validCheckpoint.getTimeStamp(), 
cpAfterCorruption.getTimeStamp());
+                // Make sure the corrupted checkpoint file was deleted
+                Assert.assertFalse(corruptedCheckpoint.exists());
+                // Corrupt the valid checkpoint by replacing its content
+                final Path validCheckpointPath = 
checkpointManager.getCheckpointPath(validCheckpoint.getTimeStamp());
+                File validCheckpointFile = validCheckpointPath.toFile();
+                Assert.assertTrue(validCheckpointFile.exists());
+                // Delete the valid checkpoint file and create it as an empty 
file
+                validCheckpointFile.delete();
+                validCheckpointFile.createNewFile();
+                // Make sure the returned checkpoint (the forged checkpoint) 
will enforce full recovery
+                Checkpoint forgedCheckpoint = checkpointManager.getLatest();
+                Assert.assertTrue(forgedCheckpoint.getMinMCTFirstLsn() < 
minFirstLSN);
+                // Make sure the forged checkpoint recovery will start from 
the first available log
+                final long readableSmallestLSN = 
txnSubsystem.getLogManager().getReadableSmallestLSN();
+                Assert.assertTrue(forgedCheckpoint.getMinMCTFirstLsn() <= 
readableSmallestLSN);
+            } finally {
+                nc.deInit();
+            }
         } catch (Throwable e) {
             e.printStackTrace();
             Assert.fail(e.getMessage());

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/2027
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If7f1b7a294968e871465900b04c05cf388b776e4
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Murtadha Hubail <[email protected]>

Reply via email to