Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
huberylee committed May 19, 2022
1 parent 8d86da1 commit 7e052f5
Showing 1 changed file with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public class AdbSyncTool extends AbstractSyncTool {
private final AbstractAdbSyncHoodieClient hoodieAdbClient;
private final String snapshotTableName;
private final Option<String> roTableTableName;
private static final byte[] LOCK = new byte[1];

public AdbSyncTool(TypedProperties props, Configuration conf, FileSystem fs) {
super(props, conf, fs);
Expand Down Expand Up @@ -93,10 +92,6 @@ private AbstractAdbSyncHoodieClient getHoodieAdbClient(AdbSyncConfig adbSyncConf

@Override
public void syncHoodieTable() {
syncHoodieTable(true);
}

public void syncHoodieTable(boolean closeClient) {
try {
switch (hoodieAdbClient.getTableType()) {
case COPY_ON_WRITE:
Expand All @@ -117,9 +112,7 @@ public void syncHoodieTable(boolean closeClient) {
} catch (Exception re) {
throw new HoodieAdbSyncException("Sync hoodie table to ADB failed, tableName:" + adbSyncConfig.tableName, re);
} finally {
if (closeClient) {
hoodieAdbClient.close();
}
hoodieAdbClient.close();
}
}

Expand All @@ -130,7 +123,7 @@ private void syncHoodieTable(String tableName, boolean useRealtimeInputFormat,

if (adbSyncConfig.autoCreateDatabase) {
try {
synchronized (LOCK) {
synchronized (AdbSyncTool.class) {
if (!hoodieAdbClient.databaseExists(adbSyncConfig.databaseName)) {
hoodieAdbClient.createDatabase(adbSyncConfig.databaseName);
}
Expand Down

0 comments on commit 7e052f5

Please sign in to comment.