Implementation:Apache Shardingsphere TableRowDataPersistService Persist
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Persistence, Statistics |
| Last Updated | 2026-02-10 00:00 GMT |
Overview
Persistence service for table row statistics data with YAML serialization.
Description
TableRowDataPersistService manages individual row statistics persistence using YAML marshaling and unmarshaling. It supports persisting, updating, deleting, and loading row-level statistics data identified by unique keys within a database/schema/table hierarchy.
Usage
Used by StatisticsPersistService to handle fine-grained row-level statistics persistence operations.
Code Reference
Source Location
- Repository: Apache_Shardingsphere
- File: TableRowDataPersistService.java
- Lines: 1-91
Signature
@RequiredArgsConstructor
public final class TableRowDataPersistService {
private final PersistRepository repository;
public void persist(String databaseName, String schemaName, String tableName,
Collection<YamlRowStatistics> rows);
public void update(String databaseName, String schemaName, String tableName,
String uniqueKey, YamlRowStatistics row);
public void delete(String databaseName, String schemaName, String tableName, String uniqueKey);
public TableStatistics load(String databaseName, String schemaName, String tableName);
}
Import
import org.apache.shardingsphere.mode.metadata.persist.metadata.service.TableRowDataPersistService;
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| databaseName | String | Yes | Target database |
| schemaName | String | Yes | Target schema |
| tableName | String | Yes | Target table |
| uniqueKey | String | Varies | Row unique identifier |
| rows | Collection<YamlRowStatistics> | Varies | Row statistics to persist |
Outputs
| Name | Type | Description |
|---|---|---|
| load() returns | TableStatistics | All row statistics for a table |
Usage Examples
TableRowDataPersistService service = new TableRowDataPersistService(repository);
// Persist row statistics
service.persist("my_db", "public", "t_order", yamlRows);
// Load statistics for a table
TableStatistics stats = service.load("my_db", "public", "t_order");
// Delete a specific row
service.delete("my_db", "public", "t_order", "row_key_1");
Related Pages
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment