Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions hadoop-hdds/common/src/main/resources/ozone-default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3514,6 +3514,25 @@
</description>
</property>

<property>
<name>ozone.snapshot.directory.service.timeout</name>
<value>300s</value>
<tag>OZONE, PERFORMANCE, OM</tag>
<description>
Timeout value for SnapshotDirectoryService.
</description>
</property>

<property>
<name>ozone.snapshot.directory.service.interval</name>
<value>24h</value>
<tag>OZONE, PERFORMANCE, OM</tag>
<description>
The time interval between successive SnapshotDirectoryService
thread run.
</description>
</property>

<property>
<name>ozone.scm.event.ContainerReport.thread.pool.size</name>
<value>10</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,18 @@ private OMConfigKeys() {
public static final String OZONE_DIR_DELETING_SERVICE_INTERVAL_DEFAULT
= "60s";

/**
* Configuration properties for Snapshot Directory Service.
*/
public static final String OZONE_SNAPSHOT_DIRECTORY_SERVICE_INTERVAL =
"ozone.snapshot.directory.service.interval";
public static final String OZONE_SNAPSHOT_DIRECTORY_SERVICE_INTERVAL_DEFAULT
= "24h";
public static final String OZONE_SNAPSHOT_DIRECTORY_SERVICE_TIMEOUT =
"ozone.snapshot.directory.service.timeout";
public static final String
OZONE_SNAPSHOT_DIRECTORY_SERVICE_TIMEOUT_DEFAULT = "300s";

public static final String OZONE_PATH_DELETING_LIMIT_PER_TASK =
"ozone.path.deleting.limit.per.task";
// default is 6000 taking account of 32MB buffer size, and assuming
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public static SnapshotStatus valueOf(SnapshotStatusProto status) {
private long referencedReplicatedSize;
private long exclusiveSize;
private long exclusiveReplicatedSize;
private boolean deepCleanedDeletedDir;

/**
* Private constructor, constructed via builder.
Expand Down Expand Up @@ -161,7 +162,8 @@ private SnapshotInfo(UUID snapshotId,
long referencedSize,
long referencedReplicatedSize,
long exclusiveSize,
long exclusiveReplicatedSize) {
long exclusiveReplicatedSize,
boolean deepCleanedDeletedDir) {
this.snapshotId = snapshotId;
this.name = name;
this.volumeName = volumeName;
Expand All @@ -180,6 +182,7 @@ private SnapshotInfo(UUID snapshotId,
this.referencedReplicatedSize = referencedReplicatedSize;
this.exclusiveSize = exclusiveSize;
this.exclusiveReplicatedSize = exclusiveReplicatedSize;
this.deepCleanedDeletedDir = deepCleanedDeletedDir;
}

public void setName(String name) {
Expand Down Expand Up @@ -284,7 +287,7 @@ public void setSstFiltered(boolean sstFiltered) {
}

public SnapshotInfo.Builder toBuilder() {
return new SnapshotInfo.Builder()
return new Builder()
.setSnapshotId(snapshotId)
.setName(name)
.setVolumeName(volumeName)
Expand All @@ -301,7 +304,8 @@ public SnapshotInfo.Builder toBuilder() {
.setReferencedSize(referencedSize)
.setReferencedReplicatedSize(referencedReplicatedSize)
.setExclusiveSize(exclusiveSize)
.setExclusiveReplicatedSize(exclusiveReplicatedSize);
.setExclusiveReplicatedSize(exclusiveReplicatedSize)
.setDeepCleanedDeletedDir(deepCleanedDeletedDir);
}

/**
Expand All @@ -326,6 +330,7 @@ public static class Builder {
private long referencedReplicatedSize;
private long exclusiveSize;
private long exclusiveReplicatedSize;
private boolean deepCleanedDeletedDir;

public Builder() {
// default values
Expand Down Expand Up @@ -422,6 +427,11 @@ public Builder setExclusiveReplicatedSize(long exclusiveReplicatedSize) {
return this;
}

public Builder setDeepCleanedDeletedDir(boolean deepCleanedDeletedDir) {
this.deepCleanedDeletedDir = deepCleanedDeletedDir;
return this;
}

public SnapshotInfo build() {
Preconditions.checkNotNull(name);
return new SnapshotInfo(
Expand All @@ -442,7 +452,8 @@ public SnapshotInfo build() {
referencedSize,
referencedReplicatedSize,
exclusiveSize,
exclusiveReplicatedSize
exclusiveReplicatedSize,
deepCleanedDeletedDir
);
}
}
Expand All @@ -464,7 +475,8 @@ public OzoneManagerProtocolProtos.SnapshotInfo getProtobuf() {
.setReferencedSize(referencedSize)
.setReferencedReplicatedSize(referencedReplicatedSize)
.setExclusiveSize(exclusiveSize)
.setExclusiveReplicatedSize(exclusiveReplicatedSize);
.setExclusiveReplicatedSize(exclusiveReplicatedSize)
.setDeepCleanedDeletedDir(deepCleanedDeletedDir);

if (pathPreviousSnapshotId != null) {
sib.setPathPreviousSnapshotID(toProtobuf(pathPreviousSnapshotId));
Expand Down Expand Up @@ -537,6 +549,11 @@ public static SnapshotInfo getFromProtobuf(
snapshotInfoProto.getExclusiveReplicatedSize());
}

if (snapshotInfoProto.hasDeepCleanedDeletedDir()) {
osib.setDeepCleanedDeletedDir(
snapshotInfoProto.getDeepCleanedDeletedDir());
}

osib.setSnapshotPath(snapshotInfoProto.getSnapshotPath())
.setCheckpointDir(snapshotInfoProto.getCheckpointDir())
.setDbTxSequenceNumber(snapshotInfoProto.getDbTxSequenceNumber());
Expand Down Expand Up @@ -621,6 +638,14 @@ public long getExclusiveReplicatedSize() {
return exclusiveReplicatedSize;
}

public boolean getDeepCleanedDeletedDir() {
return deepCleanedDeletedDir;
}

public void setDeepCleanedDeletedDir(boolean deepCleanedDeletedDir) {
this.deepCleanedDeletedDir = deepCleanedDeletedDir;
}

/**
* Generate default name of snapshot, (used if user doesn't provide one).
*/
Expand Down Expand Up @@ -654,7 +679,8 @@ public static SnapshotInfo newInstance(String volumeName,
.setSnapshotPath(volumeName + OM_KEY_PREFIX + bucketName)
.setVolumeName(volumeName)
.setBucketName(bucketName)
.setDeepClean(true);
.setDeepClean(false)
.setDeepCleanedDeletedDir(false);

if (snapshotId != null) {
builder.setCheckpointDir(getCheckpointDirName(snapshotId));
Expand Down Expand Up @@ -687,7 +713,8 @@ public boolean equals(Object o) {
referencedSize == that.referencedSize &&
referencedReplicatedSize == that.referencedReplicatedSize &&
exclusiveSize == that.exclusiveSize &&
exclusiveReplicatedSize == that.exclusiveReplicatedSize;
exclusiveReplicatedSize == that.exclusiveReplicatedSize &&
deepCleanedDeletedDir == that.deepCleanedDeletedDir;
}

@Override
Expand All @@ -698,7 +725,7 @@ public int hashCode() {
globalPreviousSnapshotId, snapshotPath, checkpointDir,
deepClean, sstFiltered,
referencedSize, referencedReplicatedSize,
exclusiveSize, exclusiveReplicatedSize);
exclusiveSize, exclusiveReplicatedSize, deepCleanedDeletedDir);
}

/**
Expand All @@ -725,6 +752,7 @@ public SnapshotInfo copyObject() {
.setReferencedReplicatedSize(referencedReplicatedSize)
.setExclusiveSize(exclusiveSize)
.setExclusiveReplicatedSize(exclusiveReplicatedSize)
.setDeepCleanedDeletedDir(deepCleanedDeletedDir)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,13 @@ private SnapshotInfo createSnapshotInfo() {
.setSnapshotPath(SNAPSHOT_PATH)
.setCheckpointDir(CHECKPOINT_DIR)
.setDbTxSequenceNumber(DB_TX_SEQUENCE_NUMBER)
.setDeepClean(true)
.setDeepClean(false)
.setSstFiltered(false)
.setReferencedSize(2000L)
.setReferencedReplicatedSize(6000L)
.setExclusiveSize(1000L)
.setExclusiveReplicatedSize(3000L)
.setDeepCleanedDeletedDir(false)
.build();
}

Expand All @@ -89,12 +90,13 @@ private OzoneManagerProtocolProtos.SnapshotInfo createSnapshotInfoProto() {
.setSnapshotPath(SNAPSHOT_PATH)
.setCheckpointDir(CHECKPOINT_DIR)
.setDbTxSequenceNumber(DB_TX_SEQUENCE_NUMBER)
.setDeepClean(true)
.setDeepClean(false)
.setSstFiltered(false)
.setReferencedSize(2000L)
.setReferencedReplicatedSize(6000L)
.setExclusiveSize(1000L)
.setExclusiveReplicatedSize(3000L)
.setDeepCleanedDeletedDir(false)
.build();
}

Expand Down Expand Up @@ -140,6 +142,9 @@ public void testSnapshotInfoToProto() {
Assertions.assertEquals(
snapshotInfoEntryExpected.getExclusiveReplicatedSize(),
snapshotInfoEntryActual.getExclusiveReplicatedSize());
Assertions.assertEquals(
snapshotInfoEntryExpected.getDeepCleanedDeletedDir(),
snapshotInfoEntryActual.getDeepCleanedDeletedDir());

Assertions.assertEquals(snapshotInfoEntryExpected, snapshotInfoEntryActual);
}
Expand Down Expand Up @@ -176,6 +181,8 @@ public void testSnapshotInfoProtoToSnapshotInfo() {
snapshotInfoActual.getExclusiveSize());
Assertions.assertEquals(snapshotInfoExpected.getExclusiveReplicatedSize(),
snapshotInfoActual.getExclusiveReplicatedSize());
Assertions.assertEquals(snapshotInfoExpected.getDeepCleanedDeletedDir(),
snapshotInfoActual.getDeepCleanedDeletedDir());

Assertions.assertEquals(snapshotInfoExpected, snapshotInfoActual);
}
Expand Down
Loading