@Override public void value(final DbEnvironment env) { // TODO would prefer to avoid this hack w/ the "executeWithinContext" here and picking a schema arbitrarily stmtExecutor.executeWithinContext(env.getPhysicalSchemas().getFirst(), new Procedure<Connection>() { @Override public void value(Connection conn) { // TODO refactor these into separate components that can be chained together (GITHUB#5) // TODO measure how long each of these takes: GITHUB#6 if (env.isInvalidObjectCheckEnabled()) { checkForInvalidObjects(conn, env.getPhysicalSchemas()); } else { LOG.info("Skipping invalid object check as configured in your environment"); } if (env.isReorgCheckEnabled()) { checkForTablesNeedingReorg(conn, env); } else { LOG.info("Skipping check for tables pending reorg as configured in your environment"); } LOG.info("Done in DB2 post-deploy action:"); } }); }
@Override public void value(final DbEnvironment env) { // TODO would prefer to avoid this hack w/ the "executeWithinContext" here and picking a schema arbitrarily stmtExecutor.executeWithinContext(env.getPhysicalSchemas().getFirst(), new Procedure<Connection>() { @Override public void value(Connection conn) { // TODO refactor these into separate components that can be chained together (GITHUB#5) // TODO measure how long each of these takes: GITHUB#6 if (env.isInvalidObjectCheckEnabled()) { checkForInvalidObjects(conn, env.getPhysicalSchemas()); } else { LOG.info("Skipping invalid object check as configured in your environment"); } if (env.isReorgCheckEnabled()) { checkForTablesNeedingReorg(conn, env); } else { LOG.info("Skipping check for tables pending reorg as configured in your environment"); } LOG.info("Done in DB2 post-deploy action:"); } }); }
public IqDataSource(DbEnvironment env, Credential userCredential, int numThreads, IqDataSourceFactory subDataSourceFactory) { this.env = env; this.subDataSourceFactory = subDataSourceFactory; MutableMap<PhysicalSchema, DataSource> dsMap = Maps.mutable.empty(); for (PhysicalSchema physicalSchema : env.getPhysicalSchemas()) { String schema = physicalSchema.getPhysicalName(); LOG.info("Creating datasource against schema {}", schema); DataSource ds = subDataSourceFactory.createDataSource(env, userCredential, schema, numThreads ); dsMap.put(physicalSchema, ds); } this.dsMap = dsMap.toImmutable(); this.setCurrentSchema(this.env.getPhysicalSchemas().getFirst()); // set one arbitrarily as the default }
@Override public void add(T changeGroup) { for (SortableDependency change : changeGroup.getComponents()) { T existingChange = retrieve(change.getChangeKey().getObjectKey().getSchema(), convertDbObjectName.valueOf(change.getChangeKey().getObjectKey().getObjectName())); // TODO getFirst is not ideal here if (existingChange == null || existingChange.getComponents().getFirst().getOrderWithinObject() < change.getOrderWithinObject()) { // only keep the latest (why latest vs earliest?) objectMap.put(convertDbObjectName.valueOf(change.getChangeKey().getObjectKey().getSchema() + "." + change.getChangeKey().getObjectKey().getObjectName()), changeGroup); } } }
@Override public void add(T changeGroup) { for (SortableDependency change : changeGroup.getComponents()) { T existingChange = retrieve(change.getChangeKey().getObjectKey().getSchema(), convertDbObjectName.valueOf(change.getChangeKey().getObjectKey().getObjectName())); // TODO getFirst is not ideal here if (existingChange == null || existingChange.getComponents().getFirst().getOrderWithinObject() < change.getOrderWithinObject()) { // only keep the latest (why latest vs earliest?) objectMap.put(convertDbObjectName.valueOf(change.getChangeKey().getObjectKey().getSchema() + "." + change.getChangeKey().getObjectKey().getObjectName()), changeGroup); } } }
@Override public void add(T changeGroup) { for (SortableDependency change : changeGroup.getComponents()) { T existingChange = retrieve(change.getChangeKey().getObjectKey().getSchema(), convertDbObjectName.valueOf(change.getChangeKey().getObjectKey().getObjectName())); // TODO getFirst is not ideal here if (existingChange == null || existingChange.getComponents().getFirst().getOrderWithinObject() < change.getOrderWithinObject()) { // only keep the latest (why latest vs earliest?) schemaToObjectMap.put(Tuples.pair(change.getChangeKey().getObjectKey().getSchema(), convertDbObjectName.valueOf(change.getChangeKey().getObjectKey().getObjectName())), changeGroup); } } }
@Override public void add(T changeGroup) { for (SortableDependency change : changeGroup.getComponents()) { T existingChange = retrieve(change.getChangeKey().getObjectKey().getSchema(), convertDbObjectName.valueOf(change.getChangeKey().getObjectKey().getObjectName())); // TODO getFirst is not ideal here if (existingChange == null || existingChange.getComponents().getFirst().getOrderWithinObject() < change.getOrderWithinObject()) { // only keep the latest (why latest vs earliest?) schemaToObjectMap.put(Tuples.pair(change.getChangeKey().getObjectKey().getSchema(), convertDbObjectName.valueOf(change.getChangeKey().getObjectKey().getObjectName())), changeGroup); } } }
@Before public void setup() throws Exception { DbDeployerAppContext context = getAppContext.valueOf(1); context.setupEnvInfra(); this.logicalSchema1 = context.getEnvironment().getSchemas().getFirst().getName(); // pick one from the environment at random as our logical schema so that we can test the retrieval logic this.logicalSchema2 = "MYSCHEMA2"; // this is just for testing in this DAO, no need to tie to the actual logical schema this.testSchema = context.getEnvironment().getPhysicalSchema(this.logicalSchema1); this.platform = context.getEnvironment().getPlatform(); this.conn = context.getDataSource().getConnection(); this.jdbcHelper = ((AbstractSqlExecutor) context.getSqlExecutor()).createJdbcHelper(context.getDataSource()); this.artifactDeployerDao = (SameSchemaChangeAuditDao) ((DbDeployerAppContextImpl) context).getArtifactDeployerDao(); this.deployExecutionDao = (SameSchemaDeployExecutionDao) context.getDeployExecutionDao(); }