= performance improve

- using bulk operation instead of iteration if possible
  - terminate loop after condition is met
This commit is contained in:
zavakid
2020-09-18 00:51:53 +08:00
parent e7de8289cd
commit 435db30b7b
2 changed files with 2 additions and 3 deletions
@@ -191,9 +191,7 @@ public class DatabaseTableMeta implements TableMetaTSDB {
try {
ResultSetPacket packet = connection.query("show databases");
List<String> schemas = new ArrayList<>();
for (String schema : packet.getFieldValues()) {
schemas.add(schema);
}
schemas.addAll(packet.getFieldValues());
for (String schema : schemas) {
// filter views
@@ -20,6 +20,7 @@ public class HeartBeatEntryEventHandler extends AbstractCanalEventDownStreamHand
for (Event event : events) {
if (event.getEntryType() == EntryType.HEARTBEAT) {
existHeartBeat = true;
break;
}
}