You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "zstan (via GitHub)" <gi...@apache.org> on 2025/11/10 08:32:57 UTC
[PR] IGNITE-26488 Sql. Introduce configuration to override CREATE TABLE defaults for data staleness configuration [ignite-3]
zstan opened a new pull request, #6927:
URL: https://github.com/apache/ignite-3/pull/6927
Thank you for submitting the pull request.
To streamline the review process of the patch and ensure better code quality
we ask both an author and a reviewer to verify the following:
### The Review Checklist
- [ ] **Formal criteria:** TC status, codestyle, mandatory documentation. Also make sure to complete the following:
\- There is a single JIRA ticket related to the pull request.
\- The web-link to the pull request is attached to the JIRA ticket.
\- The JIRA ticket has the Patch Available state.
\- The description of the JIRA ticket explains WHAT was made, WHY and HOW.
\- The pull request title is treated as the final commit message. The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
- [ ] **Design:** new code conforms with the design principles of the components it is added to.
- [ ] **Patch quality:** patch cannot be split into smaller pieces, its size must be reasonable.
- [ ] **Code quality:** code is clean and readable, necessary developer documentation is added if needed.
- [ ] **Tests code quality:** test set covers positive/negative scenarios, happy/edge cases. Tests are effective in terms of execution time and resources.
### Notes
- [Apache Ignite Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Java+Code+Style+Guide)
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-26488 Sql. Introduce configuration to override CREATE TABLE defaults for data staleness configuration [ignite-3]
Posted by "zstan (via GitHub)" <gi...@apache.org>.
zstan commented on code in PR #6927:
URL: https://github.com/apache/ignite-3/pull/6927#discussion_r2536764318
##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/TestBuilders.java:
##########
@@ -696,6 +696,8 @@ public TestCluster build() {
Supplier<TableStatsStalenessConfiguration> statStalenessProperties = () -> new TableStatsStalenessConfiguration(
DEFAULT_STALE_ROWS_FRACTION, DEFAULT_MIN_STALE_ROWS_COUNT);
+ AbstractEventProducer<StatisticChangedEvent, StatisticEventParameters> producer = new AbstractEventProducer<>() {};
Review Comment:
changed to mock
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-26488 Sql. Introduce configuration to override CREATE TABLE defaults for data staleness configuration [ignite-3]
Posted by "korlov42 (via GitHub)" <gi...@apache.org>.
korlov42 commented on code in PR #6927:
URL: https://github.com/apache/ignite-3/pull/6927#discussion_r2533745161
##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/TestBuilders.java:
##########
@@ -696,6 +696,8 @@ public TestCluster build() {
Supplier<TableStatsStalenessConfiguration> statStalenessProperties = () -> new TableStatsStalenessConfiguration(
DEFAULT_STALE_ROWS_FRACTION, DEFAULT_MIN_STALE_ROWS_COUNT);
+ AbstractEventProducer<StatisticChangedEvent, StatisticEventParameters> producer = new AbstractEventProducer<>() {};
Review Comment:
why do we need this?
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/SqlQueryProcessor.java:
##########
@@ -293,9 +294,11 @@ public synchronized CompletableFuture<Void> startAsync(ComponentContext componen
var storageProfileValidator = new ClusterWideStorageProfileValidator(logicalTopologyService);
var nodeFilterValidator = new ClusterWideNodeFilterValidator(logicalTopologyService);
+ CreateTableDefaultsView tablePropertiesView = clusterCfg.createTable().value();
Review Comment:
now configuration is cached once during component start, update won't be visible. We move this _inside_ supplier's body
##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/prepare/ddl/DdlSqlToCommandConverterTest.java:
##########
@@ -870,6 +870,28 @@ public void testAlterColumnSetDefaultRejectUnsupportedDefault(String defaultExpr
() -> convert((SqlDdl) node, createContext()));
}
+ @Test
+ void createTableWithNonDefaultStalenessConfig() throws SqlParseException {
+ long staleRowsCount = DEFAULT_MIN_STALE_ROWS_COUNT / 2;
+ double staleRowsFraction = DEFAULT_STALE_ROWS_FRACTION / 2;
+
+ assert staleRowsCount != 0 && staleRowsFraction != 0.0d;
+
+ Supplier<TableStatsStalenessConfiguration> statStalenessProperties =
+ () -> new TableStatsStalenessConfiguration(staleRowsFraction, staleRowsCount);
+ converter = new DdlSqlToCommandConverter(storageProfiles -> completedFuture(null), filter -> completedFuture(null),
+ statStalenessProperties);
+
+ CatalogCommand cmd = convert("CREATE TABLE t (id INT PRIMARY KEY, val INT)");
+
+ mockCatalogSchemaAndZone("TEST_ZONE");
+
+ NewTableEntry newTable = invokeAndGetFirstEntry(cmd, NewTableEntry.class);
+
+ assertThat(newTable.descriptor().properties().minStaleRowsCount(), is(staleRowsCount));
+ assertThat(newTable.descriptor().properties().staleRowsFraction(), is(staleRowsFraction));
Review Comment:
let's also change values somehow and verify this chance is reflected in next table
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-26488 Sql. Introduce configuration to override CREATE TABLE defaults for data staleness configuration [ignite-3]
Posted by "korlov42 (via GitHub)" <gi...@apache.org>.
korlov42 commented on code in PR #6927:
URL: https://github.com/apache/ignite-3/pull/6927#discussion_r2537773125
##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/TestBuilders.java:
##########
@@ -696,6 +696,8 @@ public TestCluster build() {
Supplier<TableStatsStalenessConfiguration> statStalenessProperties = () -> new TableStatsStalenessConfiguration(
DEFAULT_STALE_ROWS_FRACTION, DEFAULT_MIN_STALE_ROWS_COUNT);
+ AbstractEventProducer<StatisticChangedEvent, StatisticEventParameters> producer = new AbstractEventProducer<>() {};
Review Comment:
missed that `producer` is actually passed as argument to construct the `PrepareServiceImpl`... Variant with mock looks good as well as initial one
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-26488 Sql. Introduce configuration to override CREATE TABLE defaults for data staleness configuration [ignite-3]
Posted by "korlov42 (via GitHub)" <gi...@apache.org>.
korlov42 commented on code in PR #6927:
URL: https://github.com/apache/ignite-3/pull/6927#discussion_r2513995358
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/configuration/distributed/TablePropertiesConfigurationSchema.java:
##########
@@ -0,0 +1,39 @@
+/*
+ * 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.ignite.internal.sql.configuration.distributed;
+
+import static org.apache.ignite.internal.catalog.commands.CatalogUtils.DEFAULT_MIN_STALE_ROWS_COUNT;
+import static org.apache.ignite.internal.catalog.commands.CatalogUtils.DEFAULT_STALE_ROWS_FRACTION;
+
+import org.apache.ignite.configuration.annotation.Config;
+import org.apache.ignite.configuration.annotation.Value;
+import org.apache.ignite.configuration.validation.Range;
+
+/** Configuration for table initialization properties. */
+@Config
+public class TablePropertiesConfigurationSchema {
Review Comment:
nitpick: I would rename this to more abstract scope like `CreateTableDefaultsConfigurationSchema`. I envision like one might refuse to add new entries to this class just because it won't belong to _table properties_
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/SqlQueryProcessor.java:
##########
@@ -287,7 +289,11 @@ public synchronized CompletableFuture<Void> startAsync(ComponentContext componen
var storageProfileValidator = new ClusterWideStorageProfileValidator(logicalTopologyService);
var nodeFilterValidator = new ClusterWideNodeFilterValidator(logicalTopologyService);
- var ddlSqlToCommandConverter = new DdlSqlToCommandConverter(storageProfileValidator, nodeFilterValidator);
+ Supplier<TableStatsStalenessConfiguration> stalenessProperties = () -> new TableStatsStalenessConfiguration(
+ clusterCfg.createTable().staleRowsFraction().value(),
+ clusterCfg.createTable().minStaleRowsCount().value());
Review Comment:
two invocation of `value()` returns two different views of configuration. In other words, this may result in properties combination which never exists (i.e. value of `staleRowsFraction` from one state and value of `minStaleRowsCount ` from another). It's better to get view from `createTable()` and then read necessary properties
##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/prepare/ddl/DdlSqlToCommandConverterTest.java:
##########
@@ -114,7 +117,10 @@ public class DdlSqlToCommandConverterTest extends AbstractDdlSqlToCommandConvert
@BeforeEach
void setUp() {
- converter = new DdlSqlToCommandConverter(storageProfiles -> completedFuture(null), filter -> completedFuture(null));
+ Supplier<TableStatsStalenessConfiguration> statStalenessProperties = () -> new TableStatsStalenessConfiguration(
+ DEFAULT_STALE_ROWS_FRACTION, DEFAULT_MIN_STALE_ROWS_COUNT);
+ converter = new DdlSqlToCommandConverter(storageProfiles -> completedFuture(null), filter -> completedFuture(null),
+ statStalenessProperties);
}
Review Comment:
please add tests to make sure `DdlSqlToCommandConverter` respects provided configuration
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-26488 Sql. Introduce configuration to override CREATE TABLE defaults for data staleness configuration [ignite-3]
Posted by "zstan (via GitHub)" <gi...@apache.org>.
zstan commented on code in PR #6927:
URL: https://github.com/apache/ignite-3/pull/6927#discussion_r2536766142
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/SqlQueryProcessor.java:
##########
@@ -293,9 +294,11 @@ public synchronized CompletableFuture<Void> startAsync(ComponentContext componen
var storageProfileValidator = new ClusterWideStorageProfileValidator(logicalTopologyService);
var nodeFilterValidator = new ClusterWideNodeFilterValidator(logicalTopologyService);
+ CreateTableDefaultsView tablePropertiesView = clusterCfg.createTable().value();
Review Comment:
done
##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/prepare/ddl/DdlSqlToCommandConverterTest.java:
##########
@@ -870,6 +870,28 @@ public void testAlterColumnSetDefaultRejectUnsupportedDefault(String defaultExpr
() -> convert((SqlDdl) node, createContext()));
}
+ @Test
+ void createTableWithNonDefaultStalenessConfig() throws SqlParseException {
+ long staleRowsCount = DEFAULT_MIN_STALE_ROWS_COUNT / 2;
+ double staleRowsFraction = DEFAULT_STALE_ROWS_FRACTION / 2;
+
+ assert staleRowsCount != 0 && staleRowsFraction != 0.0d;
+
+ Supplier<TableStatsStalenessConfiguration> statStalenessProperties =
+ () -> new TableStatsStalenessConfiguration(staleRowsFraction, staleRowsCount);
+ converter = new DdlSqlToCommandConverter(storageProfiles -> completedFuture(null), filter -> completedFuture(null),
+ statStalenessProperties);
+
+ CatalogCommand cmd = convert("CREATE TABLE t (id INT PRIMARY KEY, val INT)");
+
+ mockCatalogSchemaAndZone("TEST_ZONE");
+
+ NewTableEntry newTable = invokeAndGetFirstEntry(cmd, NewTableEntry.class);
+
+ assertThat(newTable.descriptor().properties().minStaleRowsCount(), is(staleRowsCount));
+ assertThat(newTable.descriptor().properties().staleRowsFraction(), is(staleRowsFraction));
Review Comment:
done
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-26488 Sql. Introduce configuration to override CREATE TABLE defaults for data staleness configuration [ignite-3]
Posted by "zstan (via GitHub)" <gi...@apache.org>.
zstan commented on code in PR #6927:
URL: https://github.com/apache/ignite-3/pull/6927#discussion_r2523440500
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/configuration/distributed/TablePropertiesConfigurationSchema.java:
##########
@@ -0,0 +1,39 @@
+/*
+ * 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.ignite.internal.sql.configuration.distributed;
+
+import static org.apache.ignite.internal.catalog.commands.CatalogUtils.DEFAULT_MIN_STALE_ROWS_COUNT;
+import static org.apache.ignite.internal.catalog.commands.CatalogUtils.DEFAULT_STALE_ROWS_FRACTION;
+
+import org.apache.ignite.configuration.annotation.Config;
+import org.apache.ignite.configuration.annotation.Value;
+import org.apache.ignite.configuration.validation.Range;
+
+/** Configuration for table initialization properties. */
+@Config
+public class TablePropertiesConfigurationSchema {
Review Comment:
done
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/SqlQueryProcessor.java:
##########
@@ -287,7 +289,11 @@ public synchronized CompletableFuture<Void> startAsync(ComponentContext componen
var storageProfileValidator = new ClusterWideStorageProfileValidator(logicalTopologyService);
var nodeFilterValidator = new ClusterWideNodeFilterValidator(logicalTopologyService);
- var ddlSqlToCommandConverter = new DdlSqlToCommandConverter(storageProfileValidator, nodeFilterValidator);
+ Supplier<TableStatsStalenessConfiguration> stalenessProperties = () -> new TableStatsStalenessConfiguration(
+ clusterCfg.createTable().staleRowsFraction().value(),
+ clusterCfg.createTable().minStaleRowsCount().value());
Review Comment:
done
##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/prepare/ddl/DdlSqlToCommandConverterTest.java:
##########
@@ -114,7 +117,10 @@ public class DdlSqlToCommandConverterTest extends AbstractDdlSqlToCommandConvert
@BeforeEach
void setUp() {
- converter = new DdlSqlToCommandConverter(storageProfiles -> completedFuture(null), filter -> completedFuture(null));
+ Supplier<TableStatsStalenessConfiguration> statStalenessProperties = () -> new TableStatsStalenessConfiguration(
+ DEFAULT_STALE_ROWS_FRACTION, DEFAULT_MIN_STALE_ROWS_COUNT);
+ converter = new DdlSqlToCommandConverter(storageProfiles -> completedFuture(null), filter -> completedFuture(null),
+ statStalenessProperties);
}
Review Comment:
done
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-26488 Sql. Introduce configuration to override CREATE TABLE defaults for data staleness configuration [ignite-3]
Posted by "zstan (via GitHub)" <gi...@apache.org>.
zstan merged PR #6927:
URL: https://github.com/apache/ignite-3/pull/6927
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org