YARN-8399. NodeManager is giving 403 GSS exception post upgrade to 3.1 in secure mode. Contributed by Sunil Govindan.

(cherry picked from commit 58bc34f1e3)
This commit is contained in:
Rohith Sharma K S 2018-06-07 10:25:47 +05:30
parent 630f43faf7
commit a95f216945
2 changed files with 51 additions and 3 deletions

View File

@ -262,7 +262,7 @@ public class AuxServices extends AbstractService
}
}
s = AuxiliaryServiceWithCustomClassLoader.getInstance(
conf, className, dest.toString());
new Configuration(conf), className, dest.toString());
}
LOG.info("The aux service:" + sName
+ " are using the custom classloader");
@ -273,7 +273,7 @@ public class AuxServices extends AbstractService
if (sClass == null) {
throw new RuntimeException("No class defined for " + sName);
}
s = ReflectionUtils.newInstance(sClass, conf);
s = ReflectionUtils.newInstance(sClass, new Configuration(conf));
}
if (s == null) {
throw new RuntimeException("No object created for " + sName);
@ -294,7 +294,7 @@ public class AuxServices extends AbstractService
stateStoreFs.mkdirs(storePath, storeDirPerms);
s.setRecoveryPath(storePath);
}
s.init(conf);
s.init(new Configuration(conf));
} catch (RuntimeException e) {
LOG.error("Failed to initialize " + sName, e);
throw e;

View File

@ -678,4 +678,52 @@ public class TestAuxServices {
super("RecoverableServiceB", "Bsrv");
}
}
static class ConfChangeAuxService extends AuxiliaryService
implements Service {
ConfChangeAuxService() {
super("ConfChangeAuxService");
}
@Override
protected void serviceInit(Configuration conf) throws Exception {
conf.set("dummyConfig", "changedTestValue");
super.serviceInit(conf);
}
@Override
public void initializeApplication(
ApplicationInitializationContext initAppContext) {
}
@Override
public void stopApplication(ApplicationTerminationContext stopAppContext) {
}
@Override
public ByteBuffer getMetaData() {
return null;
}
}
@Test
public void testAuxServicesConfChange() {
Configuration conf = new Configuration();
conf.setStrings(YarnConfiguration.NM_AUX_SERVICES,
new String[]{"ConfChangeAuxService"});
conf.setClass(String.format(YarnConfiguration.NM_AUX_SERVICE_FMT,
"ConfChangeAuxService"), ConfChangeAuxService.class, Service.class);
AuxServices aux = new AuxServices(MOCK_AUX_PATH_HANDLER, MOCK_CONTEXT,
MOCK_DEL_SERVICE);
conf.set("dummyConfig", "testValue");
aux.init(conf);
aux.start();
for (AuxiliaryService s : aux.getServices()) {
assertEquals(STARTED, s.getServiceState());
assertEquals(conf.get("dummyConfig"), "testValue");
}
aux.stop();
}
}