This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 0237cb5c236 Rename YamlRowStatistics (#34436)
0237cb5c236 is described below
commit 0237cb5c2369e59eeaa6cfd325ad46f19483c093
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Jan 23 14:23:08 2025 +0800
Rename YamlRowStatistics (#34436)
* Refactor usage of DatabaseStatistics.schemaStatisticsMap
* Remove useless YamlShardingSphereTableStatisticsSwapper
* Rename YamlRowStatistics
---
...YamlShardingSphereRowData.java => YamlRowStatistics.java} | 4 ++--
...wStatisticsSwapper.java => YamlRowStatisticsSwapper.java} | 12 ++++++------
.../metadata/manager/ShardingSphereDatabaseDataManager.java | 8 ++++----
.../persist/data/AlteredShardingSphereDatabaseData.java | 8 ++++----
.../persist/data/ShardingSphereStatisticsPersistService.java | 10 +++++-----
.../service/metadata/table/TableRowDataPersistService.java | 12 ++++++------
.../refresher/ShardingSphereStatisticsRefreshEngine.java | 4 ++--
.../data/ShardingSphereStatisticsPersistServiceTest.java | 8 ++++----
.../metadata/table/TableRowDataPersistServiceTest.java | 6 +++---
.../global/ShardingSphereStatisticsChangedHandler.java | 4 ++--
.../global/ShardingSphereStatisticsChangedHandlerTest.java | 4 ++--
11 files changed, 40 insertions(+), 40 deletions(-)
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/data/pojo/YamlShardingSphereRowData.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/data/pojo/YamlRowStatistics.java
similarity index 90%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/data/pojo/YamlShardingSphereRowData.java
rename to
infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/data/pojo/YamlRowStatistics.java
index 0152a06b5b1..fdde3e390dd 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/data/pojo/YamlShardingSphereRowData.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/data/pojo/YamlRowStatistics.java
@@ -24,11 +24,11 @@ import
org.apache.shardingsphere.infra.util.yaml.YamlConfiguration;
import java.util.List;
/**
- * Yaml ShardingSphere row data.
+ * YAML row statistics.
*/
@Getter
@Setter
-public final class YamlShardingSphereRowData implements YamlConfiguration {
+public final class YamlRowStatistics implements YamlConfiguration {
private String uniqueKey;
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/data/swapper/YamlShardingSphereRowStatisticsSwapper.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/data/swapper/YamlRowStatisticsSwapper.java
similarity index 86%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/data/swapper/YamlShardingSphereRowStatisticsSwapper.java
rename to
infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/data/swapper/YamlRowStatisticsSwapper.java
index cfcb9f03175..8c0d2eed456 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/data/swapper/YamlShardingSphereRowStatisticsSwapper.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/yaml/data/swapper/YamlRowStatisticsSwapper.java
@@ -21,7 +21,7 @@ import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.infra.metadata.statistics.RowStatistics;
import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn;
import
org.apache.shardingsphere.infra.util.yaml.swapper.YamlConfigurationSwapper;
-import
org.apache.shardingsphere.infra.yaml.data.pojo.YamlShardingSphereRowData;
+import org.apache.shardingsphere.infra.yaml.data.pojo.YamlRowStatistics;
import java.math.BigDecimal;
import java.sql.Types;
@@ -31,16 +31,16 @@ import java.util.LinkedList;
import java.util.List;
/**
- * YAML ShardingSphere row statistics swapper.
+ * YAML row statistics swapper.
*/
@RequiredArgsConstructor
-public final class YamlShardingSphereRowStatisticsSwapper implements
YamlConfigurationSwapper<YamlShardingSphereRowData, RowStatistics> {
+public final class YamlRowStatisticsSwapper implements
YamlConfigurationSwapper<YamlRowStatistics, RowStatistics> {
private final List<ShardingSphereColumn> columns;
@Override
- public YamlShardingSphereRowData swapToYamlConfiguration(final
RowStatistics data) {
- YamlShardingSphereRowData result = new YamlShardingSphereRowData();
+ public YamlRowStatistics swapToYamlConfiguration(final RowStatistics data)
{
+ YamlRowStatistics result = new YamlRowStatistics();
Collection<Object> rowData = null == data.getRows() ?
Collections.emptyList() : data.getRows();
List<Object> yamlRowData = new LinkedList<>();
int count = 0;
@@ -61,7 +61,7 @@ public final class YamlShardingSphereRowStatisticsSwapper
implements YamlConfigu
}
@Override
- public RowStatistics swapToObject(final YamlShardingSphereRowData
yamlConfig) {
+ public RowStatistics swapToObject(final YamlRowStatistics yamlConfig) {
Collection<Object> yamlRow = null == yamlConfig.getRows() ?
Collections.emptyList() : yamlConfig.getRows();
List<Object> rowData = new LinkedList<>();
int count = 0;
diff --git
a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/manager/ShardingSphereDatabaseDataManager.java
b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/manager/ShardingSphereDatabaseDataManager.java
index 1673811d219..af07e426d8c 100644
---
a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/manager/ShardingSphereDatabaseDataManager.java
+++
b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/manager/ShardingSphereDatabaseDataManager.java
@@ -22,8 +22,8 @@ import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSp
import org.apache.shardingsphere.infra.metadata.statistics.DatabaseStatistics;
import org.apache.shardingsphere.infra.metadata.statistics.SchemaStatistics;
import org.apache.shardingsphere.infra.metadata.statistics.TableStatistics;
-import
org.apache.shardingsphere.infra.yaml.data.pojo.YamlShardingSphereRowData;
-import
org.apache.shardingsphere.infra.yaml.data.swapper.YamlShardingSphereRowStatisticsSwapper;
+import org.apache.shardingsphere.infra.yaml.data.pojo.YamlRowStatistics;
+import
org.apache.shardingsphere.infra.yaml.data.swapper.YamlRowStatisticsSwapper;
import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
import java.util.ArrayList;
@@ -127,7 +127,7 @@ public final class ShardingSphereDatabaseDataManager {
* @param tableName table name
* @param yamlRowData yaml row data
*/
- public synchronized void alterShardingSphereRowData(final String
databaseName, final String schemaName, final String tableName, final
YamlShardingSphereRowData yamlRowData) {
+ public synchronized void alterShardingSphereRowData(final String
databaseName, final String schemaName, final String tableName, final
YamlRowStatistics yamlRowData) {
if
(!metaDataContexts.getStatistics().containsDatabaseStatistics(databaseName) ||
!metaDataContexts.getStatistics().getDatabaseStatistics(databaseName).containsSchemaStatistics(schemaName)
||
!metaDataContexts.getStatistics().getDatabaseStatistics(databaseName).getSchemaStatistics(schemaName).containsTableStatistics(tableName))
{
return;
@@ -138,7 +138,7 @@ public final class ShardingSphereDatabaseDataManager {
}
TableStatistics tableStatistics =
metaDataContexts.getStatistics().getDatabaseStatistics(databaseName).getSchemaStatistics(schemaName).getTableStatistics(tableName);
List<ShardingSphereColumn> columns = new
ArrayList<>(metaDataContexts.getMetaData().getDatabase(databaseName).getSchema(schemaName).getTable(tableName).getAllColumns());
- tableStatistics.getRows().add(new
YamlShardingSphereRowStatisticsSwapper(columns).swapToObject(yamlRowData));
+ tableStatistics.getRows().add(new
YamlRowStatisticsSwapper(columns).swapToObject(yamlRowData));
}
/**
diff --git
a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/data/AlteredShardingSphereDatabaseData.java
b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/data/AlteredShardingSphereDatabaseData.java
index d7a4cce1193..f5fec23e4e4 100644
---
a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/data/AlteredShardingSphereDatabaseData.java
+++
b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/data/AlteredShardingSphereDatabaseData.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.mode.metadata.persist.data;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import
org.apache.shardingsphere.infra.yaml.data.pojo.YamlShardingSphereRowData;
+import org.apache.shardingsphere.infra.yaml.data.pojo.YamlRowStatistics;
import java.util.Collection;
import java.util.LinkedList;
@@ -37,9 +37,9 @@ public final class AlteredShardingSphereDatabaseData {
private final String tableName;
- private final Collection<YamlShardingSphereRowData> addedRows = new
LinkedList<>();
+ private final Collection<YamlRowStatistics> addedRows = new LinkedList<>();
- private final Collection<YamlShardingSphereRowData> updatedRows = new
LinkedList<>();
+ private final Collection<YamlRowStatistics> updatedRows = new
LinkedList<>();
- private final Collection<YamlShardingSphereRowData> deletedRows = new
LinkedList<>();
+ private final Collection<YamlRowStatistics> deletedRows = new
LinkedList<>();
}
diff --git
a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/data/ShardingSphereStatisticsPersistService.java
b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/data/ShardingSphereStatisticsPersistService.java
index 46982a3b35f..4676bc1b29b 100644
---
a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/data/ShardingSphereStatisticsPersistService.java
+++
b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/data/ShardingSphereStatisticsPersistService.java
@@ -23,8 +23,8 @@ import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSp
import org.apache.shardingsphere.infra.metadata.statistics.DatabaseStatistics;
import org.apache.shardingsphere.infra.metadata.statistics.SchemaStatistics;
import
org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereStatistics;
-import
org.apache.shardingsphere.infra.yaml.data.pojo.YamlShardingSphereRowData;
-import
org.apache.shardingsphere.infra.yaml.data.swapper.YamlShardingSphereRowStatisticsSwapper;
+import org.apache.shardingsphere.infra.yaml.data.pojo.YamlRowStatistics;
+import
org.apache.shardingsphere.infra.yaml.data.swapper.YamlRowStatisticsSwapper;
import
org.apache.shardingsphere.mode.metadata.persist.service.metadata.table.TableRowDataPersistService;
import
org.apache.shardingsphere.mode.node.path.metadata.ShardingSphereStatisticsNodePath;
import org.apache.shardingsphere.mode.spi.repository.PersistRepository;
@@ -103,13 +103,13 @@ public final class ShardingSphereStatisticsPersistService
{
private void persistTableData(final ShardingSphereDatabase database, final
String schemaName, final SchemaStatistics schemaStatistics) {
schemaStatistics.getTableStatisticsMap().values().forEach(each -> {
- YamlShardingSphereRowStatisticsSwapper swapper =
- new YamlShardingSphereRowStatisticsSwapper(new
ArrayList<>(database.getSchema(schemaName).getTable(each.getName()).getAllColumns()));
+ YamlRowStatisticsSwapper swapper =
+ new YamlRowStatisticsSwapper(new
ArrayList<>(database.getSchema(schemaName).getTable(each.getName()).getAllColumns()));
persistTableData(database.getName(), schemaName, each.getName(),
each.getRows().stream().map(swapper::swapToYamlConfiguration).collect(Collectors.toList()));
});
}
- private void persistTableData(final String databaseName, final String
schemaName, final String tableName, final Collection<YamlShardingSphereRowData>
rows) {
+ private void persistTableData(final String databaseName, final String
schemaName, final String tableName, final Collection<YamlRowStatistics> rows) {
tableRowDataPersistService.persist(databaseName, schemaName,
tableName, rows);
}
diff --git
a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/metadata/table/TableRowDataPersistService.java
b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/metadata/table/TableRowDataPersistService.java
index 4688e22038a..b52c2f7d3fa 100644
---
a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/metadata/table/TableRowDataPersistService.java
+++
b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/metadata/table/TableRowDataPersistService.java
@@ -22,8 +22,8 @@ import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.infra.metadata.statistics.TableStatistics;
import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
-import
org.apache.shardingsphere.infra.yaml.data.pojo.YamlShardingSphereRowData;
-import
org.apache.shardingsphere.infra.yaml.data.swapper.YamlShardingSphereRowStatisticsSwapper;
+import org.apache.shardingsphere.infra.yaml.data.pojo.YamlRowStatistics;
+import
org.apache.shardingsphere.infra.yaml.data.swapper.YamlRowStatisticsSwapper;
import
org.apache.shardingsphere.mode.node.path.metadata.ShardingSphereStatisticsNodePath;
import org.apache.shardingsphere.mode.spi.repository.PersistRepository;
@@ -46,7 +46,7 @@ public final class TableRowDataPersistService {
* @param tableName table name
* @param rows rows
*/
- public void persist(final String databaseName, final String schemaName,
final String tableName, final Collection<YamlShardingSphereRowData> rows) {
+ public void persist(final String databaseName, final String schemaName,
final String tableName, final Collection<YamlRowStatistics> rows) {
if (rows.isEmpty()) {
repository.persist(ShardingSphereStatisticsNodePath.getTablePath(databaseName,
schemaName, tableName.toLowerCase()), "");
} else {
@@ -63,7 +63,7 @@ public final class TableRowDataPersistService {
* @param tableName table name
* @param rows rows
*/
- public void delete(final String databaseName, final String schemaName,
final String tableName, final Collection<YamlShardingSphereRowData> rows) {
+ public void delete(final String databaseName, final String schemaName,
final String tableName, final Collection<YamlRowStatistics> rows) {
rows.forEach(each ->
repository.delete(ShardingSphereStatisticsNodePath.getTableRowPath(databaseName,
schemaName, tableName.toLowerCase(), each.getUniqueKey())));
}
@@ -77,11 +77,11 @@ public final class TableRowDataPersistService {
*/
public TableStatistics load(final String databaseName, final String
schemaName, final ShardingSphereTable table) {
TableStatistics result = new TableStatistics(table.getName());
- YamlShardingSphereRowStatisticsSwapper swapper = new
YamlShardingSphereRowStatisticsSwapper(new ArrayList<>(table.getAllColumns()));
+ YamlRowStatisticsSwapper swapper = new YamlRowStatisticsSwapper(new
ArrayList<>(table.getAllColumns()));
for (String each :
repository.getChildrenKeys(ShardingSphereStatisticsNodePath.getTablePath(databaseName,
schemaName, table.getName()))) {
String yamlRow =
repository.query(ShardingSphereStatisticsNodePath.getTableRowPath(databaseName,
schemaName, table.getName(), each));
if (!Strings.isNullOrEmpty(yamlRow)) {
-
result.getRows().add(swapper.swapToObject(YamlEngine.unmarshal(yamlRow,
YamlShardingSphereRowData.class)));
+
result.getRows().add(swapper.swapToObject(YamlEngine.unmarshal(yamlRow,
YamlRowStatistics.class)));
}
}
return result;
diff --git
a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/refresher/ShardingSphereStatisticsRefreshEngine.java
b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/refresher/ShardingSphereStatisticsRefreshEngine.java
index b6415c32d21..42dd7c0a792 100644
---
a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/refresher/ShardingSphereStatisticsRefreshEngine.java
+++
b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/refresher/ShardingSphereStatisticsRefreshEngine.java
@@ -33,7 +33,7 @@ import
org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereStatist
import org.apache.shardingsphere.infra.metadata.statistics.TableStatistics;
import
org.apache.shardingsphere.infra.metadata.statistics.collector.ShardingSphereStatisticsCollector;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
-import
org.apache.shardingsphere.infra.yaml.data.swapper.YamlShardingSphereRowStatisticsSwapper;
+import
org.apache.shardingsphere.infra.yaml.data.swapper.YamlRowStatisticsSwapper;
import
org.apache.shardingsphere.mode.metadata.persist.data.AlteredShardingSphereDatabaseData;
import org.apache.shardingsphere.mode.lock.global.GlobalLockDefinition;
import org.apache.shardingsphere.mode.manager.ContextManager;
@@ -187,7 +187,7 @@ public final class ShardingSphereStatisticsRefreshEngine {
AlteredShardingSphereDatabaseData result = new
AlteredShardingSphereDatabaseData(databaseName, schemaName,
tableStatistics.getName());
Map<String, RowStatistics> tableStatisticsMap =
tableStatistics.getRows().stream().collect(Collectors.toMap(RowStatistics::getUniqueKey,
Function.identity()));
Map<String, RowStatistics> changedTableStatisticsMap =
changedTableStatistics.getRows().stream().collect(Collectors.toMap(RowStatistics::getUniqueKey,
Function.identity()));
- YamlShardingSphereRowStatisticsSwapper swapper = new
YamlShardingSphereRowStatisticsSwapper(new ArrayList<>(table.getAllColumns()));
+ YamlRowStatisticsSwapper swapper = new YamlRowStatisticsSwapper(new
ArrayList<>(table.getAllColumns()));
for (Entry<String, RowStatistics> entry :
changedTableStatisticsMap.entrySet()) {
if (!tableStatisticsMap.containsKey(entry.getKey())) {
result.getAddedRows().add(swapper.swapToYamlConfiguration(entry.getValue()));
diff --git
a/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/data/ShardingSphereStatisticsPersistServiceTest.java
b/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/data/ShardingSphereStatisticsPersistServiceTest.java
index a11a8ebc0d5..5b1f6d37bde 100644
---
a/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/data/ShardingSphereStatisticsPersistServiceTest.java
+++
b/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/data/ShardingSphereStatisticsPersistServiceTest.java
@@ -22,7 +22,7 @@ import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereColumn;
import org.apache.shardingsphere.infra.metadata.statistics.SchemaStatistics;
import org.apache.shardingsphere.infra.metadata.statistics.TableStatistics;
-import
org.apache.shardingsphere.infra.yaml.data.pojo.YamlShardingSphereRowData;
+import org.apache.shardingsphere.infra.yaml.data.pojo.YamlRowStatistics;
import
org.apache.shardingsphere.mode.metadata.persist.service.metadata.table.TableRowDataPersistService;
import org.apache.shardingsphere.mode.spi.repository.PersistRepository;
import org.junit.jupiter.api.BeforeEach;
@@ -110,9 +110,9 @@ class ShardingSphereStatisticsPersistServiceTest {
@Test
void assertUpdate() {
- Collection<YamlShardingSphereRowData> addedRows =
Collections.singletonList(mock(YamlShardingSphereRowData.class));
- Collection<YamlShardingSphereRowData> updatedRows =
Collections.singletonList(mock(YamlShardingSphereRowData.class));
- Collection<YamlShardingSphereRowData> deletedRows =
Collections.singletonList(mock(YamlShardingSphereRowData.class));
+ Collection<YamlRowStatistics> addedRows =
Collections.singletonList(mock(YamlRowStatistics.class));
+ Collection<YamlRowStatistics> updatedRows =
Collections.singletonList(mock(YamlRowStatistics.class));
+ Collection<YamlRowStatistics> deletedRows =
Collections.singletonList(mock(YamlRowStatistics.class));
AlteredShardingSphereDatabaseData alteredData = new
AlteredShardingSphereDatabaseData("foo_db", "foo_schema", "foo_tbl");
alteredData.getAddedRows().addAll(addedRows);
alteredData.getUpdatedRows().addAll(updatedRows);
diff --git
a/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/service/metadata/table/TableRowDataPersistServiceTest.java
b/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/service/metadata/table/TableRowDataPersistServiceTest.java
index 164facae1d5..6267cbaafef 100644
---
a/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/service/metadata/table/TableRowDataPersistServiceTest.java
+++
b/mode/core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/service/metadata/table/TableRowDataPersistServiceTest.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.mode.metadata.persist.service.metadata.table;
import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable;
import org.apache.shardingsphere.infra.metadata.statistics.TableStatistics;
-import
org.apache.shardingsphere.infra.yaml.data.pojo.YamlShardingSphereRowData;
+import org.apache.shardingsphere.infra.yaml.data.pojo.YamlRowStatistics;
import org.apache.shardingsphere.mode.spi.repository.PersistRepository;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -57,7 +57,7 @@ class TableRowDataPersistServiceTest {
@Test
void assertPersistWithRows() {
- YamlShardingSphereRowData rowData = new YamlShardingSphereRowData();
+ YamlRowStatistics rowData = new YamlRowStatistics();
rowData.setUniqueKey("foo_key");
persistService.persist("foo_db", "foo_schema", "foo_tbl",
Collections.singletonList(rowData));
verify(repository).persist("/statistics/databases/foo_db/schemas/foo_schema/tables/foo_tbl/foo_key",
"uniqueKey: foo_key" + System.lineSeparator());
@@ -65,7 +65,7 @@ class TableRowDataPersistServiceTest {
@Test
void assertDelete() {
- YamlShardingSphereRowData rowData = new YamlShardingSphereRowData();
+ YamlRowStatistics rowData = new YamlRowStatistics();
rowData.setUniqueKey("foo_key");
persistService.delete("foo_db", "foo_schema", "foo_tbl",
Collections.singletonList(rowData));
verify(repository).delete("/statistics/databases/foo_db/schemas/foo_schema/tables/foo_tbl/foo_key");
diff --git
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/ShardingSphereStatisticsChangedHandler.java
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/ShardingSphereStatisticsChangedHandler.java
index eb3c28edc62..5883d7f5d90 100644
---
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/ShardingSphereStatisticsChangedHandler.java
+++
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/ShardingSphereStatisticsChangedHandler.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.mode.manager.cluster.dispatch.handler.global;
import com.google.common.base.Strings;
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
-import
org.apache.shardingsphere.infra.yaml.data.pojo.YamlShardingSphereRowData;
+import org.apache.shardingsphere.infra.yaml.data.pojo.YamlRowStatistics;
import
org.apache.shardingsphere.mode.node.path.metadata.ShardingSphereStatisticsNodePath;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
@@ -124,7 +124,7 @@ public final class ShardingSphereStatisticsChangedHandler
implements DataChanged
private void handleRowDataChanged(final ShardingSphereDatabaseDataManager
databaseManager, final Type type, final String eventValue,
final String databaseName, final String
schemaName, final String tableName, final String uniqueKey) {
if ((Type.ADDED == type || Type.UPDATED == type) &&
!Strings.isNullOrEmpty(eventValue)) {
- databaseManager.alterShardingSphereRowData(databaseName,
schemaName, tableName, YamlEngine.unmarshal(eventValue,
YamlShardingSphereRowData.class));
+ databaseManager.alterShardingSphereRowData(databaseName,
schemaName, tableName, YamlEngine.unmarshal(eventValue,
YamlRowStatistics.class));
} else if (Type.DELETED == type) {
databaseManager.deleteShardingSphereRowData(databaseName,
schemaName, tableName, uniqueKey);
}
diff --git
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/ShardingSphereStatisticsChangedHandlerTest.java
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/ShardingSphereStatisticsChangedHandlerTest.java
index c5fbb7ca07e..3edded45263 100644
---
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/ShardingSphereStatisticsChangedHandlerTest.java
+++
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/ShardingSphereStatisticsChangedHandlerTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.mode.manager.cluster.dispatch.handler.global;
import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
-import
org.apache.shardingsphere.infra.yaml.data.pojo.YamlShardingSphereRowData;
+import org.apache.shardingsphere.infra.yaml.data.pojo.YamlRowStatistics;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.manager.ContextManager;
@@ -88,7 +88,7 @@ class ShardingSphereStatisticsChangedHandlerTest {
@Test
void assertHandleWithShardingSphereRowChanged() {
- YamlShardingSphereRowData rowData = new YamlShardingSphereRowData();
+ YamlRowStatistics rowData = new YamlRowStatistics();
rowData.setUniqueKey("1");
handler.handle(contextManager, new
DataChangedEvent("/statistics/databases/foo_db/schemas/foo_schema/tables/foo_tbl/1",
"{uniqueKey: 1}", Type.ADDED));
verify(contextManager.getMetaDataContextManager().getDatabaseManager()).alterShardingSphereRowData(eq("foo_db"),
eq("foo_schema"), eq("foo_tbl"), refEq(rowData));