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

(cherry picked from commit 02c549484a)
This commit is contained in:
Xiao Chen 2017-02-16 18:07:55 -08:00
parent b23e93d465
commit 06386b7e78
2 changed files with 12 additions and 15 deletions

View File

@ -1207,14 +1207,14 @@ public class FSEditLog implements LogsPurgeable {
}
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);
@ -1222,7 +1222,7 @@ public class FSEditLog implements LogsPurgeable {
}
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);

View File

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