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 ka...@apache.org on 2014/10/22 23:26:41 UTC
git commit: HADOOP-11122. Fix findbugs in ZK
DelegationTokenSecretManagers. (Arun Suresh via kasha)
Repository: hadoop
Updated Branches:
refs/heads/trunk 7b0f9bb25 -> 70719e5c6
HADOOP-11122. Fix findbugs in ZK DelegationTokenSecretManagers. (Arun Suresh via kasha)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/70719e5c
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/70719e5c
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/70719e5c
Branch: refs/heads/trunk
Commit: 70719e5c62f32836914bea88e1ddd99c0ed009e1
Parents: 7b0f9bb
Author: Karthik Kambatla <ka...@apache.org>
Authored: Wed Oct 22 14:26:27 2014 -0700
Committer: Karthik Kambatla <ka...@apache.org>
Committed: Wed Oct 22 14:26:27 2014 -0700
----------------------------------------------------------------------
hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++
.../AbstractDelegationTokenSecretManager.java | 12 +++---------
.../delegation/ZKDelegationTokenSecretManager.java | 16 ++++++++++------
3 files changed, 16 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/70719e5c/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index a340636..ce5a6db 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -994,6 +994,9 @@ Release 2.6.0 - UNRELEASED
HADOOP-11175. Fix several issues of hadoop security configuration in user
doc. (Yi Liu via cnauroth)
+ HADOOP-11122. Fix findbugs in ZK DelegationTokenSecretManagers.
+ (Arun Suresh via kasha)
+
Release 2.5.1 - 2014-09-05
INCOMPATIBLE CHANGES
http://git-wip-us.apache.org/repos/asf/hadoop/blob/70719e5c/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java
index 7b6bf35..ebba6a1 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java
@@ -163,11 +163,6 @@ extends AbstractDelegationTokenIdentifier>
return;
}
- // for ZK based secretManager
- protected void updateMasterKey(DelegationKey key) throws IOException{
- return;
- }
-
// RM
protected void removeStoredMasterKey(DelegationKey key) {
return;
@@ -191,7 +186,7 @@ extends AbstractDelegationTokenIdentifier>
* For subclasses externalizing the storage, for example Zookeeper
* based implementations
*/
- protected int getDelegationTokenSeqNum() {
+ protected synchronized int getDelegationTokenSeqNum() {
return delegationTokenSequenceNumber;
}
@@ -199,7 +194,7 @@ extends AbstractDelegationTokenIdentifier>
* For subclasses externalizing the storage, for example Zookeeper
* based implementations
*/
- protected int incrementDelegationTokenSeqNum() {
+ protected synchronized int incrementDelegationTokenSeqNum() {
return ++delegationTokenSequenceNumber;
}
@@ -207,7 +202,7 @@ extends AbstractDelegationTokenIdentifier>
* For subclasses externalizing the storage, for example Zookeeper
* based implementations
*/
- protected void setDelegationTokenSeqNum(int seqNum) {
+ protected synchronized void setDelegationTokenSeqNum(int seqNum) {
delegationTokenSequenceNumber = seqNum;
}
@@ -234,7 +229,6 @@ extends AbstractDelegationTokenIdentifier>
*/
protected void updateDelegationKey(DelegationKey key) throws IOException {
allKeys.put(key.getKeyId(), key);
- updateMasterKey(key);
}
/**
http://git-wip-us.apache.org/repos/asf/hadoop/blob/70719e5c/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/ZKDelegationTokenSecretManager.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/ZKDelegationTokenSecretManager.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/ZKDelegationTokenSecretManager.java
index 23c7144..5f68844 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/ZKDelegationTokenSecretManager.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/ZKDelegationTokenSecretManager.java
@@ -276,7 +276,7 @@ public abstract class ZKDelegationTokenSecretManager<TokenIdent extends Abstract
}
@Override
- public void startThreads() throws IOException {
+ public synchronized void startThreads() throws IOException {
if (!isExternalClient) {
try {
zkClient.start();
@@ -402,7 +402,7 @@ public abstract class ZKDelegationTokenSecretManager<TokenIdent extends Abstract
}
@Override
- public void stopThreads() {
+ public synchronized void stopThreads() {
try {
if (!isExternalClient && (zkClient != null)) {
zkClient.close();
@@ -434,12 +434,12 @@ public abstract class ZKDelegationTokenSecretManager<TokenIdent extends Abstract
}
@Override
- protected int getDelegationTokenSeqNum() {
+ protected synchronized int getDelegationTokenSeqNum() {
return seqCounter.getCount();
}
@Override
- protected int incrementDelegationTokenSeqNum() {
+ protected synchronized int incrementDelegationTokenSeqNum() {
try {
while (!seqCounter.trySetCount(seqCounter.getCount() + 1)) {
}
@@ -450,8 +450,12 @@ public abstract class ZKDelegationTokenSecretManager<TokenIdent extends Abstract
}
@Override
- protected void setDelegationTokenSeqNum(int seqNum) {
- delegationTokenSequenceNumber = seqNum;
+ protected synchronized void setDelegationTokenSeqNum(int seqNum) {
+ try {
+ seqCounter.setCount(seqNum);
+ } catch (Exception e) {
+ throw new RuntimeException("Could not set shared counter !!", e);
+ }
}
@Override