YARN-8596. Allow SQLFederationStateStore to submit the same app in the same subcluster. Contributed by Giovanni Matteo Fumarola.
This commit is contained in:
parent
2cccf4061c
commit
79091cf76f
|
@ -564,13 +564,13 @@ public AddApplicationHomeSubClusterResponse addApplicationHomeSubCluster(
|
||||||
// Check the ROWCOUNT value, if it is equal to 0 it means the call
|
// Check the ROWCOUNT value, if it is equal to 0 it means the call
|
||||||
// did not add a new application into FederationStateStore
|
// did not add a new application into FederationStateStore
|
||||||
if (cstmt.getInt(4) == 0) {
|
if (cstmt.getInt(4) == 0) {
|
||||||
String errMsg = "The application " + appId
|
LOG.info(
|
||||||
+ " was not insert into the StateStore";
|
"The application {} was not inserted in the StateStore because it"
|
||||||
FederationStateStoreUtils.logAndThrowStoreException(LOG, errMsg);
|
+ " was already present in SubCluster {}",
|
||||||
}
|
appId, subClusterHome);
|
||||||
// Check the ROWCOUNT value, if it is different from 1 it means the call
|
} else if (cstmt.getInt(4) != 1) {
|
||||||
// had a wrong behavior. Maybe the database is not set correctly.
|
// Check the ROWCOUNT value, if it is different from 1 it means the
|
||||||
if (cstmt.getInt(4) != 1) {
|
// call had a wrong behavior. Maybe the database is not set correctly.
|
||||||
String errMsg = "Wrong behavior during the insertion of SubCluster "
|
String errMsg = "Wrong behavior during the insertion of SubCluster "
|
||||||
+ subClusterId;
|
+ subClusterId;
|
||||||
FederationStateStoreUtils.logAndThrowStoreException(LOG, errMsg);
|
FederationStateStoreUtils.logAndThrowStoreException(LOG, errMsg);
|
||||||
|
|
|
@ -281,6 +281,25 @@ public void testAddApplicationHomeSubClusterAppAlreadyExists()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAddApplicationHomeSubClusterAppAlreadyExistsInTheSameSC()
|
||||||
|
throws Exception {
|
||||||
|
ApplicationId appId = ApplicationId.newInstance(1, 1);
|
||||||
|
SubClusterId subClusterId1 = SubClusterId.newInstance("SC1");
|
||||||
|
addApplicationHomeSC(appId, subClusterId1);
|
||||||
|
|
||||||
|
ApplicationHomeSubCluster ahsc2 =
|
||||||
|
ApplicationHomeSubCluster.newInstance(appId, subClusterId1);
|
||||||
|
|
||||||
|
AddApplicationHomeSubClusterResponse response =
|
||||||
|
stateStore.addApplicationHomeSubCluster(
|
||||||
|
AddApplicationHomeSubClusterRequest.newInstance(ahsc2));
|
||||||
|
|
||||||
|
Assert.assertEquals(subClusterId1, response.getHomeSubCluster());
|
||||||
|
Assert.assertEquals(subClusterId1, queryApplicationHomeSC(appId));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteApplicationHomeSubCluster() throws Exception {
|
public void testDeleteApplicationHomeSubCluster() throws Exception {
|
||||||
ApplicationId appId = ApplicationId.newInstance(1, 1);
|
ApplicationId appId = ApplicationId.newInstance(1, 1);
|
||||||
|
|
Loading…
Reference in New Issue