def create_slot(self):
logger.info('Creating slot %s' % self.slot_name)
try:
self._repl_cursor.create_replication_slot(self.slot_name,
slot_type=psycopg2.extras.REPLICATION_LOGICAL,
output_plugin='test_decoding')
except psycopg2.ProgrammingError as p:
# Will be raised if slot exists already.
if p.pgcode != psycopg2.errorcodes.DUPLICATE_OBJECT:
logger.error(p)
raise
else:
logger.info('Slot %s is already present.' % self.slot_name)
评论列表
文章目录