Skip to content

Commit

Permalink
look for mysql database in schema *after* adding databases
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Osheroff committed Nov 23, 2015
1 parent 2272b2b commit 737701b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/main/java/com/zendesk/maxwell/schema/SchemaStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,6 @@ private void restoreFrom(BinlogPosition targetPosition)

this.schema_id = schemaRS.getLong("id");

if ( this.schema.findDatabase("mysql") == null ) {
LOGGER.info("Could not find mysql db, adding it to schema");
SchemaCapturer sc = new SchemaCapturer(connection, "mysql");
Database db = sc.capture().findDatabase("mysql");
this.schema.addDatabase(db);
shouldResave = true;
}

p = connection.prepareStatement("SELECT * from `maxwell`.`databases` where schema_id = ? ORDER by id");
p.setLong(1, this.schema_id);

Expand All @@ -252,6 +244,14 @@ private void restoreFrom(BinlogPosition targetPosition)
this.schema.getDatabases().add(restoreDatabase(dbRS.getInt("id"), dbRS.getString("name"), dbRS.getString("encoding")));
}

if ( this.schema.findDatabase("mysql") == null ) {
LOGGER.info("Could not find mysql db, adding it to schema");
SchemaCapturer sc = new SchemaCapturer(connection, "mysql");
Database db = sc.capture().findDatabase("mysql");
this.schema.addDatabase(db);
shouldResave = true;
}

if ( shouldResave )
this.schema_id = saveSchema();
}
Expand Down

0 comments on commit 737701b

Please sign in to comment.