Skip to content

Commit

Permalink
YARN-3205. FileSystemRMStateStore should disable FileSystem Cache to …
Browse files Browse the repository at this point in the history
…avoid get a Filesystem with an old configuration. Contributed by Zhihai Xu.
  • Loading branch information
oza committed Mar 18, 2015
1 parent fc90bf7 commit 3bc72cc
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
3 changes: 3 additions & 0 deletions hadoop-yarn-project/CHANGES.txt
Expand Up @@ -72,6 +72,9 @@ Release 2.8.0 - UNRELEASED
YARN-3305. Normalize AM resource request on app submission. (Rohith Sharmaks YARN-3305. Normalize AM resource request on app submission. (Rohith Sharmaks
via jianhe) via jianhe)


YARN-3205 FileSystemRMStateStore should disable FileSystem Cache to avoid
get a Filesystem with an old configuration. (Zhihai Xu via ozawa)

Release 2.7.0 - UNRELEASED Release 2.7.0 - UNRELEASED


INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES
Expand Down
Expand Up @@ -84,7 +84,10 @@ public class FileSystemRMStateStore extends RMStateStore {
protected static final String AMRMTOKEN_SECRET_MANAGER_NODE = protected static final String AMRMTOKEN_SECRET_MANAGER_NODE =
"AMRMTokenSecretManagerNode"; "AMRMTokenSecretManagerNode";


@VisibleForTesting
protected FileSystem fs; protected FileSystem fs;
@VisibleForTesting
protected Configuration fsConf;


private Path rootDirPath; private Path rootDirPath;
@Private @Private
Expand Down Expand Up @@ -121,14 +124,23 @@ protected synchronized void startInternal() throws Exception {
// create filesystem only now, as part of service-start. By this time, RM is // create filesystem only now, as part of service-start. By this time, RM is
// authenticated with kerberos so we are good to create a file-system // authenticated with kerberos so we are good to create a file-system
// handle. // handle.
Configuration conf = new Configuration(getConfig()); fsConf = new Configuration(getConfig());
conf.setBoolean("dfs.client.retry.policy.enabled", true); fsConf.setBoolean("dfs.client.retry.policy.enabled", true);
String retryPolicy = String retryPolicy =
conf.get(YarnConfiguration.FS_RM_STATE_STORE_RETRY_POLICY_SPEC, fsConf.get(YarnConfiguration.FS_RM_STATE_STORE_RETRY_POLICY_SPEC,
YarnConfiguration.DEFAULT_FS_RM_STATE_STORE_RETRY_POLICY_SPEC); YarnConfiguration.DEFAULT_FS_RM_STATE_STORE_RETRY_POLICY_SPEC);
conf.set("dfs.client.retry.policy.spec", retryPolicy); fsConf.set("dfs.client.retry.policy.spec", retryPolicy);

String scheme = fsWorkingPath.toUri().getScheme();
if (scheme == null) {
scheme = FileSystem.getDefaultUri(fsConf).getScheme();
}
if (scheme != null) {
String disableCacheName = String.format("fs.%s.impl.disable.cache", scheme);
fsConf.setBoolean(disableCacheName, true);
}


fs = fsWorkingPath.getFileSystem(conf); fs = fsWorkingPath.getFileSystem(fsConf);
mkdirsWithRetries(rmDTSecretManagerRoot); mkdirsWithRetries(rmDTSecretManagerRoot);
mkdirsWithRetries(rmAppRoot); mkdirsWithRetries(rmAppRoot);
mkdirsWithRetries(amrmTokenSecretManagerRoot); mkdirsWithRetries(amrmTokenSecretManagerRoot);
Expand Down
Expand Up @@ -106,6 +106,11 @@ public RMStateStore getRMStateStore() throws Exception {
this.store = new TestFileSystemRMStore(conf); this.store = new TestFileSystemRMStore(conf);
Assert.assertEquals(store.getNumRetries(), 8); Assert.assertEquals(store.getNumRetries(), 8);
Assert.assertEquals(store.getRetryInterval(), 900L); Assert.assertEquals(store.getRetryInterval(), 900L);
Assert.assertTrue(store.fs.getConf() == store.fsConf);
FileSystem previousFs = store.fs;
store.startInternal();
Assert.assertTrue(store.fs != previousFs);
Assert.assertTrue(store.fs.getConf() == store.fsConf);
return store; return store;
} }


Expand Down

0 comments on commit 3bc72cc

Please sign in to comment.