yihua commented on code in PR #12900:
URL: https://github.com/apache/hudi/pull/12900#discussion_r1978353414
##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/versioning/v1/ActiveTimelineV1.java:
##########
@@ -138,25 +147,24 @@ public void
createRequestedCommitWithReplaceMetadata(String instantTime, String
HoodieInstant instant =
instantGenerator.createNewInstant(HoodieInstant.State.REQUESTED, actionType,
instantTime);
LOG.info("Creating a new instant " + instant);
// Create the request replace file
- createFileInMetaPath(instantFileNameGenerator.getFileName(instant),
- TimelineMetadataUtils.serializeRequestedReplaceMetadata(new
HoodieRequestedReplaceMetadata()), false);
- } catch (IOException e) {
- throw new HoodieIOException("Error create requested replace commit ", e);
+ createFileInMetaPath(instantFileNameGenerator.getFileName(instant),
Option.of(new HoodieRequestedReplaceMetadata()), false);
+ } catch (HoodieIOException e) {
+ throw e;
}
Review Comment:
We could get rid of the try-catch.
##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/versioning/v2/ActiveTimelineV2.java:
##########
@@ -143,25 +152,24 @@ public void
createRequestedCommitWithReplaceMetadata(String instantTime, String
HoodieInstant instant =
instantGenerator.createNewInstant(HoodieInstant.State.REQUESTED, actionType,
instantTime);
LOG.info("Creating a new instant " + instant);
// Create the request replace file
- createFileInMetaPath(instantFileNameGenerator.getFileName(instant),
- TimelineMetadataUtils.serializeRequestedReplaceMetadata(new
HoodieRequestedReplaceMetadata()), false);
- } catch (IOException e) {
- throw new HoodieIOException("Error create requested replace commit ", e);
+ createFileInMetaPath(instantFileNameGenerator.getFileName(instant),
Option.of(new HoodieRequestedReplaceMetadata()), false);
+ } catch (HoodieIOException e) {
+ throw e;
Review Comment:
We could get rid of the this try-catch?
##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/TimelineUtils.java:
##########
@@ -623,4 +624,15 @@ public static Option<InputStream>
getInputStreamOptionLegacy(HoodieTimeline time
}
return Option.of(new ByteArrayInputStream(bytes.get()));
}
+
+ // TODO[HUDI-9094]: work around when caller needs to write byte array in
raw. This method should be removed.
+ public static <T> Option<HoodieInstantWriter>
getHoodieInstantWriterOption(HoodieTimeline timeline, Option<T> metadata) {
+ Option<HoodieInstantWriter> writerOption;
+ if (metadata.isPresent() && metadata.get() instanceof HoodieInstantWriter)
{
+ writerOption = (Option<HoodieInstantWriter>) metadata;
+ } else {
+ writerOption = timeline.getInstantWriter(metadata);
+ }
+ return writerOption;
+ }
Review Comment:
This method seems not to use byte array.
##########
hudi-common/src/main/java/org/apache/hudi/common/table/timeline/versioning/v1/ActiveTimelineV1.java:
##########
@@ -548,127 +551,101 @@ public void transitionRequestedToInflight(String
commitType, String inFlightInst
}
@Override
- public void transitionRequestedToInflight(HoodieInstant requested,
Option<byte[]> content) {
- transitionRequestedToInflight(requested, content, false);
+ public <T> void transitionRequestedToInflight(HoodieInstant requested,
Option<T> metadata) {
Review Comment:
```suggestion
public <T> void transitionRequestedToInflight(HoodieInstant requested,
Option<T> metadata) {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]