Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
voonhous closed pull request #19791: fix(nbcc): reject insert overwrite combined with non-blocking concurrency control URL: https://github.com/apache/hudi/pull/19791 -- 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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
voonhous commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-6701362870 Temporarily closing this PR while we debug a GitHub settings error on master (#20471); it will be reopened shortly, no action needed. -- 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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
hudi-bot commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5635317252 ## CI report: * 63ea3f8e04bdbdd72aa152624aa2141688c62740 UNKNOWN * 71a79c6c9a3051372cbb661da02442a240d18fc9 UNKNOWN * 8c6d537cb17bf7e680b970ad70e28afbac0ba7e7 Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=17008) Bot commands @hudi-bot supports the following commands: - `@hudi-bot run azure` re-run the last Azure build -- 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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
hudi-bot commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5634019771 ## CI report: * 63ea3f8e04bdbdd72aa152624aa2141688c62740 UNKNOWN * 4586468b7613bad5661d1c2cfb3c9ed9c1e50c16 Azure: [FAILURE](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=16702) * 71a79c6c9a3051372cbb661da02442a240d18fc9 UNKNOWN * 8c6d537cb17bf7e680b970ad70e28afbac0ba7e7 Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=17008) Bot commands @hudi-bot supports the following commands: - `@hudi-bot run azure` re-run the last Azure build -- 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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
hudi-bot commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5633947007 ## CI report: * 63ea3f8e04bdbdd72aa152624aa2141688c62740 UNKNOWN * 4586468b7613bad5661d1c2cfb3c9ed9c1e50c16 Azure: [FAILURE](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=16702) * 71a79c6c9a3051372cbb661da02442a240d18fc9 UNKNOWN * 8c6d537cb17bf7e680b970ad70e28afbac0ba7e7 UNKNOWN Bot commands @hudi-bot supports the following commands: - `@hudi-bot run azure` re-run the last Azure build -- 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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
hudi-bot commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5633885382 ## CI report: * 63ea3f8e04bdbdd72aa152624aa2141688c62740 UNKNOWN * 4586468b7613bad5661d1c2cfb3c9ed9c1e50c16 Azure: [FAILURE](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=16702) * 71a79c6c9a3051372cbb661da02442a240d18fc9 UNKNOWN Bot commands @hudi-bot supports the following commands: - `@hudi-bot run azure` re-run the last Azure build -- 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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
hudi-agent commented on code in PR #19791:
URL: https://github.com/apache/hudi/pull/19791#discussion_r3988809093
##
hudi-common/src/main/java/org/apache/hudi/common/model/WriteConcurrencyMode.java:
##
@@ -62,6 +67,21 @@ public boolean isNonBlockingConcurrencyControl() {
}
public static boolean isNonBlockingConcurrencyControl(String name) {
-return
WriteConcurrencyMode.valueOf(name.toUpperCase()).isNonBlockingConcurrencyControl();
+return
WriteConcurrencyMode.valueOf(name.toUpperCase(Locale.ROOT)).isNonBlockingConcurrencyControl();
+ }
+
+ /**
+ * Rejects the {@code insert overwrite} + non-blocking concurrency control
(NB-CC) combination,
+ * which silently loses data.
+ *
+ * @param isNonBlockingConcurrencyControl whether the write concurrency mode
is NB-CC
+ * @param isOverwrite whether the operation is an
insert overwrite
+ * (see {@link
WriteOperationType#isOverwrite})
+ * @throws HoodieException if the combination is requested
+ */
Review Comment:
🤖 nit: the extra alignment spaces before `isOverwrite` in the @param list
look like leftover formatting from an editor — worth normalizing to a single
space like the line above.
⚠️ AI-generated; verify before applying. React 👍/👎 to flag
quality.
##
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/configuration/OptionsResolver.java:
##
@@ -463,6 +463,20 @@ public static boolean isInsertOverwrite(Configuration
conf) {
||
conf.get(FlinkOptions.OPERATION).equalsIgnoreCase(WriteOperationType.INSERT_OVERWRITE.value());
}
+ /**
+ * Validates that insert overwrite is not combined with non-blocking
concurrency control.
+ *
+ * Insert overwrite reuses the deterministic bucket file id under
non-blocking concurrency
+ * control, but the replace commit it generates records that same file id as
replaced. Since the
+ * file system view hides a replaced file group by file id (ignoring the
replace instant), the
+ * freshly overwritten data would become invisible. Reject the combination
to avoid data loss.
+ *
+ */
+ public static void checkInsertOverwriteSupported(Configuration conf) {
+WriteConcurrencyMode.checkInsertOverwriteSupported(
+isNonBlockingConcurrencyControl(conf), isInsertOverwrite(conf));
Review Comment:
🤖 nit: there's a stray blank javadoc line before the closing `*/` here —
could you remove it?
⚠️ AI-generated; verify before applying. React 👍/👎 to flag
quality.
--
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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
Joy-2000 commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5633882491 @danny0405 Sorry for the long delay in updating. I've added fail-fast validation in HoodieTableSink and StreamSync that rejects the conflicting-parameter combination early, along with the corresponding tests. I've also rebased the branch — the latest commit(71a79c6) contains this change. -- 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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
hudi-agent commented on code in PR #19791:
URL: https://github.com/apache/hudi/pull/19791#discussion_r3901145682
##
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/configuration/OptionsResolver.java:
##
@@ -449,6 +449,20 @@ public static boolean isInsertOverwrite(Configuration
conf) {
||
conf.get(FlinkOptions.OPERATION).equalsIgnoreCase(WriteOperationType.INSERT_OVERWRITE.value());
}
+ /**
+ * Validates that insert overwrite is not combined with non-blocking
concurrency control.
+ *
+ * Insert overwrite reuses the deterministic bucket file id under
non-blocking concurrency
+ * control, but the replace commit it generates records that same file id as
replaced. Since the
+ * file system view hides a replaced file group by file id (ignoring the
replace instant), the
+ * freshly overwritten data would become invisible. Reject the combination
to avoid data loss.
+ *
+ */
+ public static void checkNonBlockingConcurrencyControl(Configuration conf) {
+WriteConcurrencyMode.checkInsertOverwriteSupported(
+isNonBlockingConcurrencyControl(conf), isInsertOverwrite(conf));
+ }
+
/**
* Returns whether the operation is INSERT OVERWRITE dynamic partition.
*/
Review Comment:
🤖 nit: could you rename this to something like
`checkInsertOverwriteSupported(Configuration conf)` to mirror the underlying
`WriteConcurrencyMode` method? `checkNonBlockingConcurrencyControl` reads more
like a predicate on the mode itself and doesn't hint at what the check is
actually validating.
⚠️ AI-generated; verify before applying. React 👍/👎 to flag
quality.
##
hudi-common/src/main/java/org/apache/hudi/common/model/WriteConcurrencyMode.java:
##
@@ -42,9 +43,13 @@ public enum WriteConcurrencyMode {
// Multiple writer can perform write ops on a MOR table with non-blocking
conflict resolution
@EnumFieldDescription("Multiple writers can operate on the table with
non-blocking conflict resolution. "
+ "The writers can write into the same file group with the conflicts
resolved automatically "
- + "by the query reader and the compactor.")
+ + "by the query reader and the compactor. Insert overwrite is not
supported in this mode.")
NON_BLOCKING_CONCURRENCY_CONTROL;
+ //Error message thrown when insert overwrite is combined with non-blocking
concurrency control.
Review Comment:
🤖 nit: missing space after `//` — `//Error message` should be `// Error
message` to match the surrounding comment style.
⚠️ AI-generated; verify before applying. React 👍/👎 to flag
quality.
--
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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
danny0405 commented on code in PR #19791:
URL: https://github.com/apache/hudi/pull/19791#discussion_r3891546793
##
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/utils/Pipelines.java:
##
@@ -500,6 +500,9 @@ public static DataStream
rowDataToHoodieRecord(Configura
public static DataStream hoodieStreamWrite(Configuration conf,
RowType rowType,
DataStream dataStream) {
+// Validate the finalized write operation (after
overwrite/static-partition resolution) at the
+// single point all production callers (table sink, flink streamer, sink
v2) funnel through.
+OptionsResolver.checkNonBlockingConcurrencyControl(conf);
Review Comment:
Could we also call
`OptionsResolver.checkNonBlockingConcurrencyControl(conf)` at the very
beginning of `HoodieTableSink.getSinkRuntimeProvider()`, before returning the
`DataStreamSinkProviderAdapter` lambda?
By that point, the planner has applied `applyOverwrite()` and
`applyStaticPartition()`, so `conf` contains the resolved operation. This gives
the Table/SQL path a single early validation point for both explicit
`write.operation` options and SQL `INSERT OVERWRITE`, without adding separate
checks in `HoodieTableFactory.sanityCheck()` and `applyOverwrite()`.
The placement before the lambda matters: the lambda performs client-ID setup
and calls `StreamerUtil.initTableFromClientIfNecessary()` before reaching this
pipeline guard. With incremental job-graph initialization or partition-level
simple bucket indexing, the latter can create the table before the invalid
combination is rejected.
Please keep this shared pipeline guard as well, since `HoodieFlinkStreamer`
and direct pipeline callers bypass `HoodieTableSink`. A sink-level test could
assert that `getSinkRuntimeProvider()` itself rejects the resolved overwrite
operation under NBCC, without invoking the returned provider.
Updated to recommend this single sink-level check instead of my earlier
factory-plus-`applyOverwrite()` suggestion.
--
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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
danny0405 commented on code in PR #19791:
URL: https://github.com/apache/hudi/pull/19791#discussion_r3891546793
##
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/utils/Pipelines.java:
##
@@ -500,6 +500,9 @@ public static DataStream
rowDataToHoodieRecord(Configura
public static DataStream hoodieStreamWrite(Configuration conf,
RowType rowType,
DataStream dataStream) {
+// Validate the finalized write operation (after
overwrite/static-partition resolution) at the
+// single point all production callers (table sink, flink streamer, sink
v2) funnel through.
+OptionsResolver.checkNonBlockingConcurrencyControl(conf);
Review Comment:
Could we also reject this combination at the Flink option/planner boundary,
before table initialization? Keep this shared pipeline guard for
HoodieFlinkStreamer and the other callers, as discussed in the earlier review.
However, HoodieTableSink.getSinkRuntimeProvider already calls
StreamerUtil.initTableFromClientIfNecessary before reaching here; with
incremental job-graph initialization or partition-level simple bucket indexing,
that can create the table before the invalid options are rejected. I would call
OptionsResolver.checkNonBlockingConcurrencyControl from
HoodieTableFactory.sanityCheck for explicitly configured write.operation, and
reject overwrite == true && NBCC at the beginning of
HoodieTableSink.applyOverwrite, before mutating the sink state. The factory
check alone is insufficient for SQL INSERT OVERWRITE: write.operation can still
be the default upsert there, and applyOverwrite changes it later. This
preserves coverage of all pipeline callers while letting table/SQL u
sers fail before initialization. Factory and sink-level tests could pin both
rejection points.
##
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/BaseHoodieWriteClient.java:
##
@@ -586,6 +587,12 @@ public void preWrite(String instantTime,
WriteOperationType writeOperationType,
*/
public void preWrite(String instantTime, WriteOperationType
writeOperationType,
HoodieTableMetaClient metaClient,
Option>> recordsOpt) {
+// Engine-agnostic backstop rejecting insert overwrite under non-blocking
concurrency control.
+// Complements the engine-specific guards by covering entry points that
bypass them (e.g. Hudi
+// Streamer, which reaches the write client directly).
+WriteConcurrencyMode.checkInsertOverwriteSupported(
+config.getWriteConcurrencyMode().isNonBlockingConcurrencyControl(),
+WriteOperationType.isOverwrite(writeOperationType));
Review Comment:
Could we add an early Spark HoodieStreamer option check alongside this
backstop? StreamSync.writeToSinkAndDoMetaSync calls startCommit before
writeToSink dispatches to insertOverwrite/insertOverwriteTable, and those
client methods call initTable before reaching preWrite. This guard prevents the
overwrite, but the invalid NBCC configuration has already caused client
initialization and commit-instant creation, unlike the Spark SQL guard.
StreamSync.getHoodieClientConfigAndWriterSchema already has the built
HoodieWriteConfig and cfg.operation; calling the shared validator immediately
after builder.build() would reject both overwrite variants before constructing
the write client. Please use cfg.operation rather than assuming the datasource
operation property is present. Keep this preWrite check as protection for
direct client callers, and add a Streamer test asserting that rejection creates
no new timeline instant.
--
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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
hudi-bot commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5467741070 ## CI report: * 63ea3f8e04bdbdd72aa152624aa2141688c62740 UNKNOWN * 4586468b7613bad5661d1c2cfb3c9ed9c1e50c16 Azure: [FAILURE](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=16702) Bot commands @hudi-bot supports the following commands: - `@hudi-bot run azure` re-run the last Azure build -- 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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
hudi-bot commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5467433307 ## CI report: * 63ea3f8e04bdbdd72aa152624aa2141688c62740 UNKNOWN * 7c36e9ba40c3f2f54f2a4a0785dbb6b0d9d5 Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=16692) * 4586468b7613bad5661d1c2cfb3c9ed9c1e50c16 Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=16702) Bot commands @hudi-bot supports the following commands: - `@hudi-bot run azure` re-run the last Azure build -- 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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
hudi-bot commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5467224949 ## CI report: * 63ea3f8e04bdbdd72aa152624aa2141688c62740 UNKNOWN * 7c36e9ba40c3f2f54f2a4a0785dbb6b0d9d5 Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=16692) * 4586468b7613bad5661d1c2cfb3c9ed9c1e50c16 UNKNOWN Bot commands @hudi-bot supports the following commands: - `@hudi-bot run azure` re-run the last Azure build -- 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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
hudi-bot commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5467143626 ## CI report: * 63ea3f8e04bdbdd72aa152624aa2141688c62740 UNKNOWN * 7c36e9ba40c3f2f54f2a4a0785dbb6b0d9d5 Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=16692) Bot commands @hudi-bot supports the following commands: - `@hudi-bot run azure` re-run the last Azure build -- 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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
hudi-bot commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5467123797 ## CI report: * 63ea3f8e04bdbdd72aa152624aa2141688c62740 UNKNOWN * 7c36e9ba40c3f2f54f2a4a0785dbb6b0d9d5 Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=16692) Bot commands @hudi-bot supports the following commands: - `@hudi-bot run azure` re-run the last Azure build -- 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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
Joy-2000 commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5467041223 @hudi-bot run azure -- 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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
voonhous commented on code in PR #19791:
URL: https://github.com/apache/hudi/pull/19791#discussion_r3886678807
##
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/dml/insert/TestInsertTable5.scala:
##
@@ -358,4 +358,80 @@ class TestInsertTable5 extends HoodieSparkSqlTestBase {
}
}
}
+
+ test("Test Insert Overwrite With Non Blocking Concurrency Control Is
Rejected") {
Review Comment:
Verified at 7c36e9ba: plain `insert overwrite` across both variants x row
writer on/off, with `getActiveTimeline.getInstants.size() == 0` after the
failure. Resolving.
--
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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
hudi-bot commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5463104602 ## CI report: * 63ea3f8e04bdbdd72aa152624aa2141688c62740 UNKNOWN * 7c36e9ba40c3f2f54f2a4a0785dbb6b0d9d5 Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=16692) Bot commands @hudi-bot supports the following commands: - `@hudi-bot run azure` re-run the last Azure build -- 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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
voonhous commented on code in PR #19791:
URL: https://github.com/apache/hudi/pull/19791#discussion_r3886679810
##
hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/sink/ITTestDataStreamV2Write.java:
##
@@ -100,6 +107,34 @@ public void testAppendWrite() throws Exception {
writeAndCheckExpected(conf, "append_write", 1);
}
+ @ParameterizedTest
Review Comment:
Verified at 7c36e9ba: test removed; `hoodieStreamWrite` is the guarded
funnel and `TestOptionsResolver` pins the predicate. Resolving.
##
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/dml/insert/TestInsertTable5.scala:
##
@@ -358,4 +358,80 @@ class TestInsertTable5 extends HoodieSparkSqlTestBase {
}
}
}
+
+ test("Test Insert Overwrite With Non Blocking Concurrency Control Is
Rejected") {
+Seq("INSERT_OVERWRITE", "INSERT_OVERWRITE_TABLE").foreach { operation =>
+ withSQLConf(
+"hoodie.write.concurrency.mode" -> "NON_BLOCKING_CONCURRENCY_CONTROL",
+"hoodie.datasource.write.operation" -> operation
+ ) {
+withTempDir { tmp =>
+ withTable(generateTableName) { tableName =>
+val tablePath = s"""${tmp.getCanonicalPath}/$tableName"""
+spark.sql(
+ s"""
+ |create table $tableName (
+ | id int,
+ | name string,
+ | price double,
+ | ts long
+ |) using hudi
+ | tblproperties (
+ | primaryKey = 'id',
+ | type = 'mor',
+ | preCombineField = 'ts',
+ | hoodie.index.type = 'BUCKET',
+ | hoodie.index.bucket.engine = 'SIMPLE',
+ | hoodie.bucket.index.hash.field = 'id',
+ | hoodie.bucket.index.num.buckets = 1)
+ | location '${tablePath}'
+ | """.stripMargin)
+
+checkExceptionContain(
+ s"""insert into $tableName values
+ | (1, 'a1', 10, 1000)
+ | """.stripMargin)(
+ "Insert overwrite is not supported with non-blocking concurrency
control")
+ }
+}
+ }
+}
+ }
+
+ test("Test Insert Overwrite (bulk_insert mode) With Non Blocking Concurrency
Control Is Rejected") {
+withSQLConf(
+ "hoodie.write.concurrency.mode" -> "NON_BLOCKING_CONCURRENCY_CONTROL",
+ "hoodie.datasource.write.operation" -> "BULK_INSERT"
+) {
+ withTempDir { tmp =>
+withTable(generateTableName) { tableName =>
+ val tablePath = s"""${tmp.getCanonicalPath}/$tableName"""
+ spark.sql(
+s"""
+ |create table $tableName (
Review Comment:
Verified at 7c36e9ba: one test in `TestInsertTable3`, single DDL,
`TestInsertTable5` back to master. Resolving.
--
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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
voonhous commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5462667040 Deferring this PR to @danny0405 now, thank you for. the contribution, no other comments from me. -- 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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
voonhous commented on code in PR #19791:
URL: https://github.com/apache/hudi/pull/19791#discussion_r3886680534
##
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieSparkSqlWriter.scala:
##
@@ -617,8 +618,29 @@ class HoodieSparkSqlWriterInternal {
}
/**
- * Resolve wildcards in partitions
+ * Reject insert overwrite combined with non-blocking concurrency control.
*
+ * Insert overwrite reuses the deterministic bucket file id under
non-blocking concurrency
+ * control, but the replace commit records that same file id as replaced.
The file system view
+ * hides a replaced file group by file id (ignoring the replace instant), so
the freshly
+ * overwritten data would become invisible. Reject the combination to avoid
data loss.
+ */
+ private def validateNonBlockingConcurrencyControl(hoodieConfig:
HoodieConfig, operation: WriteOperationType): Unit = {
+val isNonBlockingConcurrencyControl =
WriteConcurrencyMode.isNonBlockingConcurrencyControl(
+
hoodieConfig.getStringOrDefault(HoodieWriteConfig.WRITE_CONCURRENCY_MODE))
+val rowWriterOverwriteType =
Option(hoodieConfig.getString(HoodieInternalConfig.BULKINSERT_OVERWRITE_OPERATION_TYPE))
+ .map(WriteOperationType.fromValue)
+ .orNull
+val isInsertOverwrite = operation == WriteOperationType.INSERT_OVERWRITE ||
+ operation == WriteOperationType.INSERT_OVERWRITE_TABLE ||
+ rowWriterOverwriteType == WriteOperationType.INSERT_OVERWRITE ||
+ rowWriterOverwriteType == WriteOperationType.INSERT_OVERWRITE_TABLE
+if (isNonBlockingConcurrencyControl && isInsertOverwrite) {
+ throw new HoodieException("Insert overwrite is not supported with
non-blocking concurrency control")
Review Comment:
Verified at 7c36e9ba: `WriteConcurrencyMode.checkInsertOverwriteSupported` +
`INSERT_OVERWRITE_NOT_SUPPORTED_ERROR` used at all four sites, single
`HoodieException`. Resolving.
##
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieSparkSqlWriter.scala:
##
@@ -617,8 +618,29 @@ class HoodieSparkSqlWriterInternal {
}
/**
- * Resolve wildcards in partitions
+ * Reject insert overwrite combined with non-blocking concurrency control.
*
+ * Insert overwrite reuses the deterministic bucket file id under
non-blocking concurrency
+ * control, but the replace commit records that same file id as replaced.
The file system view
+ * hides a replaced file group by file id (ignoring the replace instant), so
the freshly
+ * overwritten data would become invisible. Reject the combination to avoid
data loss.
+ */
+ private def validateNonBlockingConcurrencyControl(hoodieConfig:
HoodieConfig, operation: WriteOperationType): Unit = {
+val isNonBlockingConcurrencyControl =
WriteConcurrencyMode.isNonBlockingConcurrencyControl(
+
hoodieConfig.getStringOrDefault(HoodieWriteConfig.WRITE_CONCURRENCY_MODE))
+val rowWriterOverwriteType =
Option(hoodieConfig.getString(HoodieInternalConfig.BULKINSERT_OVERWRITE_OPERATION_TYPE))
+ .map(WriteOperationType.fromValue)
+ .orNull
+val isInsertOverwrite = operation == WriteOperationType.INSERT_OVERWRITE ||
+ operation == WriteOperationType.INSERT_OVERWRITE_TABLE ||
+ rowWriterOverwriteType == WriteOperationType.INSERT_OVERWRITE ||
+ rowWriterOverwriteType == WriteOperationType.INSERT_OVERWRITE_TABLE
+if (isNonBlockingConcurrencyControl && isInsertOverwrite) {
+ throw new HoodieException("Insert overwrite is not supported with
non-blocking concurrency control")
+}
+ }
+
+ /**
* @param partitions list of partitions that may contain wildcards
Review Comment:
Verified at 7c36e9ba: summary line and indent restored. Resolving.
--
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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
hudi-bot commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5462689968 ## CI report: * 502f8176dabbb4d32529a1157002b5255d62fb1b Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=16690) * 63ea3f8e04bdbdd72aa152624aa2141688c62740 UNKNOWN * 7c36e9ba40c3f2f54f2a4a0785dbb6b0d9d5 Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=16692) Bot commands @hudi-bot supports the following commands: - `@hudi-bot run azure` re-run the last Azure build -- 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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
hudi-bot commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5462665261 ## CI report: * 502f8176dabbb4d32529a1157002b5255d62fb1b Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=16690) * 63ea3f8e04bdbdd72aa152624aa2141688c62740 UNKNOWN * 7c36e9ba40c3f2f54f2a4a0785dbb6b0d9d5 UNKNOWN Bot commands @hudi-bot supports the following commands: - `@hudi-bot run azure` re-run the last Azure build -- 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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
voonhous commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5462649124 @Joy-2000 verified all of the above at 7c36e9ba and resolved the threads. Two notes: - `validate-pr` is red because the body's `### Change Logs` heading needs to be `### Summary and Changelog`; the compliance script looks for that exact section between the problem statement and `### Impact`. - The row writer does reach `preWrite`: `bulkInsertAsRow` calls `startCommit`, then `executor.execute` -> `preExecute` -> `preWrite`. So the backstop fires there too (after the instant is requested, which is why the early `HoodieSparkSqlWriter` guard is still worth keeping), and it now also catches `BUCKET_RESCALE` under NB-CC through the inherited `INSERT_OVERWRITE` op type. -- 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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
voonhous commented on code in PR #19791:
URL: https://github.com/apache/hudi/pull/19791#discussion_r3886681279
##
hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/table/ITTestHoodieDataSource.java:
##
@@ -1468,6 +1469,48 @@ void testInsertOverwrite(String indexType,
HoodieTableType tableType) {
assertRowsEquals(result5, expected);
}
+ @Test
+ void testInsertOverwriteWithNonBlockingConcurrencyControlThrows() {
+TableEnvironment tableEnv = batchTableEnv;
+// MOR + simple bucket index + non-blocking concurrency control.
+String hoodieTableDDL = sql("t1")
+.option(FlinkOptions.PATH, tempFile.getAbsolutePath())
+.options(getDefaultKeys())
+.option(FlinkOptions.TABLE_TYPE, FlinkOptions.TABLE_TYPE_MERGE_ON_READ)
+.option(FlinkOptions.INDEX_TYPE, HoodieIndex.IndexType.BUCKET.name())
+.option(FlinkOptions.BUCKET_INDEX_NUM_BUCKETS, 1)
+.option(HoodieWriteConfig.WRITE_CONCURRENCY_MODE.key(),
+WriteConcurrencyMode.NON_BLOCKING_CONCURRENCY_CONTROL.name())
+.end();
+tableEnv.executeSql(hoodieTableDDL);
+
+// Whole-table overwrite resolves to INSERT_OVERWRITE_TABLE
+final String overwriteTable = "insert overwrite t1 values\n"
++ "('id1','Danny',24,TIMESTAMP '1970-01-01 00:00:01', 'par1')\n";
+// static-partition overwrite resolves to INSERT_OVERWRITE
+final String overwriteStaticPartition = "insert overwrite t1
partition(`partition`='par1') values\n"
++ "('id1','Danny',24,TIMESTAMP '1970-01-01 00:00:01')\n";
+// dynamic-partition overwrite resolves to INSERT_OVERWRITE
+final String overwriteDynamicPartition = "insert overwrite t1
partition(`partition`='par1') values\n"
++ "('id1','Danny',24,TIMESTAMP '1970-01-01 00:00:01')\n";
+
+for (String overwriteSql : new String[] {overwriteTable,
overwriteStaticPartition, overwriteDynamicPartition}) {
+ Throwable thrown = assertThrows(Throwable.class, () ->
tableEnv.executeSql(overwriteSql));
+ assertTrue(exceptionChainContains(thrown,
+ "Insert overwrite is not supported with non-blocking concurrency
control"),
+ "Unexpected exception: " + thrown);
+}
+ }
+
+ private static boolean exceptionChainContains(Throwable thrown, String
message) {
Review Comment:
Verified at 7c36e9ba: `ExceptionUtils.findThrowableWithMessage`, helper
dropped. Resolving.
--
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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
hudi-bot commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5462640344 ## CI report: * 502f8176dabbb4d32529a1157002b5255d62fb1b Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=16690) * 63ea3f8e04bdbdd72aa152624aa2141688c62740 UNKNOWN Bot commands @hudi-bot supports the following commands: - `@hudi-bot run azure` re-run the last Azure build -- 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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
voonhous commented on code in PR #19791:
URL: https://github.com/apache/hudi/pull/19791#discussion_r3886679111
##
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieSparkSqlWriter.scala:
##
@@ -617,8 +618,29 @@ class HoodieSparkSqlWriterInternal {
}
/**
- * Resolve wildcards in partitions
+ * Reject insert overwrite combined with non-blocking concurrency control.
*
+ * Insert overwrite reuses the deterministic bucket file id under
non-blocking concurrency
+ * control, but the replace commit records that same file id as replaced.
The file system view
+ * hides a replaced file group by file id (ignoring the replace instant), so
the freshly
+ * overwritten data would become invisible. Reject the combination to avoid
data loss.
+ */
+ private def validateNonBlockingConcurrencyControl(hoodieConfig:
HoodieConfig, operation: WriteOperationType): Unit = {
+val isNonBlockingConcurrencyControl =
WriteConcurrencyMode.isNonBlockingConcurrencyControl(
+
hoodieConfig.getStringOrDefault(HoodieWriteConfig.WRITE_CONCURRENCY_MODE))
+val rowWriterOverwriteType =
Option(hoodieConfig.getString(HoodieInternalConfig.BULKINSERT_OVERWRITE_OPERATION_TYPE))
+ .map(WriteOperationType.fromValue)
+ .orNull
+val isInsertOverwrite = operation == WriteOperationType.INSERT_OVERWRITE ||
Review Comment:
Resolving: `BUCKET_RESCALE` is still exempt from this early guard, but
`DatasetBucketRescaleCommitActionExecutor.preExecute` calls `super`, which
reaches `preWrite` with the inherited `INSERT_OVERWRITE`, so the backstop now
rejects rescale under NB-CC (after `startCommit`, before the hashing config is
saved). Good enough for this PR.
##
hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/table/ITTestHoodieDataSource.java:
##
@@ -1468,6 +1469,48 @@ void testInsertOverwrite(String indexType,
HoodieTableType tableType) {
assertRowsEquals(result5, expected);
}
+ @Test
+ void testInsertOverwriteWithNonBlockingConcurrencyControlThrows() {
+TableEnvironment tableEnv = batchTableEnv;
+// MOR + simple bucket index + non-blocking concurrency control.
+String hoodieTableDDL = sql("t1")
+.option(FlinkOptions.PATH, tempFile.getAbsolutePath())
+.options(getDefaultKeys())
+.option(FlinkOptions.TABLE_TYPE, FlinkOptions.TABLE_TYPE_MERGE_ON_READ)
+.option(FlinkOptions.INDEX_TYPE, HoodieIndex.IndexType.BUCKET.name())
+.option(FlinkOptions.BUCKET_INDEX_NUM_BUCKETS, 1)
+.option(HoodieWriteConfig.WRITE_CONCURRENCY_MODE.key(),
+WriteConcurrencyMode.NON_BLOCKING_CONCURRENCY_CONTROL.name())
+.end();
+tableEnv.executeSql(hoodieTableDDL);
+
+// Whole-table overwrite resolves to INSERT_OVERWRITE_TABLE
+final String overwriteTable = "insert overwrite t1 values\n"
++ "('id1','Danny',24,TIMESTAMP '1970-01-01 00:00:01', 'par1')\n";
+// static-partition overwrite resolves to INSERT_OVERWRITE
+final String overwriteStaticPartition = "insert overwrite t1
partition(`partition`='par1') values\n"
++ "('id1','Danny',24,TIMESTAMP '1970-01-01 00:00:01')\n";
+// dynamic-partition overwrite resolves to INSERT_OVERWRITE
+final String overwriteDynamicPartition = "insert overwrite t1
partition(`partition`='par1') values\n"
++ "('id1','Danny',24,TIMESTAMP '1970-01-01 00:00:01')\n";
Review Comment:
Verified at 7c36e9ba: dynamic leg uses the `OPTIONS` hint. Resolving.
--
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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
voonhous commented on code in PR #19791:
URL: https://github.com/apache/hudi/pull/19791#discussion_r3886678158
##
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/ProvidesHoodieConfig.scala:
##
@@ -232,23 +232,23 @@ trait ProvidesHoodieConfig extends Logging {
}
)
-val overwriteTableOpts = if
(operation.equals(BULK_INSERT_OPERATION_OPT_VAL)) {
+val overwriteTableOpts = if
(operation.equalsIgnoreCase(BULK_INSERT_OPERATION_OPT_VAL)) {
Review Comment:
Verified at 7c36e9ba: `operation` lower-cased once with `Locale.ROOT` in
both `buildHoodieInsertConfig` and `deduceOverwriteConfig`, comparisons back to
`equals`. Resolving.
##
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/dml/insert/TestInsertTable5.scala:
##
@@ -358,4 +358,80 @@ class TestInsertTable5 extends HoodieSparkSqlTestBase {
}
}
}
+
+ test("Test Insert Overwrite With Non Blocking Concurrency Control Is
Rejected") {
+Seq("INSERT_OVERWRITE", "INSERT_OVERWRITE_TABLE").foreach { operation =>
+ withSQLConf(
+"hoodie.write.concurrency.mode" -> "NON_BLOCKING_CONCURRENCY_CONTROL",
+"hoodie.datasource.write.operation" -> operation
+ ) {
+withTempDir { tmp =>
+ withTable(generateTableName) { tableName =>
+val tablePath = s"""${tmp.getCanonicalPath}/$tableName"""
+spark.sql(
+ s"""
+ |create table $tableName (
+ | id int,
+ | name string,
+ | price double,
+ | ts long
+ |) using hudi
+ | tblproperties (
+ | primaryKey = 'id',
+ | type = 'mor',
+ | preCombineField = 'ts',
+ | hoodie.index.type = 'BUCKET',
+ | hoodie.index.bucket.engine = 'SIMPLE',
+ | hoodie.bucket.index.hash.field = 'id',
+ | hoodie.bucket.index.num.buckets = 1)
+ | location '${tablePath}'
+ | """.stripMargin)
+
+checkExceptionContain(
+ s"""insert into $tableName values
+ | (1, 'a1', 10, 1000)
+ | """.stripMargin)(
+ "Insert overwrite is not supported with non-blocking concurrency
control")
+ }
+}
+ }
+}
+ }
+
+ test("Test Insert Overwrite (bulk_insert mode) With Non Blocking Concurrency
Control Is Rejected") {
+withSQLConf(
+ "hoodie.write.concurrency.mode" -> "NON_BLOCKING_CONCURRENCY_CONTROL",
+ "hoodie.datasource.write.operation" -> "BULK_INSERT"
Review Comment:
Verified at 7c36e9ba: `TestInsertTable3` "Test Insert Overwrite Bucket Index
Table" now loops `bulk_insert`/`BULK_INSERT` and asserts replacement. nit: its
comment attributes the old append to `deduceOverwriteConfig`; it was the
`equals` in `buildHoodieInsertConfig`. Resolving.
--
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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
voonhous commented on code in PR #19791:
URL: https://github.com/apache/hudi/pull/19791#discussion_r3886677396
##
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/HoodieTableSink.java:
##
@@ -79,6 +79,10 @@ public HoodieTableSink(Configuration conf, ResolvedSchema
schema, boolean overwr
public SinkRuntimeProvider getSinkRuntimeProvider(Context context) {
return (DataStreamSinkProviderAdapter) dataStream -> {
+ // validate the finalized write operation (after #applyOverwrite /
#applyStaticPartition)
+ // before any table initialization takes place.
+ OptionsResolver.checkNonBlockingConcurrencyControl(conf);
Review Comment:
Verified at 7c36e9ba: single call at the top of
`Pipelines.hoodieStreamWrite`, sink and V2 copies removed. Resolving.
##
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieSparkSqlWriter.scala:
##
@@ -617,8 +618,29 @@ class HoodieSparkSqlWriterInternal {
}
/**
- * Resolve wildcards in partitions
+ * Reject insert overwrite combined with non-blocking concurrency control.
*
+ * Insert overwrite reuses the deterministic bucket file id under
non-blocking concurrency
+ * control, but the replace commit records that same file id as replaced.
The file system view
+ * hides a replaced file group by file id (ignoring the replace instant), so
the freshly
+ * overwritten data would become invisible. Reject the combination to avoid
data loss.
+ */
+ private def validateNonBlockingConcurrencyControl(hoodieConfig:
HoodieConfig, operation: WriteOperationType): Unit = {
Review Comment:
Verified at 7c36e9ba: `preWrite` now rejects NB-CC + `isOverwrite` before
`setOperationType`; covers `StreamSync` and, via
`BaseDatasetBulkInsertCommitActionExecutor.preExecute`, the row writer too.
Resolving.
--
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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
Joy-2000 commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5462570015 Thanks for the detailed review @voonhous — all points addressed. Summary below. **Engine-agnostic backstop.** You're right that the per-engine guards left the Hudi Streamer path exposed. I moved the real safety net down to `BaseHoodieWriteClient#preWrite` — the single chokepoint every overwrite entry point funnels through — keyed on `config.getWriteConcurrencyMode().isNonBlockingConcurrencyControl() && WriteOperationType.isOverwrite(writeOperationType)`. The per-engine checks (Spark `HoodieSparkSqlWriter`, Flink `OptionsResolver`) are kept only to fail fast with a friendlier message; they're no longer load-bearing. **Flink single funnel.** Consolidated the check to the top of `Pipelines#hoodieStreamWrite`, which the table sink, the Flink Streamer (`--op insert_overwrite`), and Sink V2 all pass through, and removed the duplicated checks from `HoodieTableSink` and `PipelinesV2`. This closes the `HoodieFlinkStreamer` gap you flagged. **Message literal → one validator.** Went a step further than hoisting the string: the whole rule now lives in one place — `WriteConcurrencyMode.checkInsertOverwriteSupported(isNbcc, isOverwrite)` — which owns both the message constant and the thrown type. All four sites route through it: `preWrite`, `HoodieSparkSqlWriter`, `OptionsResolver`, and the pre-existing `BaseSparkBucketIndexBucketInfoGetter` partitioner check. This also **unifies the exception type to `HoodieException`** everywhere — the Flink `OptionsResolver` and the partitioner previously threw `IllegalArgumentException` via `ValidationUtils.checkArgument`, which was the inconsistency you flagged. (Tests match on message, and the Flink IT / `ITTestHoodieDataSource` use `findThrowableWithMessage`, so they stay green; I updated the one `TestOptionsResolver` assertion that pinned `IllegalArgumentException`.) The call sites themselves can't be collapsed — `bulkInsertAsRow` calls `writeClient.startCommit` directl y and bypasses `preWrite`, so each entry point still needs its own guard — but they now share a single source of truth for the rule. **Enum + Locale.** Added the restriction clause to the `@EnumFieldDescription` on `NON_BLOCKING_CONCURRENCY_CONTROL`, and fixed `isNonBlockingConcurrencyControl(String)` to use `Locale.ROOT` like its sibling. **Case sensitivity.** Both `sparkSqlInsertIntoOperation` and `deduceOverwriteConfig` now lower-case the operation once with `Locale.ROOT` (the `deduceOverwriteConfig` one is the dangerous path you noted — uppercase could otherwise delete the table path). **scaladoc / ExceptionUtils.** Restored the `resolvePartitionWildcards` summary line, and the Flink IT now uses `ExceptionUtils.findThrowableWithMessage(...)` instead of the hand-rolled walker. **Tests** (moved to their conventional home in `TestInsertTable3`): - Positive routing: added an uppercase leg to `Test Insert Overwrite Bucket Index Table`, so `BULK_INSERT` still replaces rows instead of silently appending. - NBCC rejection: one consolidated test that explicitly pins `hoodie.datasource.write.operation` to each overwrite variant (`insert_overwrite` / `insert_overwrite_table`) × row-writer bulk_insert off/on, and asserts the **active timeline is empty** after failure — red against the old late partitioner check, proving we now fail before `startCommit`. - Dropped the redundant `ITTestDataStreamV2Write` mini-cluster test (the check moved to `hoodieStreamWrite`, and `TestOptionsResolver` already pins it). - Guard precision: added `TestWriteConcurrencyMode` in hudi-common — a direct unit test of the shared `checkInsertOverwriteSupported` validator, asserting both overwrite variants are rejected under NB-CC and every non-overwrite operation (e.g. `insert into` / upsert) still passes, so the guard can't over-block appends. **Description.** Updated to state that the Spark RDD path already rejected this since HUDI-8866 (`BaseSparkBucketIndexBucketInfoGetter`), and that this PR adds (a) failing *before* `initTable`/`startCommit`, and (b) covering the row-writer bulk_insert overwrite path — so the partitioner check isn't read as missed. **On the broader invariant.** Fully agree with you: the real invariant is *a fixed-id file group must never be listed in a replacecommit*, and `delete_partition` + re-insert hits the same trap. I've called this out in the description. I intentionally scoped **this** PR to `insert overwrite` as a narrow fail-early guard — `isOverwrite(...)` deliberately excludes `DELETE_PARTITION`, since a standalone `delete_partition` under NB-CC is valid and loses no data, so blanket-rejecting it would be a regression. The proper fix (bumping the `-0` generation in `newBucketFileIdForNBCC` on replace, so re-inserts land on a fresh id) is a larger change with its own
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
hudi-bot commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5462042671 ## CI report: * 502f8176dabbb4d32529a1157002b5255d62fb1b Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=16690) Bot commands @hudi-bot supports the following commands: - `@hudi-bot run azure` re-run the last Azure build -- 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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
voonhous commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5461872342 The existing Spark check is a drive-by from HUDI-8866 (`a93c6eec6788`): once each NB-CC bucket got one fixed file id, overwrite had no valid choice (the fixed id collides with the replaced group, a random id splits the bucket), so it was rejected, untested. The invariant is broader than insert overwrite: `delete_partition` then re-insert (`SparkDeletePartitionCommitActionExecutor.java:66`) hides data the same way. Could the description state "a fixed-id file group must never be listed in a replacecommit", and is bumping the `-0` generation in `newBucketFileIdForNBCC` on replace the root fix worth tracking instead of per-operation guards? -- 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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
voonhous commented on code in PR #19791:
URL: https://github.com/apache/hudi/pull/19791#discussion_r3886286226
##
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/HoodieTableSink.java:
##
@@ -79,6 +79,10 @@ public HoodieTableSink(Configuration conf, ResolvedSchema
schema, boolean overwr
public SinkRuntimeProvider getSinkRuntimeProvider(Context context) {
return (DataStreamSinkProviderAdapter) dataStream -> {
+ // validate the finalized write operation (after #applyOverwrite /
#applyStaticPartition)
+ // before any table initialization takes place.
+ OptionsResolver.checkNonBlockingConcurrencyControl(conf);
Review Comment:
This misses `HoodieFlinkStreamer --op insert_overwrite`: it calls
`Pipelines.bootstrap` + `Pipelines.hoodieStreamWrite` directly
(`HoodieFlinkStreamer.java:107-108`) and never passes through
`HoodieTableSink`, and Flink has no partitioner-level backstop like Spark's, so
that path still loses data. `PipelinesV2.sink` also has no production caller,
so the V2 copy is unreachable today. Could we move the single call to the top
of `Pipelines.hoodieStreamWrite`, which all three callers funnel through
(`HoodieTableSink:130`, `PipelinesV2:135`, `HoodieFlinkStreamer:108`), beside
the consistent-hashing overwrite rejection at `Pipelines.java:578-581`?
##
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/ProvidesHoodieConfig.scala:
##
@@ -232,23 +232,23 @@ trait ProvidesHoodieConfig extends Logging {
}
)
-val overwriteTableOpts = if
(operation.equals(BULK_INSERT_OPERATION_OPT_VAL)) {
+val overwriteTableOpts = if
(operation.equalsIgnoreCase(BULK_INSERT_OPERATION_OPT_VAL)) {
Review Comment:
`deduceOverwriteConfig` (`:345-346`) still compares case-sensitively, with a
worse outcome: `hoodie.datasource.write.operation=INSERT_OVERWRITE` (uppercase)
plus `insert overwrite t values (...)` on a partitioned table makes
`isOverwriteOperation` false, so `isStaticOverwrite` and `isOverWriteTable`
turn true, the mode becomes `SaveMode.Overwrite`, and `handleSaveModes` deletes
the table path (`HoodieSparkSqlWriter.scala:925-930`); lowercase gives
`SaveMode.Append` and a dynamic partition overwrite. Since
`WriteOperationType.fromValue` accepts any case, could we lower-case
`operation` once (`Locale.ROOT`) in both methods instead of converting
comparisons one at a time?
##
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieSparkSqlWriter.scala:
##
@@ -617,8 +618,29 @@ class HoodieSparkSqlWriterInternal {
}
/**
- * Resolve wildcards in partitions
+ * Reject insert overwrite combined with non-blocking concurrency control.
*
+ * Insert overwrite reuses the deterministic bucket file id under
non-blocking concurrency
+ * control, but the replace commit records that same file id as replaced.
The file system view
+ * hides a replaced file group by file id (ignoring the replace instant), so
the freshly
+ * overwritten data would become invisible. Reject the combination to avoid
data loss.
+ */
+ private def validateNonBlockingConcurrencyControl(hoodieConfig:
HoodieConfig, operation: WriteOperationType): Unit = {
Review Comment:
Every overwrite entry point on every engine reaches
`BaseHoodieWriteClient.preWrite` with the overwrite op:
`SparkRDDWriteClient:258,274`, `HoodieFlinkWriteClient:294,307`, and the row
writer via `BaseDatasetBulkInsertCommitActionExecutor:86`
(`getWriteOperationType()` is `INSERT_OVERWRITE`). Hudi Streamer
(`StreamSync.java:1118-1124`) bypasses this writer and today only fails via the
partitioner check, after the requested and inflight replacecommit and the
workload-profile shuffle. Could we add
`config.isNonBlockingConcurrencyControl() &&
WriteOperationType.isOverwrite(writeOperationType)` to `preWrite` as the
engine-agnostic backstop, keeping this guard and the Flink one for the early,
clean-timeline error?
##
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/dml/insert/TestInsertTable5.scala:
##
@@ -358,4 +358,80 @@ class TestInsertTable5 extends HoodieSparkSqlTestBase {
}
}
}
+
+ test("Test Insert Overwrite With Non Blocking Concurrency Control Is
Rejected") {
Review Comment:
This test passes on master without the `HoodieSparkSqlWriter` change:
`insert into` with the forced op takes the RDD path, where
`BaseSparkBucketIndexBucketInfoGetter.java:40-42` already throws the
byte-identical message, and `checkExceptionContain` matches it via root cause
(`HoodieSparkSqlTestBase.scala:241`). The behavioural delta of the new guard is
that nothing lands on the timeline; the old check fires after the requested and
inflight replacecommit. Could we use plain `insert overwrite $tableName` here
(the DML users actually run, currently untested) and assert
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
Joy-2000 commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5461679545 @voonhous Yeah, non-blocking concurrency control requires the MOR table with simple bucket index. -- 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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
voonhous commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5461610707 +1 on this to fail loudly. IIUC, this is only relevant to simple bucket index right? -- 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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
codecov-commenter commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5461566394 ## [Codecov](https://app.codecov.io/gh/apache/hudi/pull/19791?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report :white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 78.06%. Comparing base ([`816bd96`](https://app.codecov.io/gh/apache/hudi/commit/816bd96a583c29aafa18982ab8d30187eb48490a?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`502f817`](https://app.codecov.io/gh/apache/hudi/commit/502f8176dabbb4d32529a1157002b5255d62fb1b?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)). :warning: Report is 4 commits behind head on master. Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #19791 +/- ## - Coverage 78.14% 78.06% -0.09% - Complexity3369234001 +309 Files 2540 2541 +1 Lines141413 142909+1496 Branches 1712317220 +97 + Hits 110513 111560+1047 - Misses2320023619 +419 - Partials 7700 7730 +30 ``` | [Components](https://app.codecov.io/gh/apache/hudi/pull/19791/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | | |---|---|---| | [hudi-common](https://app.codecov.io/gh/apache/hudi/pull/19791/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `83.50% <ø> (-0.09%)` | :arrow_down: | | [hudi-client](https://app.codecov.io/gh/apache/hudi/pull/19791/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `82.61% <ø> (-0.54%)` | :arrow_down: | | [hudi-flink](https://app.codecov.io/gh/apache/hudi/pull/19791/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `85.65% <ø> (ø)` | | | [hudi-spark-datasource](https://app.codecov.io/gh/apache/hudi/pull/19791/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `72.70% <ø> (+<0.01%)` | :arrow_up: | | [hudi-utilities](https://app.codecov.io/gh/apache/hudi/pull/19791/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `74.51% <ø> (ø)` | | | [hudi-cli](https://app.codecov.io/gh/apache/hudi/pull/19791/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `15.06% <ø> (ø)` | | | [hudi-hadoop](https://app.codecov.io/gh/apache/hudi/pull/19791/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `70.13% <ø> (+0.02%)` | :arrow_up: | | [hudi-sync](https://app.codecov.io/gh/apache/hudi/pull/19791/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `75.54% <ø> (ø)` | | | [hudi-io](https://app.codecov.io/gh/apache/hudi/pull/19791/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `79.90% <ø> (+0.14%)` | :arrow_up: | | [hudi-timeline-service](https://app.codecov.io/gh/apache/hudi/pull/19791/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `83.54% <ø> (ø)` | | | [hudi-cloud](https://app.codecov.io/gh/apache/hudi/pull/19791/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `65.81% <ø> (ø)` | | | [hudi-kafka-connect](https://app.codecov.io/gh/apache/hudi/pull/19791/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `53.20% <ø> (ø)` | | | [Flag](https://app.codecov.io/gh/apache/hudi/pull/19791/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | | |---|---|---| |
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
hudi-bot commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5461563800 ## CI report: * 502f8176dabbb4d32529a1157002b5255d62fb1b Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=16690) Bot commands @hudi-bot supports the following commands: - `@hudi-bot run azure` re-run the last Azure build -- 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]
Re: [PR] fix(nbcc): reject insert overwrite combined with non-blocking concurrency control [hudi]
hudi-bot commented on PR #19791: URL: https://github.com/apache/hudi/pull/19791#issuecomment-5461541064 ## CI report: * 502f8176dabbb4d32529a1157002b5255d62fb1b UNKNOWN Bot commands @hudi-bot supports the following commands: - `@hudi-bot run azure` re-run the last Azure build -- 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]
