Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
a8b2d15
HDDS-8166. [Snapshot] Add a config to enable or disable Ozone snapsho…
smengcl May 3, 2023
5019540
Address comment 1.
smengcl May 3, 2023
79e5f7d
More docker compose config additions.
smengcl May 3, 2023
485fe1d
Add new Aspect SnapshotFeatureEnabled.
smengcl May 3, 2023
9c6ef61
Clean up Aspect impl and test.
smengcl May 4, 2023
49ca500
More test changes to enable snapshot feature explicitly.
smengcl May 4, 2023
85c75e6
omSnapshotManager can't easily be null due to the usage in OMDirector…
smengcl May 4, 2023
fcd2c8b
Even more test changes to enable snapshot feature explicitly.
smengcl May 4, 2023
efebf55
Add comments for HDDS-8529; add debug logging when omSnapshotManager …
smengcl May 4, 2023
3df4394
Add workaround for HDDS-8529.
smengcl May 4, 2023
484a529
Rename `SnapshotFeatureEnabled` to `RequireSnapshotFeatureState`; com…
smengcl May 4, 2023
18b39dc
Add debug logging in RequireSnapshotFeatureStateAspect.
smengcl May 4, 2023
a9be442
Add one more `omSnapshotManager` null check in `installCheckpoint`.
smengcl May 4, 2023
48db6b6
Can't disable `omSnapshotManager` as all read paths now requires `omS…
smengcl May 4, 2023
3e4c57c
Disallow snapshot access when feature is disabled by forcing `OmSnaps…
smengcl May 4, 2023
b832a91
Remove workaround now that `omSnapshotManager` won't be null.
smengcl May 4, 2023
c71cf5d
Revert `omSnapshotManager` null handling; add integration test.
smengcl May 4, 2023
7a5357d
Merge remote-tracking branch 'asf/master' into HDDS-8166-snapshot-config
smengcl May 4, 2023
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
10 changes: 10 additions & 0 deletions hadoop-hdds/common/src/main/resources/ozone-default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3200,6 +3200,16 @@
</description>
</property>

<property>
<name>ozone.filesystem.snapshot.enabled</name>
<value>true</value>
<tag>OZONE, OM</tag>
<description>
Enables Ozone filesystem snapshot feature if set to true on the OM side.
Disables it otherwise.
</description>
</property>

<property>
<name>ozone.snapshot.deleting.service.timeout</name>
<value>300s</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ public final class OMConfigKeys {
private OMConfigKeys() {
}

public static final String OZONE_FILESYSTEM_SNAPSHOT_ENABLED_KEY =
"ozone.filesystem.snapshot.enabled";
public static final boolean OZONE_FILESYSTEM_SNAPSHOT_ENABLED_DEFAULT = true;

// Location where the OM stores its DB files. In the future we may support
// multiple entries for performance (sharding)..
public static final String OZONE_OM_DB_DIRS = "ozone.om.db.dirs";
Expand Down
3 changes: 3 additions & 0 deletions hadoop-ozone/dist/src/main/compose/ozone/docker-config
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,6 @@ OZONE_CONF_DIR=/etc/hadoop
OZONE_LOG_DIR=/var/log/hadoop

no_proxy=om,scm,s3g,recon,kdc,localhost,127.0.0.1

# Explicitly enable filesystem snapshot feature for this Docker compose cluster
OZONE-SITE.XML_ozone.filesystem.snapshot.enabled=true
3 changes: 3 additions & 0 deletions hadoop-ozone/dist/src/main/compose/ozonesecure/docker-config
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,6 @@ OZONE-SITE.XML_ozone.om.multitenancy.ranger.sync.timeout=10s
# change or let all OMs write to AccessController if this dev flag is set.
#
OZONE-SITE.XML_ozone.om.tenant.dev.skip.ranger=true

# Explicitly enable filesystem snapshot feature for this Docker compose cluster
OZONE-SITE.XML_ozone.filesystem.snapshot.enabled=true
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,9 @@ public void start(OzoneConfiguration configuration) {
}
}

if (snapshotDeletingService == null) {
if (snapshotDeletingService == null &&
ozoneManager.isFilesystemSnapshotEnabled()) {

long snapshotServiceInterval = configuration.getTimeDuration(
OZONE_SNAPSHOT_DELETING_SERVICE_INTERVAL,
OZONE_SNAPSHOT_DELETING_SERVICE_INTERVAL_DEFAULT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ public final class OzoneManager extends ServiceRuntimeInfoImpl
private final OzoneLockProvider ozoneLockProvider;
private OMPerformanceMetrics perfMetrics;

private boolean fsSnapshotEnabled;

/**
* OM Startup mode.
*/
Expand Down Expand Up @@ -544,6 +546,10 @@ private OzoneManager(OzoneConfiguration conf, StartupOption startupOption)
OMConfigKeys.OZONE_OM_RATIS_ENABLE_KEY,
OMConfigKeys.OZONE_OM_RATIS_ENABLE_DEFAULT);

fsSnapshotEnabled = configuration.getBoolean(
OMConfigKeys.OZONE_FILESYSTEM_SNAPSHOT_ENABLED_KEY,
OMConfigKeys.OZONE_FILESYSTEM_SNAPSHOT_ENABLED_DEFAULT);

String defaultBucketLayoutString =
configuration.getTrimmed(OZONE_DEFAULT_BUCKET_LAYOUT,
OZONE_DEFAULT_BUCKET_LAYOUT_DEFAULT);
Expand Down Expand Up @@ -783,7 +789,13 @@ private void instantiateServices(boolean withNewSnapshot) throws IOException {
perfMetrics);
omMetadataReader = new OmMetadataReader(keyManager, prefixManager,
this, LOG, AUDIT, metrics);
omSnapshotManager = new OmSnapshotManager(this);

if (fsSnapshotEnabled) {
omSnapshotManager = new OmSnapshotManager(this);
} else {
omSnapshotManager = null;
// TODO: [Snapshot] Check all usages of omSnapshotManager.
}

// Snapshot metrics
updateActiveSnapshotMetrics();
Expand Down Expand Up @@ -3994,6 +4006,13 @@ public boolean isRatisEnabled() {
return isRatisEnabled;
}

/**
* @return true if Ozone filesystem snapshot is enabled, false otherwise.
*/
public boolean isFilesystemSnapshotEnabled() {
return fsSnapshotEnabled;
}

/**
* Get DB updates since a specific sequence number.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import java.util.LinkedHashMap;
import java.util.Map;

import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.FEATURE_NOT_ENABLED;
import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.INVALID_KEY_NAME;

/**
Expand Down Expand Up @@ -569,4 +570,15 @@ public static String isValidKeyPath(String path) throws OMException {
throw new OMException("Invalid KeyPath " + path, INVALID_KEY_NAME);
}
}

/**
* Helper method that throws OMException if filesystem snapshot is disabled.
*/
protected static void checkFsSnapshotEnabled(OzoneManager ozoneManager)
throws OMException {
if (!ozoneManager.isFilesystemSnapshotEnabled()) {
throw new OMException("Snapshot is not enabled", FEATURE_NOT_ENABLED);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ public OMSnapshotCreateRequest(OMRequest omRequest) {

@Override
public OMRequest preExecute(OzoneManager ozoneManager) throws IOException {
// Reject if snapshot feature is disabled
checkFsSnapshotEnabled(ozoneManager);
// TODO: Use an annotation similar to @DisallowedUntilLayoutVersion instead?
// See HDDS-7772.

final OMRequest omRequest = super.preExecute(ozoneManager);
// Verify name
OmUtils.validateSnapshotName(snapshotName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.apache.hadoop.hdds.server.ServerUtils;
import org.apache.hadoop.hdds.utils.db.DBConfigFromFile;
import org.apache.hadoop.ozone.om.KeyManager;
import org.apache.hadoop.ozone.om.OMConfigKeys;
import org.apache.hadoop.ozone.om.OMMetadataManager;
import org.apache.hadoop.ozone.om.OmSnapshot;
import org.apache.hadoop.ozone.om.OmTestManagers;
Expand Down Expand Up @@ -94,6 +95,8 @@ public void createConfAndInitValues() throws Exception {
conf.setTimeDuration(OZONE_SNAPSHOT_DELETING_SERVICE_TIMEOUT,
100000, TimeUnit.MILLISECONDS);
conf.setQuietMode(false);
// Enable filesystem snapshot feature for the test regardless of the default
conf.setBoolean(OMConfigKeys.OZONE_FILESYSTEM_SNAPSHOT_ENABLED_KEY, true);
omTestManagers = new OmTestManagers(conf);
keyManager = omTestManagers.getKeyManager();
omMetadataManager = omTestManagers.getMetadataManager();
Expand Down