代码调试故障修复

This commit is contained in:
inrgihc
2021-03-01 19:08:25 +08:00
parent 23ae5e159c
commit e9588782e8

View File

@@ -200,7 +200,7 @@ public class MainService {
List<String> pks1 = mds.queryTablePrimaryKeys(tableDescription.getSchemaName(), List<String> pks1 = mds.queryTablePrimaryKeys(tableDescription.getSchemaName(),
tableDescription.getTableName()); tableDescription.getTableName());
List<String> pks2 = mdt.queryTablePrimaryKeys(properties.getTarget().getTargetSchema(), List<String> pks2 = mdt.queryTablePrimaryKeys(properties.getTarget().getTargetSchema(),
tableDescription.getTableName()); sourceProperties.getPrefixTable() + tableDescription.getTableName());
if (!pks1.isEmpty() && !pks2.isEmpty() && pks1.containsAll(pks2) && pks2.containsAll(pks1)) { if (!pks1.isEmpty() && !pks2.isEmpty() && pks1.containsAll(pks2) && pks2.containsAll(pks1)) {
if (targetDatabaseType == DatabaseTypeEnum.MYSQL if (targetDatabaseType == DatabaseTypeEnum.MYSQL
@@ -278,18 +278,18 @@ public class MainService {
if (cache.size() >= BATCH_SIZE) { if (cache.size() >= BATCH_SIZE) {
long ret = writer.write(fields, cache); long ret = writer.write(fields, cache);
log.info("handle table [{}] data count: {}", fullTableName, ret); log.info("[FullCoverSynch] handle table [{}] data count: {}", fullTableName, ret);
cache.clear(); cache.clear();
} }
} }
if (cache.size() > 0) { if (cache.size() > 0) {
long ret = writer.write(fields, cache); long ret = writer.write(fields, cache);
log.info("handle table [{}] data count: {}", fullTableName, ret); log.info("[FullCoverSynch] handle table [{}] data count: {}", fullTableName, ret);
cache.clear(); cache.clear();
} }
log.info("handle table [{}] total data count:{} ", fullTableName, totalCount); log.info("[FullCoverSynch] handle table [{}] total data count:{} ", fullTableName, totalCount);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} finally { } finally {
@@ -328,7 +328,7 @@ public class MainService {
TaskParamBean param = taskBuilder.build(); TaskParamBean param = taskBuilder.build();
IDatabaseSynchronize synch = DatabaseSynchronizeFactory.createDatabaseWriter(writer.getDataSource()); IDatabaseSynchronize synch = DatabaseSynchronizeFactory.createDatabaseWriter(writer.getDataSource());
synch.prepare(param.getOldSchemaName(), sourceProperties.getPrefixTable() + param.getOldTableName(), fields, pks); synch.prepare(param.getOldSchemaName(), param.getOldTableName(), fields, pks);
IDatabaseChangeCaculator changeCaculator = new ChangeCaculatorService(); IDatabaseChangeCaculator changeCaculator = new ChangeCaculatorService();
changeCaculator.setFetchSize(BATCH_SIZE); changeCaculator.setFetchSize(BATCH_SIZE);
@@ -399,25 +399,25 @@ public class MainService {
doUpdate(fields); doUpdate(fields);
} }
log.info("Handle table [{}] total count: {}, Insert:{},Update:{},Delete:{} ", fullTableName, count, log.info("[IncreaseSynch] Handle table [{}] total count: {}, Insert:{},Update:{},Delete:{} ", fullTableName, count,
countInsert, countUpdate, countDelete); countInsert, countUpdate, countDelete);
} }
private void doInsert(List<String> fields) { private void doInsert(List<String> fields) {
long ret = synch.executeInsert(cacheInsert); long ret = synch.executeInsert(cacheInsert);
log.info("handle table [{}] data Insert count: {}", fullTableName, ret); log.info("[IncreaseSynch] Handle table [{}] data Insert count: {}", fullTableName, ret);
cacheInsert.clear(); cacheInsert.clear();
} }
private void doUpdate(List<String> fields) { private void doUpdate(List<String> fields) {
long ret = synch.executeUpdate(cacheUpdate); long ret = synch.executeUpdate(cacheUpdate);
log.info("handle table [{}] data Update count: {}", fullTableName, ret); log.info("[IncreaseSynch] Handle table [{}] data Update count: {}", fullTableName, ret);
cacheUpdate.clear(); cacheUpdate.clear();
} }
private void doDelete(List<String> fields) { private void doDelete(List<String> fields) {
long ret = synch.executeDelete(cacheDelete); long ret = synch.executeDelete(cacheDelete);
log.info("handle table [{}] data Delete count: {}", fullTableName, ret); log.info("[IncreaseSynch] Handle table [{}] data Delete count: {}", fullTableName, ret);
cacheDelete.clear(); cacheDelete.clear();
} }