hudi-agent commented on code in PR #19801:
URL: https://github.com/apache/hudi/pull/19801#discussion_r3984780068
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/StreamingMetadataWriteHandler.java:
##########
@@ -71,15 +78,32 @@ public void commitToMetadataTable(HoodieTable table,
List<HoodieWriteStat>
partialMetadataWriteStats) {
Option<HoodieTableMetadataWriter> metadataWriterOpt =
getMetadataWriter(instantTime, table);
ValidationUtils.checkState(metadataWriterOpt.isPresent(), "Should not be
reachable. Metadata Writer should have been instantiated by now");
+ boolean metadataPartitionsWereStreamed =
instantsWithStreamingMetadataWrites.contains(instantTime);
Review Comment:
🤖 Only the Flink coordinator ever calls `markStreamingMetadataWrite`, so
this flag is hard-wired to `false` for every Spark commit (ingest and table
services via `SparkRDDTableServiceClient`), which bakes the "Spark streaming =
batch RLI/SI derivation + shuffle" behavior from the earlier thread into the
interface. Is that the intended end state? If so, could
`STREAMING_WRITE_ENABLED`'s doc (still says Spark streams) and the
`HoodieWriteHandle` delegate/SI-stat bookkeeping under
`isMetadataStreamingWritesEnabled` be reconciled, or otherwise have the Spark
handler mark and stream at full parallelism from the persisted RDD?
<sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag
quality.</i></sub>
##########
hudi-client/hudi-flink-client/src/test/java/org/apache/hudi/client/TestFlinkStreamingMetadataWriteHandler.java:
##########
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.hudi.client;
+
+import org.apache.hudi.common.data.HoodieData;
+import org.apache.hudi.common.engine.HoodieEngineContext;
+import org.apache.hudi.common.model.HoodieCommitMetadata;
+import org.apache.hudi.common.model.HoodieRecord;
+import org.apache.hudi.common.table.HoodieTableMetaClient;
+import org.apache.hudi.common.util.Option;
+import org.apache.hudi.metadata.HoodieTableMetadataWriter;
+import org.apache.hudi.storage.StoragePath;
+import org.apache.hudi.table.HoodieTable;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.Collections;
+
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+class TestFlinkStreamingMetadataWriteHandler {
+
+ @Test
+ void abandonedStreamingWriteDoesNotLeakIntoLaterCompletion() {
+ String instantTime = "001";
+ HoodieTableMetadataWriter metadataWriter =
mock(HoodieTableMetadataWriter.class);
+ HoodieEngineContext context = mock(HoodieEngineContext.class);
+ HoodieTable table = mockTable(context);
+ HoodieData<HoodieRecord> indexRecords = mock(HoodieData.class);
+ HoodieData<WriteStatus> writeStatuses = mock(HoodieData.class);
+ HoodieCommitMetadata commitMetadata = mock(HoodieCommitMetadata.class);
+ when(metadataWriter.streamWriteToMetadataPartitions(indexRecords,
Collections.emptySet(), instantTime))
+ .thenReturn(writeStatuses);
+ FlinkStreamingMetadataWriteHandler handler = new
TestHandler(metadataWriter);
+
+ handler.streamWriteToMetadataPartitions(table, indexRecords,
Collections.emptySet(), instantTime);
+ handler.cleanResources(instantTime);
Review Comment:
🤖 Nothing in this test ever marks the instant —
`streamWriteToMetadataPartitions` doesn't call `markStreamingMetadataWrite`,
only the coordinator does — so `false` here is the default and `cleanResources`
clearing the set isn't actually exercised. Could you call
`markMetadataPartitionsWereStreamed(instantTime)` before `cleanResources` so
this covers the abandon path it's named for?
<sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag
quality.</i></sub>
--
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]