|
@@ -39,6 +39,7 @@ import org.apache.ambari.server.state.Cluster;
|
|
import org.apache.ambari.server.state.Clusters;
|
|
import org.apache.ambari.server.state.Clusters;
|
|
import org.apache.ambari.server.state.Service;
|
|
import org.apache.ambari.server.state.Service;
|
|
import org.apache.ambari.server.state.StackId;
|
|
import org.apache.ambari.server.state.StackId;
|
|
|
|
+import org.apache.ambari.server.state.stack.OsFamily;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -92,6 +93,9 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog {
|
|
|
|
|
|
@Inject
|
|
@Inject
|
|
DaoUtils daoUtils;
|
|
DaoUtils daoUtils;
|
|
|
|
+
|
|
|
|
+ @Inject
|
|
|
|
+ private OsFamily osFamily;
|
|
|
|
|
|
/**
|
|
/**
|
|
* {@inheritDoc}
|
|
* {@inheritDoc}
|
|
@@ -109,14 +113,6 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog {
|
|
return "2.1.0";
|
|
return "2.1.0";
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * {@inheritDoc}
|
|
|
|
- */
|
|
|
|
- @Override
|
|
|
|
- public String[] getCompatibleVersions() {
|
|
|
|
- return new String[] {"*"};
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* Logger.
|
|
* Logger.
|
|
*/
|
|
*/
|
|
@@ -135,6 +131,7 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog {
|
|
this.injector = injector;
|
|
this.injector = injector;
|
|
|
|
|
|
daoUtils = injector.getInstance(DaoUtils.class);
|
|
daoUtils = injector.getInstance(DaoUtils.class);
|
|
|
|
+ osFamily = injector.getInstance(OsFamily.class);
|
|
}
|
|
}
|
|
|
|
|
|
// ----- AbstractUpgradeCatalog --------------------------------------------
|
|
// ----- AbstractUpgradeCatalog --------------------------------------------
|
|
@@ -317,6 +314,8 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog {
|
|
"host_id", HOSTS_TABLE, "host_id", false);
|
|
"host_id", HOSTS_TABLE, "host_id", false);
|
|
dbAccessor.addFKConstraint(HOST_COMPONENT_DESIRED_STATE_TABLE, "FK_hcdesiredstate_host_id",
|
|
dbAccessor.addFKConstraint(HOST_COMPONENT_DESIRED_STATE_TABLE, "FK_hcdesiredstate_host_id",
|
|
"host_id", HOSTS_TABLE, "host_id", false);
|
|
"host_id", HOSTS_TABLE, "host_id", false);
|
|
|
|
+ dbAccessor.addFKConstraint(HOST_ROLE_COMMAND_TABLE, "FK_host_role_command_host_id",
|
|
|
|
+ "host_id", HOSTS_TABLE, "host_id", false);
|
|
dbAccessor.addFKConstraint(HOST_STATE_TABLE, "FK_hoststate_host_id",
|
|
dbAccessor.addFKConstraint(HOST_STATE_TABLE, "FK_hoststate_host_id",
|
|
"host_id", HOSTS_TABLE, "host_id", false);
|
|
"host_id", HOSTS_TABLE, "host_id", false);
|
|
dbAccessor.addFKConstraint(KERBEROS_PRINCIPAL_HOST_TABLE, "FK_krb_pr_host_id",
|
|
dbAccessor.addFKConstraint(KERBEROS_PRINCIPAL_HOST_TABLE, "FK_krb_pr_host_id",
|
|
@@ -503,7 +502,7 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog {
|
|
/**
|
|
/**
|
|
* Adds the stack table and constraints.
|
|
* Adds the stack table and constraints.
|
|
*/
|
|
*/
|
|
- protected void executeStackDMLUpdates() throws AmbariException, SQLException {
|
|
|
|
|
|
+ protected void executeStackPreDMLUpdates() throws AmbariException, SQLException {
|
|
Gson gson = new Gson();
|
|
Gson gson = new Gson();
|
|
|
|
|
|
injector.getInstance(AmbariMetaInfo.class);
|
|
injector.getInstance(AmbariMetaInfo.class);
|
|
@@ -755,6 +754,14 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog {
|
|
return found ? constraint : null;
|
|
return found ? constraint : null;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * {@inheritDoc}
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ protected void executePreDMLUpdates() throws AmbariException, SQLException {
|
|
|
|
+ executeStackPreDMLUpdates();
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* {@inheritDoc}
|
|
* {@inheritDoc}
|
|
*/
|
|
*/
|
|
@@ -764,9 +771,6 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog {
|
|
|
|
|
|
// Initialize all default widgets and widget layouts
|
|
// Initialize all default widgets and widget layouts
|
|
initializeClusterAndServiceWidgets();
|
|
initializeClusterAndServiceWidgets();
|
|
-
|
|
|
|
- // populate new stack ID columns
|
|
|
|
- executeStackDMLUpdates();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|