HDFS-11410. Use the cached instance when edit logging SetAclOp, SetXAttrOp and RemoveXAttrOp.

This commit is contained in:
Xiao Chen 2017-02-16 18:07:55 -08:00
parent 658702efff
commit 02c549484a
2 changed files with 12 additions and 15 deletions

View File

@ -1206,14 +1206,14 @@ void logFinalizeRollingUpgrade(long finalizeTime) {
} }
void logSetAcl(String src, List<AclEntry> entries) { void logSetAcl(String src, List<AclEntry> entries) {
SetAclOp op = SetAclOp.getInstance(); final SetAclOp op = SetAclOp.getInstance(cache.get());
op.src = src; op.src = src;
op.aclEntries = entries; op.aclEntries = entries;
logEdit(op); logEdit(op);
} }
void logSetXAttrs(String src, List<XAttr> xAttrs, boolean toLogRpcIds) { 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.src = src;
op.xAttrs = xAttrs; op.xAttrs = xAttrs;
logRpcIds(op, toLogRpcIds); logRpcIds(op, toLogRpcIds);
@ -1221,7 +1221,7 @@ void logSetXAttrs(String src, List<XAttr> xAttrs, boolean toLogRpcIds) {
} }
void logRemoveXAttrs(String src, List<XAttr> xAttrs, boolean toLogRpcIds) { 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.src = src;
op.xAttrs = xAttrs; op.xAttrs = xAttrs;
logRpcIds(op, toLogRpcIds); logRpcIds(op, toLogRpcIds);

View File

@ -3745,8 +3745,7 @@ public AddCacheDirectiveInfoOp() {
} }
static AddCacheDirectiveInfoOp getInstance(OpInstanceCache cache) { static AddCacheDirectiveInfoOp getInstance(OpInstanceCache cache) {
return (AddCacheDirectiveInfoOp) cache return (AddCacheDirectiveInfoOp) cache.get(OP_ADD_CACHE_DIRECTIVE);
.get(OP_ADD_CACHE_DIRECTIVE);
} }
@Override @Override
@ -3816,8 +3815,7 @@ public ModifyCacheDirectiveInfoOp() {
} }
static ModifyCacheDirectiveInfoOp getInstance(OpInstanceCache cache) { static ModifyCacheDirectiveInfoOp getInstance(OpInstanceCache cache) {
return (ModifyCacheDirectiveInfoOp) cache return (ModifyCacheDirectiveInfoOp) cache.get(OP_MODIFY_CACHE_DIRECTIVE);
.get(OP_MODIFY_CACHE_DIRECTIVE);
} }
@Override @Override
@ -3893,8 +3891,7 @@ public RemoveCacheDirectiveInfoOp() {
} }
static RemoveCacheDirectiveInfoOp getInstance(OpInstanceCache cache) { static RemoveCacheDirectiveInfoOp getInstance(OpInstanceCache cache) {
return (RemoveCacheDirectiveInfoOp) cache return (RemoveCacheDirectiveInfoOp) cache.get(OP_REMOVE_CACHE_DIRECTIVE);
.get(OP_REMOVE_CACHE_DIRECTIVE);
} }
@Override @Override
@ -4146,8 +4143,8 @@ static class RemoveXAttrOp extends FSEditLogOp {
super(OP_REMOVE_XATTR); super(OP_REMOVE_XATTR);
} }
static RemoveXAttrOp getInstance() { static RemoveXAttrOp getInstance(OpInstanceCache cache) {
return new RemoveXAttrOp(); return (RemoveXAttrOp) cache.get(OP_REMOVE_XATTR);
} }
@Override @Override
@ -4199,8 +4196,8 @@ static class SetXAttrOp extends FSEditLogOp {
super(OP_SET_XATTR); super(OP_SET_XATTR);
} }
static SetXAttrOp getInstance() { static SetXAttrOp getInstance(OpInstanceCache cache) {
return new SetXAttrOp(); return (SetXAttrOp) cache.get(OP_SET_XATTR);
} }
@Override @Override
@ -4252,8 +4249,8 @@ static class SetAclOp extends FSEditLogOp {
super(OP_SET_ACL); super(OP_SET_ACL);
} }
static SetAclOp getInstance() { static SetAclOp getInstance(OpInstanceCache cache) {
return new SetAclOp(); return (SetAclOp) cache.get(OP_SET_ACL);
} }
@Override @Override