MAPREDUCE-7266. historyContext doesn't need to be a class attribute inside JobHistoryServer. Contributed by Siddharth Ahuja

(cherry picked from commit e2c87b7917)
This commit is contained in:
Szilard Nemeth 2020-04-09 12:38:54 +02:00
parent 9a66477e4d
commit 8daa8556d6
2 changed files with 2 additions and 18 deletions

View File

@ -64,7 +64,6 @@ public class JobHistoryServer extends CompositeService {
private static final Logger LOG = private static final Logger LOG =
LoggerFactory.getLogger(JobHistoryServer.class); LoggerFactory.getLogger(JobHistoryServer.class);
protected HistoryContext historyContext;
private HistoryClientService clientService; private HistoryClientService clientService;
private JobHistory jobHistoryService; private JobHistory jobHistoryService;
protected JHSDelegationTokenSecretManager jhsDTSecretManager; protected JHSDelegationTokenSecretManager jhsDTSecretManager;
@ -128,7 +127,6 @@ public class JobHistoryServer extends CompositeService {
throw new YarnRuntimeException("History Server Failed to login", ie); throw new YarnRuntimeException("History Server Failed to login", ie);
} }
jobHistoryService = new JobHistory(); jobHistoryService = new JobHistory();
historyContext = (HistoryContext)jobHistoryService;
stateStore = createStateStore(conf); stateStore = createStateStore(conf);
this.jhsDTSecretManager = createJHSSecretManager(conf, stateStore); this.jhsDTSecretManager = createJHSSecretManager(conf, stateStore);
clientService = createHistoryClientService(); clientService = createHistoryClientService();
@ -152,8 +150,7 @@ public class JobHistoryServer extends CompositeService {
@VisibleForTesting @VisibleForTesting
protected HistoryClientService createHistoryClientService() { protected HistoryClientService createHistoryClientService() {
return new HistoryClientService(historyContext, return new HistoryClientService(jobHistoryService, this.jhsDTSecretManager);
this.jhsDTSecretManager);
} }
protected JHSDelegationTokenSecretManager createJHSSecretManager( protected JHSDelegationTokenSecretManager createJHSSecretManager(

View File

@ -37,7 +37,6 @@ import org.apache.hadoop.mapreduce.v2.api.protocolrecords.CancelDelegationTokenR
import org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetDelegationTokenRequest; import org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetDelegationTokenRequest;
import org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetJobReportRequest; import org.apache.hadoop.mapreduce.v2.api.protocolrecords.GetJobReportRequest;
import org.apache.hadoop.mapreduce.v2.api.protocolrecords.RenewDelegationTokenRequest; import org.apache.hadoop.mapreduce.v2.api.protocolrecords.RenewDelegationTokenRequest;
import org.apache.hadoop.mapreduce.v2.hs.HistoryClientService;
import org.apache.hadoop.mapreduce.v2.hs.HistoryServerStateStoreService; import org.apache.hadoop.mapreduce.v2.hs.HistoryServerStateStoreService;
import org.apache.hadoop.mapreduce.v2.hs.JHSDelegationTokenSecretManager; import org.apache.hadoop.mapreduce.v2.hs.JHSDelegationTokenSecretManager;
import org.apache.hadoop.mapreduce.v2.hs.JobHistoryServer; import org.apache.hadoop.mapreduce.v2.hs.JobHistoryServer;
@ -95,19 +94,7 @@ public class TestJHSSecurity {
return new JHSDelegationTokenSecretManager(initialInterval, return new JHSDelegationTokenSecretManager(initialInterval,
maxLifetime, renewInterval, 3600000, store); maxLifetime, renewInterval, 3600000, store);
} }
@Override
protected HistoryClientService createHistoryClientService() {
return new HistoryClientService(historyContext,
this.jhsDTSecretManager) {
@Override
protected void initializeWebApp(Configuration conf) {
// Don't need it, skip.;
}
}; };
}
};
// final JobHistoryServer jobHistoryServer = jhServer;
jobHistoryServer.init(conf); jobHistoryServer.init(conf);
jobHistoryServer.start(); jobHistoryServer.start();
final MRClientProtocol hsService = jobHistoryServer.getClientService() final MRClientProtocol hsService = jobHistoryServer.getClientService()