Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to deal with tableMap events #14

Open
daveey opened this issue Jun 29, 2015 · 1 comment
Open

Failure to deal with tableMap events #14

daveey opened this issue Jun 29, 2015 · 1 comment

Comments

@daveey
Copy link
Contributor

daveey commented Jun 29, 2015

It looks like CacheableTableMapBehaviour doesn't properly deal with tableMap events.

We have a table Foo that was mapped to id 71 for a while. We then had a failover, and the next binary log file has it mapped to 81. The table-map events are correct in the bin-log, and are being processed by the trait, but the tableCache doesn't register the new id->name and continues to return Foo for id=71

I had to work around in my code by adding:

... extends AbstractMySQLBinaryLogConsumer {
    var tableCacheBinLogPosition: Option[String] = None
    override protected def handleEvent(binaryLogEvent: MEvent): Unit = {
      if (Some(getBinaryLogPosition.get.filename) != tableCacheBinLogPosition) {
        logger.info("resetting table cache")
        this.tableCache = new TableCache(hostname, port, username, password)
      }
      super.handleEvent(binaryLogEvent)
      tableCacheBinLogPosition = Some(getBinaryLogPosition.get.filename)
    }
}

but it would be nice to have that logic go into the CacheableTableMapBehaviour behaviour

@daveey
Copy link
Contributor Author

daveey commented Jun 29, 2015

It seems like adding a layer of inderiction to TableCache where we go from (db,table_name) -> table and table_id->(db,table_name) would fix this pretty cleanly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants