Skip to content

Commit

Permalink
HDDS-2946. Rename audit log should contain both srcKey and dstKey not…
Browse files Browse the repository at this point in the history
… just key

Closes #535
  • Loading branch information
fapifta authored and elek committed Feb 10, 2020
1 parent 295d030 commit fb90756
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ private OzoneConsts() {
public static final String VOLUME = "volume";
public static final String BUCKET = "bucket";
public static final String KEY = "key";
public static final String SRC_KEY = "srcKey";
public static final String DST_KEY = "dstKey";
public static final String QUOTA = "quota";
public static final String QUOTA_IN_BYTES = "quotaInBytes";
public static final String OBJECT_ID = "objectID";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import org.apache.hadoop.ozone.OzoneConsts;
import org.apache.hadoop.ozone.om.ratis.utils.OzoneManagerDoubleBufferHelper;
import org.apache.hadoop.ozone.security.acl.IAccessAuthorizer;
import org.apache.hadoop.ozone.security.acl.OzoneObj;
Expand Down Expand Up @@ -111,7 +112,8 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,

AuditLogger auditLogger = ozoneManager.getAuditLogger();

Map<String, String> auditMap = buildKeyArgsAuditMap(renameKeyArgs);
Map<String, String> auditMap =
buildAuditMap(renameKeyArgs, renameKeyRequest);

OzoneManagerProtocolProtos.OMResponse.Builder omResponse =
OzoneManagerProtocolProtos.OMResponse.newBuilder().setCmdType(
Expand Down Expand Up @@ -284,4 +286,13 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,
}
return omClientResponse;
}

private Map<String, String> buildAuditMap(
KeyArgs keyArgs, RenameKeyRequest renameKeyRequest) {
Map<String, String> auditMap = buildKeyArgsAuditMap(keyArgs);
auditMap.remove(OzoneConsts.KEY);
auditMap.put(OzoneConsts.SRC_KEY, keyArgs.getKeyName());
auditMap.put(OzoneConsts.DST_KEY, renameKeyRequest.getToKeyName());
return auditMap;
}
}

0 comments on commit fb90756

Please sign in to comment.