You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by am...@apache.org on 2025/03/11 12:09:31 UTC
(ignite-3) branch ignite-24763 created (now 78f0876eaad)
This is an automated email from the ASF dual-hosted git repository.
amashenkov pushed a change to branch ignite-24763
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
at 78f0876eaad Fix column names in DisasterRecoverySystemViews
This branch includes the following new commits:
new 78f0876eaad Fix column names in DisasterRecoverySystemViews
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(ignite-3) 01/01: Fix column names in DisasterRecoverySystemViews
Posted by am...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
amashenkov pushed a commit to branch ignite-24763
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
commit 78f0876eaad39dd08f9d354e95b411af04a03b6b
Author: amashenkov <am...@apache.org>
AuthorDate: Tue Mar 11 15:09:16 2025 +0300
Fix column names in DisasterRecoverySystemViews
---
.../disaster/DisasterRecoveryManager.java | 2 ++
.../disaster/DisasterRecoverySystemViews.java | 8 ++++-
.../distributed/disaster/LocalPartitionState.java | 16 ++++-----
.../disaster/ItDisasterRecoverySystemViewTest.java | 40 ++++++++++++++++++++++
4 files changed, 55 insertions(+), 11 deletions(-)
diff --git a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/DisasterRecoveryManager.java b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/DisasterRecoveryManager.java
index d70da229ee7..78776c92029 100644
--- a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/DisasterRecoveryManager.java
+++ b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/DisasterRecoveryManager.java
@@ -869,7 +869,9 @@ public class DisasterRecoveryManager implements IgniteComponent, SystemViewProvi
String schemaName = catalog.schema(tableDescriptor.schemaId()).name();
return new LocalPartitionState(
+ tableDescriptor.zoneId(),
zoneName,
+ tableDescriptor.schemaId(),
schemaName,
tableDescriptor.id(),
tableDescriptor.name(),
diff --git a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/DisasterRecoverySystemViews.java b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/DisasterRecoverySystemViews.java
index 4adea07ab2e..15e96b1f328 100644
--- a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/DisasterRecoverySystemViews.java
+++ b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/DisasterRecoverySystemViews.java
@@ -71,8 +71,14 @@ class DisasterRecoverySystemViews {
.addColumn("SCHEMA_NAME", STRING, state -> state.state.schemaName)
.addColumn("TABLE_NAME", STRING, state -> state.state.tableName)
.addColumn("PARTITION_ID", INT32, state -> state.state.partitionId)
- .addColumn("STATE", STRING, state -> state.state.state.name())
+ .addColumn("PARTITION_STATE", STRING, state -> state.state.state.name())
.addColumn("ESTIMATED_ROWS", INT64, state -> state.state.estimatedRows)
+ .addColumn("ZONE_ID", INT32, state -> state.state.zoneId)
+ .addColumn("SCHEMA_ID", INT32, state -> state.state.schemaId)
+ // TODO https://issues.apache.org/jira/browse/IGNITE-24589: Next columns are deprecated and should be removed.
+ // They are kept for compatibility with 3.0 version, to allow columns being found by their old names.
+ .addColumn("STATE", STRING, state -> state.state.state.name())
+ // End of legacy columns list. New columns must be added below this line.
.dataProvider(systemViewPublisher(() -> localPartitionStatesAsync(manager)))
.build();
}
diff --git a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/LocalPartitionState.java b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/LocalPartitionState.java
index f553801c8d2..d4c5a18b938 100644
--- a/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/LocalPartitionState.java
+++ b/modules/table/src/main/java/org/apache/ignite/internal/table/distributed/disaster/LocalPartitionState.java
@@ -18,36 +18,30 @@
package org.apache.ignite.internal.table.distributed.disaster;
import org.apache.ignite.internal.partition.replicator.network.disaster.LocalPartitionStateEnum;
-import org.apache.ignite.internal.tostring.IgniteToStringInclude;
import org.apache.ignite.internal.tostring.S;
/**
* Local partition state.
*/
public class LocalPartitionState {
- @IgniteToStringInclude
public final int tableId;
+ public final int zoneId;
+ public final int schemaId;
- @IgniteToStringInclude
public final String schemaName;
-
- @IgniteToStringInclude
public final String tableName;
-
- @IgniteToStringInclude
public final String zoneName;
- @IgniteToStringInclude
public final int partitionId;
- @IgniteToStringInclude
public final LocalPartitionStateEnum state;
- @IgniteToStringInclude
public final long estimatedRows;
LocalPartitionState(
+ int zoneId,
String zoneName,
+ int schemaId,
String schemaName,
int tableId,
String tableName,
@@ -55,6 +49,8 @@ public class LocalPartitionState {
LocalPartitionStateEnum state,
long estimatedRows
) {
+ this.zoneId = zoneId;
+ this.schemaId = schemaId;
this.tableId = tableId;
this.schemaName = schemaName;
this.tableName = tableName;
diff --git a/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoverySystemViewTest.java b/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoverySystemViewTest.java
index f866225eed0..a939232843d 100644
--- a/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoverySystemViewTest.java
+++ b/modules/transactions/src/integrationTest/java/org/apache/ignite/internal/disaster/ItDisasterRecoverySystemViewTest.java
@@ -38,9 +38,11 @@ import org.apache.ignite.internal.catalog.CatalogManager;
import org.apache.ignite.internal.raft.service.RaftGroupService;
import org.apache.ignite.internal.replicator.TablePartitionId;
import org.apache.ignite.internal.sql.BaseSqlIntegrationTest;
+import org.apache.ignite.internal.sql.engine.util.MetadataMatcher;
import org.apache.ignite.internal.storage.MvPartitionStorage;
import org.apache.ignite.internal.table.TableImpl;
import org.apache.ignite.internal.table.distributed.PublicApiThreadingTable;
+import org.apache.ignite.sql.ColumnType;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@@ -68,6 +70,44 @@ public class ItDisasterRecoverySystemViewTest extends BaseSqlIntegrationTest {
sql("DROP ZONE IF EXISTS " + ZONE_NAME);
}
+ @Test
+ public void globalPatitionStatesMetadata() {
+ assertQuery("SELECT * FROM SYSTEM.GLOBAL_PARTITION_STATES")
+ .columnMetadata(
+ new MetadataMatcher().name("ZONE_NAME").type(ColumnType.STRING).nullable(true),
+ new MetadataMatcher().name("TABLE_ID").type(ColumnType.INT32).nullable(true),
+ new MetadataMatcher().name("SCHEMA_NAME").type(ColumnType.STRING).nullable(true),
+ new MetadataMatcher().name("TABLE_NAME").type(ColumnType.STRING).nullable(true),
+ new MetadataMatcher().name("PARTITION_ID").type(ColumnType.INT32).nullable(true),
+ new MetadataMatcher().name("PARTITION_STATE").type(ColumnType.STRING).nullable(true),
+ new MetadataMatcher().name("ZONE_ID").type(ColumnType.INT32).nullable(true),
+ new MetadataMatcher().name("SCHEMA_ID").type(ColumnType.INT32).nullable(true),
+ // Legacy columns.
+ new MetadataMatcher().name("STATE").type(ColumnType.STRING).nullable(true)
+ )
+ .check();
+ }
+
+ @Test
+ public void localPatitionStatesMetadata() {
+ assertQuery("SELECT * FROM SYSTEM.LOCAL_PARTITION_STATES")
+ .columnMetadata(
+ new MetadataMatcher().name("NODE_NAME").type(ColumnType.STRING).nullable(true),
+ new MetadataMatcher().name("ZONE_NAME").type(ColumnType.STRING).nullable(true),
+ new MetadataMatcher().name("TABLE_ID").type(ColumnType.INT32).nullable(true),
+ new MetadataMatcher().name("SCHEMA_NAME").type(ColumnType.STRING).nullable(true),
+ new MetadataMatcher().name("TABLE_NAME").type(ColumnType.STRING).nullable(true),
+ new MetadataMatcher().name("PARTITION_ID").type(ColumnType.INT32).nullable(true),
+ new MetadataMatcher().name("PARTITION_STATE").type(ColumnType.STRING).nullable(true),
+ new MetadataMatcher().name("ESTIMATED_ROWS").type(ColumnType.INT64).nullable(true),
+ new MetadataMatcher().name("ZONE_ID").type(ColumnType.INT32).nullable(true),
+ new MetadataMatcher().name("SCHEMA_ID").type(ColumnType.INT32).nullable(true),
+ // Legacy columns.
+ new MetadataMatcher().name("STATE").type(ColumnType.STRING).nullable(true)
+ )
+ .check();
+ }
+
@Test
void testNoZonesAndTables() {
assertQuery(globalPartitionStatesSystemViewSql()).returnNothing().check();