forked from openGauss-Ecosystem/openGauss-server
Compare commits
3 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
595ea4c5f9 | |
|
|
14511103b3 | |
|
|
93cf8543c1 |
|
|
@ -1,24 +0,0 @@
|
|||
[submodule "openGauss-Custom-function"]
|
||||
path = openGauss-Custom-function
|
||||
url = ../openGauss-Custom-function.git
|
||||
[submodule "openGauss-Query-select"]
|
||||
path = openGauss-Query-select
|
||||
url = ../openGauss-Query-select.git
|
||||
[submodule "openGauss-Security-control"]
|
||||
path = openGauss-Security-control
|
||||
url = ../openGauss-Security-control.git
|
||||
[submodule "openGauss-Stored-Procedure"]
|
||||
path = openGauss-Stored-Procedure
|
||||
url = ../openGauss-Stored-Procedure.git
|
||||
[submodule "openGauss-basic-operation"]
|
||||
path = openGauss-basic-operation
|
||||
url = ../openGauss-basic-operation.git
|
||||
[submodule "openGauss-transaction"]
|
||||
path = openGauss-transaction
|
||||
url = ../openGauss-transaction.git
|
||||
[submodule "openGauss-trigger"]
|
||||
path = openGauss-trigger
|
||||
url = ../openGauss-trigger.git
|
||||
[submodule "openGauss-competition"]
|
||||
path = openGauss-competition
|
||||
url = ../openGauss-competition.git
|
||||
|
|
@ -835,7 +835,6 @@
|
|||
./lib/libpagecompression.so*
|
||||
./lib/libdssapi.so
|
||||
./lib/libdms.so
|
||||
./lib/libodbc.so*
|
||||
|
||||
./include/postgresql/server/postgres_ext.h
|
||||
./include/postgresql/server/pg_config_os.h
|
||||
|
|
|
|||
|
|
@ -884,7 +884,6 @@
|
|||
./lib/postgresql/latin2_and_win1250.so
|
||||
./lib/postgresql/euc2004_sjis2004.so
|
||||
./lib/libhll.so
|
||||
./lib/libodbc.so*
|
||||
|
||||
./include/postgresql/server/postgres_ext.h
|
||||
./include/postgresql/server/pg_config_os.h
|
||||
|
|
|
|||
|
|
@ -887,7 +887,6 @@
|
|||
./lib/postgresql/latin2_and_win1250.so
|
||||
./lib/postgresql/euc2004_sjis2004.so
|
||||
./lib/libhll.so
|
||||
./lib/libodbc.so*
|
||||
|
||||
./include/postgresql/server/postgres_ext.h
|
||||
./include/postgresql/server/pg_config_os.h
|
||||
|
|
|
|||
|
|
@ -832,7 +832,6 @@
|
|||
./lib/libpagecompression.so*
|
||||
./lib/libdssapi.so
|
||||
./lib/libdms.so
|
||||
./lib/libodbc.so*
|
||||
|
||||
./include/postgresql/server/postgres_ext.h
|
||||
./include/postgresql/server/pg_config_os.h
|
||||
|
|
|
|||
|
|
@ -106,7 +106,6 @@ static bool UseODBCLinker(char* connstr);
|
|||
#define REMOTE_CONN_HASH (get_session_context()->remoteConnHash)
|
||||
/* initial number of connection hashes */
|
||||
#define NUMCONN 16
|
||||
#define NAX_ERR_MSG_LEN 1000
|
||||
#define MAX_BUF_LEN 100000
|
||||
#define MAX_DRIVERNAME_LEN 50
|
||||
#define DBLINK_NOTIFY_COLS 3
|
||||
|
|
@ -560,9 +559,6 @@ ODBCLinker::ODBCLinker(char* connstr_or_name)
|
|||
}
|
||||
|
||||
LinkInfo linfo;
|
||||
linfo.drivername = NULL;
|
||||
linfo.password = NULL;
|
||||
linfo.username = NULL;
|
||||
int len = strlen(connstr_or_name);
|
||||
GetDrivername(connstr_or_name, &linfo);
|
||||
/* atuo commit is the default value */
|
||||
|
|
@ -572,13 +568,11 @@ ODBCLinker::ODBCLinker(char* connstr_or_name)
|
|||
securec_check(rc, "\0", "\0");
|
||||
|
||||
if ((error != SQL_SUCCESS) && (error != SQL_SUCCESS_WITH_INFO)) {
|
||||
SQLCHAR sqlcode[NAX_ERR_MSG_LEN];
|
||||
SQLGetDiagField(SQL_HANDLE_DBC, this->connHandle, 1, SQL_DIAG_MESSAGE_TEXT, &sqlcode, NAX_ERR_MSG_LEN, NULL);
|
||||
SQLFreeHandle(SQL_HANDLE_DBC, this->connHandle);
|
||||
SQLFreeHandle(SQL_HANDLE_ENV, this->envHandle);
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_CONNECTION_FAILURE),
|
||||
errmsg("Error SQLConnect\n%s", sqlcode)));
|
||||
errmsg("Error SQLConnect")));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -635,8 +629,9 @@ char* ODBCLinker::errorMsg()
|
|||
if (this->stmt == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
char* msg = (char*)palloc(sizeof(char) * NAX_ERR_MSG_LEN);
|
||||
SQLGetDiagRec(SQL_HANDLE_STMT, this->stmt, 1, NULL, NULL, (SQLCHAR*)msg, NAX_ERR_MSG_LEN, NULL);
|
||||
int msgLen = 100;
|
||||
char* msg = (char*)palloc(sizeof(char) * msgLen);
|
||||
SQLGetDiagRec(SQL_HANDLE_STMT, this->stmt, 1, NULL, NULL, (SQLCHAR*)msg, 100 ,NULL);
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -310,7 +310,7 @@ docker_temp_server_start() {
|
|||
|
||||
# internal start of server in order to allow setup using gsql client
|
||||
# does not listen on external TCP/IP and waits until start finishes
|
||||
set -- "$@" -c "listen_addresses='*'" -p "${PGPORT:-5432}"
|
||||
set -- "$@" -c listen_addresses='' -p "${PGPORT:-5432}"
|
||||
|
||||
PGUSER="${PGUSER:-$GS_USER}" \
|
||||
gs_ctl -D "$PGDATA" \
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit f2a09ee9e98b3c0ed1ec26da6f1c3ddacece41b1
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit ba09836e0bb59243426a28b79c260570ec87e78e
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 5c3a84bd0c656ef7529a8fcd806e07f24560b415
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 22959853b32c2653c6dc663fb236329680847ed6
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 26e5d6310154258393807b95336c04b2eda991ce
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit a8f2377a242dbdb6a8366738c85d365bef478477
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit d037643b5dfb030eb8b0da4ecb22b0bd6a51a8b1
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit f7a9a3b2e2c28a4f045a857debcaea372273826d
|
||||
|
|
@ -4205,7 +4205,7 @@ int main(int argc, char* argv[])
|
|||
break;
|
||||
case 8:
|
||||
FREE_NOT_STATIC_ZERO_STRING(locale);
|
||||
locale = xstrdup("C");
|
||||
locale = "C";
|
||||
break;
|
||||
case 9:
|
||||
FREE_NOT_STATIC_ZERO_STRING(pwfilename);
|
||||
|
|
|
|||
|
|
@ -1154,6 +1154,8 @@ static void BaseBackup(void)
|
|||
/* Error message already written in GetConnection() */
|
||||
exit(1);
|
||||
|
||||
ClearAndFreePasswd();
|
||||
|
||||
/*
|
||||
* Run IDENTIFY_SYSTEM so we can get the timeline
|
||||
*/
|
||||
|
|
@ -1333,7 +1335,6 @@ static void BaseBackup(void)
|
|||
StartLogStreamer((const char *)xlogstart, timeline, sysidentifier);
|
||||
}
|
||||
|
||||
ClearAndFreePasswd();
|
||||
/* free sysidentifier after use */
|
||||
PQfreemem(sysidentifier);
|
||||
sysidentifier = NULL;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1137,67 +1137,6 @@ void* MemoryContextAllocZeroAlignedDebug(MemoryContext context, Size size, const
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* MemoryContextAllocExtended
|
||||
* Allocate space within the specified context using the given flags.
|
||||
*
|
||||
* This method supports all three memory allocation flags which makes it
|
||||
* suitable for almost all circumstances.
|
||||
*/
|
||||
void* MemoryContextAllocExtendedDebug(MemoryContext context, Size size, int flags, const char* file, int line)
|
||||
{
|
||||
void* ret = NULL;
|
||||
bool allocsz_is_valid = false;
|
||||
|
||||
Assert(MemoryContextIsValid(context));
|
||||
#ifdef MEMORY_CONTEXT_CHECKING
|
||||
PreventActionOnSealedContext(context);
|
||||
#endif
|
||||
|
||||
/* Make sure memory allocation size is valid. */
|
||||
if ((flags & MCXT_ALLOC_HUGE) != 0) {
|
||||
allocsz_is_valid = AllocHugeSizeIsValid(size);
|
||||
} else {
|
||||
allocsz_is_valid = AllocSizeIsValid(size);
|
||||
}
|
||||
|
||||
if (!allocsz_is_valid) {
|
||||
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("invalid memory alloc request size %lu in %s:%d", (unsigned long)size, file, line)));
|
||||
}
|
||||
|
||||
context->isReset = false;
|
||||
|
||||
/* Invoke memory allocator */
|
||||
ret = (*context->methods->alloc)(context, 0, size, file, line);
|
||||
if ((flags & MCXT_ALLOC_NO_OOM) != 0) {
|
||||
/* Do nothing */
|
||||
} else if (unlikely(ret == NULL)) {
|
||||
ereport(ERROR, (errcode(ERRCODE_OUT_OF_LOGICAL_MEMORY), errmsg("memory is temporarily unavailable"),
|
||||
errdetail("Failed on request of size %lu bytes under queryid %lu in %s:%d.",
|
||||
(unsigned long)size, u_sess->debug_query_id, file, line)));
|
||||
}
|
||||
|
||||
/* Set aligned if MCXT_ALLOC_ZERO */
|
||||
if ((flags & MCXT_ALLOC_ZERO) != 0) {
|
||||
MemSetAligned(ret, 0, size);
|
||||
}
|
||||
|
||||
#ifdef MEMORY_CONTEXT_CHECKING
|
||||
/* check if the memory context is out of control */
|
||||
MemoryContextCheckMaxSize(context, size, file, line);
|
||||
#endif
|
||||
|
||||
/* check if the session used memory is beyond the limitation */
|
||||
if (unlikely(STATEMENT_MAX_MEM)) {
|
||||
MemoryContextCheckSessionMemory(context, size, file, line);
|
||||
}
|
||||
InsertMemoryAllocInfo(ret, context, file, line, size);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* palloc_extended
|
||||
* palloc with flags, it will return NULL while OOM happend.
|
||||
|
|
|
|||
|
|
@ -657,13 +657,13 @@ static HeapTuple PLy_modify_tuple(PLyProcedure* proc, PyObject* pltd, TriggerDat
|
|||
} else if (plval != Py_None) {
|
||||
PLyObToDatum* att = &proc->result.out.r.atts[atti];
|
||||
|
||||
modvalues[i] = (att->func)(att, tupdesc->attrs[atti].atttypmod, plval);
|
||||
modvalues[i] = (att->func)(att, tupdesc->attrs[atti]->atttypmod, plval);
|
||||
modnulls[i] = ' ';
|
||||
} else {
|
||||
modvalues[i] = InputFunctionCall(&proc->result.out.r.atts[atti].typfunc,
|
||||
NULL,
|
||||
proc->result.out.r.atts[atti].typioparam,
|
||||
tupdesc->attrs[atti].atttypmod);
|
||||
tupdesc->attrs[atti]->atttypmod);
|
||||
modnulls[i] = 'n';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
#include "executor/spi.h"
|
||||
#include "executor/executor.h"
|
||||
#include "miscadmin.h"
|
||||
#include "auditfuncs.h"
|
||||
#include "pgaudit.h"
|
||||
#include "utils/guc.h"
|
||||
#include "utils/memutils.h"
|
||||
|
|
@ -30,6 +29,7 @@
|
|||
#include "plpy_plpymodule.h"
|
||||
#include "plpy_procedure.h"
|
||||
|
||||
const int PGAUDIT_MAXLENGTH = 1024;
|
||||
|
||||
/* exported functions */
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ static PLyProcedure* PLy_procedure_create(HeapTuple procTup, Oid fn_oid, bool is
|
|||
rvTypeStruct = (Form_pg_type)GETSTRUCT(rvTypeTup);
|
||||
/* Disallow pseudotype result, except for void or record */
|
||||
if (rvTypeStruct->typtype == TYPTYPE_PSEUDO) {
|
||||
if (procStruct->prorettype == TRIGGEROID || procStruct->prorettype == EVTTRIGGEROID) {
|
||||
if (procStruct->prorettype == TRIGGEROID || rettype == EVTTRIGGEROID) {
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("trigger functions can only be called as triggers")));
|
||||
|
|
|
|||
|
|
@ -300,6 +300,7 @@ static int CBDbIsPrimary(void *db_handle)
|
|||
|
||||
static int CBSwitchoverPromote(void *db_handle, unsigned char origPrimaryId)
|
||||
{
|
||||
g_instance.dms_cxt.SSClusterState = NODESTATE_STANDBY_PROMOTING;
|
||||
g_instance.dms_cxt.SSRecoveryInfo.new_primary_reset_walbuf_flag = true;
|
||||
/* allow recovery in switchover to keep LSN in order */
|
||||
t_thrd.shemem_ptr_cxt.XLogCtl->IsRecoveryDone = false;
|
||||
|
|
@ -1248,10 +1249,12 @@ static int CBRecoveryStandby(void *db_handle, int inst_id)
|
|||
Assert(inst_id == g_instance.attr.attr_storage.dms_attr.instance_id);
|
||||
ereport(LOG, (errmsg("[SS reform] Recovery as standby")));
|
||||
|
||||
g_instance.dms_cxt.SSRecoveryInfo.skip_redo_replay = true;
|
||||
if (!SSRecoveryNodes()) {
|
||||
ereport(WARNING, (errmodule(MOD_DMS), errmsg("Recovery failed in startup first")));
|
||||
return GS_ERROR;
|
||||
}
|
||||
g_instance.dms_cxt.SSRecoveryInfo.skip_redo_replay = false;
|
||||
|
||||
return GS_SUCCESS;
|
||||
}
|
||||
|
|
@ -1260,6 +1263,7 @@ static int CBRecoveryPrimary(void *db_handle, int inst_id)
|
|||
{
|
||||
Assert(g_instance.dms_cxt.SSReformerControl.primaryInstId == inst_id ||
|
||||
g_instance.dms_cxt.SSReformerControl.primaryInstId == -1);
|
||||
g_instance.dms_cxt.SSRecoveryInfo.skip_redo_replay = false;
|
||||
g_instance.dms_cxt.SSRecoveryInfo.in_flushcopy = false;
|
||||
ereport(LOG, (errmsg("[SS reform] Recovery as primary, will replay xlog from inst:%d",
|
||||
g_instance.dms_cxt.SSReformerControl.primaryInstId)));
|
||||
|
|
@ -1388,31 +1392,23 @@ static int CBGetDBPrimaryId(void *db_handle, unsigned int *primary_id)
|
|||
return GS_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Currently only used in SS switchover. To prevent state machine misjudgement,
|
||||
* DSS status, dms_role, SSClusterState must be set atommically.
|
||||
* DSS recommends we retry dss_set_server_status if it failed.
|
||||
*/
|
||||
/* Currently only used in SS switchover */
|
||||
static void CBReformSetDmsRole(void *db_handle, unsigned int reformer_id)
|
||||
{
|
||||
ss_reform_info_t *reform_info = &g_instance.dms_cxt.SSReformInfo;
|
||||
dms_role_t new_dms_role = reformer_id == (unsigned int)SS_MY_INST_ID ? DMS_ROLE_REFORMER : DMS_ROLE_PARTNER;
|
||||
if (new_dms_role == DMS_ROLE_REFORMER) {
|
||||
ereport(LOG, (errmodule(MOD_DMS), errmsg("[SS switchover]begin to set currrent DSS as primary")));
|
||||
while (dss_set_server_status_wrapper() != GS_SUCCESS) {
|
||||
pg_usleep(REFORM_WAIT_LONG);
|
||||
ereport(WARNING, (errmodule(MOD_DMS),
|
||||
errmsg("Failed to set DSS as primary, vgname: \"%s\", socketpath: \"%s\"",
|
||||
g_instance.attr.attr_storage.dss_attr.ss_dss_vg_name,
|
||||
g_instance.attr.attr_storage.dss_attr.ss_dss_conn_path),
|
||||
errhint("Check vgname and socketpath and restart later.")));
|
||||
reform_info->dms_role = reformer_id == (unsigned int)SS_MY_INST_ID ? DMS_ROLE_REFORMER : DMS_ROLE_PARTNER;
|
||||
if (reform_info->dms_role == DMS_ROLE_REFORMER) {
|
||||
/* since original primary must have demoted, it is safe to allow promting standby write */
|
||||
if (dss_set_server_status_wrapper() != GS_SUCCESS) {
|
||||
ereport(PANIC, (errmodule(MOD_DMS),
|
||||
errmsg("Could not set dssserver flag, vgname: \"%s\", socketpath: \"%s\"",
|
||||
g_instance.attr.attr_storage.dss_attr.ss_dss_vg_name,
|
||||
g_instance.attr.attr_storage.dss_attr.ss_dss_conn_path),
|
||||
errhint("Check vgname and socketpath and restart later.")));
|
||||
}
|
||||
g_instance.dms_cxt.SSClusterState = NODESTATE_STANDBY_PROMOTING;
|
||||
}
|
||||
|
||||
reform_info->dms_role = new_dms_role;
|
||||
ereport(LOG, (errmodule(MOD_DMS),
|
||||
errmsg("[SS switchover]role and lock switched, updated inst:%d with role:%d success",
|
||||
errmsg("[SS switchover]switching, updated inst:%d with role:%d success",
|
||||
SS_MY_INST_ID, reform_info->dms_role)));
|
||||
}
|
||||
|
||||
|
|
@ -1446,13 +1442,8 @@ static void CBReformStartNotify(void *db_handle, dms_role_t role, unsigned char
|
|||
ereport(LOG, (errmodule(MOD_DMS),
|
||||
errmsg("[SS reform] dms reform start, role:%d, reform type:%d", role, (int)ss_reform_type)));
|
||||
if (reform_info->dms_role == DMS_ROLE_REFORMER) {
|
||||
while (dss_set_server_status_wrapper() != GS_SUCCESS) {
|
||||
pg_usleep(REFORM_WAIT_LONG);
|
||||
ereport(WARNING, (errmodule(MOD_DMS),
|
||||
errmsg("Failed to set DSS as primary, vgname: \"%s\", socketpath: \"%s\"",
|
||||
g_instance.attr.attr_storage.dss_attr.ss_dss_vg_name,
|
||||
g_instance.attr.attr_storage.dss_attr.ss_dss_conn_path),
|
||||
errhint("Check vgname and socketpath and restart later.")));
|
||||
if (dss_set_server_status_wrapper() != GS_SUCCESS) {
|
||||
ereport(PANIC, (errmodule(MOD_DMS), errmsg("[SS reform] Could not set dssserver flag=read_write")));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ bool SSRecoveryNodes()
|
|||
return result;
|
||||
}
|
||||
|
||||
bool SSRecoveryApplyDelay()
|
||||
bool SSRecoveryApplyDelay(const XLogReaderState *record)
|
||||
{
|
||||
if (!ENABLE_REFORM) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
dms_commit_id=e3e57f04172da967232eb5ec593e5576ee1563a4
|
||||
dss_commit_id=2b1567f18e8d78c0473b781b97cae963a06d1735
|
||||
dms_commit_id=4680252c5c93314e0a8c8a8cabac5365b6ec2f66
|
||||
dss_commit_id=e3e57f04172da967232eb5ec593e5576ee1563a4
|
||||
|
|
|
|||
|
|
@ -1440,7 +1440,7 @@ bool has_lossy_pages(RelOptInfo *baserel, const double &pages_fetched, double &l
|
|||
*/
|
||||
double heap_pages = Min(pages_fetched, baserel->pages);
|
||||
const long work_mem_size = u_sess->attr.attr_memory.work_mem * 1024L;
|
||||
long maxentries = tbm_calculate_entries(work_mem_size, false);
|
||||
long maxentries = tbm_calculate_entries(work_mem_size);
|
||||
if (maxentries >= heap_pages) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3037,13 +3037,11 @@ int PostmasterMain(int argc, char* argv[])
|
|||
}
|
||||
|
||||
if (SS_PRIMARY_MODE) {
|
||||
while (dss_set_server_status_wrapper() != GS_SUCCESS) {
|
||||
pg_usleep(REFORM_WAIT_LONG);
|
||||
ereport(WARNING, (errmodule(MOD_DMS),
|
||||
errmsg("Failed to set DSS as primary, vgname: \"%s\", socketpath: \"%s\"",
|
||||
g_instance.attr.attr_storage.dss_attr.ss_dss_vg_name,
|
||||
g_instance.attr.attr_storage.dss_attr.ss_dss_conn_path),
|
||||
errhint("Check vgname and socketpath and restart later.")));
|
||||
if (dss_set_server_status_wrapper() != GS_SUCCESS) {
|
||||
ereport(FATAL, (errmsg("Could not set dssserver flag, vgname: \"%s\", socketpath: \"%s\"",
|
||||
g_instance.attr.attr_storage.dss_attr.ss_dss_vg_name,
|
||||
g_instance.attr.attr_storage.dss_attr.ss_dss_conn_path),
|
||||
errhint("Check vgname and socketpath and restart later.")));
|
||||
}
|
||||
ereport(LOG, (errmsg("set dss server status as primary")));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6244,7 +6244,7 @@ ProcessUtilitySlow(Node *parse_tree,
|
|||
break;
|
||||
|
||||
case T_CreatePLangStmt:
|
||||
if (!IsInitdb && strncmp(((CreatePLangStmt*)parse_tree)->plname, "plpython", strlen("plpython")) != 0)
|
||||
if (!IsInitdb)
|
||||
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("new language is not yet supported.")));
|
||||
address = CreateProceduralLanguage((CreatePLangStmt*)parse_tree);
|
||||
#ifdef PGXC
|
||||
|
|
|
|||
|
|
@ -183,6 +183,7 @@ static void knl_g_dms_init(knl_g_dms_context *dms_cxt)
|
|||
dms_cxt->SSRecoveryInfo.recovery_pause_flag = true;
|
||||
dms_cxt->SSRecoveryInfo.failover_triggered = false;
|
||||
dms_cxt->SSRecoveryInfo.new_primary_reset_walbuf_flag = false;
|
||||
dms_cxt->SSRecoveryInfo.skip_redo_replay = false;
|
||||
dms_cxt->SSRecoveryInfo.ready_to_startup = false;
|
||||
dms_cxt->SSRecoveryInfo.startup_reform = true;
|
||||
dms_cxt->SSRecoveryInfo.restart_failover_flag = false;
|
||||
|
|
|
|||
|
|
@ -112,10 +112,8 @@ Node* MultiExecBitmapAnd(BitmapAndState* node)
|
|||
*/
|
||||
for (i = 0; i < nplans; i++) {
|
||||
PlanState* subnode = bitmapplans[i];
|
||||
TIDBitmap* subresult = NULL;
|
||||
TBMHandler tbm_handler;
|
||||
|
||||
subnode->hbktScanSlot.currSlot = node->ps.hbktScanSlot.currSlot;
|
||||
TIDBitmap* subresult = NULL;
|
||||
|
||||
subresult = (TIDBitmap*)MultiExecProcNode(subnode);
|
||||
if (subresult == NULL || !IsA(subresult, TIDBitmap))
|
||||
|
|
@ -127,8 +125,6 @@ Node* MultiExecBitmapAnd(BitmapAndState* node)
|
|||
if (result == NULL) {
|
||||
result = subresult; /* first subplan */
|
||||
} else {
|
||||
/* get tbm handlers */
|
||||
tbm_handler = tbm_get_handler(result);
|
||||
/*
|
||||
* If the global tbm intersect with non-global tbm,
|
||||
* set the final result to non-global tbm.
|
||||
|
|
@ -141,7 +137,7 @@ Node* MultiExecBitmapAnd(BitmapAndState* node)
|
|||
tbm_set_global(result, false);
|
||||
}
|
||||
|
||||
tbm_handler._intersect(result, subresult);
|
||||
tbm_intersect(result, subresult);
|
||||
tbm_free(subresult);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -258,7 +258,6 @@ static TupleTableSlot* BitmapHeapTblNext(BitmapHeapScanState* node)
|
|||
ExprContext* econtext = NULL;
|
||||
TableScanDesc scan = NULL;
|
||||
TIDBitmap* tbm = NULL;
|
||||
TBMHandler tbm_handler;
|
||||
TBMIterator* tbmiterator = NULL;
|
||||
TBMIterateResult* tbmres = NULL;
|
||||
HBktTblScanDesc hpscan = NULL;
|
||||
|
|
@ -302,7 +301,6 @@ static TupleTableSlot* BitmapHeapTblNext(BitmapHeapScanState* node)
|
|||
*/
|
||||
if (tbm == NULL) {
|
||||
tbm = (TIDBitmap*)MultiExecProcNode(outerPlanState(node));
|
||||
tbm_handler = tbm_get_handler(tbm);
|
||||
|
||||
if (tbm == NULL || !IsA(tbm, TIDBitmap)) {
|
||||
ereport(ERROR,
|
||||
|
|
@ -312,12 +310,12 @@ static TupleTableSlot* BitmapHeapTblNext(BitmapHeapScanState* node)
|
|||
}
|
||||
|
||||
node->tbm = tbm;
|
||||
node->tbmiterator = tbmiterator = tbm_handler._begin_iterate(tbm);
|
||||
node->tbmiterator = tbmiterator = tbm_begin_iterate(tbm);
|
||||
node->tbmres = tbmres = NULL;
|
||||
|
||||
#ifdef USE_PREFETCH
|
||||
if (u_sess->storage_cxt.target_prefetch_pages > 0) {
|
||||
node->prefetch_iterator = prefetch_iterator = tbm_handler._begin_iterate(tbm);
|
||||
node->prefetch_iterator = prefetch_iterator = tbm_begin_iterate(tbm);
|
||||
node->prefetch_pages = 0;
|
||||
node->prefetch_target = -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,21 @@
|
|||
#include "nodes/makefuncs.h"
|
||||
|
||||
static void ExecInitNextPartitionForBitmapIndexScan(BitmapIndexScanState* node);
|
||||
/* If bitmapscan uses global partition index, set tbm to global */
|
||||
static inline void GPIUpdateTbmType(BitmapIndexScanState* node, TIDBitmap* tbm)
|
||||
{
|
||||
if (RelationIsGlobalIndex(node->biss_RelationDesc)) {
|
||||
tbm_set_global(tbm, true);
|
||||
}
|
||||
}
|
||||
|
||||
/* if bitmapscan uses crossbucket index, set tbm->crossbucket to true */
|
||||
static inline void CBIUpdateTbmType(BitmapIndexScanState* node, TIDBitmap* tbm)
|
||||
{
|
||||
if (RelationIsCrossBucketIndex(node->biss_RelationDesc)) {
|
||||
tbm_set_crossbucket(tbm, true);
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* MultiExecBitmapIndexScan(node)
|
||||
|
|
@ -83,9 +98,13 @@ Node* MultiExecBitmapIndexScan(BitmapIndexScanState* node)
|
|||
node->biss_result = NULL; /* reset for next time */
|
||||
} else {
|
||||
/* XXX should we use less than u_sess->attr.attr_memory.work_mem for this? */
|
||||
long maxbytes = u_sess->attr.attr_memory.work_mem * 1024L;
|
||||
tbm = tbm_create(maxbytes, RelationIsGlobalIndex(node->biss_RelationDesc),
|
||||
RelationIsCrossBucketIndex(node->biss_RelationDesc), isUstore);
|
||||
tbm = TbmCreate(u_sess->attr.attr_memory.work_mem * 1024L, isUstore);
|
||||
|
||||
/* If bitmapscan uses global partition index, set tbm to global. */
|
||||
GPIUpdateTbmType(node, tbm);
|
||||
|
||||
/* If bitmapscan uses crossbucket index, set tbm->crossbucket to true. */
|
||||
CBIUpdateTbmType(node, tbm);
|
||||
}
|
||||
|
||||
/* Cross-bucket index scan should not switch the index bucket. */
|
||||
|
|
|
|||
|
|
@ -126,11 +126,15 @@ Node* MultiExecBitmapOr(BitmapOrState* node)
|
|||
/* first subplan */
|
||||
if (result == NULL) {
|
||||
/* XXX should we use less than u_sess->attr.attr_memory.work_mem for this? */
|
||||
long maxbytes = u_sess->attr.attr_memory.work_mem * 1024L;
|
||||
result = tbm_create(maxbytes,
|
||||
RelationIsGlobalIndex(((BitmapIndexScanState *)subnode)->biss_RelationDesc),
|
||||
RelationIsCrossBucketIndex(((BitmapIndexScanState *)subnode)->biss_RelationDesc),
|
||||
isUstore);
|
||||
result = TbmCreate(u_sess->attr.attr_memory.work_mem * 1024L, isUstore);
|
||||
/* If bitmapscan uses global partition index, set tbm to global. */
|
||||
if (RelationIsGlobalIndex(((BitmapIndexScanState*)subnode)->biss_RelationDesc)) {
|
||||
tbm_set_global(result, true);
|
||||
}
|
||||
/* If bitmapscan uses crossbucket index, set tbm to crossbucket. */
|
||||
if (RelationIsCrossBucketIndex(((BitmapIndexScanState*)subnode)->biss_RelationDesc)) {
|
||||
tbm_set_crossbucket(result, true);
|
||||
}
|
||||
}
|
||||
|
||||
((BitmapIndexScanState*)subnode)->biss_result = result;
|
||||
|
|
@ -153,14 +157,13 @@ Node* MultiExecBitmapOr(BitmapOrState* node)
|
|||
if (result == NULL) {
|
||||
result = subresult; /* first subplan */
|
||||
} else {
|
||||
TBMHandler tbm_handler = tbm_get_handler(result);
|
||||
if (tbm_is_global(result) != tbm_is_global(subresult)) {
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNRECOGNIZED_NODE_TYPE),
|
||||
errmsg(
|
||||
"do not support bitmap index scan for global index and local index simultaneously.")));
|
||||
}
|
||||
tbm_handler._union(result, subresult);
|
||||
tbm_union(result, subresult);
|
||||
tbm_free(subresult);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,6 +148,9 @@ Node* MultiExecHash(HashState* node)
|
|||
}
|
||||
(void)pgstat_report_waitstatus(oldStatus);
|
||||
|
||||
/* analyze hash table information for unique sql hash state */
|
||||
UpdateUniqueSQLHashStats(hashtable, &start_time);
|
||||
|
||||
/* resize the hash table if needed (NTUP_PER_BUCKET exceeded) */
|
||||
if (hashtable->nbuckets != hashtable->nbuckets_optimal) {
|
||||
/* We never decrease the number of buckets. */
|
||||
|
|
@ -169,9 +172,6 @@ Node* MultiExecHash(HashState* node)
|
|||
if (hashtable->spaceUsed > hashtable->spacePeak)
|
||||
hashtable->spacePeak = hashtable->spaceUsed;
|
||||
|
||||
/* analyze hash table information for unique sql hash state */
|
||||
UpdateUniqueSQLHashStats(hashtable, &start_time);
|
||||
|
||||
/* must provide our own instrumentation support */
|
||||
if (node->ps.instrument) {
|
||||
InstrStopNode(node->ps.instrument, hashtable->totalTuples);
|
||||
|
|
|
|||
|
|
@ -178,11 +178,10 @@ int GinDataLeafPageGetItemsToTbm(Page page, TIDBitmap *tbm)
|
|||
|
||||
nitems = ginPostingListDecodeAllSegmentsToTbm(segment, len, tbm);
|
||||
} else {
|
||||
TBMHandler tbm_handler = tbm_get_handler(tbm);
|
||||
uncompressed = dataLeafPageGetUncompressed(page, &nitems);
|
||||
|
||||
if (nitems > 0)
|
||||
tbm_handler._add_tuples(tbm, uncompressed, nitems, false, InvalidOid, InvalidBktId);
|
||||
tbm_add_tuples(tbm, uncompressed, nitems, false);
|
||||
}
|
||||
|
||||
return nitems;
|
||||
|
|
|
|||
|
|
@ -132,12 +132,10 @@ static bool collectMatchBitmap(GinBtreeData *btree, GinBtreeStack *stack, GinSca
|
|||
{
|
||||
OffsetNumber attnum;
|
||||
Form_pg_attribute attr;
|
||||
TBMHandler tbm_handler;
|
||||
|
||||
/* Initialize empty bitmap result */
|
||||
if (!isColStore) {
|
||||
scanEntry->matchBitmap = tbm_create(u_sess->attr.attr_memory.work_mem * 1024L);
|
||||
tbm_handler = tbm_get_handler(scanEntry->matchBitmap);
|
||||
scanEntry->matchBitmap = TbmCreate(u_sess->attr.attr_memory.work_mem * 1024L);
|
||||
}
|
||||
|
||||
/* Null query cannot partial-match anything */
|
||||
|
|
@ -282,7 +280,7 @@ static bool collectMatchBitmap(GinBtreeData *btree, GinBtreeStack *stack, GinSca
|
|||
ipd = ginReadTuple(btree->ginstate, scanEntry->attnum, itup, &nipd);
|
||||
|
||||
if (!isColStore) {
|
||||
tbm_handler._add_tuples(scanEntry->matchBitmap, ipd, nipd, false, InvalidOid, InvalidBktId);
|
||||
tbm_add_tuples(scanEntry->matchBitmap, ipd, nipd, false);
|
||||
} else {
|
||||
if (scanEntry->matchList == NULL) {
|
||||
scanEntry->matchList = (ItemPointer)palloc(nipd * sizeof(ItemPointerData));
|
||||
|
|
@ -376,8 +374,7 @@ restartScanEntry:
|
|||
}
|
||||
|
||||
if (!isColStore && entry->matchBitmap && !tbm_is_empty(entry->matchBitmap)) {
|
||||
TBMHandler tbm_handler = tbm_get_handler(entry->matchBitmap);
|
||||
entry->matchIterator = tbm_handler._begin_iterate(entry->matchBitmap);
|
||||
entry->matchIterator = tbm_begin_iterate(entry->matchBitmap);
|
||||
entry->isFinished = false;
|
||||
}
|
||||
|
||||
|
|
@ -1572,7 +1569,6 @@ static void scanPendingInsert(IndexScanDesc scan, TIDBitmap *tbm, int64 *ntids)
|
|||
pendingPosition pos;
|
||||
Buffer metabuffer = ReadBuffer(scan->indexRelation, GIN_METAPAGE_BLKNO);
|
||||
BlockNumber blkno;
|
||||
TBMHandler tbm_handler = tbm_get_handler(tbm);
|
||||
Oid partHeapOid = IndexScanGetPartHeapOid(scan);
|
||||
|
||||
*ntids = 0;
|
||||
|
|
@ -1632,7 +1628,7 @@ static void scanPendingInsert(IndexScanDesc scan, TIDBitmap *tbm, int64 *ntids)
|
|||
MemoryContextReset(so->tempCtx);
|
||||
|
||||
if (match) {
|
||||
tbm_handler._add_tuples(tbm, &pos.item, 1, recheck, partHeapOid, InvalidBktId);
|
||||
tbm_add_tuples(tbm, &pos.item, 1, recheck, partHeapOid);
|
||||
(*ntids)++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1656,7 +1652,6 @@ Datum gingetbitmap(PG_FUNCTION_ARGS)
|
|||
int64 ntids;
|
||||
ItemPointerData iptr;
|
||||
bool recheck = false;
|
||||
TBMHandler tbm_handler = tbm_get_handler(tbm);
|
||||
Oid partHeapOid = IndexScanGetPartHeapOid(scan);
|
||||
|
||||
/*
|
||||
|
|
@ -1696,9 +1691,9 @@ Datum gingetbitmap(PG_FUNCTION_ARGS)
|
|||
break;
|
||||
|
||||
if (ItemPointerIsLossyPage(&iptr))
|
||||
tbm_handler._add_page(tbm, ItemPointerGetBlockNumber(&iptr), partHeapOid, InvalidBktId);
|
||||
tbm_add_page(tbm, ItemPointerGetBlockNumber(&iptr), partHeapOid);
|
||||
else
|
||||
tbm_handler._add_tuples(tbm, &iptr, 1, recheck, partHeapOid, InvalidBktId);
|
||||
tbm_add_tuples(tbm, &iptr, 1, recheck, partHeapOid);
|
||||
ntids++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -361,10 +361,9 @@ int ginPostingListDecodeAllSegmentsToTbm(GinPostingList *ptr, int len, TIDBitmap
|
|||
{
|
||||
int ndecoded;
|
||||
ItemPointer items;
|
||||
TBMHandler tbm_handler = tbm_get_handler(tbm);
|
||||
|
||||
items = ginPostingListDecodeAllSegments(ptr, len, &ndecoded);
|
||||
tbm_handler._add_tuples(tbm, items, ndecoded, false, InvalidOid, InvalidBktId);
|
||||
tbm_add_tuples(tbm, items, ndecoded, false);
|
||||
pfree(items);
|
||||
return ndecoded;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -288,12 +288,11 @@ static void gistScanPage(IndexScanDesc scan, const GISTSearchItem *pageItem, con
|
|||
continue;
|
||||
|
||||
if (tbm && GistPageIsLeaf(page)) {
|
||||
TBMHandler tbm_handler = tbm_get_handler(tbm);
|
||||
/*
|
||||
* getbitmap scan, so just push heap tuple TIDs into the bitmap
|
||||
* without worrying about ordering
|
||||
*/
|
||||
tbm_handler._add_tuples(tbm, &it->t_tid, 1, recheck, partHeapOid, InvalidBktId);
|
||||
tbm_add_tuples(tbm, &it->t_tid, 1, recheck, partHeapOid);
|
||||
(*ntids)++;
|
||||
} else if (scan->numberOfOrderBys == 0 && GistPageIsLeaf(page)) {
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -357,9 +357,8 @@ Datum hashgetbitmap(PG_FUNCTION_ARGS)
|
|||
|
||||
/* Save tuple ID, and continue scanning */
|
||||
if (add_tuple) {
|
||||
TBMHandler tbm_handler = tbm_get_handler(tbm);
|
||||
/* Note we mark the tuple ID as requiring recheck */
|
||||
tbm_handler._add_tuples(tbm, &(so->hashso_heappos), 1, true, partHeapOid, InvalidBktId);
|
||||
tbm_add_tuples(tbm, &(so->hashso_heappos), 1, true, partHeapOid);
|
||||
ntids++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -320,9 +320,6 @@ int64 btgetbitmap_internal(IndexScanDesc scan, TIDBitmap *tbm)
|
|||
BTScanOpaque so = (BTScanOpaque)scan->opaque;
|
||||
int64 ntids = 0;
|
||||
ItemPointer heapTid;
|
||||
Oid currPartOid;
|
||||
int2 bucketid;
|
||||
TBMHandler tbm_handler = tbm_get_handler(tbm);
|
||||
|
||||
/*
|
||||
* If we have any array keys, initialize them.
|
||||
|
|
@ -342,9 +339,9 @@ int64 btgetbitmap_internal(IndexScanDesc scan, TIDBitmap *tbm)
|
|||
if (_bt_first(scan, ForwardScanDirection)) {
|
||||
/* Save tuple ID, and continue scanning */
|
||||
heapTid = &scan->xs_ctup.t_self;
|
||||
currPartOid = so->currPos.items[so->currPos.itemIndex].partitionOid;
|
||||
bucketid = so->currPos.items[so->currPos.itemIndex].bucketid;
|
||||
tbm_handler._add_tuples(tbm, heapTid, 1, false, currPartOid, bucketid);
|
||||
Oid currPartOid = so->currPos.items[so->currPos.itemIndex].partitionOid;
|
||||
int2 bucketid = so->currPos.items[so->currPos.itemIndex].bucketid;
|
||||
tbm_add_tuples(tbm, heapTid, 1, false, currPartOid, bucketid);
|
||||
ntids++;
|
||||
|
||||
for (;;) {
|
||||
|
|
@ -363,7 +360,7 @@ int64 btgetbitmap_internal(IndexScanDesc scan, TIDBitmap *tbm)
|
|||
heapTid = &so->currPos.items[so->currPos.itemIndex].heapTid;
|
||||
currPartOid = so->currPos.items[so->currPos.itemIndex].partitionOid;
|
||||
bucketid = so->currPos.items[so->currPos.itemIndex].bucketid;
|
||||
tbm_handler._add_tuples(tbm, heapTid, 1, false, currPartOid, bucketid);
|
||||
tbm_add_tuples(tbm, heapTid, 1, false, currPartOid, bucketid);
|
||||
ntids++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -489,9 +489,8 @@ static void spgWalk(Relation index, SpGistScanOpaque so, bool scanWholeIndex, st
|
|||
|
||||
/* storeRes subroutine for getbitmap case */
|
||||
static void storeBitmap(SpGistScanOpaque so, ItemPointer heapPtr, Datum leafValue, bool isnull, bool recheck)
|
||||
{
|
||||
TBMHandler tbm_handler = tbm_get_handler(so->tbm);
|
||||
tbm_handler._add_tuples(so->tbm, heapPtr, 1, recheck, so->partHeapOid, InvalidBktId);
|
||||
{
|
||||
tbm_add_tuples(so->tbm, heapPtr, 1, recheck, so->partHeapOid);
|
||||
so->ntids++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9866,9 +9866,7 @@ void StartupXLOG(void)
|
|||
* replay. This avoids as well any subsequent scans when doing recovery
|
||||
* of the on-disk two-phase data.
|
||||
*/
|
||||
if (!ENABLE_DMS || SS_PRIMARY_MODE) {
|
||||
restoreTwoPhaseData();
|
||||
}
|
||||
restoreTwoPhaseData();
|
||||
|
||||
StartupCSNLOG();
|
||||
|
||||
|
|
@ -9914,8 +9912,7 @@ void StartupXLOG(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (SS_STANDBY_MODE && t_thrd.xlog_cxt.InRecovery == true) {
|
||||
SSRecoveryApplyDelay();
|
||||
if (SSSKIP_REDO_REPLAY && t_thrd.xlog_cxt.InRecovery == true) {
|
||||
/* do not need replay anything in SS standby mode */
|
||||
ereport(LOG, (errmsg("[SS] Skip redo replay in standby mode")));
|
||||
t_thrd.xlog_cxt.InRecovery = false;
|
||||
|
|
@ -10327,7 +10324,7 @@ void StartupXLOG(void)
|
|||
CountRedoTime(t_thrd.xlog_cxt.timeCost[TIME_COST_STEP_2]);
|
||||
#endif
|
||||
|
||||
if (ENABLE_DMS && !SS_PERFORMING_SWITCHOVER && SSRecoveryApplyDelay()) {
|
||||
if (ENABLE_DMS && !SS_PERFORMING_SWITCHOVER && SSRecoveryApplyDelay(xlogreader)) {
|
||||
if (xlogctl->recoveryPause) {
|
||||
recoveryPausesHere();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -291,8 +291,6 @@ Datum ubtgetbitmap(PG_FUNCTION_ARGS)
|
|||
BTScanOpaque so = (BTScanOpaque)scan->opaque;
|
||||
int64 ntids = 0;
|
||||
ItemPointer heapTid;
|
||||
Oid currPartOid;
|
||||
TBMHandler tbm_handler = tbm_get_handler(tbm);
|
||||
|
||||
WHITEBOX_TEST_STUB("ubtgetbitmap", WhiteboxDefaultErrorEmit);
|
||||
|
||||
|
|
@ -314,8 +312,8 @@ Datum ubtgetbitmap(PG_FUNCTION_ARGS)
|
|||
if (UBTreeFirst(scan, ForwardScanDirection)) {
|
||||
/* Save tuple ID, and continue scanning */
|
||||
heapTid = &scan->xs_ctup.t_self;
|
||||
currPartOid = so->currPos.items[so->currPos.itemIndex].partitionOid;
|
||||
tbm_handler._add_tuples(tbm, heapTid, 1, scan->xs_recheck_itup, currPartOid, InvalidBktId);
|
||||
Oid currPartOid = so->currPos.items[so->currPos.itemIndex].partitionOid;
|
||||
tbm_add_tuples(tbm, heapTid, 1, scan->xs_recheck_itup, currPartOid);
|
||||
ntids++;
|
||||
|
||||
for (;;) {
|
||||
|
|
@ -333,7 +331,7 @@ Datum ubtgetbitmap(PG_FUNCTION_ARGS)
|
|||
/* Save tuple ID, and continue scanning */
|
||||
heapTid = &so->currPos.items[so->currPos.itemIndex].heapTid;
|
||||
currPartOid = so->currPos.items[so->currPos.itemIndex].partitionOid;
|
||||
tbm_handler._add_tuples(tbm, heapTid, 1, scan->xs_recheck_itup, currPartOid, InvalidBktId);
|
||||
tbm_add_tuples(tbm, heapTid, 1, scan->xs_recheck_itup, currPartOid);
|
||||
ntids++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#define RECOVERY_WAIT_TIME 10000
|
||||
#define SSFAILOVER_TRIGGER (ENABLE_DMS && g_instance.dms_cxt.SSRecoveryInfo.failover_triggered == true)
|
||||
#define SSSKIP_REDO_REPLAY (ENABLE_DMS && g_instance.dms_cxt.SSRecoveryInfo.skip_redo_replay == true)
|
||||
#define SS_BEFORE_RECOVERY (ENABLE_DMS && g_instance.dms_cxt.SSReformInfo.in_reform == true \
|
||||
&& g_instance.dms_cxt.SSRecoveryInfo.recovery_pause_flag == true)
|
||||
#define SS_IN_FAILOVER (ENABLE_DMS && g_instance.dms_cxt.SSRecoveryInfo.in_failover == true)
|
||||
|
|
@ -49,6 +50,7 @@ typedef struct ss_recovery_info {
|
|||
bool recovery_pause_flag;
|
||||
volatile bool failover_triggered;
|
||||
char recovery_xlogDir[MAXPGPATH];
|
||||
bool skip_redo_replay;
|
||||
LWLock* update_seg_lock;
|
||||
bool new_primary_reset_walbuf_flag;
|
||||
bool ready_to_startup; // when DB start (except failover), the flag will set true
|
||||
|
|
@ -66,7 +68,7 @@ extern int SSGetPrimaryInstId();
|
|||
extern void SSSavePrimaryInstId(int id);
|
||||
extern void SSReadControlFile(int id, bool updateDmsCtx = false);
|
||||
extern void SSWriteReformerControlPages(void);
|
||||
extern bool SSRecoveryApplyDelay();
|
||||
extern bool SSRecoveryApplyDelay(const XLogReaderState *record);
|
||||
extern void SShandle_promote_signal();
|
||||
extern void SSTriggerFailover();
|
||||
extern void ss_failover_dw_init();
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
#define BAK_CTRL_FILE_NUM 2
|
||||
#define BIT_NUM_INT32 32
|
||||
#define REFORM_WAIT_TIME 10000 /* 0.01 sec */
|
||||
#define REFORM_WAIT_LONG 100000 /* 0.1 sec */
|
||||
#define WAIT_REFORM_CTRL_REFRESH_TRIES 1000
|
||||
|
||||
typedef struct SSBroadcastCancelTrx {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -28,8 +28,8 @@
|
|||
* Actual bitmap representation is private to tidbitmap.c. Callers can
|
||||
* do IsA(x, TIDBitmap) on it, but nothing else.
|
||||
*/
|
||||
|
||||
typedef struct TIDBitmap TIDBitmap;
|
||||
|
||||
/* Likewise, TBMIterator is private */
|
||||
typedef struct TBMIterator TBMIterator;
|
||||
|
||||
|
|
@ -44,47 +44,27 @@ typedef struct {
|
|||
OffsetNumber offsets[FLEXIBLE_ARRAY_MEMBER];
|
||||
} TBMIterateResult;
|
||||
|
||||
/*
|
||||
* We want the caller to choose between their own best hash between
|
||||
* dynamic hash and a more cache-friendly simple simple hash table.
|
||||
* Therefore a set of handler is required to avoid all kinds of
|
||||
* unnecessary branches inside this performance-critical area.
|
||||
*
|
||||
* All handlers defined here can be templated base on the hash
|
||||
* table the caller used.And the caller can invoke the handler
|
||||
* with little to no overheads.
|
||||
*
|
||||
* Most of external use of tbm related functions are exposed by
|
||||
* this handler interface.Some of others like tbm_oterate does
|
||||
* not templated like handlers are not included.
|
||||
*/
|
||||
typedef struct TMBHandler {
|
||||
/* page generic handlers */
|
||||
void (*_add_tuples)(TIDBitmap*, const ItemPointer, int, bool, Oid, int2);
|
||||
void (*_add_page)(TIDBitmap*, BlockNumber, Oid, int2);
|
||||
|
||||
/* page operator handlers */
|
||||
void (*_union)(TIDBitmap*, const TIDBitmap*);
|
||||
void (*_intersect)(TIDBitmap*, const TIDBitmap*);
|
||||
|
||||
/* iterator handlers */
|
||||
TBMIterator* (*_begin_iterate)(TIDBitmap*);
|
||||
} TBMHandler;
|
||||
|
||||
/* function prototypes in nodes/tidbitmap.c */
|
||||
extern TIDBitmap* tbm_create(long maxbytes, bool is_global_part = true, bool is_crossbucket =true, bool is_ustore = false);
|
||||
extern TIDBitmap* TbmCreate(long maxbytes, bool is_ustore = false);
|
||||
extern void tbm_free(TIDBitmap* tbm);
|
||||
extern long tbm_calculate_entries(double maxbytes, bool complex_key);
|
||||
extern long tbm_calculate_entries(double maxbytes);
|
||||
|
||||
/* iterator prototypes in nodes/tidbitmap.c */
|
||||
extern void tbm_add_tuples(
|
||||
TIDBitmap* tbm, const ItemPointer tids, int ntids, bool recheck, Oid partitionOid = InvalidOid,
|
||||
int2 bucketid = InvalidBktId);
|
||||
extern void tbm_add_page(TIDBitmap* tbm, BlockNumber pageno, Oid partitionOid = InvalidOid,
|
||||
int2 bucketid = InvalidBktId);
|
||||
|
||||
extern void tbm_union(TIDBitmap* a, const TIDBitmap* b);
|
||||
extern void tbm_intersect(TIDBitmap* a, const TIDBitmap* b);
|
||||
|
||||
extern bool tbm_is_empty(const TIDBitmap* tbm);
|
||||
|
||||
extern TBMIterator* tbm_begin_iterate(TIDBitmap* tbm);
|
||||
extern TBMIterateResult* tbm_iterate(TBMIterator* iterator);
|
||||
extern void tbm_end_iterate(TBMIterator* iterator);
|
||||
|
||||
/* function prototypes for TIDBitmap member checks */
|
||||
extern void tbm_set_global(TIDBitmap* tbm, bool val);
|
||||
extern bool tbm_is_global(const TIDBitmap* tbm);
|
||||
extern bool tbm_is_empty(const TIDBitmap* tbm);
|
||||
extern void tbm_set_global(TIDBitmap* tbm, bool isGlobal);
|
||||
extern bool tbm_is_crossbucket(const TIDBitmap* tbm);
|
||||
extern TBMHandler tbm_get_handler(TIDBitmap* tbm);
|
||||
|
||||
extern void tbm_set_crossbucket(TIDBitmap* tbm, bool crossbucket);
|
||||
#endif /* TIDBITMAP_H */
|
||||
|
|
|
|||
|
|
@ -129,21 +129,6 @@ static inline int pg_rightmost_one_pos64(uint64 word)
|
|||
#endif /* HAVE__BUILTIN_CTZ */
|
||||
}
|
||||
|
||||
static inline uint64 pg_nextpower2_64(uint64 num)
|
||||
{
|
||||
Assert(num > 0 && num <= PG_UINT64_MAX / 2 + 1);
|
||||
|
||||
/*
|
||||
* A power 2 number has only 1 bit set. Subtracting 1 from such a number
|
||||
* will turn on all previous bits resulting in no common bits being set
|
||||
* between num and num-1.
|
||||
*/
|
||||
if ((num & (num - 1)) == 0)
|
||||
return num; /* already power 2 */
|
||||
|
||||
return ((uint64) 1) << (pg_leftmost_one_pos64(num) + 1);
|
||||
}
|
||||
|
||||
/* Count the number of one-bits in a uint32 or uint64 */
|
||||
extern int (*pg_popcount32)(uint32 word);
|
||||
extern int (*pg_popcount64)(uint64 word);
|
||||
|
|
|
|||
|
|
@ -42,10 +42,4 @@ static inline uint32 murmurhash32(uint32 data)
|
|||
return h;
|
||||
}
|
||||
|
||||
static inline uint32 hash_combine(uint32 a, uint32 b)
|
||||
{
|
||||
a ^= b + 0x9e3779b9 + (a << 6) + (a >> 2);
|
||||
return a;
|
||||
}
|
||||
|
||||
#endif /* HASHUTILS_H */
|
||||
|
|
|
|||
|
|
@ -72,8 +72,6 @@ extern THR_LOCAL PGDLLIMPORT MemoryContext TopMemoryContext;
|
|||
#define MemoryContextAllocZero(context, size) MemoryContextAllocZeroDebug(context, size, __FILE__, __LINE__)
|
||||
#define MemoryContextAllocZeroAligned(context, size) \
|
||||
MemoryContextAllocZeroAlignedDebug(context, size, __FILE__, __LINE__)
|
||||
#define MemoryContextAllocExtended(context, size, flags) \
|
||||
MemoryContextAllocExtendedDebug(context, size, flags, __FILE__, __LINE__)
|
||||
#define MemoryContextStrdup(context, size) MemoryContextStrdupDebug(context, size, __FILE__, __LINE__)
|
||||
#define repalloc(pointer, size) repallocDebug(pointer, size, __FILE__, __LINE__)
|
||||
#define repalloc_noexcept(pointer, size) repalloc_noexcept_Debug(pointer, size, __FILE__, __LINE__)
|
||||
|
|
@ -92,7 +90,6 @@ extern void* MemoryContextAllocHugeDebug(MemoryContext context, Size size, const
|
|||
extern void* repallocHugeDebug(void* pointer, Size size, const char* file, int line);
|
||||
extern void* MemoryContextAllocZeroDebug(MemoryContext context, Size size, const char* file, int line);
|
||||
extern void* MemoryContextAllocZeroAlignedDebug(MemoryContext context, Size size, const char* file, int line);
|
||||
extern void* MemoryContextAllocExtendedDebug(MemoryContext context, Size size, int flags, const char* file, int line);
|
||||
extern char* MemoryContextStrdupDebug(MemoryContext context, const char* string, const char* file, int line);
|
||||
extern void* MemoryContextMemalignAllocDebug(MemoryContext context, Size align, Size size, const char* file, int line);
|
||||
extern void MemoryContextMemalignFree(MemoryContext context, void* pointer);
|
||||
|
|
|
|||
|
|
@ -36,20 +36,4 @@ CREATE TABLE CREATE_TBL_INIT_TD_CHECK.T_INIT_TD_5
|
|||
ID NUMBER(20) not null,
|
||||
VARCHAR2_1 VARCHAR2(40)
|
||||
)with(INIT_TD=10,STORAGE_TYPE=USTORE);
|
||||
|
||||
set enable_default_ustore_table = on;
|
||||
DROP TABLE IF EXISTS CREATE_TBL_INIT_TD_CHECK.T_INIT_TD_7;
|
||||
CREATE TABLE CREATE_TBL_INIT_TD_CHECK.T_INIT_TD_7
|
||||
(
|
||||
ID NUMBER(20) not null,
|
||||
VARCHAR2_1 VARCHAR2(40)
|
||||
)with(INIT_TD=10);
|
||||
|
||||
set enable_default_ustore_table = off;
|
||||
DROP TABLE IF EXISTS CREATE_TBL_INIT_TD_CHECK.T_INIT_TD_6;
|
||||
CREATE TABLE CREATE_TBL_INIT_TD_CHECK.T_INIT_TD_6
|
||||
(
|
||||
ID NUMBER(20) not null,
|
||||
VARCHAR2_1 VARCHAR2(40)
|
||||
)with(INIT_TD=10);
|
||||
DROP SCHEMA CREATE_TBL_INIT_TD_CHECK CASCADE;
|
||||
DROP SCHEMA CREATE_TBL_INIT_TD_CHECK;
|
||||
|
|
@ -25,7 +25,6 @@ EXPLAIN (analyze on, costs off, timing off) SELECT count(*) FROM bmscantest WHER
|
|||
Aggregate (actual rows=1 loops=1)
|
||||
-> Bitmap Heap Scan on bmscantest (actual rows=20 loops=1)
|
||||
Recheck Cond: ((b = 1) AND (a = 1))
|
||||
Rows Removed by Index Recheck: 1257
|
||||
--? Heap Blocks: exact=.*
|
||||
-> BitmapAnd (actual rows=0 loops=1)
|
||||
-> Bitmap Index Scan on i_bmtest_b (actual rows=1051 loops=1)
|
||||
|
|
@ -33,7 +32,7 @@ EXPLAIN (analyze on, costs off, timing off) SELECT count(*) FROM bmscantest WHER
|
|||
-> Bitmap Index Scan on i_bmtest_a (actual rows=1170 loops=1)
|
||||
Index Cond: (a = 1)
|
||||
--?.*
|
||||
(11 rows)
|
||||
(10 rows)
|
||||
|
||||
SELECT count(*) FROM bmscantest WHERE a = 1 AND b = 1;
|
||||
count
|
||||
|
|
@ -48,7 +47,7 @@ EXPLAIN (analyze on, costs off, timing off) SELECT count(*) FROM bmscantest WHER
|
|||
Aggregate (actual rows=1 loops=1)
|
||||
-> Bitmap Heap Scan on bmscantest (actual rows=2201 loops=1)
|
||||
Recheck Cond: ((a = 1) OR (b = 1))
|
||||
Rows Removed by Index Recheck: 17287
|
||||
Rows Removed by Index Recheck: 14419
|
||||
--? Heap Blocks: exact=.* lossy=.*
|
||||
-> BitmapOr (actual rows=0 loops=1)
|
||||
-> Bitmap Index Scan on i_bmtest_a (actual rows=1170 loops=1)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
-- A typical wrong case
|
||||
CREATE SCHEMA CREATE_TBL_INIT_TD_CHECK;
|
||||
DROP TABLE IF EXISTS CREATE_TBL_INIT_TD_CHECK.T_INIT_TD_1;
|
||||
NOTICE: table "t_init_td_1" does not exist, skipping
|
||||
--?.*
|
||||
CREATE TABLE CREATE_TBL_INIT_TD_CHECK.T_INIT_TD_1
|
||||
(
|
||||
ID NUMBER(20) NOT NULL,
|
||||
|
|
@ -10,7 +10,7 @@ VARCHAR2_1 VARCHAR2(40)
|
|||
ERROR: Un-support feature
|
||||
DETAIL: Forbid to set option "init_td" for relations except for ustore relation
|
||||
DROP TABLE IF EXISTS CREATE_TBL_INIT_TD_CHECK.T_INIT_TD_2;
|
||||
NOTICE: table "t_init_td_2" does not exist, skipping
|
||||
--?.*
|
||||
CREATE TABLE CREATE_TBL_INIT_TD_CHECK.T_INIT_TD_2
|
||||
(
|
||||
ID NUMBER(20) NOT NULL,
|
||||
|
|
@ -19,7 +19,7 @@ VARCHAR2_1 VARCHAR2(40)
|
|||
ERROR: Un-support feature
|
||||
DETAIL: Forbid to set option "init_td" for relations except for ustore relation
|
||||
DROP TABLE IF EXISTS CREATE_TBL_INIT_TD_CHECK.T_INIT_TD_3;
|
||||
NOTICE: table "t_init_td_3" does not exist, skipping
|
||||
--?.*
|
||||
CREATE TABLE CREATE_TBL_INIT_TD_CHECK.T_INIT_TD_3
|
||||
(
|
||||
ID NUMBER(20) NOT NULL,
|
||||
|
|
@ -29,39 +29,21 @@ ERROR: Un-support feature
|
|||
DETAIL: Forbid to set option "init_td" for relations except for ustore relation
|
||||
-- right cases
|
||||
DROP TABLE IF EXISTS CREATE_TBL_INIT_TD_CHECK.T_INIT_TD_4;
|
||||
NOTICE: table "t_init_td_4" does not exist, skipping
|
||||
--?.*
|
||||
CREATE TABLE CREATE_TBL_INIT_TD_CHECK.T_INIT_TD_4
|
||||
(
|
||||
ID NUMBER(20) NOT NULL,
|
||||
VARCHAR2_1 VARCHAR2(40)
|
||||
)WITH(ORIENTATION=ROW,STORAGE_TYPE=USTORE, INIT_TD=10);
|
||||
DROP TABLE IF EXISTS CREATE_TBL_INIT_TD_CHECK.T_INIT_TD_5;
|
||||
NOTICE: table "t_init_td_5" does not exist, skipping
|
||||
--?.*
|
||||
CREATE TABLE CREATE_TBL_INIT_TD_CHECK.T_INIT_TD_5
|
||||
(
|
||||
ID NUMBER(20) not null,
|
||||
VARCHAR2_1 VARCHAR2(40)
|
||||
)with(INIT_TD=10,STORAGE_TYPE=USTORE);
|
||||
set enable_default_ustore_table = on;
|
||||
DROP TABLE IF EXISTS CREATE_TBL_INIT_TD_CHECK.T_INIT_TD_7;
|
||||
NOTICE: table "t_init_td_7" does not exist, skipping
|
||||
CREATE TABLE CREATE_TBL_INIT_TD_CHECK.T_INIT_TD_7
|
||||
(
|
||||
ID NUMBER(20) not null,
|
||||
VARCHAR2_1 VARCHAR2(40)
|
||||
)with(INIT_TD=10);
|
||||
set enable_default_ustore_table = off;
|
||||
DROP TABLE IF EXISTS CREATE_TBL_INIT_TD_CHECK.T_INIT_TD_6;
|
||||
NOTICE: table "t_init_td_6" does not exist, skipping
|
||||
CREATE TABLE CREATE_TBL_INIT_TD_CHECK.T_INIT_TD_6
|
||||
(
|
||||
ID NUMBER(20) not null,
|
||||
VARCHAR2_1 VARCHAR2(40)
|
||||
)with(INIT_TD=10);
|
||||
ERROR: Un-support feature
|
||||
DETAIL: Forbid to set option "init_td" for relations except for ustore relation
|
||||
DROP SCHEMA CREATE_TBL_INIT_TD_CHECK CASCADE;
|
||||
NOTICE: drop cascades to 3 other objects
|
||||
DETAIL: drop cascades to table create_tbl_init_td_check.t_init_td_4
|
||||
drop cascades to table create_tbl_init_td_check.t_init_td_5
|
||||
drop cascades to table create_tbl_init_td_check.t_init_td_7
|
||||
DROP SCHEMA CREATE_TBL_INIT_TD_CHECK;
|
||||
ERROR: cannot drop schema create_tbl_init_td_check because other objects depend on it
|
||||
DETAIL: table create_tbl_init_td_check.t_init_td_4 depends on schema create_tbl_init_td_check
|
||||
table create_tbl_init_td_check.t_init_td_5 depends on schema create_tbl_init_td_check
|
||||
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
||||
|
|
|
|||
|
|
@ -1479,9 +1479,6 @@ SERIALIZABLEXIDTAG
|
|||
SERVICE_STATUS
|
||||
SERVICE_STATUS_HANDLE
|
||||
SERVICE_TABLE_ENTRY
|
||||
SH_TYPE
|
||||
SH_ITERATOR
|
||||
SH_STATUS
|
||||
SHA1_CTX
|
||||
SHA224_CTX
|
||||
SHA256_CTX
|
||||
|
|
|
|||
Loading…
Reference in New Issue