justbk2015 commented on a change in pull request #12318:
URL: https://github.com/apache/shardingsphere/pull/12318#discussion_r706542356



##########
File path: 
shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-postgresql/src/main/java/org/apache/shardingsphere/scaling/postgresql/component/PostgreSQLWalDumper.java
##########
@@ -75,16 +77,19 @@ public void start() {
     }
     
     private void dump() {
-        try (Connection pgConnection = 
logicalReplication.createPgConnection((StandardJDBCDataSourceConfiguration) 
dumperConfig.getDataSourceConfig());
-             PGReplicationStream stream = 
logicalReplication.createReplicationStream(pgConnection, 
PostgreSQLPositionInitializer.SLOT_NAME, walPosition.getLogSequenceNumber())) {
-            DecodingPlugin decodingPlugin = new 
TestDecodingPlugin(pgConnection.unwrap(PgConnection.class).getTimestampUtils());
+        try {
+            Connection pgConnection = 
logicalReplication.createPgConnection((StandardJDBCDataSourceConfiguration) 
dumperConfig.getDataSourceConfig());
+            PostgreSQLTimestampUtils utils = new 
PostgreSQLTimestampUtils(pgConnection.unwrap(PgConnection.class).getTimestampUtils());
+            DecodingPlugin decodingPlugin = new TestDecodingPlugin(utils);
+            PGReplicationStream stream = 
logicalReplication.createReplicationStream(pgConnection, 
PostgreSQLPositionInitializer.SLOT_NAME, walPosition.getLogSequenceNumber());

Review comment:
       I have already add try-resource, with Connection.
   stream no need to close, if called close, the database will throw 
SQLException info: backend close except.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to