yjhjstz commented on code in PR #1675:
URL: https://github.com/apache/cloudberry/pull/1675#discussion_r3065658607
##########
gpMgmt/bin/gppylib/commands/pg.py:
##########
@@ -17,6 +19,31 @@
GPHOME=os.environ.get('GPHOME')
+
+def ensure_replication_slot_exists(source_host, source_port,
+ replication_slot_name):
+ if not replication_slot_name:
+ return False
+
+ escaped_slot_name = replication_slot_name.replace("'", "''")
+ dburl = dbconn.DbURL(hostname=source_host, port=source_port,
+ dbname='template1')
+ with closing(dbconn.connect(dburl, utility=True)) as conn:
+ slot_exists = dbconn.querySingleton(
+ conn,
+ "SELECT count(*) FROM pg_catalog.pg_replication_slots "
+ "WHERE slot_name = '{}'".format(escaped_slot_name))
+ if slot_exists > 0:
+ return False
+
+ dbconn.querySingleton(
Review Comment:
use `dbconn.execSQL` ?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]