修复 【使用alter system方式修改参数num_internal_lock_partitions后,重启数据库失败】的问题
This commit is contained in:
@ -4816,7 +4816,7 @@ void InitializeNumLwLockPartitions(void)
|
||||
/* set default values */
|
||||
SetLWLockPartDefaultNum();
|
||||
/* Do str copy and remove space. */
|
||||
char* attr = TrimStr(g_instance.attr.attr_storage.num_internal_lock_partitions_str);
|
||||
char* attr = TrimStrQuote(g_instance.attr.attr_storage.num_internal_lock_partitions_str, true);
|
||||
if (attr == NULL || attr[0] == '\0') { /* use default values */
|
||||
return;
|
||||
}
|
||||
@ -6125,11 +6125,24 @@ static void assign_ss_log_backup_file_count(int newval, void *extra)
|
||||
|
||||
static bool check_logical_decode_options_default(char** newval, void** extra, GucSource source)
|
||||
{
|
||||
if (!LogicalDecodeParseOptionsDefault(*newval, extra)) {
|
||||
GUC_check_errdetail("invalid parameter setting for loglical_decode_options_default");
|
||||
return false;
|
||||
/*Check argument whether coming frmo SYATEM ALTER SET*/
|
||||
char* temp = *newval;
|
||||
int len = strlen(temp);
|
||||
char ch = (len > 0) ? temp[len-1] : '\0';
|
||||
if(QuoteCheckOut(temp)) {
|
||||
temp[len - 1] = '\0';
|
||||
temp++;
|
||||
}
|
||||
if (!LogicalDecodeParseOptionsDefault(temp, extra)) {
|
||||
GUC_check_errdetail("invalid parameter setting for loglical_decode_options_default");
|
||||
if(len != 0) {
|
||||
(*newval)[len - 1] = ch;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if(len != 0) {
|
||||
(*newval)[len - 1] = ch;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -8714,7 +8714,7 @@ bool StrToInt32(const char* s, int *val)
|
||||
return true;
|
||||
}
|
||||
|
||||
char* TrimStr(const char* str)
|
||||
char* TrimStrQuote(const char* str, bool isQuote)
|
||||
{
|
||||
if (str == NULL) {
|
||||
return NULL;
|
||||
@ -8742,12 +8742,24 @@ char* TrimStr(const char* str)
|
||||
}
|
||||
|
||||
len = end - begin + 1;
|
||||
|
||||
if (isQuote && len>=2 && *begin == '"' && *end == '"') {
|
||||
begin++;
|
||||
end--;
|
||||
len = end - begin + 1;
|
||||
}
|
||||
|
||||
rc = memmove_s(cpyStr, strlen(cpyStr), begin, len);
|
||||
securec_check(rc, "\0", "\0");
|
||||
cpyStr[len] = '\0';
|
||||
return cpyStr;
|
||||
}
|
||||
|
||||
char* TrimStr(const char* str)
|
||||
{
|
||||
return TrimStrQuote(str, false);
|
||||
}
|
||||
|
||||
/* Deserialize the LOCATION options into locations list.
|
||||
* the multi-locations should be separated by '|'
|
||||
*/
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
#include "postgres.h"
|
||||
#include "knl/knl_variable.h"
|
||||
#include "utils/guc.h"
|
||||
|
||||
#include "commands/copy.h"
|
||||
#include "access/multi_redo_settings.h"
|
||||
#include "access/multi_redo_api.h"
|
||||
#include "threadpool/threadpool_controler.h"
|
||||
@ -133,7 +133,7 @@ static uint32 GetCPUCount()
|
||||
|
||||
void ParseBindCpuInfo(RedoCpuBindControl *control)
|
||||
{
|
||||
char* attr = TrimStr(g_instance.attr.attr_storage.redo_bind_cpu_attr);
|
||||
char* attr = TrimStrQuote(g_instance.attr.attr_storage.redo_bind_cpu_attr, true);
|
||||
if (attr == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -85,6 +85,15 @@ static void parallel_change_cb_wrapper(ParallelReorderBuffer *cache, ReorderBuff
|
||||
static void LoadOutputPlugin(OutputPluginCallbacks *callbacks, const char *plugin);
|
||||
static void LoadOutputPlugin(ParallelOutputPluginCallbacks *callbacks, const char *plugin);
|
||||
|
||||
/* Checkout aurgments whether coming from ALTER SYSTEM SET*/
|
||||
bool QuoteCheckOut(char* newval)
|
||||
{
|
||||
int len = strlen(newval);
|
||||
if(len >= 2 && newval[0] == '"' && newval[0] == newval[len - 1])
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure the current settings & environment are capable of doing logical
|
||||
* decoding.
|
||||
|
||||
@ -448,8 +448,8 @@ extern int GetDecimalFromHex(char hex);
|
||||
extern char* limit_printout_length(const char* str);
|
||||
|
||||
extern bool StrToInt32(const char* s, int *val);
|
||||
extern char* TrimStrQuote(const char* str, bool isQuote);
|
||||
extern char* TrimStr(const char* str);
|
||||
|
||||
extern void UHeapAddToBulkInsertSelect(CopyFromBulk bulk, Tuple tup, bool needCopy);
|
||||
|
||||
extern void HeapAddToBulkInsertSelect(CopyFromBulk bulk, Tuple tup, bool needCopy);
|
||||
|
||||
@ -306,7 +306,7 @@ typedef struct DecodeOptionsDefault {
|
||||
|
||||
extern LogicalDispatcher g_Logicaldispatcher[];
|
||||
extern bool firstCreateDispatcher;
|
||||
|
||||
extern bool QuoteCheckOut(char* newval);
|
||||
extern void CheckLogicalDecodingRequirements(Oid databaseId);
|
||||
extern void ParallelReorderBufferQueueChange(ParallelReorderBuffer *rb, logicalLog *change, int slotId);
|
||||
extern void ParallelReorderBufferForget(ParallelReorderBuffer *rb, int slotId, ParallelReorderBufferTXN *txn);
|
||||
|
||||
Reference in New Issue
Block a user