修复复制槽名称长度为64,65时提示创建复制槽成功但是复制槽不存在的偶现问题

This commit is contained in:
unknown
2022-07-30 17:37:30 +08:00
parent 451ed9c59e
commit 33faa1a8ce
2 changed files with 2 additions and 3 deletions

View File

@ -1221,7 +1221,7 @@ int main(int argc, char** argv)
rc = snprintf_s(query,
sizeof(query),
sizeof(query) - 1,
"CREATE_REPLICATION_SLOT \"%s\" LOGICAL \"%s\"",
"CREATE_REPLICATION_SLOT %s LOGICAL %s",
replication_slot,
plugin);
securec_check_ss_c(rc, "\0", "\0");

View File

@ -2035,7 +2035,6 @@ static bool cmdStringLengthCheck(const char* cmd_string)
{
const size_t cmd_length_limit = 1024;
const size_t slotname_limit = 64;
const size_t double_quotes_len = 2;
char comd[cmd_length_limit] = {'\0'};
char* sub_cmd = NULL;
char* rm_cmd = NULL;
@ -2085,7 +2084,7 @@ static bool cmdStringLengthCheck(const char* cmd_string)
return true;
}
if (strlen(slot_name) >= slotname_limit + double_quotes_len) {
if (strlen(slot_name) >= slotname_limit) {
return false;
}
return true;