You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "alex-plekhanov (via GitHub)" <gi...@apache.org> on 2026/04/16 19:30:37 UTC
[PR] IGNITE-28568 SQL Calcite: Fix sync tx key waiting for DML operations [ignite]
alex-plekhanov opened a new pull request, #13042:
URL: https://github.com/apache/ignite/pull/13042
Thank you for submitting the pull request to the Apache Ignite.
In order to streamline the review of the contribution
we ask you to ensure the following steps have been taken:
### The Contribution Checklist
- [ ] 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 pull request body describes changes that have been made.
The description explains _WHAT_ and _WHY_ was made instead of _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.
- [ ] A reviewer has been mentioned through the JIRA comments
(see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers))
- [ ] The pull request has been checked by the Teamcity Bot and
the `green visa` attached to the JIRA ticket (see tab `PR Check` at [TC.Bot - Instance 1](https://tcbot2.sbt-ignite-dev.ru/prs.html) or [TC.Bot - Instance 2](https://mtcga.gridgain.com/prs.html))
### Notes
- [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
- [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
- [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
- [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
--
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-28568 SQL Calcite: Fix sync tx key waiting for DML operations [ignite]
Posted by "alex-plekhanov (via GitHub)" <gi...@apache.org>.
alex-plekhanov commented on PR #13042:
URL: https://github.com/apache/ignite/pull/13042#issuecomment-4278560563
@zstan, performance is not affected:
Before:
```
Benchmark (engine) Mode Cnt Score Error Units
JmhSqlDmlBenchmark.insertDeleteBatch CALCITE thrpt 3 247,423 ± 13,055 ops/s
JmhSqlDmlBenchmark.insertDeleteUniqueIndexed CALCITE thrpt 3 5110,236 ± 225,257 ops/s
JmhSqlDmlBenchmark.updateBatch CALCITE thrpt 3 506,234 ± 2,200 ops/s
JmhSqlDmlBenchmark.updateUniqueIndexed CALCITE thrpt 3 10052,103 ± 406,226 ops/s
```
After:
```
Benchmark (engine) Mode Cnt Score Error Units
JmhSqlDmlBenchmark.insertDeleteBatch CALCITE thrpt 3 245,689 ± 7,192 ops/s
JmhSqlDmlBenchmark.insertDeleteUniqueIndexed CALCITE thrpt 3 5190,206 ± 118,936 ops/s
JmhSqlDmlBenchmark.updateBatch CALCITE thrpt 3 515,950 ± 9,915 ops/s
JmhSqlDmlBenchmark.updateUniqueIndexed CALCITE thrpt 3 10128,092 ± 205,757 ops/s
```
--
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-28568 SQL Calcite: Fix sync tx key waiting for DML operations [ignite]
Posted by "asf-gitbox-commits (via GitHub)" <gi...@apache.org>.
asf-gitbox-commits closed pull request #13042: IGNITE-28568 SQL Calcite: Fix sync tx key waiting for DML operations
URL: https://github.com/apache/ignite/pull/13042
--
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-28568 SQL Calcite: Fix sync tx key waiting for DML operations [ignite]
Posted by "alex-plekhanov (via GitHub)" <gi...@apache.org>.
alex-plekhanov commented on code in PR #13042:
URL: https://github.com/apache/ignite/pull/13042#discussion_r3108854911
##########
modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/TxThreadLockingTest.java:
##########
@@ -0,0 +1,219 @@
+/*
+ * 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.processors.tx;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.processors.query.IgniteSQLException;
+import org.apache.ignite.internal.processors.query.calcite.exec.rel.AbstractExecutionTest;
+import org.apache.ignite.internal.processors.query.calcite.integration.AbstractBasicIntegrationTest;
+import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.transactions.Transaction;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.IGNITE_CALCITE_USE_QUERY_BLOCKING_TASK_EXECUTOR;
+import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
+import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED;
+
+/** */
+@RunWith(Parameterized.class)
+public class TxThreadLockingTest extends AbstractBasicIntegrationTest {
+ /** */
+ private static final long TIMEOUT = 10_000L;
+
+ /** */
+ private static final int POOL_SIZE = 10;
+
+ /** */
+ private static final int IN_BUFFER_SIZE = AbstractExecutionTest.IN_BUFFER_SIZE;
+
+ /** */
+ private static final int MODIFY_BATCH_SIZE = AbstractExecutionTest.MODIFY_BATCH_SIZE;
+
+ /** Use query blocking executor. */
+ @Parameterized.Parameter(0)
+ public boolean qryBlockingExecutor;
+
+ /** */
+ @Parameterized.Parameters(name = "qryBlockingExecutor={0}")
+ public static Collection<?> parameters() {
+ return List.of(false, true);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ System.setProperty(IGNITE_CALCITE_USE_QUERY_BLOCKING_TASK_EXECUTOR, String.valueOf(qryBlockingExecutor));
+
+ startGrid(0);
+
+ client = startClientGrid();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ System.clearProperty(IGNITE_CALCITE_USE_QUERY_BLOCKING_TASK_EXECUTOR);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ return super.getConfiguration(igniteInstanceName).setQueryThreadPoolSize(POOL_SIZE);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected <K, V> CacheConfiguration<K, V> cacheConfiguration() {
+ return super.<K, V>cacheConfiguration().setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+ }
+
+ /** */
+ @Test
+ public void testThreadsLockingByDml() throws Exception {
+ createAndPopulateTable();
+
+ CountDownLatch unlockLatch = new CountDownLatch(1);
+
+ IgniteInternalFuture<?> lockKeyFut = lockKeyAndWaitForLatch(0, unlockLatch);
+
+ IgniteInternalFuture<?> updFut = GridTestUtils.runMultiThreadedAsync(() -> {
+ sql("UPDATE person SET salary = 1 WHERE id = 0");
+ }, POOL_SIZE + 1, "update-thread");
+
+ // Ensure update queries are blocked.
+ assertFalse(GridTestUtils.waitForCondition(updFut::isDone, 200));
+
+ IgniteInternalFuture<?> selectFut = GridTestUtils.runMultiThreadedAsync(() -> {
+ for (int i = 0; i < 100; i++)
+ sql("SELECT * FROM person WHERE id = 1");
+ }, POOL_SIZE + 1, "select-thread");
+
+ // Ensure other queries are not blocked by update queries.
+ selectFut.get(TIMEOUT, TimeUnit.MILLISECONDS);
+
+ unlockLatch.countDown();
+
+ lockKeyFut.get();
+
+ // Ensure update queries are released.
+ updFut.get(TIMEOUT, TimeUnit.MILLISECONDS);
+ }
+
+ /** */
+ @Test
+ public void testDiffrentBlockedBatchSize() throws Exception {
Review Comment:
Fixed
--
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-28568 SQL Calcite: Fix sync tx key waiting for DML operations [ignite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #13042:
URL: https://github.com/apache/ignite/pull/13042#issuecomment-4278666106
## [](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13042) **Quality Gate failed**
Failed conditions
 [2 New Code Smells](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13042) (required ≤ 1)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13042)
##
 Catch issues before they fail your Quality Gate with our IDE extension  [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
--
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-28568 SQL Calcite: Fix sync tx key waiting for DML operations [ignite]
Posted by "zstan (via GitHub)" <gi...@apache.org>.
zstan commented on code in PR #13042:
URL: https://github.com/apache/ignite/pull/13042#discussion_r3098275491
##########
modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/TxThreadLockingTest.java:
##########
@@ -0,0 +1,219 @@
+/*
+ * 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.processors.tx;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.processors.query.IgniteSQLException;
+import org.apache.ignite.internal.processors.query.calcite.exec.rel.AbstractExecutionTest;
+import org.apache.ignite.internal.processors.query.calcite.integration.AbstractBasicIntegrationTest;
+import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.transactions.Transaction;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.IGNITE_CALCITE_USE_QUERY_BLOCKING_TASK_EXECUTOR;
+import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
+import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED;
+
+/** */
+@RunWith(Parameterized.class)
+public class TxThreadLockingTest extends AbstractBasicIntegrationTest {
+ /** */
+ private static final long TIMEOUT = 10_000L;
+
+ /** */
+ private static final int POOL_SIZE = 10;
+
+ /** */
+ private static final int IN_BUFFER_SIZE = AbstractExecutionTest.IN_BUFFER_SIZE;
+
+ /** */
+ private static final int MODIFY_BATCH_SIZE = AbstractExecutionTest.MODIFY_BATCH_SIZE;
+
+ /** Use query blocking executor. */
+ @Parameterized.Parameter(0)
+ public boolean qryBlockingExecutor;
+
+ /** */
+ @Parameterized.Parameters(name = "qryBlockingExecutor={0}")
+ public static Collection<?> parameters() {
+ return List.of(false, true);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ System.setProperty(IGNITE_CALCITE_USE_QUERY_BLOCKING_TASK_EXECUTOR, String.valueOf(qryBlockingExecutor));
+
+ startGrid(0);
+
+ client = startClientGrid();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ System.clearProperty(IGNITE_CALCITE_USE_QUERY_BLOCKING_TASK_EXECUTOR);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ return super.getConfiguration(igniteInstanceName).setQueryThreadPoolSize(POOL_SIZE);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected <K, V> CacheConfiguration<K, V> cacheConfiguration() {
+ return super.<K, V>cacheConfiguration().setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+ }
+
+ /** */
+ @Test
+ public void testThreadsLockingByDml() throws Exception {
+ createAndPopulateTable();
+
+ CountDownLatch unlockLatch = new CountDownLatch(1);
+
+ IgniteInternalFuture<?> lockKeyFut = lockKeyAndWaitForLatch(0, unlockLatch);
+
+ IgniteInternalFuture<?> updFut = GridTestUtils.runMultiThreadedAsync(() -> {
+ sql("UPDATE person SET salary = 1 WHERE id = 0");
+ }, POOL_SIZE + 1, "update-thread");
+
+ // Ensure update queries are blocked.
+ assertFalse(GridTestUtils.waitForCondition(updFut::isDone, 200));
+
+ IgniteInternalFuture<?> selectFut = GridTestUtils.runMultiThreadedAsync(() -> {
+ for (int i = 0; i < 100; i++)
+ sql("SELECT * FROM person WHERE id = 1");
+ }, POOL_SIZE + 1, "select-thread");
+
+ // Ensure other queries are not blocked by update queries.
+ selectFut.get(TIMEOUT, TimeUnit.MILLISECONDS);
+
+ unlockLatch.countDown();
+
+ lockKeyFut.get();
+
+ // Ensure update queries are released.
+ updFut.get(TIMEOUT, TimeUnit.MILLISECONDS);
+ }
+
+ /** */
+ @Test
+ public void testDiffrentBlockedBatchSize() throws Exception {
Review Comment:
```suggestion
public void testDifferentBlockedBatchSize() throws Exception {
```
--
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-28568 SQL Calcite: Fix sync tx key waiting for DML operations [ignite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #13042:
URL: https://github.com/apache/ignite/pull/13042#issuecomment-4262891396
## [](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13042) **Quality Gate failed**
Failed conditions
 [2 New Code Smells](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13042) (required ≤ 1)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ignite&pullRequest=13042)
##
 Catch issues before they fail your Quality Gate with our IDE extension  [SonarQube for IDE](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=pull-request)
--
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