Skip to content

Commit

Permalink
HDFS-11410. Use the cached instance when edit logging SetAclOp, SetXA…
Browse files Browse the repository at this point in the history
…ttrOp and RemoveXAttrOp.
  • Loading branch information
xiao-chen committed Feb 17, 2017
1 parent 658702e commit 02c5494
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1206,22 +1206,22 @@ void logFinalizeRollingUpgrade(long finalizeTime) {
}

void logSetAcl(String src, List<AclEntry> entries) {
SetAclOp op = SetAclOp.getInstance();
final SetAclOp op = SetAclOp.getInstance(cache.get());
op.src = src;
op.aclEntries = entries;
logEdit(op);
}

void logSetXAttrs(String src, List<XAttr> xAttrs, boolean toLogRpcIds) {
final SetXAttrOp op = SetXAttrOp.getInstance();
final SetXAttrOp op = SetXAttrOp.getInstance(cache.get());
op.src = src;
op.xAttrs = xAttrs;
logRpcIds(op, toLogRpcIds);
logEdit(op);
}

void logRemoveXAttrs(String src, List<XAttr> xAttrs, boolean toLogRpcIds) {
final RemoveXAttrOp op = RemoveXAttrOp.getInstance();
final RemoveXAttrOp op = RemoveXAttrOp.getInstance(cache.get());
op.src = src;
op.xAttrs = xAttrs;
logRpcIds(op, toLogRpcIds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3745,8 +3745,7 @@ public AddCacheDirectiveInfoOp() {
}

static AddCacheDirectiveInfoOp getInstance(OpInstanceCache cache) {
return (AddCacheDirectiveInfoOp) cache
.get(OP_ADD_CACHE_DIRECTIVE);
return (AddCacheDirectiveInfoOp) cache.get(OP_ADD_CACHE_DIRECTIVE);
}

@Override
Expand Down Expand Up @@ -3816,8 +3815,7 @@ public ModifyCacheDirectiveInfoOp() {
}

static ModifyCacheDirectiveInfoOp getInstance(OpInstanceCache cache) {
return (ModifyCacheDirectiveInfoOp) cache
.get(OP_MODIFY_CACHE_DIRECTIVE);
return (ModifyCacheDirectiveInfoOp) cache.get(OP_MODIFY_CACHE_DIRECTIVE);
}

@Override
Expand Down Expand Up @@ -3893,8 +3891,7 @@ public RemoveCacheDirectiveInfoOp() {
}

static RemoveCacheDirectiveInfoOp getInstance(OpInstanceCache cache) {
return (RemoveCacheDirectiveInfoOp) cache
.get(OP_REMOVE_CACHE_DIRECTIVE);
return (RemoveCacheDirectiveInfoOp) cache.get(OP_REMOVE_CACHE_DIRECTIVE);
}

@Override
Expand Down Expand Up @@ -4146,8 +4143,8 @@ static class RemoveXAttrOp extends FSEditLogOp {
super(OP_REMOVE_XATTR);
}

static RemoveXAttrOp getInstance() {
return new RemoveXAttrOp();
static RemoveXAttrOp getInstance(OpInstanceCache cache) {
return (RemoveXAttrOp) cache.get(OP_REMOVE_XATTR);
}

@Override
Expand Down Expand Up @@ -4199,8 +4196,8 @@ static class SetXAttrOp extends FSEditLogOp {
super(OP_SET_XATTR);
}

static SetXAttrOp getInstance() {
return new SetXAttrOp();
static SetXAttrOp getInstance(OpInstanceCache cache) {
return (SetXAttrOp) cache.get(OP_SET_XATTR);
}

@Override
Expand Down Expand Up @@ -4252,8 +4249,8 @@ static class SetAclOp extends FSEditLogOp {
super(OP_SET_ACL);
}

static SetAclOp getInstance() {
return new SetAclOp();
static SetAclOp getInstance(OpInstanceCache cache) {
return (SetAclOp) cache.get(OP_SET_ACL);
}

@Override
Expand Down

0 comments on commit 02c5494

Please sign in to comment.