You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by sa...@apache.org on 2024/01/08 08:24:38 UTC
(pinot) branch master updated: Fix upsert tenant tag override check (#12233)
This is an automated email from the ASF dual-hosted git repository.
saurabhd336 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 388d394c7f Fix upsert tenant tag override check (#12233)
388d394c7f is described below
commit 388d394c7f2335c7958934805f556cf36d39ffda
Author: Saurabh Dubey <sa...@gmail.com>
AuthorDate: Mon Jan 8 13:54:31 2024 +0530
Fix upsert tenant tag override check (#12233)
Co-authored-by: Saurabh Dubey <sa...@Saurabhs-MacBook-Pro.local>
---
.../pinot/segment/local/utils/TableConfigUtils.java | 7 +++++--
.../pinot/segment/local/utils/TableConfigUtilsTest.java | 16 +++++++++++++++-
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/TableConfigUtils.java b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/TableConfigUtils.java
index 188f17e733..93aa057ecd 100644
--- a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/TableConfigUtils.java
+++ b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/TableConfigUtils.java
@@ -29,6 +29,7 @@ import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@@ -705,8 +706,10 @@ public final class TableConfigUtils {
Preconditions.checkState(
tableConfig.getRoutingConfig() != null && isRoutingStrategyAllowedForUpsert(tableConfig.getRoutingConfig()),
"Upsert/Dedup table must use strict replica-group (i.e. strictReplicaGroup) based routing");
- Preconditions.checkState(tableConfig.getTenantConfig().getTagOverrideConfig() == null,
- "Upsert/Dedup table cannot use tenant tag override");
+ Preconditions.checkState(tableConfig.getTenantConfig().getTagOverrideConfig() == null || (Objects.equals(
+ tableConfig.getTenantConfig().getTagOverrideConfig().getRealtimeConsuming(),
+ tableConfig.getTenantConfig().getTagOverrideConfig().getRealtimeCompleted())),
+ "Invalid tenant tag override used for Upsert/Dedup table");
// specifically for upsert
UpsertConfig upsertConfig = tableConfig.getUpsertConfig();
diff --git a/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/utils/TableConfigUtilsTest.java b/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/utils/TableConfigUtilsTest.java
index dfdd8ccade..1cc6f3d2b5 100644
--- a/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/utils/TableConfigUtilsTest.java
+++ b/pinot-segment-local/src/test/java/org/apache/pinot/segment/local/utils/TableConfigUtilsTest.java
@@ -1674,9 +1674,23 @@ public class TableConfigUtilsTest {
TableConfigUtils.validateUpsertAndDedupConfig(tableConfig, schema);
Assert.fail("Tag override must not be allowed with upsert");
} catch (IllegalStateException e) {
- Assert.assertEquals(e.getMessage(), "Upsert/Dedup table cannot use tenant tag override");
+ Assert.assertEquals(e.getMessage(), "Invalid tenant tag override used for Upsert/Dedup table");
}
+ // valid tag override with upsert
+ tableConfig = new TableConfigBuilder(TableType.REALTIME).setTableName(TABLE_NAME).setTimeColumnName(TIME_COLUMN)
+ .setUpsertConfig(new UpsertConfig(UpsertConfig.Mode.FULL)).setStreamConfigs(getStreamConfigs())
+ .setRoutingConfig(new RoutingConfig(null, null, RoutingConfig.STRICT_REPLICA_GROUP_INSTANCE_SELECTOR_TYPE))
+ .setTagOverrideConfig(new TagOverrideConfig("T1_REALTIME", "T1_REALTIME")).build();
+ TableConfigUtils.validateUpsertAndDedupConfig(tableConfig, schema);
+
+ // empty tag override with upsert should pass
+ tableConfig = new TableConfigBuilder(TableType.REALTIME).setTableName(TABLE_NAME).setTimeColumnName(TIME_COLUMN)
+ .setUpsertConfig(new UpsertConfig(UpsertConfig.Mode.FULL)).setStreamConfigs(getStreamConfigs())
+ .setRoutingConfig(new RoutingConfig(null, null, RoutingConfig.STRICT_REPLICA_GROUP_INSTANCE_SELECTOR_TYPE))
+ .setTagOverrideConfig(new TagOverrideConfig(null, null)).build();
+ TableConfigUtils.validateUpsertAndDedupConfig(tableConfig, schema);
+
tableConfig = new TableConfigBuilder(TableType.REALTIME).setTableName(TABLE_NAME).setUpsertConfig(upsertConfig)
.setRoutingConfig(new RoutingConfig(null, null, RoutingConfig.STRICT_REPLICA_GROUP_INSTANCE_SELECTOR_TYPE))
.setStreamConfigs(streamConfigs).build();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org