You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fluss.apache.org by "zuston (via GitHub)" <gi...@apache.org> on 2026/05/15 09:27:47 UTC
[PR] [kv] Treat full-schema partial writes as full row for DefaultRowMerger [fluss]
zuston opened a new pull request, #3325:
URL: https://github.com/apache/fluss/pull/3325
### Purpose
Linked issue: close #xxx
Upper-layer frameworks sometimes route every upsert through `UpsertWriter` partial-update APIs even when all columns are provided. That forced the `PartialUpdateRowMerger` path and prevented WAL optimizations that depend on DefaultRowMerger, producing excessive RocksDB gets and slowing tablet RPC.
When targetColumns covers every index of the latest schema, behave like null target columns and keep plain DefaultRowMerger semantics.
### Brief change log
<!-- Please describe the changes made in this pull request and explain how they address the issue -->
### Tests
<!-- List UT and IT cases to verify this change -->
### API and Format
<!-- Does this change affect API or storage format -->
### Documentation
<!-- Does this change introduce a new feature -->
--
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: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [kv] Treat full-schema partial writes as full row for DefaultRowMerger [fluss]
Posted by "luoyuxia (via GitHub)" <gi...@apache.org>.
luoyuxia commented on code in PR #3325:
URL: https://github.com/apache/fluss/pull/3325#discussion_r3316503571
##########
fluss-server/src/test/java/org/apache/fluss/server/kv/rowmerger/DefaultRowMergerTest.java:
##########
@@ -94,9 +94,10 @@ void testDefaultRowMerger(DeleteBehavior deleteBehavior) {
void testPartialUpdateRowMergerDeleteBehavior(DeleteBehavior deleteBehavior) {
DefaultRowMerger merger = new DefaultRowMerger(KvFormat.COMPACTED, deleteBehavior);
- // Configure for partial update (only name column)
+ // Explicit full schema ({id, name}) matches plain merger behavior (same as null targets).
RowMerger partialMerger =
Review Comment:
+1
##########
fluss-server/src/test/java/org/apache/fluss/server/kv/rowmerger/DefaultRowMergerTest.java:
##########
@@ -94,9 +94,10 @@ void testDefaultRowMerger(DeleteBehavior deleteBehavior) {
void testPartialUpdateRowMergerDeleteBehavior(DeleteBehavior deleteBehavior) {
DefaultRowMerger merger = new DefaultRowMerger(KvFormat.COMPACTED, deleteBehavior);
- // Configure for partial update (only name column)
+ // Explicit full schema ({id, name}) matches plain merger behavior (same as null targets).
RowMerger partialMerger =
Review Comment:
+1
--
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: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [kv] Treat full-schema partial writes as full row for DefaultRowMerger [fluss]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #3325:
URL: https://github.com/apache/fluss/pull/3325#discussion_r3298138598
##########
fluss-server/src/main/java/org/apache/fluss/server/kv/TargetColumns.java:
##########
@@ -0,0 +1,55 @@
+/*
+ * 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.fluss.server.kv;
+
+import org.apache.fluss.metadata.Schema;
+
+import java.util.BitSet;
+
+import static org.apache.fluss.utils.Preconditions.checkNotNull;
+
+/** Helpers for interpreting KV write {@code targetColumns}. */
+public final class TargetColumns {
+
+ private TargetColumns() {}
+
+ /**
+ * Returns {@code true} when {@code targetColumns} specifies every row field index of {@code
+ * schema} (each index in {@code [0, fieldCount)} appears at least once, with no index outside
+ * that range).
+ *
+ * <p>In that case the write is equivalent to a full-row upsert for merge-engine purposes even
+ * if the client passed an explicit column array instead of {@code null}.
+ */
+ public static boolean specifiesAllSchemaFieldIndexes(Schema schema, int[] targetColumns) {
+ checkNotNull(schema, "schema");
+ checkNotNull(targetColumns, "targetColumns");
+ int fieldCount = schema.getRowType().getFieldCount();
+ if (fieldCount == 0) {
+ return targetColumns.length == 0;
+ }
Review Comment:
`specifiesAllSchemaFieldIndexes` always allocates a BitSet and iterates `targetColumns`. Since it can’t possibly cover all fields when `targetColumns.length < fieldCount`, consider an early return in that case to avoid extra allocation/work.
##########
fluss-server/src/test/java/org/apache/fluss/server/kv/rowmerger/DefaultRowMergerTest.java:
##########
@@ -94,9 +94,10 @@ void testDefaultRowMerger(DeleteBehavior deleteBehavior) {
void testPartialUpdateRowMergerDeleteBehavior(DeleteBehavior deleteBehavior) {
DefaultRowMerger merger = new DefaultRowMerger(KvFormat.COMPACTED, deleteBehavior);
- // Configure for partial update (only name column)
+ // Explicit full schema ({id, name}) matches plain merger behavior (same as null targets).
RowMerger partialMerger =
Review Comment:
This test now verifies both the “explicit full schema targets behave like null” path and a true partial-update path after a schema change. Consider renaming/splitting the test so the method name reflects the behaviors being asserted (it’s no longer purely a partial-update merger test).
--
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: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [kv] Treat full-schema partial writes as full row for DefaultRowMerger [fluss]
Posted by "luoyuxia (via GitHub)" <gi...@apache.org>.
luoyuxia merged PR #3325:
URL: https://github.com/apache/fluss/pull/3325
--
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: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [kv] Treat full-schema partial writes as full row for DefaultRowMerger [fluss]
Posted by "luoyuxia (via GitHub)" <gi...@apache.org>.
luoyuxia commented on code in PR #3325:
URL: https://github.com/apache/fluss/pull/3325#discussion_r3316500897
##########
fluss-server/src/main/java/org/apache/fluss/server/kv/TargetColumns.java:
##########
@@ -0,0 +1,55 @@
+/*
+ * 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.fluss.server.kv;
+
+import org.apache.fluss.metadata.Schema;
+
+import java.util.BitSet;
+
+import static org.apache.fluss.utils.Preconditions.checkNotNull;
+
+/** Helpers for interpreting KV write {@code targetColumns}. */
+public final class TargetColumns {
+
+ private TargetColumns() {}
+
+ /**
+ * Returns {@code true} when {@code targetColumns} specifies every row field index of {@code
+ * schema} (each index in {@code [0, fieldCount)} appears at least once, with no index outside
+ * that range).
+ *
+ * <p>In that case the write is equivalent to a full-row upsert for merge-engine purposes even
+ * if the client passed an explicit column array instead of {@code null}.
+ */
+ public static boolean specifiesAllSchemaFieldIndexes(Schema schema, int[] targetColumns) {
+ checkNotNull(schema, "schema");
+ checkNotNull(targetColumns, "targetColumns");
+ int fieldCount = schema.getRowType().getFieldCount();
+ if (fieldCount == 0) {
+ return targetColumns.length == 0;
+ }
Review Comment:
+1
--
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: issues-unsubscribe@fluss.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org