Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,15 @@ public final class OzoneConfigKeys {
OZONE_SNAPSHOT_SST_FILTERING_SERVICE_TIMEOUT_DEFAULT = "300s";
// 300s for default

public static final String OZONE_SNAPSHOT_DEFRAG_SERVICE_TIMEOUT =
"ozone.snapshot.defrag.service.timeout";
public static final String
OZONE_SNAPSHOT_DEFRAG_SERVICE_TIMEOUT_DEFAULT = "300s";
// TODO: Adjust timeout as needed.
// One concern would be that snapdiff can take a long time.
// If snapdiff wait time is included in the timeout it can make it indeterministic.
// -- So don't wait? Trigger and check later?

public static final String OZONE_SNAPSHOT_DELETING_SERVICE_INTERVAL =
"ozone.snapshot.deleting.service.interval";
public static final String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ public final class OzoneConsts {
public static final String OM_SNAPSHOT_DIR = "db.snapshots";
public static final String OM_SNAPSHOT_CHECKPOINT_DIR = OM_SNAPSHOT_DIR
+ OM_KEY_PREFIX + "checkpointState";
public static final String OM_SNAPSHOT_CHECKPOINT_DEFRAGGED_DIR = "checkpointStateDefragged";
public static final String OM_SNAPSHOT_DIFF_DIR = OM_SNAPSHOT_DIR
+ OM_KEY_PREFIX + "diffState";

Expand Down
15 changes: 15 additions & 0 deletions hadoop-hdds/common/src/main/resources/ozone-default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3758,13 +3758,28 @@
Snapshot Deleting Service per run.
</description>
</property>
<property>
<name>ozone.snapshot.defrag.limit.per.task</name>
<value>1</value>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to benchmark to find a more appropriate value.

<tag>OZONE, PERFORMANCE, OM</tag>
<description>The maximum number of snapshots that would be defragmented in
each task run of snapshot defragmentation service.
</description>
</property>
<property>
<name>ozone.snapshot.filtering.service.interval</name>
<value>1m</value>
<tag>OZONE, PERFORMANCE, OM</tag>
<description>Time interval of the SST File filtering service from Snapshot.
</description>
</property>
<property>
<name>ozone.snapshot.defrag.service.interval</name>
<value>-1</value>
<tag>OZONE, PERFORMANCE, OM</tag>
<description>Task interval of snapshot defragmentation service.
</description>
</property>
<property>
<name>ozone.om.snapshot.checkpoint.dir.creation.poll.timeout</name>
<value>20s</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
/**
* DumpFileWriter using rocksdb sst files.
*/
class RDBSstFileWriter implements Closeable {
public class RDBSstFileWriter implements Closeable {

private ManagedSstFileWriter sstFileWriter;
private File sstFile;
private AtomicLong keyCounter;
private ManagedOptions emptyOption = new ManagedOptions();
private final ManagedEnvOptions emptyEnvOptions = new ManagedEnvOptions();

RDBSstFileWriter(File externalFile) throws RocksDatabaseException {
public RDBSstFileWriter(File externalFile) throws RocksDatabaseException {
this.sstFileWriter = new ManagedSstFileWriter(emptyEnvOptions, emptyOption);
this.keyCounter = new AtomicLong(0);
this.sstFile = externalFile;
Expand All @@ -60,6 +60,17 @@ public void put(byte[] key, byte[] value) throws RocksDatabaseException {
}
}

public void delete(byte[] key) throws RocksDatabaseException {
try {
sstFileWriter.delete(key);
keyCounter.incrementAndGet();
} catch (RocksDBException e) {
closeOnFailure();
throw new RocksDatabaseException("Failed to delete key (length=" + key.length
+ "), sstFile=" + sstFile.getAbsolutePath(), e);
}
}

@Override
public void close() throws RocksDatabaseException {
if (sstFileWriter != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public boolean isClosed() {
*
* @see ManagedCheckpoint
*/
final class RocksCheckpoint implements Closeable {
public final class RocksCheckpoint implements Closeable {
private final ManagedCheckpoint checkpoint;

private RocksCheckpoint() {
Expand Down Expand Up @@ -609,7 +609,7 @@ public List<LiveFileMetaData> getLiveFilesMetaData() throws RocksDatabaseExcepti
}
}

RocksCheckpoint createCheckpoint() {
public RocksCheckpoint createCheckpoint() {
return new RocksCheckpoint();
}

Expand Down Expand Up @@ -660,7 +660,7 @@ public Collection<ColumnFamily> getExtraColumnFamilies() {
return Collections.unmodifiableCollection(columnFamilies.values());
}

byte[] get(ColumnFamily family, byte[] key) throws RocksDatabaseException {
public byte[] get(ColumnFamily family, byte[] key) throws RocksDatabaseException {
try (UncheckedAutoCloseable ignored = acquire()) {
return db.get().get(family.getHandle(), key);
} catch (RocksDBException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,11 +428,22 @@ public final class OMConfigKeys {
"ozone.snapshot.deleting.limit.per.task";
public static final int SNAPSHOT_DELETING_LIMIT_PER_TASK_DEFAULT = 10;

// Snapshot defragmentation service configuration
public static final String SNAPSHOT_DEFRAG_LIMIT_PER_TASK =
"ozone.snapshot.defrag.limit.per.task";
public static final int SNAPSHOT_DEFRAG_LIMIT_PER_TASK_DEFAULT = 1;

public static final String OZONE_SNAPSHOT_SST_FILTERING_SERVICE_INTERVAL =
"ozone.snapshot.filtering.service.interval";
public static final String
OZONE_SNAPSHOT_SST_FILTERING_SERVICE_INTERVAL_DEFAULT = "60s";

public static final String OZONE_SNAPSHOT_DEFRAG_SERVICE_INTERVAL =
"ozone.snapshot.defrag.service.interval";
public static final String
OZONE_SNAPSHOT_DEFRAG_SERVICE_INTERVAL_DEFAULT = "-1";
// TODO: Disabled by default. Do not enable by default until upgrade handling is complete.

public static final String
OZONE_SNAPSHOT_CHECKPOINT_DIR_CREATION_POLL_TIMEOUT =
"ozone.om.snapshot.checkpoint.dir.creation.poll.timeout";
Expand Down
Loading