Package com.zendesk.maxwell.bootstrap
Class BootstrapController
- java.lang.Object
-
- com.zendesk.maxwell.util.RunLoopProcess
-
- com.zendesk.maxwell.bootstrap.BootstrapController
-
- All Implemented Interfaces:
StoppableTask
public class BootstrapController extends RunLoopProcess
Watches maxwell.bootstrap, starts and stops bootstrap tasks
-
-
Field Summary
-
Fields inherited from class com.zendesk.maxwell.util.RunLoopProcess
taskState
-
-
Constructor Summary
Constructors Constructor Description BootstrapController(ConnectionPool maxwellConnectionPool, AbstractProducer producer, SynchronousBootstrapper bootstrapper, String clientID, boolean syncMode, Long currentSchemaID)
Instantiate a controller
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
setCurrentSchemaID(Long schemaID)
setup a value for outputting as "schema_id".boolean
shouldSkip(RowMap row)
If a bootstrap is active for a table, buffer the row for later.protected void
work()
-
Methods inherited from class com.zendesk.maxwell.util.RunLoopProcess
awaitStop, beforeStart, beforeStop, interrupt, requestStop, runLoop
-
-
-
-
Constructor Detail
-
BootstrapController
public BootstrapController(ConnectionPool maxwellConnectionPool, AbstractProducer producer, SynchronousBootstrapper bootstrapper, String clientID, boolean syncMode, Long currentSchemaID)
Instantiate a controller- Parameters:
maxwellConnectionPool
- maxwell connection poolproducer
- where to write rowsbootstrapper
- the "actor" that actually does workclientID
- current client IDsyncMode
- whether to stop replication while we bootstrapcurrentSchemaID
- initial value for schema_id
-
-
Method Detail
-
work
protected void work() throws Exception
- Specified by:
work
in classRunLoopProcess
- Throws:
Exception
-
setCurrentSchemaID
public void setCurrentSchemaID(Long schemaID)
setup a value for outputting as "schema_id". Note that this is laughably unreliable, as there's totally no way of syncing the bootstrap's work with the replicators'. But one of my great talents as an engineer has been ignoring stuff that's sublty wrong but functionally useful.- Parameters:
schemaID
- the totally disconnected from reality schema_id
-
shouldSkip
public boolean shouldSkip(RowMap row) throws IOException
If a bootstrap is active for a table, buffer the row for later. At the end of a bootstrap we will output the buffered rows. This allows us to output a consistant snapshot of table, first doing the SELECT * and then outputting deltas.- Parameters:
row
- a row to possibly buffer- Returns:
- whether the row was buffered
- Throws:
IOException
- if there was a problem buffering the row
-
-