Skip to content

Commit 03cb5af

Browse files
live-wirebdevetakaka-netzero
authored
Ignoring Payload table from validation (mysql-time-machine#56)
* Adding support for validator in Replicator v016 * Formatting updates ValidationService * Validator silently set to null if broker not in config * Removing pungent code * refactoring augmenter context & bug fixes * Upgrading the LOG.warn to a RuntimeException in order to die out as soon as a QUERY_EVENT is encountered which does not have an eventTable Additionally modified the shouldProcess condition to skip over events related to any schema other than the replicatedSchema (the chosen one) * Because apparently doing (String) var == (String) var2 (where var and var2 have the same string value) IS FALSE BUT If you do (String) var.equals( (String) var2 ) everything works. &shrug; I can't explain it, and apparently that isn't how it's *supposed* to work, but if you look at previous CI builds you see it fails. * Integration tests for Replicator validator * Formatting updates * Fixing kafka message consumption * Removing code smells for sonarcloud.io * Added unit test to improve coverage * Adding more information to the 'Severe environment error', as this error can also indicate a missing table in the ActiveSchema rather than just binlog_row_image=MINIMAL * Added support for a new configuration variable to enable the ActiveSchema management to fall back to the replicant schema in the event of a missing table. This is useful in a very narrow set of circumstances, as generally you are much better off properly bootstrapping and starting from a known good state. But, occasionally reality doesn't allow for this, thus this explicit option. * Unit test updates to improve coverage * Improving conditional coverage * Further improving unit test coverage * Triggering travis build * Untested patch: for some reason my integration tests fail on my local pc. This patch attempts to revert my fallback behaviour to match the previous code (pre RC2). * I thought I was being smart by replacing the previous use of SHOW TABLES LIKE ? with the already created SHOW_CREATE_TABLE_SQL var, turns out I overlooked a very important aspect of SHOW TABLES LIKE: graceful failure SHOW CREATE TABLE will throw a fit if the table doesn't actually exist, whereas SHOW TABLES LIKE will gladly return you an empty resultset. * Providing a default value for this configuration option, as without it we throw an NullPointerException in the event that it isn't provided in the config file. * Validation task moved to logger debug * Added field to ignore * Setting default back to HBASE for integration tests * Removing code smell * Adding support for validator in Replicator v016 (mysql-time-machine#51) * Adding support for validator in Replicator v016 * Formatting updates ValidationService * Validator silently set to null if broker not in config * Removing pungent code * Integration tests for Replicator validator * Formatting updates * Fixing kafka message consumption * Removing code smells for sonarcloud.io * Added unit test to improve coverage * Unit test updates to improve coverage * Improving conditional coverage * Further improving unit test coverage * Triggering travis build * Adding an ignore-field for validator (mysql-time-machine#52) * Adding support for validator in Replicator v016 * Formatting updates ValidationService * Validator silently set to null if broker not in config * Removing pungent code * Integration tests for Replicator validator * Formatting updates * Fixing kafka message consumption * Removing code smells for sonarcloud.io * Added unit test to improve coverage * Unit test updates to improve coverage * Improving conditional coverage * Further improving unit test coverage * Triggering travis build * Validation task moved to logger debug * Added field to ignore * Setting default back to HBASE for integration tests * Removing code smell * Sending shard and original table info downstream * Mutation generator code cleanup * Fixing tests to incorporate shard and table forward * Avoiding null metrics config * Null check for metrics * Removing code smell * Ignoring Payload table name from validation * Moved conditional to a new line Co-authored-by: Bosko Devetak <bosko.devetak@gmail.com> Co-authored-by: aka-netzero <steve.aurigema@gmail.com>
1 parent 7932192 commit 03cb5af

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

mysql-replicator-applier/src/main/java/com/booking/replication/applier/hbase/writer/HBaseTimeMachineWriter.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public class HBaseTimeMachineWriter implements HBaseApplierWriter {
4343
HBaseApplierMutationGenerator mutationGenerator;
4444
private final boolean dryRun;
4545
private final ValidationService validationService;
46+
private final String payloadTableName;
4647

4748
Connection connection;
4849
Admin admin;
@@ -57,6 +58,8 @@ public HBaseTimeMachineWriter(Configuration hbaseConfig,
5758

5859
this.validationService = validationService;
5960

61+
this.payloadTableName = (String) configuration.get(HBaseApplier.Configuration.PAYLOAD_TABLE_NAME);
62+
6063
this.metrics = Metrics.getInstance(configuration);
6164

6265
this.hbaseSchemaManager = hbaseSchemaManager;
@@ -256,7 +259,9 @@ private void writeToHBase(Long threadID) throws IOException {
256259
// table.close();
257260

258261
for (HBaseApplierMutationGenerator.PutMutation mutation : tableMutations){
259-
if (validationService != null) validationService.registerValidationTask(mutation.getTransactionUUID(), mutation.getSourceRowUri(), mutation.getTargetRowUri());
262+
if (validationService != null && !tableName.equalsIgnoreCase(payloadTableName)) {
263+
validationService.registerValidationTask(mutation.getTransactionUUID(), mutation.getSourceRowUri(), mutation.getTargetRowUri());
264+
}
260265
}
261266

262267
long timeEnd = System.currentTimeMillis();

0 commit comments

Comments
 (0)