From e2371ae1a06002ae426a6e79050db3a2b28bad01 Mon Sep 17 00:00:00 2001 From: Bin Fan Date: Wed, 6 Sep 2023 00:24:26 -0700 Subject: [PATCH] Further improvement --- .../main/java/alluxio/conf/PropertyKey.java | 9 ++ .../java/alluxio/util/UpdateCheckUtils.java | 13 --- .../alluxio/util/UpdateCheckUtilsTest.java | 1 - .../master/meta/MasterUpdateChecker.java | 3 +- .../main/java/alluxio/fuse/AlluxioFuse.java | 15 ++- .../alluxio/fuse/meta/FuseUpdateChecker.java | 99 +++++-------------- .../alluxio/fuse/options/FuseCliOptions.java | 24 +---- .../alluxio/fuse/options/FuseOptions.java | 52 +--------- .../fuse/meta/FuseUpdateCheckerTest.java | 53 +++------- .../fuse/options/FuseCliOptionsTest.java | 6 -- .../fuse/ufs/AbstractFuseFileSystemTest.java | 1 - .../fuse/dora/AbstractFuseFileSystemTest.java | 1 - .../client/fuse/dora/FuseEndToEndTest.java | 1 - .../AbstractFuseHdfsIntegrationTest.java | 1 - .../readonly/AbstractFuseFileSystemTest.java | 1 - 15 files changed, 63 insertions(+), 217 deletions(-) diff --git a/dora/core/common/src/main/java/alluxio/conf/PropertyKey.java b/dora/core/common/src/main/java/alluxio/conf/PropertyKey.java index 92fc6b647f17..6a948a6d4b80 100755 --- a/dora/core/common/src/main/java/alluxio/conf/PropertyKey.java +++ b/dora/core/common/src/main/java/alluxio/conf/PropertyKey.java @@ -6261,6 +6261,13 @@ public String toString() { .setConsistencyCheckLevel(ConsistencyCheckLevel.IGNORE) .setScope(Scope.CLIENT) .build(); + public static final PropertyKey FUSE_UPDATE_CHECK_ENABLED = + booleanBuilder(Name.FUSE_UPDATE_CHECK_ENABLED) + .setDefaultValue(Boolean.parseBoolean(ProjectConstants.UPDATE_CHECK_ENABLED)) + .setDescription("Whether to check for update availability for alluxio-fuse") + .setConsistencyCheckLevel(ConsistencyCheckLevel.ENFORCE) + .setIsHidden(true) + .build(); public static final PropertyKey FUSE_USER_GROUP_TRANSLATION_ENABLED = booleanBuilder(Name.FUSE_USER_GROUP_TRANSLATION_ENABLED) .setDefaultValue(false) @@ -8259,6 +8266,8 @@ public static final class Name { "alluxio.fuse.stat.cache.refresh.interval"; public static final String FUSE_UMOUNT_TIMEOUT = "alluxio.fuse.umount.timeout"; + public static final String FUSE_UPDATE_CHECK_ENABLED = + "alluxio.fuse.update.check.enabled"; public static final String FUSE_USER_GROUP_TRANSLATION_ENABLED = "alluxio.fuse.user.group.translation.enabled"; public static final String FUSE_SPECIAL_COMMAND_ENABLED = diff --git a/dora/core/common/src/main/java/alluxio/util/UpdateCheckUtils.java b/dora/core/common/src/main/java/alluxio/util/UpdateCheckUtils.java index 4679e04eb392..5972bb6ea1b2 100644 --- a/dora/core/common/src/main/java/alluxio/util/UpdateCheckUtils.java +++ b/dora/core/common/src/main/java/alluxio/util/UpdateCheckUtils.java @@ -140,19 +140,6 @@ public static void addUserAgentEnvironments(List info) { } } - /** - * Add feature name if condition is true. - * - * @param valid true, if condition is valid - * @param features feature list - * @param featureName feature name - */ - public static void addIfTrue(boolean valid, List features, String featureName) { - if (valid) { - features.add(featureName); - } - } - /** * Adds the information of EC2 environment to given list. * diff --git a/dora/core/common/src/test/java/alluxio/util/UpdateCheckUtilsTest.java b/dora/core/common/src/test/java/alluxio/util/UpdateCheckUtilsTest.java index 040f1d5c4528..137ad57f9a4a 100644 --- a/dora/core/common/src/test/java/alluxio/util/UpdateCheckUtilsTest.java +++ b/dora/core/common/src/test/java/alluxio/util/UpdateCheckUtilsTest.java @@ -159,5 +159,4 @@ public void userAgent() { Matcher matcher = pattern.matcher(userAgentString); Assert.assertTrue(matcher.matches()); } - } diff --git a/dora/core/server/master/src/main/java/alluxio/master/meta/MasterUpdateChecker.java b/dora/core/server/master/src/main/java/alluxio/master/meta/MasterUpdateChecker.java index e290a2edd507..9ccc835a35ce 100644 --- a/dora/core/server/master/src/main/java/alluxio/master/meta/MasterUpdateChecker.java +++ b/dora/core/server/master/src/main/java/alluxio/master/meta/MasterUpdateChecker.java @@ -29,7 +29,7 @@ public final class MasterUpdateChecker implements HeartbeatExecutor { private static final Logger LOG = LoggerFactory.getLogger(MasterUpdateChecker.class); private static final String NUM_WORKER_INFO_FORMAT = "numWorkers:%s"; - + private static final String TYPE_MASTER = "master"; private final MetaMaster mMetaMaster; /** @@ -53,6 +53,7 @@ public void heartbeat(long timeLimitMs) { // TODO(lu) use -1 here since we cannot distinguish // no worker vs cluster not ready (still registering) cases clusterSize > 0 ? clusterSize : -1)); + additionalInfo.add(TYPE_MASTER); String latestVersion = UpdateCheckUtils.getLatestVersion(mMetaMaster.getClusterID(), additionalInfo); if (!ProjectConstants.VERSION.equals(latestVersion)) { diff --git a/dora/integration/fuse/src/main/java/alluxio/fuse/AlluxioFuse.java b/dora/integration/fuse/src/main/java/alluxio/fuse/AlluxioFuse.java index 13dee6772b42..555e7bffc420 100644 --- a/dora/integration/fuse/src/main/java/alluxio/fuse/AlluxioFuse.java +++ b/dora/integration/fuse/src/main/java/alluxio/fuse/AlluxioFuse.java @@ -11,8 +11,6 @@ package alluxio.fuse; -import static alluxio.fuse.options.FuseOptions.FUSE_UPDATE_CHECK_ENABLED; - import alluxio.Constants; import alluxio.ProjectConstants; import alluxio.RuntimeConstants; @@ -97,10 +95,15 @@ public void start(AlluxioConfiguration conf) throws ParseException { } startJvmMonitorProcess(); ExecutorService executor = null; - if (fuseOptions.updateCheckEnabled()) { + // updateCheck is false only if configurable and not enabled + boolean updateCheck = true; + if (Boolean.parseBoolean(ProjectConstants.UPDATE_CHECK_CONFIGURABLE)) { + updateCheck = Configuration.getBoolean(PropertyKey.FUSE_UPDATE_CHECK_ENABLED); + } + if (updateCheck && !Configuration.getBoolean(PropertyKey.TEST_MODE)) { executor = Executors.newSingleThreadExecutor(); executor.submit(new HeartbeatThread(HeartbeatContext.FUSE_UPDATE_CHECK, - FuseUpdateChecker.create(fuseOptions), () -> new FixedIntervalSupplier(Constants.DAY_MS), + new FuseUpdateChecker(fuseOptions), () -> new FixedIntervalSupplier(Constants.DAY_MS), Configuration.global(), UserState.Factory.create(conf))); } try (FileSystem fs = createBaseFileSystem(fsContext, fuseOptions)) { @@ -242,10 +245,6 @@ protected static InstancedConfiguration parseCliOptionsAsConfig(FuseCliOptions c InstancedConfiguration conf = new InstancedConfiguration(new AlluxioProperties()); cli.getMountPoint() .ifPresent(mp -> conf.set(PropertyKey.FUSE_MOUNT_POINT, mp, Source.RUNTIME)); - cli.getUpdateCheck() - .ifPresent(updateCheckEnabled -> { - conf.set(FUSE_UPDATE_CHECK_ENABLED, updateCheckEnabled, Source.RUNTIME); - }); cli.getRootUfsUri() .ifPresent(ufsRootUri -> { conf.set(FuseOptions.FUSE_UFS_ROOT, ufsRootUri.toString(), Source.RUNTIME); diff --git a/dora/integration/fuse/src/main/java/alluxio/fuse/meta/FuseUpdateChecker.java b/dora/integration/fuse/src/main/java/alluxio/fuse/meta/FuseUpdateChecker.java index 9be03af7f564..b6c5c402293e 100644 --- a/dora/integration/fuse/src/main/java/alluxio/fuse/meta/FuseUpdateChecker.java +++ b/dora/integration/fuse/src/main/java/alluxio/fuse/meta/FuseUpdateChecker.java @@ -12,23 +12,18 @@ package alluxio.fuse.meta; import alluxio.ProjectConstants; -import alluxio.util.UpdateCheckUtils; -import alluxio.fuse.FuseConstants; import alluxio.fuse.options.FuseOptions; import alluxio.heartbeat.HeartbeatExecutor; -import alluxio.metrics.MetricsSystem; import alluxio.util.URIUtils; +import alluxio.util.UpdateCheckUtils; import com.google.common.annotations.VisibleForTesting; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.ArrayList; -import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.UUID; -import java.util.stream.Collectors; import javax.annotation.concurrent.NotThreadSafe; /** @@ -37,42 +32,32 @@ @NotThreadSafe public final class FuseUpdateChecker implements HeartbeatExecutor { private static final Logger LOG = LoggerFactory.getLogger(FuseUpdateChecker.class); - static final String UNDERLYING_FS_FORMAT = "UnderlyingFileSystem:%s"; static final String LOCAL_ALLUXIO_DATA_CACHE = "localAlluxioDataCache"; static final String LOCAL_ALLUXIO_METADATA_CACHE = "localAlluxioMetadataCache"; static final String LOCAL_KERNEL_DATA_CACHE = "localKernelDataCache"; - static final String ALLUXIO_FS = "alluxio"; static final String LOCAL_FS = "local"; - + static final String TYPE_FUSE = "fuse"; private final String mInstanceId = UUID.randomUUID().toString(); - - private final Map mFuseOpsCounter; - private final List mUnchangeableFuseInfo; + private final List mFuseInfo = new ArrayList<>(); /** * Creates a {@link FuseUpdateChecker}. * * @param fuseOptions the fuse options - * @return the update checker */ - public static FuseUpdateChecker create(FuseOptions fuseOptions) { - List fuseInfo = new ArrayList<>(); - UpdateCheckUtils.addIfTrue(isLocalAlluxioDataCacheEnabled(fuseOptions), - fuseInfo, LOCAL_ALLUXIO_DATA_CACHE); - UpdateCheckUtils.addIfTrue(isLocalAlluxioMetadataCacheEnabled(fuseOptions), fuseInfo, - LOCAL_ALLUXIO_METADATA_CACHE); - UpdateCheckUtils.addIfTrue(isLocalKernelDataCacheEnabled(fuseOptions), - fuseInfo, LOCAL_KERNEL_DATA_CACHE); - fuseInfo.add(String.format("UnderlyingFileSystem:%s", getUnderlyingFileSystem(fuseOptions))); - return new FuseUpdateChecker(Collections.unmodifiableList(fuseInfo), - FuseConstants.getFuseMethodNames().stream() - .collect(Collectors.toMap(methodName -> methodName, methodName -> 0L))); - } - - private FuseUpdateChecker(List unchangeableFuseInfo, Map fuseOpsCounter) { - mUnchangeableFuseInfo = unchangeableFuseInfo; - mFuseOpsCounter = fuseOpsCounter; + public FuseUpdateChecker(FuseOptions fuseOptions) { + if (fuseOptions.getFileSystemOptions().isDataCacheEnabled()) { + mFuseInfo.add(LOCAL_ALLUXIO_DATA_CACHE); + } + if (fuseOptions.getFileSystemOptions().isMetadataCacheEnabled()) { + mFuseInfo.add(LOCAL_ALLUXIO_METADATA_CACHE); + } + if (!fuseOptions.getFuseMountOptions().contains("direct_io")) { + mFuseInfo.add(LOCAL_KERNEL_DATA_CACHE); + } + mFuseInfo.add(String.format("UnderlyingFileSystem:%s", getUnderlyingFileSystem(fuseOptions))); + mFuseInfo.add(TYPE_FUSE); } /** @@ -82,7 +67,7 @@ private FuseUpdateChecker(List unchangeableFuseInfo, Map f public void heartbeat(long timeLimitMs) { try { String latestVersion = - UpdateCheckUtils.getLatestVersion(mInstanceId, getFuseCheckInfo()); + UpdateCheckUtils.getLatestVersion(mInstanceId, mFuseInfo); if (!ProjectConstants.VERSION.equals(latestVersion)) { LOG.info("The latest version (" + latestVersion + ") is not the same " + "as the current version (" + ProjectConstants.VERSION + "). To upgrade " @@ -96,50 +81,6 @@ public void heartbeat(long timeLimitMs) { @Override public void close() {} - @VisibleForTesting - List getFuseCheckInfo() { - List info = new ArrayList<>(mUnchangeableFuseInfo); - for (String fuseOps : mFuseOpsCounter.keySet()) { - mFuseOpsCounter.computeIfPresent(fuseOps, (key, value) -> { - long newCount = MetricsSystem.timer(key).getCount(); - if (newCount > value) { - info.add(fuseOps); - } - return newCount; - }); - } - return info; - } - - /** - * @return - */ - @VisibleForTesting - List getUnchangeableFuseInfo() { - return mUnchangeableFuseInfo; - } - - /** - * @return true, if local Alluxio data cache is enabled - */ - private static boolean isLocalAlluxioDataCacheEnabled(FuseOptions fuseOptions) { - return fuseOptions.getFileSystemOptions().isDataCacheEnabled(); - } - - /** - * @return true, if local Alluxio metadata cache is enabled - */ - private static boolean isLocalAlluxioMetadataCacheEnabled(FuseOptions fuseOptions) { - return fuseOptions.getFileSystemOptions().isMetadataCacheEnabled(); - } - - /** - * @return true, if local kernel data cache is enabled - */ - private static boolean isLocalKernelDataCacheEnabled(FuseOptions fuseOptions) { - return !fuseOptions.getFuseMountOptions().contains("direct_io"); - } - /** * @return the underlying file system type */ @@ -158,4 +99,12 @@ private static String getUnderlyingFileSystem(FuseOptions fuseOptions) { } return components[0]; } + + /** + * @return + */ + @VisibleForTesting + List getFuseInfo() { + return mFuseInfo; + } } diff --git a/dora/integration/fuse/src/main/java/alluxio/fuse/options/FuseCliOptions.java b/dora/integration/fuse/src/main/java/alluxio/fuse/options/FuseCliOptions.java index 9d34532d0993..297c14264049 100644 --- a/dora/integration/fuse/src/main/java/alluxio/fuse/options/FuseCliOptions.java +++ b/dora/integration/fuse/src/main/java/alluxio/fuse/options/FuseCliOptions.java @@ -57,18 +57,6 @@ public class FuseCliOptions { @Nullable protected MountCliOptions mMountCliOptions = new MountCliOptions(); - @Parameter( - names = {"--update-check"}, - description = "Enables or disables the FUSE version update check. " - + "Disabled by default when connecting to Alluxio system cache or Dora cache. " - + "Enabled by default when connecting an under storage directly.", - arity = 0, - required = false, - hidden = true - ) - @Nullable - protected Boolean mUpdateCheck = null; - @Parameter( names = {"-h", "--help"}, description = "Display this help message", @@ -112,13 +100,6 @@ public Optional getRootUfsUri() { return Optional.ofNullable(mRootUfsUri); } - /** - * @return if update check is enabled - */ - public Optional getUpdateCheck() { - return Optional.ofNullable(mUpdateCheck); - } - /** * @return if user specified {@code --help} */ @@ -156,12 +137,11 @@ public boolean equals(Object o) { return mHelp == that.mHelp && Objects.equals(mMountPoint, that.mMountPoint) && Objects.equals(mRootUfsUri, that.mRootUfsUri) - && Objects.equals(mMountCliOptions, that.mMountCliOptions) - && Objects.equals(mUpdateCheck, that.mUpdateCheck); + && Objects.equals(mMountCliOptions, that.mMountCliOptions); } @Override public int hashCode() { - return Objects.hash(mMountPoint, mRootUfsUri, mMountCliOptions, mUpdateCheck, mHelp); + return Objects.hash(mMountPoint, mRootUfsUri, mMountCliOptions, mHelp); } } diff --git a/dora/integration/fuse/src/main/java/alluxio/fuse/options/FuseOptions.java b/dora/integration/fuse/src/main/java/alluxio/fuse/options/FuseOptions.java index deb74cb8cda5..6e23e13b8745 100644 --- a/dora/integration/fuse/src/main/java/alluxio/fuse/options/FuseOptions.java +++ b/dora/integration/fuse/src/main/java/alluxio/fuse/options/FuseOptions.java @@ -30,24 +30,17 @@ */ public class FuseOptions { private static final Logger LOG = LoggerFactory.getLogger(FuseOptions.class); - public static final PropertyKey FUSE_UPDATE_CHECK_ENABLED = - PropertyKey.Builder.booleanBuilder("alluxio.fuse.update.check.enabled") - .setIsBuiltIn(false) - .setDefaultValue(true) - .buildUnregistered(); - /** * The UFS root that Fuse mounts. * In standalone Fuse SDK, this is different from {@link PropertyKey#DORA_CLIENT_UFS_ROOT}. * */ public static final PropertyKey FUSE_UFS_ROOT = - PropertyKey.Builder.stringBuilder("alluxio.fuse.ufs.root") + PropertyKey.Builder.stringBuilder("fuse.ufs.root") .setIsBuiltIn(false) .buildUnregistered(); private final FileSystemOptions mFileSystemOptions; private final Set mFuseMountOptions; - private final boolean mUpdateCheckEnabled; private final boolean mSpecialCommandEnabled; /** @@ -55,14 +48,12 @@ public class FuseOptions { * * @param fileSystemOptions the file system options * @param fuseMountOptions the FUSE mount options - * @param updateCheckEnabled whether to enable update check * @param specialCommandEnabled whether fuse special commands are enabled */ protected FuseOptions(FileSystemOptions fileSystemOptions, - Set fuseMountOptions, boolean updateCheckEnabled, boolean specialCommandEnabled) { + Set fuseMountOptions, boolean specialCommandEnabled) { mFileSystemOptions = Preconditions.checkNotNull(fileSystemOptions); mFuseMountOptions = Preconditions.checkNotNull(fuseMountOptions); - mUpdateCheckEnabled = updateCheckEnabled; mSpecialCommandEnabled = specialCommandEnabled; } @@ -80,13 +71,6 @@ public Set getFuseMountOptions() { return mFuseMountOptions; } - /** - * @return true if update check is enabled - */ - public boolean updateCheckEnabled() { - return mUpdateCheckEnabled; - } - /** * @return true if fuse special command is enabled */ @@ -100,7 +84,6 @@ public boolean specialCommandEnabled() { public static class Builder { private FileSystemOptions mFileSystemOptions; private Set mFuseMountOptions; - private boolean mUpdateCheckEnabled; private boolean mSpecialCommandEnabled; /** @@ -117,17 +100,6 @@ public Builder() { } public static Builder fromConfig(AlluxioConfiguration conf) { FuseOptions.Builder builder = new FuseOptions.Builder(); - // Set update check - final boolean updateCheckEnabled; - if (!conf.isSetByUser(FUSE_UPDATE_CHECK_ENABLED)) { - // Standalone FUSE SDK without dora distributed cache - updateCheckEnabled = !conf.getBoolean(PropertyKey.DORA_ENABLED) - && conf.isSetByUser(PropertyKey.DORA_CLIENT_UFS_ROOT); - } else { - updateCheckEnabled = conf.getBoolean(FUSE_UPDATE_CHECK_ENABLED); - } - builder.setUpdateCheckEnabled(updateCheckEnabled); - // Set mount options HashSet mountOptions = new HashSet<>(conf.getList(PropertyKey.FUSE_MOUNT_OPTIONS)); LibfuseVersion version = AlluxioFuseUtils.getLibfuseVersion(conf); @@ -212,24 +184,6 @@ public Builder setFuseMountOptions(Set fuseMountOptions) { return this; } - /** - * @return if update check is enabled - */ - public boolean isUpdateCheckEnabled() { - return mUpdateCheckEnabled; - } - - /** - * Enables or disables update check. - * - * @param updateCheckEnabled - * @return this builder - */ - public Builder setUpdateCheckEnabled(boolean updateCheckEnabled) { - mUpdateCheckEnabled = updateCheckEnabled; - return this; - } - /** * @return if fuse special commands are enabled */ @@ -254,7 +208,7 @@ public Builder setSpecialCommandEnabled(boolean specialCommandEnabled) { * @return fuse options */ public FuseOptions build() { - return new FuseOptions(mFileSystemOptions, mFuseMountOptions, mUpdateCheckEnabled, + return new FuseOptions(mFileSystemOptions, mFuseMountOptions, mSpecialCommandEnabled); } } diff --git a/dora/integration/fuse/src/test/java/alluxio/fuse/meta/FuseUpdateCheckerTest.java b/dora/integration/fuse/src/test/java/alluxio/fuse/meta/FuseUpdateCheckerTest.java index d6abf7c729c9..a64586fe99b5 100644 --- a/dora/integration/fuse/src/test/java/alluxio/fuse/meta/FuseUpdateCheckerTest.java +++ b/dora/integration/fuse/src/test/java/alluxio/fuse/meta/FuseUpdateCheckerTest.java @@ -11,36 +11,30 @@ package alluxio.fuse.meta; -import alluxio.annotation.dora.DoraTestTodoItem; import alluxio.client.file.options.FileSystemOptions; import alluxio.client.file.options.UfsFileSystemOptions; import alluxio.conf.Configuration; import alluxio.conf.InstancedConfiguration; import alluxio.conf.PropertyKey; -import alluxio.fuse.FuseConstants; import alluxio.fuse.options.FuseOptions; -import alluxio.metrics.MetricsSystem; import org.junit.Assert; import org.junit.Assume; -import org.junit.Ignore; import org.junit.Test; import java.util.List; -import java.util.concurrent.TimeUnit; /** * Tests for {@link FuseUpdateChecker}. */ public class FuseUpdateCheckerTest { + private final InstancedConfiguration mConf = Configuration.copyGlobal(); + @Test - @DoraTestTodoItem(action = DoraTestTodoItem.Action.FIX, owner = "LuQQiu", - comment = "fix UpdateChecker for 30x") - @Ignore public void UnderFileSystemAlluxio() { - try (FuseUpdateChecker checker = FuseUpdateChecker - .create(FuseOptions.Builder.fromConfig(Configuration.global()).build())) { - Assert.assertTrue(containsTargetInfo(checker.getUnchangeableFuseInfo(), + try (FuseUpdateChecker checker = new FuseUpdateChecker( + FuseOptions.Builder.fromConfig(Configuration.global()).build())) { + Assert.assertTrue(containsTargetInfo(checker.getFuseInfo(), FuseUpdateChecker.ALLUXIO_FS)); } } @@ -48,7 +42,7 @@ public void UnderFileSystemAlluxio() { @Test public void UnderFileSystemLocal() { try (FuseUpdateChecker checker = getUpdateCheckerWithUfs("/home/ec2-user/testFolder")) { - Assert.assertTrue(containsTargetInfo(checker.getUnchangeableFuseInfo(), + Assert.assertTrue(containsTargetInfo(checker.getFuseInfo(), FuseUpdateChecker.LOCAL_FS)); } } @@ -56,21 +50,21 @@ public void UnderFileSystemLocal() { @Test public void UnderFileSystemS3() { try (FuseUpdateChecker checker = getUpdateCheckerWithUfs("s3://alluxio-test/")) { - Assert.assertTrue(containsTargetInfo(checker.getUnchangeableFuseInfo(), "s3")); + Assert.assertTrue(containsTargetInfo(checker.getFuseInfo(), "s3")); } } @Test public void UnderFileSystemS3A() { try (FuseUpdateChecker checker = getUpdateCheckerWithUfs("s3a://alluxio-test/")) { - Assert.assertTrue(containsTargetInfo(checker.getUnchangeableFuseInfo(), "s3a")); + Assert.assertTrue(containsTargetInfo(checker.getFuseInfo(), "s3a")); } } @Test public void UnderFileSystemHdfs() { try (FuseUpdateChecker checker = getUpdateCheckerWithUfs("hdfs://namenode:port/testFolder")) { - Assert.assertTrue(containsTargetInfo(checker.getUnchangeableFuseInfo(), "hdfs")); + Assert.assertTrue(containsTargetInfo(checker.getFuseInfo(), "hdfs")); } } @@ -78,7 +72,7 @@ public void UnderFileSystemHdfs() { public void localKernelDataCacheDisabled() { Assume.assumeTrue(Configuration.getInt(PropertyKey.FUSE_JNIFUSE_LIBFUSE_VERSION) == 2); try (FuseUpdateChecker checker = getUpdateCheckerWithMountOptions("direct_io")) { - Assert.assertFalse(containsTargetInfo(checker.getUnchangeableFuseInfo(), + Assert.assertFalse(containsTargetInfo(checker.getFuseInfo(), FuseUpdateChecker.LOCAL_KERNEL_DATA_CACHE)); } } @@ -86,46 +80,31 @@ public void localKernelDataCacheDisabled() { @Test public void localKernelDataCacheEnabled() { try (FuseUpdateChecker checker = getUpdateCheckerWithMountOptions("kernel_cache")) { - Assert.assertTrue(containsTargetInfo(checker.getUnchangeableFuseInfo(), + Assert.assertTrue(containsTargetInfo(checker.getFuseInfo(), FuseUpdateChecker.LOCAL_KERNEL_DATA_CACHE)); } try (FuseUpdateChecker checker = getUpdateCheckerWithMountOptions("auto_cache")) { - Assert.assertTrue(containsTargetInfo(checker.getUnchangeableFuseInfo(), + Assert.assertTrue(containsTargetInfo(checker.getFuseInfo(), FuseUpdateChecker.LOCAL_KERNEL_DATA_CACHE)); } } - @Test - public void FuseOpsCalled() { - try (FuseUpdateChecker checker = FuseUpdateChecker.create( - FuseOptions.Builder.fromConfig(Configuration.global()).build())) { - MetricsSystem.timer(FuseConstants.FUSE_READ).update(5, TimeUnit.MILLISECONDS); - Assert.assertTrue(containsTargetInfo(checker.getFuseCheckInfo(), FuseConstants.FUSE_READ)); - MetricsSystem.timer(FuseConstants.FUSE_WRITE).update(5, TimeUnit.MILLISECONDS); - List checkInfo = checker.getFuseCheckInfo(); - Assert.assertFalse(containsTargetInfo(checkInfo, FuseConstants.FUSE_READ)); - Assert.assertTrue(containsTargetInfo(checkInfo, FuseConstants.FUSE_WRITE)); - } - } - private FuseUpdateChecker getUpdateCheckerWithUfs(String ufsAddress) { final FileSystemOptions fileSystemOptions = FileSystemOptions.Builder - .fromConf(Configuration.global()) + .fromConf(mConf) .setUfsFileSystemOptions(new UfsFileSystemOptions(ufsAddress)) .build(); - return FuseUpdateChecker.create( + return new FuseUpdateChecker( FuseOptions.Builder.fromConfig(Configuration.global()) .setFileSystemOptions(fileSystemOptions) - .setUpdateCheckEnabled(false) .build()); } private FuseUpdateChecker getUpdateCheckerWithMountOptions(String mountOptions) { - InstancedConfiguration conf = Configuration.copyGlobal(); - conf.set(PropertyKey.FUSE_MOUNT_OPTIONS, + mConf.set(PropertyKey.FUSE_MOUNT_OPTIONS, PropertyKey.FUSE_MOUNT_OPTIONS.formatValue(mountOptions)); - return FuseUpdateChecker.create(FuseOptions.Builder.fromConfig(conf).build()); + return new FuseUpdateChecker(FuseOptions.Builder.fromConfig(mConf).build()); } private boolean containsTargetInfo(List list, String targetInfo) { diff --git a/dora/integration/fuse/src/test/java/alluxio/fuse/options/FuseCliOptionsTest.java b/dora/integration/fuse/src/test/java/alluxio/fuse/options/FuseCliOptionsTest.java index 64c6be2bbf8a..dc1dc9927dda 100644 --- a/dora/integration/fuse/src/test/java/alluxio/fuse/options/FuseCliOptionsTest.java +++ b/dora/integration/fuse/src/test/java/alluxio/fuse/options/FuseCliOptionsTest.java @@ -55,12 +55,6 @@ public void testGetRootUfsUri() { assertEquals(Optional.of(new AlluxioURI("scheme://host/path")), mOptions.getRootUfsUri()); } - @Test - public void testGetUpdateCheck() { - mJCommander.parse("-m", "/tmp/fuse-mp", "--update-check"); - assertEquals(Optional.of(true), mOptions.getUpdateCheck()); - } - @Test public void testGetHelp() { mJCommander.parse("--help"); diff --git a/dora/integration/fuse/src/test/java/alluxio/fuse/ufs/AbstractFuseFileSystemTest.java b/dora/integration/fuse/src/test/java/alluxio/fuse/ufs/AbstractFuseFileSystemTest.java index b92347beef4e..b0e6556682c3 100644 --- a/dora/integration/fuse/src/test/java/alluxio/fuse/ufs/AbstractFuseFileSystemTest.java +++ b/dora/integration/fuse/src/test/java/alluxio/fuse/ufs/AbstractFuseFileSystemTest.java @@ -47,7 +47,6 @@ public void beforeActions() { .setFileSystemOptions(FileSystemOptions.Builder.fromConf(mConf) .setUfsFileSystemOptions(mUfsOptions) .build()) - .setUpdateCheckEnabled(false) .build(); mFuseFs = new AlluxioJniFuseFileSystem(mContext, mFileSystem, fuseOptions); mFileStat = FileStat.of(ByteBuffer.allocateDirect(256)); diff --git a/dora/tests/integration/src/test/java/alluxio/client/fuse/dora/AbstractFuseFileSystemTest.java b/dora/tests/integration/src/test/java/alluxio/client/fuse/dora/AbstractFuseFileSystemTest.java index a16d9bd0e10c..1ff49f1ba9f4 100644 --- a/dora/tests/integration/src/test/java/alluxio/client/fuse/dora/AbstractFuseFileSystemTest.java +++ b/dora/tests/integration/src/test/java/alluxio/client/fuse/dora/AbstractFuseFileSystemTest.java @@ -41,7 +41,6 @@ public void beforeActions() { mFuseFs = new AlluxioJniFuseFileSystem(mContext, mFileSystem, FuseOptions.Builder.fromConfig(Configuration.global()) .setFileSystemOptions(fileSystemOptions) - .setUpdateCheckEnabled(false) .build()); mFileStat = FileStat.of(ByteBuffer.allocateDirect(256)); mFileInfo = new AlluxioFuseUtils.CloseableFuseFileInfo(); diff --git a/dora/tests/integration/src/test/java/alluxio/client/fuse/dora/FuseEndToEndTest.java b/dora/tests/integration/src/test/java/alluxio/client/fuse/dora/FuseEndToEndTest.java index 2fd4644ebe26..a52cb573d155 100644 --- a/dora/tests/integration/src/test/java/alluxio/client/fuse/dora/FuseEndToEndTest.java +++ b/dora/tests/integration/src/test/java/alluxio/client/fuse/dora/FuseEndToEndTest.java @@ -85,7 +85,6 @@ public static void beforeClass() throws Exception { AlluxioJniFuseFileSystem fuseFileSystem = new AlluxioJniFuseFileSystem(context, fileSystem, FuseOptions.Builder.fromConfig(Configuration.global()) .setFileSystemOptions(fileSystemOptions) - .setUpdateCheckEnabled(false) .build()); fuseFileSystem.mount(false, false, new HashSet<>()); if (!FuseUtils.waitForFuseMounted(MOUNT_POINT)) { diff --git a/dora/tests/integration/src/test/java/alluxio/client/fuse/dora/hdfs3/AbstractFuseHdfsIntegrationTest.java b/dora/tests/integration/src/test/java/alluxio/client/fuse/dora/hdfs3/AbstractFuseHdfsIntegrationTest.java index 49bf0c6db820..d3e9e625667f 100644 --- a/dora/tests/integration/src/test/java/alluxio/client/fuse/dora/hdfs3/AbstractFuseHdfsIntegrationTest.java +++ b/dora/tests/integration/src/test/java/alluxio/client/fuse/dora/hdfs3/AbstractFuseHdfsIntegrationTest.java @@ -119,7 +119,6 @@ private void mountFuse() throws IOException { mAlluxioClusterResource.get().getClient(), FuseOptions.Builder.fromConfig(Configuration.global()) .setFileSystemOptions(fileSystemOptions) - .setUpdateCheckEnabled(false) .build()); mFuseFileSystem.mount(false, false, new HashSet<>()); if (!FuseUtils.waitForFuseMounted(MOUNT_POINT)) { diff --git a/dora/tests/integration/src/test/java/alluxio/client/fuse/dora/readonly/AbstractFuseFileSystemTest.java b/dora/tests/integration/src/test/java/alluxio/client/fuse/dora/readonly/AbstractFuseFileSystemTest.java index 17da81f8c67d..5dc72a6be43a 100644 --- a/dora/tests/integration/src/test/java/alluxio/client/fuse/dora/readonly/AbstractFuseFileSystemTest.java +++ b/dora/tests/integration/src/test/java/alluxio/client/fuse/dora/readonly/AbstractFuseFileSystemTest.java @@ -38,7 +38,6 @@ public void beforeActions() { mFuseFs = new AlluxioJniFuseFileSystem(mContext, mFileSystem, FuseOptions.Builder.fromConfig(Configuration.global()) .setFileSystemOptions(fileSystemOptions) - .setUpdateCheckEnabled(false) .build()); mFileStat = FileStat.of(ByteBuffer.allocateDirect(256)); mFileInfo = new AlluxioFuseUtils.CloseableFuseFileInfo();