This is an automated email from the ASF dual-hosted git repository.
zhonghongsheng 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 3cc435f2fd1 Rename PostgreSQLReplicationSlotInfo (#32519)
3cc435f2fd1 is described below
commit 3cc435f2fd17da6abed72c17f7dfe0b65f170ccd
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Aug 15 12:10:06 2024 +0800
Rename PostgreSQLReplicationSlotInfo (#32519)
---
.../PostgreSQLReplicationSlotInfo.java} | 6 +++---
.../pipeline/postgresql/ingest/slot/PostgreSQLSlotManager.java | 7 +++----
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git
a/kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/pojo/ReplicationSlotInfo.java
b/kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/slot/PostgreSQLReplicationSlotInfo.java
similarity index 91%
rename from
kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/pojo/ReplicationSlotInfo.java
rename to
kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/slot/PostgreSQLReplicationSlotInfo.java
index 3b14d003269..5445729a27f 100644
---
a/kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/pojo/ReplicationSlotInfo.java
+++
b/kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/slot/PostgreSQLReplicationSlotInfo.java
@@ -15,17 +15,17 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.data.pipeline.postgresql.ingest.pojo;
+package org.apache.shardingsphere.data.pipeline.postgresql.ingest.slot;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
- * Replication slot info.
+ * Replication slot info of PostgreSQL.
*/
@RequiredArgsConstructor
@Getter
-public final class ReplicationSlotInfo {
+public final class PostgreSQLReplicationSlotInfo {
private final String slotName;
diff --git
a/kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/slot/PostgreSQLSlotManager.java
b/kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/slot/PostgreSQLSlotManager.java
index e0d08e82ee9..06889f97b03 100644
---
a/kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/slot/PostgreSQLSlotManager.java
+++
b/kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/slot/PostgreSQLSlotManager.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.data.pipeline.postgresql.ingest.slot;
import lombok.RequiredArgsConstructor;
-import
org.apache.shardingsphere.data.pipeline.postgresql.ingest.pojo.ReplicationSlotInfo;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -45,7 +44,7 @@ public final class PostgreSQLSlotManager {
*/
public void create(final Connection connection, final String
slotNameSuffix) throws SQLException {
String slotName =
PostgreSQLSlotNameGenerator.getUniqueSlotName(connection, slotNameSuffix);
- Optional<ReplicationSlotInfo> slotInfo = load(connection, slotName);
+ Optional<PostgreSQLReplicationSlotInfo> slotInfo = load(connection,
slotName);
if (!slotInfo.isPresent()) {
doCreate(connection, slotName);
return;
@@ -56,13 +55,13 @@ public final class PostgreSQLSlotManager {
}
}
- private Optional<ReplicationSlotInfo> load(final Connection connection,
final String slotName) throws SQLException {
+ private Optional<PostgreSQLReplicationSlotInfo> load(final Connection
connection, final String slotName) throws SQLException {
String sql = "SELECT slot_name, database FROM pg_replication_slots
WHERE slot_name=? AND plugin=?";
try (PreparedStatement preparedStatement =
connection.prepareStatement(sql)) {
preparedStatement.setString(1, slotName);
preparedStatement.setString(2, decodePlugin);
try (ResultSet resultSet = preparedStatement.executeQuery()) {
- return resultSet.next() ? Optional.of(new
ReplicationSlotInfo(resultSet.getString(1), resultSet.getString(2))) :
Optional.empty();
+ return resultSet.next() ? Optional.of(new
PostgreSQLReplicationSlotInfo(resultSet.getString(1), resultSet.getString(2)))
: Optional.empty();
}
}
}