Skip to content

Commit 1d3aef3

Browse files
committed
Add unique id to CopyEntity instead of computing it from serialised json string
1 parent f7fe367 commit 1d3aef3

File tree

1 file changed

+7
-2
lines changed
  • gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy

1 file changed

+7
-2
lines changed

gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopyEntity.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.io.IOException;
2525
import java.util.List;
2626
import java.util.Map;
27+
import java.util.UUID;
2728

2829
import lombok.AccessLevel;
2930
import lombok.AllArgsConstructor;
@@ -54,6 +55,8 @@ public class CopyEntity implements HasGuid {
5455

5556
public static final Gson GSON = GsonInterfaceAdapter.getGson(Object.class);
5657

58+
private final Guid id = new Guid(UUID.randomUUID().toString().getBytes());
59+
5760
/**
5861
* File set this file belongs to. {@link CopyEntity}s in the same fileSet and originating from the same
5962
* {@link CopyableDataset} will be treated as a unit: they will be published nearly atomically, and a notification
@@ -66,7 +69,7 @@ public class CopyEntity implements HasGuid {
6669

6770
@Override
6871
public Guid guid() throws IOException {
69-
return Guid.fromStrings(toString());
72+
return id;
7073
}
7174

7275
/**
@@ -118,7 +121,9 @@ public static List<CopyEntity> deserializeList(String serialized) {
118121
*/
119122
public static String getSerializedWithNewPackage(String serialized) {
120123
serialized = serialized.replace("\"gobblin.data.management.", "\"org.apache.gobblin.data.management.");
121-
log.debug("Serialized updated copy entity: " + serialized);
124+
if (log.isDebugEnabled()) {
125+
log.debug("Serialized updated copy entity: " + serialized);
126+
}
122127
return serialized;
123128
}
124129

0 commit comments

Comments
 (0)