You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ar...@apache.org on 2017/05/25 21:02:17 UTC
hadoop git commit: HDFS-11879. Fix JN sync interval in case of
exception. Contributed by Hanisha Koneru.
Repository: hadoop
Updated Branches:
refs/heads/trunk 29b7df960 -> 116156313
HDFS-11879. Fix JN sync interval in case of exception. Contributed by Hanisha Koneru.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/11615631
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/11615631
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/11615631
Branch: refs/heads/trunk
Commit: 11615631360ba49c1e9d256ed4f65119d99fd67d
Parents: 29b7df9
Author: Arpit Agarwal <ar...@apache.org>
Authored: Thu May 25 14:01:53 2017 -0700
Committer: Arpit Agarwal <ar...@apache.org>
Committed: Thu May 25 14:01:53 2017 -0700
----------------------------------------------------------------------
.../hdfs/qjournal/server/JournalNodeSyncer.java | 40 ++++++++++++--------
1 file changed, 25 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/11615631/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/JournalNodeSyncer.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/JournalNodeSyncer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/JournalNodeSyncer.java
index 99bd499..479f6a0 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/JournalNodeSyncer.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/JournalNodeSyncer.java
@@ -172,7 +172,6 @@ public class JournalNodeSyncer {
} else {
syncJournals();
}
- Thread.sleep(journalSyncInterval);
} catch (Throwable t) {
if (!shouldSync) {
if (t instanceof InterruptedException) {
@@ -194,6 +193,17 @@ public class JournalNodeSyncer {
LOG.error(
"JournalNodeSyncer daemon received Runtime exception. ", t);
}
+ try {
+ Thread.sleep(journalSyncInterval);
+ } catch (InterruptedException e) {
+ if (!shouldSync) {
+ LOG.info("Stopping JournalNode Sync.");
+ } else {
+ LOG.warn("JournalNodeSyncer interrupted", e);
+ }
+ Thread.currentThread().interrupt();
+ return;
+ }
}
});
syncJournalDaemon.start();
@@ -320,30 +330,30 @@ public class JournalNodeSyncer {
List<RemoteEditLog> missingEditLogs = Lists.newArrayList();
- int thisJnIndex = 0, otherJnIndex = 0;
- int thisJnNumLogs = thisJournalEditLogs.size();
- int otherJnNumLogs = otherJournalEditLogs.size();
+ int localJnIndex = 0, remoteJnIndex = 0;
+ int localJnNumLogs = thisJournalEditLogs.size();
+ int remoteJnNumLogs = otherJournalEditLogs.size();
- while (thisJnIndex < thisJnNumLogs && otherJnIndex < otherJnNumLogs) {
- long localJNstartTxId = thisJournalEditLogs.get(thisJnIndex)
+ while (localJnIndex < localJnNumLogs && remoteJnIndex < remoteJnNumLogs) {
+ long localJNstartTxId = thisJournalEditLogs.get(localJnIndex)
.getStartTxId();
- long remoteJNstartTxId = otherJournalEditLogs.get(otherJnIndex)
+ long remoteJNstartTxId = otherJournalEditLogs.get(remoteJnIndex)
.getStartTxId();
if (localJNstartTxId == remoteJNstartTxId) {
- thisJnIndex++;
- otherJnIndex++;
+ localJnIndex++;
+ remoteJnIndex++;
} else if (localJNstartTxId > remoteJNstartTxId) {
- missingEditLogs.add(otherJournalEditLogs.get(otherJnIndex));
- otherJnIndex++;
+ missingEditLogs.add(otherJournalEditLogs.get(remoteJnIndex));
+ remoteJnIndex++;
} else {
- thisJnIndex++;
+ localJnIndex++;
}
}
- if (otherJnIndex < otherJnNumLogs) {
- for (; otherJnIndex < otherJnNumLogs; otherJnIndex++) {
- missingEditLogs.add(otherJournalEditLogs.get(otherJnIndex));
+ if (remoteJnIndex < remoteJnNumLogs) {
+ for (; remoteJnIndex < remoteJnNumLogs; remoteJnIndex++) {
+ missingEditLogs.add(otherJournalEditLogs.get(remoteJnIndex));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org