This is an automated email from the ASF dual-hosted git repository.
ptupitsyn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new 80e4cbd674b IGNITE-27034 Add client tests for table partition count
change (#7742)
80e4cbd674b is described below
commit 80e4cbd674b5ef5a1460d8bbeffdb761e53c8504
Author: Pavel Tupitsyn <[email protected]>
AuthorDate: Tue Mar 10 14:39:56 2026 +0100
IGNITE-27034 Add client tests for table partition count change (#7742)
---
.../Table/TablesPartitionCountTests.cs | 75 +++++++++++++++++++
.../runner/app/client/ItThinClientTablesTest.java | 84 ++++++++++++++++++++++
2 files changed, 159 insertions(+)
diff --git
a/modules/platforms/dotnet/Apache.Ignite.Tests/Table/TablesPartitionCountTests.cs
b/modules/platforms/dotnet/Apache.Ignite.Tests/Table/TablesPartitionCountTests.cs
new file mode 100644
index 00000000000..03b36149015
--- /dev/null
+++
b/modules/platforms/dotnet/Apache.Ignite.Tests/Table/TablesPartitionCountTests.cs
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Tests.Table;
+
+using System.Threading.Tasks;
+using NUnit.Framework;
+
+/// <summary>
+/// Tests for table partition count changes.
+/// </summary>
+public class TablesPartitionCountTests : IgniteTestsBase
+{
+ private const string TestTable = "TEST_TABLE";
+ private const string TestZone = "TEST_PARTITION_ZONE";
+
+ [TearDown]
+ public async Task DropTestZone()
+ {
+ var sql = Client.Sql;
+ await sql.ExecuteAsync(null, $"DROP TABLE IF EXISTS {TestTable}");
+ await sql.ExecuteAsync(null, $"DROP ZONE IF EXISTS {TestZone}");
+ }
+
+ [Test]
+ public async Task TestTablePartitionCountChange()
+ {
+ var sql = Client.Sql;
+
+ // Create zone and table with 5 partitions
+ await sql.ExecuteAsync(null, $"CREATE ZONE {TestZone} (REPLICAS 1,
PARTITIONS 5) STORAGE PROFILES ['default']");
+ await sql.ExecuteAsync(null, $"CREATE TABLE {TestTable} (id INT
PRIMARY KEY, val VARCHAR) ZONE {TestZone}");
+
+ // Perform operations to ensure client caches partition info
+ var table = await Client.Tables.GetTableAsync(TestTable);
+ var partitions = await
table!.PartitionDistribution.GetPartitionsAsync();
+ Assert.AreEqual(5, partitions.Count);
+
+ var view = table.GetKeyValueView<int, string>();
+ var key1 = 1;
+ await view.PutAsync(null, key1, "value1");
+
+ // Drop and recreate with different partition count
+ await sql.ExecuteAsync(null, $"DROP TABLE {TestTable}");
+ await sql.ExecuteAsync(null, $"DROP ZONE {TestZone}");
+ await sql.ExecuteAsync(null, $"CREATE ZONE {TestZone} (REPLICAS 1,
PARTITIONS 10) STORAGE PROFILES ['default']");
+ await sql.ExecuteAsync(null, $"CREATE TABLE {TestTable}(id INT PRIMARY
KEY, val VARCHAR) ZONE {TestZone}");
+
+ // Old table handle does not work after drop
+ Assert.ThrowsAsync<TableNotFoundException>(async () => await
view.GetAsync(null, key1));
+
+ // Get the table again
+ var table2 = await Client.Tables.GetTableAsync(TestTable);
+ var partitions2 = await
table2!.PartitionDistribution.GetPartitionsAsync();
+ Assert.AreEqual(10, partitions2.Count);
+
+ var view2 = table2.GetKeyValueView<int, string>();
+ var result2 = await view2.GetAsync(null, key1);
+ Assert.IsFalse(result2.HasValue, "Old key should not exist after table
recreation");
+ }
+}
diff --git
a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItThinClientTablesTest.java
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItThinClientTablesTest.java
new file mode 100644
index 00000000000..1a8d484e8c7
--- /dev/null
+++
b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/client/ItThinClientTablesTest.java
@@ -0,0 +1,84 @@
+/*
+ * 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.runner.app.client;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+import org.apache.ignite.client.IgniteClient;
+import org.apache.ignite.lang.TableNotFoundException;
+import org.apache.ignite.sql.IgniteSql;
+import org.apache.ignite.table.RecordView;
+import org.apache.ignite.table.Table;
+import org.apache.ignite.table.Tuple;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Tests for thin client table operations.
+ */
+@SuppressWarnings("resource")
+public class ItThinClientTablesTest extends ItAbstractThinClientTest {
+ private static final String TEST_TABLE = "TEST_TABLE";
+ private static final String TEST_ZONE = "TEST_PARTITION_ZONE";
+
+ @AfterEach
+ public void afterEach() {
+ IgniteSql sql = client().sql();
+ sql.execute("DROP TABLE IF EXISTS " + TEST_TABLE);
+ sql.execute("DROP ZONE IF EXISTS " + TEST_ZONE);
+ }
+
+ @Test
+ public void testTablePartitionCountChange() {
+ IgniteClient client = client();
+ IgniteSql sql = client.sql();
+
+ // Create zone and table with 5 partitions
+ sql.execute("CREATE ZONE " + TEST_ZONE + " (REPLICAS 1, PARTITIONS 5)
STORAGE PROFILES ['default']");
+ sql.execute("CREATE TABLE " + TEST_TABLE + "(id INT PRIMARY KEY, val
VARCHAR) ZONE " + TEST_ZONE);
+
+ // Perform operations to ensure client caches partition info
+ Table table = client.tables().table(TEST_TABLE);
+ assertEquals(5, table.partitionDistribution().partitions().size());
+
+ RecordView<Tuple> view = table.recordView();
+ Tuple key1 = Tuple.create().set("id", 1);
+ view.upsert(null, Tuple.create().set("id", 1).set("val", "value1"));
+
+ Tuple result = view.get(null, key1);
+ assertEquals("value1", result.stringValue("val"));
+
+ // Drop and recreate with different partition count
+ sql.execute("DROP TABLE " + TEST_TABLE);
+ sql.execute("DROP ZONE " + TEST_ZONE);
+ sql.execute("CREATE ZONE " + TEST_ZONE + " (REPLICAS 1, PARTITIONS 10)
STORAGE PROFILES ['default']");
+ sql.execute("CREATE TABLE " + TEST_TABLE + "(id INT PRIMARY KEY, val
VARCHAR) ZONE " + TEST_ZONE);
+
+ // Old table handle does not work after drop.
+ assertThrows(TableNotFoundException.class, () -> view.get(null, key1));
+
+ // Get the table again.
+ Table table2 = client.tables().table(TEST_TABLE);
+ assertEquals(10, table2.partitionDistribution().partitions().size());
+
+ RecordView<Tuple> view2 = table2.recordView();
+ assertNull(view2.get(null, key1), "Old key should not exist after
table recreation");
+ }
+}