Source:
<code>public void testSchemaIdRestore() throws Exception { MysqlIsolatedServer server = masterServer; Position oldlogPosition = MaxwellTestSupport.capture(server.getConnection()); LOGGER.info("Initial pos: " + oldlogPosition); MaxwellContext context = getContext(server.getPort(), false); context.getPositionStore().set(oldlogPosition); MysqlSavedSchema savedSchema = MysqlSavedSchema.restore(context, oldlogPosition); if (savedSchema == null) { Connection c = context.getMaxwellConnection(); Schema newSchema = new SchemaCapturer(c, context.getCaseSensitivity()).capture(); savedSchema = new MysqlSavedSchema(context, newSchema, context.getInitialPosition()); savedSchema.save(c); } Long oldSchemaId = savedSchema.getSchemaID(); LOGGER.info("old schema id: " + oldSchemaId); server.execute("CREATE TABLE shard_1.new (id int(11))"); BufferedMaxwell maxwell = new BufferedMaxwell(getConfig(server.getPort(), false)); List<RowMap> rows = new ArrayList<>(); new Thread(maxwell).start(); drainReplication(maxwell, rows); maxwell.terminate(); Position newPosition = MaxwellTestSupport.capture(server.getConnection()); LOGGER.info("New pos: " + newPosition); MysqlSavedSchema newSavedSchema = MysqlSavedSchema.restore(context, newPosition); LOGGER.info("New schema id: " + newSavedSchema.getSchemaID()); <START> assertEquals(new Long(oldSchemaId + 3), newSavedSchema.getSchemaID()); <END> assertTrue(newPosition.newerThan(savedSchema.getPosition())); MysqlSavedSchema restored = MysqlSavedSchema.restore(context, oldlogPosition); assertEquals(oldSchemaId, restored.getSchemaID()); }</code><technical_language>ah. ok, I clear checked in SQL / schema migrations; please *both* changes SQL file code upgrades schemas. new schemas get in place schema gracefully updated. this odd change this test away</technical_language>

Target:
public void testSchemaIdRestore() throws Exception { MysqlIsolatedServer server = masterServer; Position oldlogPosition = MaxwellTestSupport.capture(server.getConnection()); LOGGER.info("Initial pos: " + oldlogPosition); MaxwellContext context = getContext(server.getPort(), false); context.getPositionStore().set(oldlogPosition); MysqlSavedSchema savedSchema = MysqlSavedSchema.restore(context, oldlogPosition); if (savedSchema == null) { Connection c = context.getMaxwellConnection(); Schema newSchema = new SchemaCapturer(c, context.getCaseSensitivity()).capture(); savedSchema = new MysqlSavedSchema(context, newSchema, context.getInitialPosition()); savedSchema.save(c); } Long oldSchemaId = savedSchema.getSchemaID(); LOGGER.info("old schema id: " + oldSchemaId); server.execute("CREATE TABLE shard_1.new (id int(11))"); BufferedMaxwell maxwell = new BufferedMaxwell(getConfig(server.getPort(), false)); List<RowMap> rows = new ArrayList<>(); new Thread(maxwell).start(); drainReplication(maxwell, rows); maxwell.terminate(); Position newPosition = MaxwellTestSupport.capture(server.getConnection()); LOGGER.info("New pos: " + newPosition); MysqlSavedSchema newSavedSchema = MysqlSavedSchema.restore(context, newPosition); LOGGER.info("New schema id: " + newSavedSchema.getSchemaID()); assertEquals(new Long(oldSchemaId + 1), newSavedSchema.getSchemaID()); assertTrue(newPosition.newerThan(savedSchema.getPosition())); MysqlSavedSchema restored = MysqlSavedSchema.restore(context, oldlogPosition); assertEquals(oldSchemaId, restored.getSchemaID()); }