Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id DA1C5200D16 for ; Tue, 26 Sep 2017 05:19:07 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D0AA21609E9; Tue, 26 Sep 2017 03:19:07 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id EF6721609BB for ; Tue, 26 Sep 2017 05:19:06 +0200 (CEST) Received: (qmail 98854 invoked by uid 500); 26 Sep 2017 03:19:06 -0000 Mailing-List: contact commits-help@asterixdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@asterixdb.apache.org Delivered-To: mailing list commits@asterixdb.apache.org Received: (qmail 98845 invoked by uid 99); 26 Sep 2017 03:19:06 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Sep 2017 03:19:06 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E7C28E0395; Tue, 26 Sep 2017 03:19:05 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mhubail@apache.org To: commits@asterixdb.apache.org Message-Id: <20d5702b2bff4eeba8df989b01e8ba6b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: asterixdb git commit: [NO ISSUE][CLUS] Unexport Metadata Node Stub on NC Stop Date: Tue, 26 Sep 2017 03:19:05 +0000 (UTC) archived-at: Tue, 26 Sep 2017 03:19:08 -0000 Repository: asterixdb Updated Branches: refs/heads/master 8351d2531 -> 62cdcc253 [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 Reviewed-on: https://asterix-gerrit.ics.uci.edu/2027 Sonar-Qube: Jenkins Tested-by: Jenkins Contrib: Jenkins Integration-Tests: Jenkins Reviewed-by: abdullah alamoudi Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/62cdcc25 Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/62cdcc25 Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/62cdcc25 Branch: refs/heads/master Commit: 62cdcc2532a080f4549e1e6e61d4f9e8dddb9350 Parents: 8351d25 Author: Murtadha Hubail Authored: Mon Sep 25 22:53:14 2017 +0300 Committer: Murtadha Hubail Committed: Mon Sep 25 20:18:33 2017 -0700 ---------------------------------------------------------------------- .../asterix/app/nc/NCAppRuntimeContext.java | 10 ++- .../asterix/test/logging/CheckpointingTest.java | 74 +++++++++++--------- 2 files changed, 46 insertions(+), 38 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/asterixdb/blob/62cdcc25/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCAppRuntimeContext.java ---------------------------------------------------------------------- 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..eedc8ec 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 @@ -284,8 +284,11 @@ public class NCAppRuntimeContext implements INcApplicationContext { } @Override - public void preStop() throws Exception { + public synchronized void preStop() throws Exception { activeManager.shutdown(); + if (metadataNodeStub != null) { + unexportMetadataNodeStub(); + } } @Override @@ -455,7 +458,7 @@ public class NCAppRuntimeContext implements INcApplicationContext { } @Override - public void exportMetadataNodeStub() throws RemoteException { + public synchronized void exportMetadataNodeStub() throws RemoteException { if (metadataNodeStub == null) { metadataNodeStub = (IMetadataNode) UnicastRemoteObject.exportObject(MetadataNode.INSTANCE, getMetadataProperties().getMetadataPort()); @@ -464,8 +467,9 @@ public class NCAppRuntimeContext implements INcApplicationContext { } @Override - public void unexportMetadataNodeStub() throws RemoteException { + public synchronized void unexportMetadataNodeStub() throws RemoteException { UnicastRemoteObject.unexportObject(MetadataNode.INSTANCE, false); + metadataNodeStub = null; } public NCExtensionManager getNcExtensionManager() { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/62cdcc25/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/logging/CheckpointingTest.java ---------------------------------------------------------------------- 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 @@ public class CheckpointingTest { 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());