commit
dfc6cba5c2
|
@ -300,13 +300,6 @@ fi
|
|||
|
||||
if [ "$product_mode"x == "opengauss"x ]; then
|
||||
release_file_list=$(echo ${release_file_list}_single | sed -e 's/mpp_release/opengauss_release/')
|
||||
if [ ! -f $binarylib_dir/dependency/masstree/masstree-beta-0.9.0.tar.gz ]; then
|
||||
echo "ERROR: there is no necessary files in $binarylib_dir/dependency/masstree/"
|
||||
echo " You may copy them from 'third_party' repo by executing:"
|
||||
echo " mkdir -p $binarylib_dir/dependency/masstree && cp -fr <third_party>/dependency/masstree/* $binarylib_dir/dependency/masstree"
|
||||
echo " You should substitute <third_party> by real path to third_party repo"
|
||||
# exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
read_mpp_version
|
||||
|
|
|
@ -82,8 +82,6 @@
|
|||
./share/postgresql/extension/gc_fdw.control
|
||||
./share/postgresql/extension/log_fdw--1.0.sql
|
||||
./share/postgresql/extension/log_fdw.control
|
||||
./share/postgresql/extension/mot_fdw--1.0.sql
|
||||
./share/postgresql/extension/mot_fdw.control
|
||||
./share/postgresql/extension/dimsearch--1.0.sql
|
||||
./share/postgresql/extension/dimsearch.control
|
||||
./share/postgresql/extension/packages--1.0.sql
|
||||
|
@ -779,9 +777,6 @@
|
|||
./lib/libcom_err_gauss.so
|
||||
./lib/libcom_err_gauss.so.3
|
||||
./lib/libcom_err_gauss.so.3.0
|
||||
./lib/libatomic.so
|
||||
./lib/libatomic.so.1
|
||||
./lib/libatomic.so.1.2.0
|
||||
./lib/libgpr.so
|
||||
./lib/libgpr.so.9
|
||||
./lib/libgpr.so.9.0.0
|
||||
|
|
|
@ -788,6 +788,7 @@
|
|||
./lib/libatomic.so
|
||||
./lib/libatomic.so.1
|
||||
./lib/libatomic.so.1.2.0
|
||||
./lib/libmasstree.so
|
||||
./lib/libgpr.so
|
||||
./lib/libgpr.so.9
|
||||
./lib/libgpr.so.9.0.0
|
||||
|
|
|
@ -792,6 +792,7 @@
|
|||
./lib/libatomic.so
|
||||
./lib/libatomic.so.1
|
||||
./lib/libatomic.so.1.2.0
|
||||
./lib/libmasstree.so
|
||||
./lib/libgpr.so
|
||||
./lib/libgpr.so.9
|
||||
./lib/libgpr.so.9.0.0
|
||||
|
|
|
@ -786,6 +786,7 @@
|
|||
./lib/libatomic.so
|
||||
./lib/libatomic.so.1
|
||||
./lib/libatomic.so.1.2.0
|
||||
./lib/libmasstree.so
|
||||
./lib/libgpr.so
|
||||
./lib/libgpr.so.9
|
||||
./lib/libgpr.so.9.0.0
|
||||
|
|
|
@ -782,6 +782,7 @@
|
|||
./lib/libatomic.so
|
||||
./lib/libatomic.so.1
|
||||
./lib/libatomic.so.1.2.0
|
||||
./lib/libmasstree.so
|
||||
./lib/libgpr.so
|
||||
./lib/libgpr.so.9
|
||||
./lib/libgpr.so.9.0.0
|
||||
|
|
|
@ -110,11 +110,11 @@ else
|
|||
fi
|
||||
|
||||
SCRIPT_DIR=$(cd $(dirname $SCRIPT_PATH) && pwd)
|
||||
|
||||
package_path=$SCRIPT_DIR
|
||||
test -d ${SCRIPT_DIR}/../../output || mkdir -p ${SCRIPT_DIR}/../../output
|
||||
output_path=$(cd ${SCRIPT_DIR}/../../output && pwd)
|
||||
|
||||
#######################################################################
|
||||
##version 1.0.1
|
||||
##version 1.1.0
|
||||
#######################################################################
|
||||
function read_srv_version()
|
||||
{
|
||||
|
@ -124,8 +124,16 @@ function read_srv_version()
|
|||
#auto read the number from kernal globals.cpp, no need to change it here
|
||||
}
|
||||
|
||||
read_srv_version
|
||||
function deploy_pkgs()
|
||||
{
|
||||
for pkg in $@; do
|
||||
if [ -f $pkg ]; then
|
||||
mv $pkg $output_path/
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
read_srv_version
|
||||
|
||||
#########################################################################
|
||||
##read command line paramenters
|
||||
|
@ -281,6 +289,7 @@ function install_gaussdb()
|
|||
./separate_debug_information.sh
|
||||
cd $SCRIPT_DIR
|
||||
mv symbols.tar.gz $kernel_symbol_package_name
|
||||
deploy_pkgs $kernel_symbol_package_name
|
||||
fi
|
||||
|
||||
#insert the commitid to version.cfg as the upgrade app path specification
|
||||
|
@ -388,7 +397,8 @@ function make_package_srv()
|
|||
mkdir -p temp
|
||||
mkdir -p ${BUILD_DIR}/temp/etc
|
||||
target_file_copy "$copydest" ${BUILD_DIR}/temp
|
||||
mv ${sha256_name} ${kernel_package_name} ${package_path}
|
||||
|
||||
deploy_pkgs ${sha256_name} ${kernel_package_name}
|
||||
echo "make server(all) package success!"
|
||||
}
|
||||
|
||||
|
@ -420,7 +430,8 @@ function make_package_upgrade_sql()
|
|||
|
||||
chmod 600 ${UPGRADE_SQL_TAR}
|
||||
chmod 600 ${UPGRADE_SQL_SHA256}
|
||||
mv ${UPGRADE_SQL_TAR} ${UPGRADE_SQL_SHA256} ${package_path}
|
||||
|
||||
deploy_pkgs ${UPGRADE_SQL_TAR} ${UPGRADE_SQL_SHA256}
|
||||
|
||||
echo "Successfully packaged upgrade_sql files."
|
||||
}
|
||||
|
@ -485,8 +496,9 @@ function make_package_libpq()
|
|||
if [ $? -ne 0 ]; then
|
||||
die "$package_command ${libpq_package_name} failed"
|
||||
fi
|
||||
mv ${libpq_package_name} ${package_path}
|
||||
echo "install $pkgname tools is ${libpq_package_name} of ${package_path} directory " >> "$LOG_FILE" 2>&1
|
||||
|
||||
deploy_pkgs ${libpq_package_name}
|
||||
echo "install $pkgname tools is ${libpq_package_name} of ${output_path} directory " >> "$LOG_FILE" 2>&1
|
||||
echo "success!"
|
||||
}
|
||||
|
||||
|
@ -541,8 +553,9 @@ function make_package_tools()
|
|||
if [ $? -ne 0 ]; then
|
||||
die "$package_command ${tools_package_name} failed"
|
||||
fi
|
||||
mv ${tools_package_name} ${package_path}
|
||||
echo "install $pkgname tools is ${tools_package_name} of ${package_path} directory " >> "$LOG_FILE" 2>&1
|
||||
|
||||
deploy_pkgs ${tools_package_name}
|
||||
echo "install $pkgname tools is ${tools_package_name} of ${output_path} directory " >> "$LOG_FILE" 2>&1
|
||||
echo "success!"
|
||||
}
|
||||
|
||||
|
|
|
@ -2650,10 +2650,10 @@ $as_echo "$as_me: error: argument required for --with-gs-version option" >&2;}
|
|||
else
|
||||
product=$(cat build/script/gauss.spec | grep 'PRODUCT' | awk -F "=" '{print $2}')
|
||||
version=$(cat build/script/gauss.spec | grep 'VERSION' | awk -F "=" '{print $2}')
|
||||
gitversion=$(git log | grep commit | head -1 | awk '{print $2}' | cut -b 1-8)
|
||||
commits=$(git log | grep "See in merge request" | wc -l)
|
||||
gitversion=$(git log 2>/dev/null | grep commit | head -1 | awk '{print $2}' | cut -b 1-8)
|
||||
commits=$(git log 2>/dev/null | grep "See in merge request" | wc -l)
|
||||
debug_str=""
|
||||
mrid=$(git log | grep "See merge request" | head -1 | awk -F! '{print $2}' | grep -o '[0-9]\+')
|
||||
mrid=$(git log 2>/dev/null | grep "See merge request" | head -1 | awk -F! '{print $2}' | grep -o '[0-9]\+')
|
||||
if test "$enable_debug" = yes; then
|
||||
debug_str="debug"
|
||||
fi
|
||||
|
|
|
@ -319,7 +319,7 @@ ifeq ($(with_3rd), NONE)
|
|||
LIBNANOMSG_HOME = $(top_builddir)/$(BINARYPATH)/nanomsg/comm
|
||||
HLL_HOME = $(top_builddir)/$(BINARYPATH)/postgresql-hll/$(LIB_SUPPORT_LLT)
|
||||
PLJAVA_HOME = $(top_builddir)/$(BINARYPATH)/pljava/$(LIB_SUPPORT_LLT)
|
||||
MASSTREE_HOME = $(top_builddir)/dependency/masstree
|
||||
MASSTREE_HOME = $(top_builddir)/$(BINARYPATH)/masstree/comm
|
||||
MYFDW_HOME = $(top_builddir)/dependency/mysql_fdw
|
||||
ORCFDW_HOME = $(top_builddir)/dependency/oracle_fdw
|
||||
PLDBG_HOME = $(top_builddir)/dependency/pldebugger
|
||||
|
@ -371,7 +371,7 @@ else
|
|||
LIBNANOMSG_HOME = $(with_3rd)/$(BINARYPATH)/nanomsg/comm
|
||||
HLL_HOME = $(with_3rd)/$(BINARYPATH)/postgresql-hll/$(LIB_SUPPORT_LLT)
|
||||
PLJAVA_HOME = $(with_3rd)/$(BINARYPATH)/pljava/$(LIB_SUPPORT_LLT)
|
||||
MASSTREE_HOME = $(with_3rd)/dependency/masstree
|
||||
MASSTREE_HOME = $(with_3rd)/$(BINARYPATH)/masstree/comm
|
||||
MYFDW_HOME = $(with_3rd)/dependency/mysql_fdw
|
||||
ORCFDW_HOME = $(with_3rd)/dependency/oracle_fdw
|
||||
PLDBG_HOME = $(with_3rd)/dependency/pldebugger
|
||||
|
@ -680,6 +680,12 @@ NUMA_LIB_PATH = $(NUMA_HOME)/lib
|
|||
LIBCURL_INCLUDE_PATH = $(LIBCURL_HOME)/include
|
||||
LIBCURL_LIB_PATH = $(LIBCURL_HOME)/lib
|
||||
|
||||
#############################################################################
|
||||
# masstree component
|
||||
#############################################################################
|
||||
MASSTREE_INCLUDE_PATH = $(MASSTREE_HOME)/include
|
||||
MASSTREE_LIB_PATH = $(MASSTREE_HOME)/lib
|
||||
|
||||
############################################################################
|
||||
#
|
||||
# Programs and flags
|
||||
|
@ -733,6 +739,10 @@ ifeq ($(SUPPORT_HOTPATCH), yes)
|
|||
override CPPFLAGS := $(CPPFLAGS) -I$(LIBHOTPATCH_INCLUDE_PATH)
|
||||
endif
|
||||
|
||||
ifeq ($(enable_mot), yes)
|
||||
override CPPFLAGS := $(CPPFLAGS) -I$(MASSTREE_INCLUDE_PATH)
|
||||
endif
|
||||
|
||||
CC = @CC@
|
||||
GCC = @GCC@
|
||||
C = gcc
|
||||
|
@ -866,6 +876,9 @@ endif
|
|||
LDFLAGS += -L$(GSTRACE_LIB_PATH)
|
||||
LDFLAGS += -L$(NUMA_LIB_PATH)
|
||||
LDFLAGS += -L$(LIBCURL_LIB_PATH)
|
||||
ifeq ($(enable_mot), yes)
|
||||
LDFLAGS += -L$(MASSTREE_LIB_PATH)
|
||||
endif
|
||||
LDFLAGS += @LDFLAGS@
|
||||
|
||||
LDFLAGS_EX = @LDFLAGS_EX@
|
||||
|
|
|
@ -32,7 +32,7 @@ top_builddir = ../../..
|
|||
include $(top_builddir)/src/Makefile.global
|
||||
EXTRA_CLEAN += logging.h
|
||||
|
||||
override CXXFLAGS := -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0 -fsigned-char -DHAVE_LIBZ -DSTREAMPLAN -DPGXC -O0 -g -DENABLE_GSTRACE -fpermissive -Wl,-z,relro,-z,now
|
||||
override CXXFLAGS := -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0 -fsigned-char -DHAVE_LIBZ -DSTREAMPLAN -DPGXC -O0 -g -DENABLE_GSTRACE -Wl,-z,relro,-z,now
|
||||
LDFLAGS += -L$(LZ4_LIB_PATH)
|
||||
LIBS += -lgssapi_krb5_gauss -lgssrpc_gauss -lkrb5_gauss -lkrb5support_gauss -lk5crypto_gauss -lcom_err_gauss -llz4
|
||||
PG_CPPFLAGS = -I$(libpq_srcdir) ${PTHREAD_CFLAGS} -Isrc -I$(top_builddir)/$(subdir) -I$(LZ4_INCLUDE_PATH) -I$(ZLIB_INCLUDE_PATH)
|
||||
|
|
|
@ -1719,7 +1719,7 @@ void write_table_label_and_tablespace_map(pgBackup *backup, PGresult *res,
|
|||
|
||||
}
|
||||
|
||||
void pg_stop_backup_sent(PGconn *conn, char **stop_backup_query)
|
||||
void pg_stop_backup_sent(PGconn *conn, const char **stop_backup_query)
|
||||
{
|
||||
if (!pg_stop_backup_is_sent) {
|
||||
bool sent = false;
|
||||
|
|
|
@ -1184,8 +1184,8 @@ walk_files_collect_timelines(InstanceConfig *instance)
|
|||
save_backupinfo_belong_timelines(instance, timelineinfos);
|
||||
|
||||
if (xlog_files_list) {
|
||||
parray_walk(xlog_files_list, pgFileFree);
|
||||
parray_free(xlog_files_list);
|
||||
parray_walk(xlog_files_list, pfree);
|
||||
parray_free(xlog_files_list);
|
||||
}
|
||||
|
||||
return timelineinfos;
|
||||
|
|
|
@ -155,8 +155,8 @@ JARPLJAVA = pljava.jar
|
|||
# MOT component
|
||||
##############################################################################
|
||||
ifeq ($(enable_mot), yes)
|
||||
LIBS += -latomic -lmot_engine
|
||||
LDFLAGS += -L$(top_builddir)/src/gausskernel/storage/mot/core/bin
|
||||
LIBS += -latomic -lmot_engine -lmasstree
|
||||
LDFLAGS += -L$(top_builddir)/src/gausskernel/storage/mot/core/bin -L$(MASSTREE_LIB_PATH)
|
||||
CXXFLAGS += -I$(JEMALLOC_INCLUDE_PATH)
|
||||
endif
|
||||
|
||||
|
@ -644,6 +644,9 @@ endif
|
|||
ifneq (, $(findstring __USE_NUMA, $(CFLAGS)))
|
||||
cp $(NUMA_LIB_PATH)/* '$(DESTDIR)$(libdir)/'
|
||||
endif
|
||||
ifeq ($(enable_mot), yes)
|
||||
cp -d $(MASSTREE_LIB_PATH)/libmasstree* '$(DESTDIR)$(libdir)/'
|
||||
endif
|
||||
ifeq ($(with_3rd), NONE)
|
||||
cp $(top_builddir)/$(BUILD_TOOLS_PATH)/gcc$(subst .0,,$(CC_VERSION))/gcc/lib64/libstdc++.so.6 '$(DESTDIR)$(libdir)/'
|
||||
cp $(top_builddir)/$(BUILD_TOOLS_PATH)/gcc$(subst .0,,$(CC_VERSION))/gcc/lib64/libgcc_s.so.1 '$(DESTDIR)$(libdir)/'
|
||||
|
@ -669,7 +672,7 @@ ifeq ($(enable_thread_check), yes)
|
|||
endif
|
||||
cp $(with_3rd)/buildtools/server_key/* '$(DESTDIR)$(bindir)/'
|
||||
endif
|
||||
cp -r $(with_3rd)/platform/$(PLAT_FORM_STR)/openjdk8/jdk1.8.222/jre/* '$(DESTDIR)$(bindir)/../jre/'
|
||||
cp -r $(with_3rd)/platform/$(PLAT_FORM_STR)/openjdk8/jdk1.8.0_222/jre/* '$(DESTDIR)$(bindir)/../jre/'
|
||||
|
||||
cp $(PLJAVA_LIB_PATH)/* '$(DESTDIR)$(libdir)/'
|
||||
cp $(PLJAVA_JAR_PATH)/$(JARPLJAVA) '$(DESTDIR)$(pkglibdir)/java/'
|
||||
|
|
|
@ -938,11 +938,7 @@ void ExplainOnePlan(
|
|||
* and than calling ExecutorStart for ExecInitNode in CN.
|
||||
*/
|
||||
/* only stream plan can use u_sess->instr_cxt.global_instr to collect executor info */
|
||||
#ifdef ENABLE_MULTIPLE_NODES
|
||||
if (IS_PGXC_COORDINATOR && queryDesc->plannedstmt->is_stream_plan == true &&
|
||||
#else
|
||||
if (queryDesc->plannedstmt->is_stream_plan == true &&
|
||||
#endif
|
||||
check_stream_support() && instrument_option != 0 && u_sess->instr_cxt.global_instr == NULL &&
|
||||
queryDesc->plannedstmt->num_nodes != 0) {
|
||||
int dop = queryDesc->plannedstmt->query_dop;
|
||||
|
@ -1129,7 +1125,7 @@ void ExplainOnePlan(
|
|||
|
||||
/* Check plan was influenced by row level security or not, here need to skip remote dummy node */
|
||||
if (range_table_walker(
|
||||
plannedstmt->rtable, (bool (*)())ContainRlsQualInRteWalker, NULL, QTW_EXAMINE_RTES | QTW_IGNORE_DUMMY)) {
|
||||
plannedstmt->rtable, (bool (*)())ContainRlsQualInRteWalker, NULL, QTW_EXAMINE_RTES | QTW_IGNORE_DUMMY)) {
|
||||
if (t_thrd.explain_cxt.explain_perf_mode != EXPLAIN_NORMAL && es->planinfo != NULL
|
||||
&& es->planinfo->m_detailInfo != NULL) {
|
||||
appendStringInfo(es->planinfo->m_detailInfo->info_str,
|
||||
|
@ -5436,10 +5432,7 @@ static void show_buffers(ExplainState* es, StringInfo infostr, const Instrumenta
|
|||
appendStringInfoSpaces(es->str, es->indent * 2);
|
||||
show_buffers_info(infostr, has_shared, has_local, has_temp, usage);
|
||||
} else if (is_datanode) {
|
||||
if (get_execute_mode(es, nodeIdx))
|
||||
appendStringInfo(infostr, "(Buffers: 0)\n");
|
||||
else
|
||||
appendStringInfo(infostr, "(Buffers: unknown)\n");
|
||||
appendStringInfo(infostr, get_execute_mode(es, nodeIdx) ? "(Buffers: 0)\n" : "(Buffers: unknown)\n");
|
||||
}
|
||||
|
||||
/* As above, show only positive counter values. */
|
||||
|
|
|
@ -5108,6 +5108,11 @@ void TryLockAccount(Oid roleID, int extrafails, bool superlock)
|
|||
bool lockflag = 0;
|
||||
char* rolename = NULL;
|
||||
|
||||
/* We could not insert new xlog if recovery in process */
|
||||
if (RecoveryInProgress()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!LockAccountParaValid(roleID, extrafails, superlock)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2473,6 +2473,11 @@ void mark_parent_child_pushdown_flag(Query *parent, Query *child)
|
|||
if (IS_STREAM_PLAN && ((parent->can_push && !child->can_push) ||
|
||||
(!parent->can_push && child->can_push))) {
|
||||
if (check_base_rel_in_fromlist(parent, (Node *)parent->jointree)) {
|
||||
#ifndef ENABLE_MULTIPLE_NODES
|
||||
if (u_sess->opt_cxt.is_stream_support) {
|
||||
mark_stream_unsupport();
|
||||
}
|
||||
#endif
|
||||
set_stream_off();
|
||||
} else {
|
||||
parent->can_push = false;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "nodes/nodeFuncs.h"
|
||||
#include "nodes/plannodes.h"
|
||||
#include "optimizer/clauses.h"
|
||||
#include "optimizer/stream_check.h"
|
||||
#include "parser/parse_coerce.h"
|
||||
#include "parser/parse_relation.h"
|
||||
#include "parser/parsetree.h"
|
||||
|
@ -1082,6 +1083,11 @@ Node* replace_rte_variables_mutator(Node* node, replace_rte_variables_context* c
|
|||
expression_tree_mutator(node, (Node* (*)(Node*, void*)) replace_rte_variables_mutator, (void*)context);
|
||||
|
||||
if (contain_subplans(newnode)) {
|
||||
#ifndef ENABLE_MULTIPLE_NODES
|
||||
if (u_sess->opt_cxt.is_stream_support) {
|
||||
mark_stream_unsupport();
|
||||
}
|
||||
#endif
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg(
|
||||
|
|
|
@ -1042,7 +1042,11 @@ static void knl_u_syscache_init(knl_u_syscache_context* syscache_cxt)
|
|||
|
||||
static void knl_u_pgxc_init(knl_u_pgxc_context* pgxc_cxt)
|
||||
{
|
||||
#ifdef ENABLE_MULTIPLE_NODES
|
||||
pgxc_cxt->NumDataNodes = 0;
|
||||
#else
|
||||
pgxc_cxt->NumDataNodes = 1;
|
||||
#endif /* ENABLE_MULTIPLE_NODES */
|
||||
pgxc_cxt->NumCoords = 0;
|
||||
pgxc_cxt->NumStandbyDataNodes = 0;
|
||||
pgxc_cxt->datanode_count = 0;
|
||||
|
|
|
@ -536,8 +536,8 @@ PlanState* ExecInitNode(Plan* node, EState* estate, int e_flags)
|
|||
}
|
||||
#else
|
||||
if (u_sess->instr_cxt.global_instr != NULL && u_sess->instr_cxt.thread_instr && node->plan_node_id > 0 &&
|
||||
u_sess->instr_cxt.global_instr->get_planIdOffsetArray()[node->plan_node_id - 1] ==
|
||||
u_sess->instr_cxt.thread_instr->getSegmentId() - 1) {
|
||||
(!StreamTopConsumerAmI() ||
|
||||
u_sess->instr_cxt.global_instr->get_planIdOffsetArray()[node->plan_node_id - 1] == 0)) {
|
||||
result->instrument = u_sess->instr_cxt.thread_instr->allocInstrSlot(
|
||||
node->plan_node_id, node->parent_node_id, result->plan, estate);
|
||||
} else {
|
||||
|
|
|
@ -29,66 +29,9 @@ top_builddir ?= ../../../../../../
|
|||
|
||||
include $(top_builddir)/src/Makefile.global
|
||||
|
||||
MASSTREE_DIR=$(MASSTREE_HOME)
|
||||
MASSTREE_PACKAGE=masstree-beta-0.9.0
|
||||
MOT_MASSTREE_PATCH=masstree-beta-0.9.0_patch
|
||||
MASSTREE_MEGRED_SOURCES_DIR=$(MASSTREE_DIR)/code
|
||||
|
||||
|
||||
mot_target:
|
||||
@$(call create_masstree_sources)
|
||||
@make -f Makefile.local
|
||||
|
||||
clean:
|
||||
@rm -rf $(MASSTREE_MEGRED_SOURCES_DIR)
|
||||
@make -f Makefile.local clean
|
||||
|
||||
MASSTREE_RELEVANT_SOURCES = \
|
||||
btree_leaflink.hh \
|
||||
circular_int.hh \
|
||||
compiler.cc \
|
||||
compiler.hh \
|
||||
hashcode.hh \
|
||||
kpermuter.hh \
|
||||
ksearch.hh \
|
||||
masstree_get.hh \
|
||||
masstree.hh \
|
||||
masstree_insert.hh \
|
||||
masstree_key.hh \
|
||||
masstree_remove.hh \
|
||||
masstree_scan.hh \
|
||||
masstree_split.hh \
|
||||
masstree_struct.hh \
|
||||
masstree_tcursor.hh \
|
||||
memdebug.cc \
|
||||
memdebug.hh \
|
||||
mtcounters.hh \
|
||||
kvthread.cc \
|
||||
kvthread.hh \
|
||||
nodeversion.hh \
|
||||
small_vector.hh \
|
||||
straccum.cc \
|
||||
straccum.hh \
|
||||
str.hh \
|
||||
stringbag.hh \
|
||||
string_base.hh \
|
||||
string.cc \
|
||||
string.hh \
|
||||
string_slice.hh \
|
||||
timestamp.hh
|
||||
|
||||
define create_masstree_sources
|
||||
rm -rf $(MASSTREE_DIR)/tmp; \
|
||||
rm -rf $(MASSTREE_MEGRED_SOURCES_DIR); \
|
||||
mkdir $(MASSTREE_DIR)/tmp; \
|
||||
mkdir $(MASSTREE_MEGRED_SOURCES_DIR); \
|
||||
tar xfzv $(MASSTREE_DIR)/$(MASSTREE_PACKAGE).tar.gz -C $(MASSTREE_DIR)/tmp &> /dev/null; \
|
||||
for src_file in $(MASSTREE_RELEVANT_SOURCES); \
|
||||
do \
|
||||
cp $(MASSTREE_DIR)/tmp/$(MASSTREE_PACKAGE)/$$src_file $(MASSTREE_MEGRED_SOURCES_DIR); \
|
||||
done
|
||||
rename ".cc" ".cpp" $(MASSTREE_MEGRED_SOURCES_DIR)/*.cc; \
|
||||
rm -rf $(MASSTREE_DIR)/tmp; \
|
||||
patch -d $(MASSTREE_MEGRED_SOURCES_DIR) < $(MASSTREE_DIR)/$(MOT_MASSTREE_PATCH).patch &> /dev/null;
|
||||
endef
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ CFLAGS ?=
|
|||
|
||||
subdir=src/gausskernel/storage/mot/core/src
|
||||
top_builddir ?= ../../../../../../
|
||||
MASSTREE_MEGRED_SOURCES_DIR=$(MASSTREE_HOME)/code
|
||||
|
||||
ifeq ($(UNDERPG),yes)
|
||||
include $(top_builddir)/src/Makefile.global
|
||||
|
@ -48,7 +47,7 @@ SRC_TARGET_DIRS = \
|
|||
memory \
|
||||
storage \
|
||||
system \
|
||||
$(MASSTREE_MEGRED_SOURCES_DIR) \
|
||||
$(MASSTREE_HOME)/include \
|
||||
utils
|
||||
|
||||
SRC_DIRS = $(shell find $(SRC_TARGET_DIRS) -type d 2> /dev/null) # 2> /dev/null To remove error printout when calling clean
|
||||
|
@ -108,6 +107,7 @@ CFLAGS += -faligned-new
|
|||
# turn on some warnings
|
||||
CFLAGS += -Wwrite-strings -Wcast-align -Wreturn-type
|
||||
CFLAGS += -Wpointer-arith -Wlogical-op -Waddress -Wsizeof-pointer-memaccess -Winit-self
|
||||
CFLAGS += -L$(MASSTREE_HOME)/lib -lmasstree
|
||||
|
||||
# Enable this warning for gcc version 6.0 or higher
|
||||
#CFLAGS += -Wduplicated-cond
|
||||
|
|
|
@ -110,13 +110,7 @@ void RowHeader::WriteChangesToRow(const Access* access, uint64_t csn)
|
|||
#ifdef MOT_DEBUG
|
||||
if (access->m_params.IsPrimarySentinel()) {
|
||||
uint64_t v = m_csnWord;
|
||||
if (MOTEngine::GetInstance()->IsRecovering()) {
|
||||
if (!(csn == GetCSN() && (v & LOCK_BIT))) {
|
||||
MOT_LOG_ERROR(
|
||||
"csn=%ld, v & LOCK_BIT=%ld, v & (~LOCK_BIT)=%ld\n", csn, (v & LOCK_BIT), (v & (~LOCK_BIT)));
|
||||
MOT_ASSERT(false);
|
||||
}
|
||||
} else {
|
||||
if (!MOTEngine::GetInstance()->IsRecovering()) {
|
||||
if (!(csn > GetCSN() && (v & LOCK_BIT))) {
|
||||
MOT_LOG_ERROR(
|
||||
"csn=%ld, v & LOCK_BIT=%ld, v & (~LOCK_BIT)=%ld\n", csn, (v & LOCK_BIT), (v & (~LOCK_BIT)));
|
||||
|
|
|
@ -247,7 +247,7 @@ void GcManager::CleanIndexItems(uint32_t indexId, bool dropIndex)
|
|||
}
|
||||
m_managerLock.unlock();
|
||||
if (counter) {
|
||||
MOT_LOG_INFO("Entity:%s threadId = %d cleaned from index id = %d items = %d\n",
|
||||
MOT_LOG_INFO("Entity:%s threadId = %d cleaned from index id = %u items = %u\n",
|
||||
enGcTypes[m_purpose],
|
||||
m_tid,
|
||||
indexId,
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2020 Huawei Technologies Co.,Ltd.
|
||||
*
|
||||
* openGauss is licensed under Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
*
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* config.h
|
||||
* Masstree index configurations template.
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* src/gausskernel/storage/mot/core/src/storage/index/masstree/config.h
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "mot_masstree_config.hpp"
|
||||
|
||||
#ifndef MASSTREE_CONFIG_H
|
||||
#define MASSTREE_CONFIG_H
|
||||
|
||||
#define HAVE_CXX_TEMPLATE_ALIAS MOT_HAVE_CXX_TEMPLATE_ALIAS
|
||||
#define HAVE_INT64_T_IS_LONG MOT_HAVE_INT64_T_IS_LONG
|
||||
#define HAVE_SIZE_T_IS_UNSIGNED_LONG MOT_HAVE_SIZE_T_IS_UNSIGNED_LONG
|
||||
#define HAVE_STD_HASH MOT_HAVE_STD_HASH
|
||||
#define HAVE_STD_IS_TRIVIALLY_COPYABLE MOT_HAVE_STD_IS_TRIVIALLY_COPYABLE
|
||||
#define HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE MOT_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE
|
||||
#define HAVE_SUPERPAGE MOT_HAVE_SUPERPAGE
|
||||
#define HAVE_TYPE_TRAITS MOT_HAVE_TYPE_TRAITS
|
||||
#define HAVE_UNALIGNED_ACCESS MOT_HAVE_UNALIGNED_ACCESS
|
||||
#define HAVE___BUILTIN_CLZ MOT_HAVE___BUILTIN_CLZ
|
||||
#define HAVE___BUILTIN_CLZL MOT_HAVE___BUILTIN_CLZL
|
||||
#define HAVE___BUILTIN_CLZLL MOT_HAVE___BUILTIN_CLZLL
|
||||
#define HAVE___BUILTIN_CTZ MOT_HAVE___BUILTIN_CTZ
|
||||
#define HAVE___BUILTIN_CTZL MOT_HAVE___BUILTIN_CTZL
|
||||
#define HAVE___BUILTIN_CTZLL MOT_HAVE___BUILTIN_CTZLL
|
||||
#define HAVE___HAS_TRIVIAL_COPY MOT_HAVE___HAS_TRIVIAL_COPY
|
||||
#define HAVE___HAS_TRIVIAL_DESTRUCTOR MOT_HAVE___HAS_TRIVIAL_DESTRUCTOR
|
||||
#define HAVE___SYNC_BOOL_COMPARE_AND_SWAP MOT_HAVE___SYNC_BOOL_COMPARE_AND_SWAP
|
||||
#define HAVE___SYNC_BOOL_COMPARE_AND_SWAP_8 MOT_HAVE___SYNC_BOOL_COMPARE_AND_SWAP_8
|
||||
#define HAVE___SYNC_FETCH_AND_ADD MOT_HAVE___SYNC_FETCH_AND_ADD
|
||||
#define HAVE___SYNC_FETCH_AND_ADD_8 MOT_HAVE___SYNC_FETCH_AND_ADD_8
|
||||
#define HAVE___SYNC_FETCH_AND_OR MOT_HAVE___SYNC_FETCH_AND_OR
|
||||
#define HAVE___SYNC_FETCH_AND_OR_8 MOT_HAVE___SYNC_FETCH_AND_OR_8
|
||||
#define HAVE___SYNC_VAL_COMPARE_AND_SWAP MOT_HAVE___SYNC_VAL_COMPARE_AND_SWAP
|
||||
#define HAVE___SYNC_VAL_COMPARE_AND_SWAP_8 MOT_HAVE___SYNC_VAL_COMPARE_AND_SWAP_8
|
||||
#define MASSTREE_MAXKEYLEN MOT_MASSTREE_MAXKEYLEN
|
||||
#define SIZEOF_INT MOT_SIZEOF_INT
|
||||
#define SIZEOF_LONG MOT_SIZEOF_LONG
|
||||
#define SIZEOF_LONG_LONG MOT_SIZEOF_LONG_LONG
|
||||
#define SIZEOF_SHORT MOT_SIZEOF_SHORT
|
||||
#define WORDS_BIGENDIAN_SET MOT_WORDS_BIGENDIAN_SET
|
||||
|
||||
#endif
|
|
@ -1,77 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2020 Huawei Technologies Co.,Ltd.
|
||||
*
|
||||
* openGauss is licensed under Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
*
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* mot_masstree_config.hpp
|
||||
* MOT configurations for Masstree index.
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* src/gausskernel/storage/mot/core/src/storage/index/masstree/mot_masstree_config.hpp
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef MOT_MASSTREE_CONFIG_HPP
|
||||
#define MOT_MASSTREE_CONFIG_HPP
|
||||
|
||||
#define MOT_HAVE_CXX_TEMPLATE_ALIAS 1
|
||||
#define MOT_HAVE_INT64_T_IS_LONG 1
|
||||
#define MOT_HAVE_SIZE_T_IS_UNSIGNED_LONG 1
|
||||
#define MOT_HAVE_STD_HASH 1
|
||||
#define MOT_HAVE_STD_IS_TRIVIALLY_COPYABLE 1
|
||||
#define MOT_HAVE_STD_IS_TRIVIALLY_DESTRUCTIBLE 1
|
||||
#define MOT_HAVE_SUPERPAGE 1
|
||||
#define MOT_HAVE_TYPE_TRAITS 1
|
||||
#define MOT_HAVE_UNALIGNED_ACCESS 0
|
||||
#define MOT_HAVE___BUILTIN_CLZ 1
|
||||
#define MOT_HAVE___BUILTIN_CLZL 1
|
||||
#define MOT_HAVE___BUILTIN_CLZLL 1
|
||||
#define MOT_HAVE___BUILTIN_CTZ 1
|
||||
#define MOT_HAVE___BUILTIN_CTZL 1
|
||||
#define MOT_HAVE___BUILTIN_CTZLL 1
|
||||
#define MOT_HAVE___HAS_TRIVIAL_COPY 1
|
||||
#define MOT_HAVE___HAS_TRIVIAL_DESTRUCTOR 1
|
||||
#define MOT_HAVE___SYNC_BOOL_COMPARE_AND_SWAP 1
|
||||
#define MOT_HAVE___SYNC_BOOL_COMPARE_AND_SWAP_8 1
|
||||
#define MOT_HAVE___SYNC_FETCH_AND_ADD 1
|
||||
#define MOT_HAVE___SYNC_FETCH_AND_ADD_8 1
|
||||
#define MOT_HAVE___SYNC_FETCH_AND_OR 1
|
||||
#define MOT_HAVE___SYNC_FETCH_AND_OR_8 1
|
||||
#define MOT_HAVE___SYNC_VAL_COMPARE_AND_SWAP 1
|
||||
#define MOT_HAVE___SYNC_VAL_COMPARE_AND_SWAP_8 1
|
||||
|
||||
/* Maximum key length */
|
||||
#define MOT_MASSTREE_MAXKEYLEN MAX_KEY_SIZE
|
||||
#define MOT_SIZEOF_INT 4
|
||||
#define MOT_SIZEOF_LONG 8
|
||||
#define MOT_SIZEOF_LONG_LONG 8
|
||||
#define MOT_SIZEOF_SHORT 2
|
||||
#define MOT_WORDS_BIGENDIAN_SET 1
|
||||
|
||||
#define masstree_invariant(x, ...) \
|
||||
do { \
|
||||
} while (0)
|
||||
|
||||
#define masstree_precondition(x, ...) \
|
||||
do { \
|
||||
} while (0)
|
||||
|
||||
#ifndef invariant
|
||||
#define invariant masstree_invariant
|
||||
#endif
|
||||
#ifndef precondition
|
||||
#define precondition masstree_precondition
|
||||
#endif
|
||||
|
||||
#endif // MOT_MASSTREE_CONFIG_HPP
|
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
* Copyright (c) 2020 Huawei Technologies Co.,Ltd.
|
||||
*
|
||||
* openGauss is licensed under Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
*
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* mot_masstree_kvthread.hpp
|
||||
* Replace Masstree's thread info implementations with MOT functionality.
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* src/gausskernel/storage/mot/core/src/storage/index/masstree/mot_masstree_kvthread.cpp
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "masstree_index.h"
|
||||
#include "kvthread.hh"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <new>
|
||||
#include <sys/mman.h>
|
||||
#if HAVE_SUPERPAGE && !NOSUPERPAGE
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
#include "mm_api.h"
|
||||
#include "mm_gc_manager.h"
|
||||
|
||||
// This is the thread info which serves the current masstree operation. It is set before the operation starts.
|
||||
__thread threadinfo* mtSessionThreadInfo = nullptr;
|
||||
|
||||
volatile mrcu_epoch_type globalepoch;
|
||||
|
||||
inline threadinfo::threadinfo(int purpose, int index, int rcu_max_free_count)
|
||||
{
|
||||
errno_t erc = memset_s(this, sizeof(*this), 0, sizeof(*this));
|
||||
securec_check(erc, "\0", "\0");
|
||||
|
||||
purpose_ = purpose;
|
||||
index_ = index;
|
||||
rcu_free_count = rcu_max_free_count;
|
||||
|
||||
ts_ = 2;
|
||||
}
|
||||
|
||||
threadinfo* threadinfo::make(void* obj_mem, int purpose, int index, int rcu_max_free_count)
|
||||
{
|
||||
threadinfo* ti = new(obj_mem) threadinfo(purpose, index, rcu_max_free_count);
|
||||
|
||||
if (use_pool()) {
|
||||
void *limbo_space = ti->allocate(MAX_MEMTAG_MASSTREE_LIMBO_GROUP_ALLOCATION_SIZE, memtag_limbo);
|
||||
if (!limbo_space) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ti->mark(tc_limbo_slots, mt_limbo_group::capacity);
|
||||
ti->limbo_head_ = ti->limbo_tail_ = new(limbo_space) mt_limbo_group;
|
||||
}
|
||||
|
||||
return ti;
|
||||
}
|
||||
|
||||
|
||||
void* threadinfo::allocate(size_t sz, memtag tag, size_t* actual_size)
|
||||
{
|
||||
int size = sz;
|
||||
void* p = nullptr;
|
||||
if (likely(!use_pool())) {
|
||||
p = cur_working_index->AllocateMem(size, tag);
|
||||
} else {
|
||||
p = malloc(sz + memdebug_size);
|
||||
}
|
||||
|
||||
p = memdebug::make(p, sz, tag);
|
||||
if (p) {
|
||||
if (actual_size) {
|
||||
*actual_size = size;
|
||||
}
|
||||
mark(threadcounter(tc_alloc + (tag > memtag_value)), sz);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
void threadinfo::deallocate(void* p, size_t sz, memtag tag)
|
||||
{
|
||||
MOT_ASSERT(p);
|
||||
p = memdebug::check_free(p, sz, tag);
|
||||
if (likely(!use_pool())) {
|
||||
cur_working_index->DeallocateMem(p, sz, tag);
|
||||
} else {
|
||||
free(p);
|
||||
}
|
||||
mark(threadcounter(tc_alloc + (tag > memtag_value)), -sz);
|
||||
}
|
||||
|
||||
void threadinfo::ng_record_rcu(void* p, int sz, memtag tag)
|
||||
{
|
||||
MOT_ASSERT(p);
|
||||
memdebug::check_rcu(p, sz, tag);
|
||||
cur_working_index->RecordMemRcu(p, sz, tag);
|
||||
mark(threadcounter(tc_alloc + (tag > memtag_value)), -sz);
|
||||
}
|
||||
|
||||
void threadinfo::set_gc_session(MOT::GcManager* gc_session)
|
||||
{
|
||||
gc_session_ = gc_session;
|
||||
}
|
||||
|
||||
inline MOT::GcManager* threadinfo::get_gc_session()
|
||||
{
|
||||
return gc_session_;
|
||||
}
|
|
@ -28,7 +28,7 @@
|
|||
#include "index.h"
|
||||
#include "index_base.h"
|
||||
#include "utilities.h"
|
||||
#include "masstree/config.h"
|
||||
#include "masstree_config.h"
|
||||
#include "masstree/mot_masstree.hpp"
|
||||
#include "masstree/mot_masstree_insert.hpp"
|
||||
#include "masstree/mot_masstree_remove.hpp"
|
||||
|
|
|
@ -552,7 +552,7 @@ uint32_t CheckpointRecovery::HaveTasks()
|
|||
|
||||
bool CheckpointRecovery::IsMemoryLimitReached(uint32_t numThreads, uint32_t neededBytes)
|
||||
{
|
||||
uint64_t memoryRequiredBytes = numThreads * neededBytes;
|
||||
uint64_t memoryRequiredBytes = (uint64_t)numThreads * neededBytes;
|
||||
if (MOTEngine::GetInstance()->GetCurrentMemoryConsumptionBytes() + memoryRequiredBytes >=
|
||||
MOTEngine::GetInstance()->GetHardMemoryLimitBytes()) {
|
||||
MOT_LOG_WARN("CheckpointRecovery::IsMemoryLimitReached: memory limit reached "
|
||||
|
|
|
@ -175,24 +175,16 @@ void TxnAccess::ClearSet()
|
|||
{
|
||||
m_lastAcc = nullptr;
|
||||
MOT_ASSERT(m_rowCnt == m_rowsSet->size());
|
||||
m_rowsSet->clear();
|
||||
if (unlikely(m_accessSetSize > DEFAULT_ACCESS_SIZE)) {
|
||||
ShrinkAccessSet();
|
||||
}
|
||||
m_rowsSet->clear();
|
||||
m_allocatedAc = 0;
|
||||
|
||||
unsigned int i;
|
||||
for (i = 0; i < m_accessSetSize; i++) {
|
||||
Access* ac = GetAccessPtr(i);
|
||||
if (ac != nullptr) {
|
||||
DestroyAccess(ac);
|
||||
} else {
|
||||
break;
|
||||
} else {
|
||||
for (unsigned int i = 0; i < m_rowCnt; i++) {
|
||||
DestroyAccess(m_accessesSetBuff[i]);
|
||||
}
|
||||
m_rowCnt = 0;
|
||||
}
|
||||
m_allocatedAc = i;
|
||||
m_insertManager->ClearSet();
|
||||
m_rowCnt = 0;
|
||||
}
|
||||
|
||||
void TxnAccess::DestroyAccess(Access* access)
|
||||
|
@ -241,15 +233,9 @@ void TxnAccess::ShrinkAccessSet()
|
|||
errno_t erc;
|
||||
uint64_t new_array_size = DEFAULT_ACCESS_SIZE;
|
||||
// Clear access set
|
||||
for (unsigned int i = DEFAULT_ACCESS_SIZE; i < m_accessSetSize; i++) {
|
||||
Access* ac = GetAccessPtr(i);
|
||||
if (ac != nullptr) {
|
||||
DestroyAccess(ac);
|
||||
delete ac;
|
||||
ResetAccessPtr(i);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
for (unsigned int i = 0; i < m_allocatedAc; i++) {
|
||||
DestroyAccess(m_accessesSetBuff[i]);
|
||||
delete m_accessesSetBuff[i];
|
||||
}
|
||||
|
||||
if (new_array_size < m_accessSetSize) {
|
||||
|
@ -269,11 +255,11 @@ void TxnAccess::ShrinkAccessSet()
|
|||
|
||||
erc = memset_s(ptr, alloc_size, 0, sizeof(Access*) * new_array_size);
|
||||
securec_check(erc, "\0", "\0");
|
||||
erc = memcpy_s(ptr, alloc_size, m_accessesSetBuff, sizeof(Access*) * DEFAULT_ACCESS_SIZE);
|
||||
securec_check(erc, "\0", "\0");
|
||||
MemSessionFree(m_accessesSetBuff);
|
||||
SetAccessesSet(reinterpret_cast<Access**>(ptr));
|
||||
m_accessSetSize = new_array_size;
|
||||
m_allocatedAc = 0;
|
||||
m_rowCnt = 0;
|
||||
}
|
||||
|
||||
Access* TxnAccess::GetNewRowAccess(const Row* row, AccessType type, RC& rc)
|
||||
|
|
|
@ -369,8 +369,9 @@ RC RedoLog::SerializeTransactionDDLs(IdxDDLAccessMap& idxDDLMap)
|
|||
RC RedoLog::SerializeTransactionDMLs()
|
||||
{
|
||||
RC status = RC_OK;
|
||||
for (uint32_t index = 0; index < m_txn->m_accessMgr->m_rowCnt; index++) {
|
||||
Access* access = m_txn->m_accessMgr->GetAccessPtr(index);
|
||||
TxnOrderedSet_t& orderedSet = m_txn->m_accessMgr->GetOrderedRowSet();
|
||||
for (const auto& raPair : orderedSet) {
|
||||
Access* access = raPair.second;
|
||||
if (access != nullptr) {
|
||||
switch (access->m_type) {
|
||||
case INS:
|
||||
|
|
|
@ -574,8 +574,9 @@ static void MOTGetForeignPaths(PlannerInfo* root, RelOptInfo* baserel, Oid forei
|
|||
foreach (lc, baserel->baserestrictinfo) {
|
||||
RestrictInfo* ri = (RestrictInfo*)lfirst(lc);
|
||||
|
||||
if (!IsMOTExpr(baserel, planstate, &marr, ri->clause, NULL, true))
|
||||
if (!IsMOTExpr(baserel, planstate, &marr, ri->clause, nullptr, true)) {
|
||||
planstate->m_localConds = lappend(planstate->m_localConds, ri->clause);
|
||||
}
|
||||
}
|
||||
|
||||
// get best index
|
||||
|
@ -675,8 +676,8 @@ static void MOTGetForeignPaths(PlannerInfo* root, RelOptInfo* baserel, Oid forei
|
|||
foreach (lc, bestClause) {
|
||||
RestrictInfo* ri = (RestrictInfo*)lfirst(lc);
|
||||
|
||||
IsMOTExpr(baserel, planstate, &marr, ri->clause, nullptr, false);
|
||||
// in case we use index params DO NOT add it to envelope filter
|
||||
// In case we use index params DO NOT add it to envelope filter.
|
||||
(void)IsMOTExpr(baserel, planstate, &marr, ri->clause, nullptr, false);
|
||||
}
|
||||
|
||||
best = MOTAdaptor::GetBestMatchIndex(planstate, &marr, list_length(bestClause), false);
|
||||
|
@ -1383,7 +1384,7 @@ static TupleTableSlot* MOTExecForeignInsert(
|
|||
MOTFdwStateSt* fdwState = (MOTFdwStateSt*)resultRelInfo->ri_FdwState;
|
||||
MOT::RC rc = MOT::RC_OK;
|
||||
|
||||
if (MOTAdaptor::m_engine->IsSoftMemoryLimitReached()) {
|
||||
if (MOTAdaptor::m_engine->IsSoftMemoryLimitReached() && fdwState != nullptr) {
|
||||
CleanQueryStatesOnError(fdwState->m_currTxn);
|
||||
}
|
||||
|
||||
|
|
|
@ -78,9 +78,7 @@ void MOTRedo(XLogReaderState* record)
|
|||
|
||||
uint64_t XLOGLogger::AddToLog(MOT::RedoLogBuffer** redoLogBufferArray, uint32_t size)
|
||||
{
|
||||
uint64_t written = MOT::ILogger::AddToLog(redoLogBufferArray, size);
|
||||
XLogSetAsyncXactLSN(t_thrd.xlog_cxt.XactLastRecEnd);
|
||||
return written;
|
||||
return MOT::ILogger::AddToLog(redoLogBufferArray, size);
|
||||
}
|
||||
|
||||
uint64_t XLOGLogger::AddToLog(uint8_t* data, uint32_t size)
|
||||
|
|
|
@ -580,7 +580,7 @@ static llvm::Value* ProcessOpExpr(
|
|||
JitLlvmCodeGenContext* ctx, const OpExpr* op_expr, int& result_type, int arg_pos, int depth, int* max_arg)
|
||||
{
|
||||
llvm::Value* result = nullptr;
|
||||
MOT_LOG_DEBUG("%*s --> Processing OP %d expression", depth, "", (int)op_expr->opfuncid);
|
||||
MOT_LOG_DEBUG("%*s --> Processing OP %u expression", depth, "", op_expr->opfuncid);
|
||||
if (depth > MOT_JIT_MAX_EXPR_DEPTH) {
|
||||
MOT_LOG_TRACE("Cannot process expression: Expression exceeds depth limit %d", (int)MOT_JIT_MAX_EXPR_DEPTH);
|
||||
return nullptr;
|
||||
|
@ -615,11 +615,11 @@ static llvm::Value* ProcessOpExpr(
|
|||
APPLY_OPERATORS()
|
||||
|
||||
default:
|
||||
MOT_LOG_TRACE("Unsupported operator function type: %d", op_expr->opfuncid);
|
||||
MOT_LOG_TRACE("Unsupported operator function type: %u", op_expr->opfuncid);
|
||||
break;
|
||||
}
|
||||
|
||||
MOT_LOG_DEBUG("%*s <-- Processing OP %d expression result: %p", depth, "", (int)op_expr->opfuncid, result);
|
||||
MOT_LOG_DEBUG("%*s <-- Processing OP %u expression result: %p", depth, "", op_expr->opfuncid, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -1032,7 +1032,7 @@ static TableExprClass clasifyTableExprArgs(Query* query, MOT::Table* table, MOT:
|
|||
static TableExprClass classifyTableOpExpr(Query* query, MOT::Table* table, MOT::Index* index, OpExpr* op_expr)
|
||||
{
|
||||
if (!IsFuncIdSupported(op_expr->opfuncid)) {
|
||||
MOT_LOG_TRACE("classifyTableOpExpr(): Unsupported function id %d", (int)op_expr->opfuncid);
|
||||
MOT_LOG_TRACE("classifyTableOpExpr(): Unsupported function id %u", op_expr->opfuncid);
|
||||
return TableExprError;
|
||||
}
|
||||
|
||||
|
|
|
@ -534,7 +534,7 @@ static Expression* ProcessOpExpr(
|
|||
{
|
||||
Expression* result = nullptr;
|
||||
const int op_args_num = 3;
|
||||
MOT_LOG_DEBUG("%*s --> Processing OP %d expression", depth, "", (int)op_expr->opfuncid);
|
||||
MOT_LOG_DEBUG("%*s --> Processing OP %u expression", depth, "", op_expr->opfuncid);
|
||||
if (depth > MOT_JIT_MAX_EXPR_DEPTH) {
|
||||
MOT_LOG_TRACE("Cannot process expression: Expression exceeds depth limit %d", (int)MOT_JIT_MAX_EXPR_DEPTH);
|
||||
return nullptr;
|
||||
|
@ -567,11 +567,11 @@ static Expression* ProcessOpExpr(
|
|||
APPLY_OPERATORS()
|
||||
|
||||
default:
|
||||
MOT_LOG_TRACE("Unsupported operator function type: %d", op_expr->opfuncid);
|
||||
MOT_LOG_TRACE("Unsupported operator function type: %u", op_expr->opfuncid);
|
||||
break;
|
||||
}
|
||||
|
||||
MOT_LOG_DEBUG("%*s <-- Processing OP %d expression result: %p", depth, "", (int)op_expr->opfuncid, result);
|
||||
MOT_LOG_DEBUG("%*s <-- Processing OP %u expression result: %p", depth, "", op_expr->opfuncid, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -97,71 +97,6 @@ RETURNS BOOL LANGUAGE INTERNAL strict volatile as 'pgxc_unlock_for_transfer';
|
|||
DROP FUNCTION IF EXISTS pg_catalog.table_skewness(text, OUT DNName text, OUT Num text, OUT Ratio text);
|
||||
DROP FUNCTION IF EXISTS pg_catalog.distributed_count(IN _table_name text, OUT DNName text, OUT Num text, OUT Ratio text);
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.distributed_count(IN _table_name text, OUT DNName text, OUT Num text, OUT Ratio text)
|
||||
RETURNS setof record
|
||||
AS $$
|
||||
DECLARE
|
||||
row_data record;
|
||||
row_name record;
|
||||
query_str text;
|
||||
query_str_nodes text;
|
||||
total_num bigint;
|
||||
flag boolean;
|
||||
special text := '[;|-]';
|
||||
BEGIN
|
||||
EXECUTE IMMEDIATE 'SELECT regexp_like(:1,:2);' INTO flag USING IN _table_name, IN special;
|
||||
IF flag = true THEN
|
||||
raise WARNING 'illegal character entered for function';
|
||||
RETURN;
|
||||
END IF;
|
||||
EXECUTE 'SELECT count(1) FROM ' || _table_name
|
||||
INTO total_num;
|
||||
|
||||
--Get the node names
|
||||
query_str_nodes := 'SELECT node_name FROM pgxc_node, pgxc_class where node_type IN (''C'', ''D'') AND is_oid_in_group_members(oid, nodeoids) AND
|
||||
pcrelid=''' || _table_name || '''::regclass::oid';
|
||||
|
||||
FOR row_name IN EXECUTE(query_str_nodes) LOOP
|
||||
query_str := 'EXECUTE DIRECT ON (' || row_name.node_name || ') ''select ''''DN_name'''' as dnname1, count(1) as count1 from ' || $1 || '''';
|
||||
|
||||
FOR row_data IN EXECUTE(query_str) LOOP
|
||||
row_data.dnname1 := CASE
|
||||
WHEN LENGTH(row_name.node_name)<20
|
||||
THEN row_name.node_name || right(' ',20-length(row_name.node_name))
|
||||
ELSE SUBSTR(row_name.node_name,1,20)
|
||||
END;
|
||||
DNName := row_data.dnname1;
|
||||
Num := row_data.count1;
|
||||
IF total_num = 0 THEN
|
||||
Ratio := 0.000 ||'%';
|
||||
ELSE
|
||||
Ratio := ROUND(row_data.count1/total_num*100,3) || '%';
|
||||
END IF;
|
||||
RETURN next;
|
||||
END LOOP;
|
||||
END LOOP;
|
||||
|
||||
RETURN;
|
||||
END; $$
|
||||
LANGUAGE plpgsql NOT FENCED;
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.table_skewness(text, OUT DNName text, OUT Num text, OUT Ratio text)
|
||||
RETURNS setof record
|
||||
AS $$
|
||||
declare
|
||||
flag boolean;
|
||||
special text := '[;|-]';
|
||||
BEGIN
|
||||
EXECUTE IMMEDIATE 'SELECT regexp_like(:1,:2);' INTO flag USING IN $1, IN special;
|
||||
IF flag = true THEN
|
||||
raise WARNING 'illegal character entered for function';
|
||||
return NEXT;
|
||||
ELSE
|
||||
RETURN QUERY EXECUTE 'SELECT * FROM distributed_count(''' || $1 || ''') ORDER BY num DESC, dnname';
|
||||
END IF;
|
||||
END; $$
|
||||
LANGUAGE plpgsql NOT FENCED;
|
||||
|
||||
-- upgrade 3956
|
||||
DROP FUNCTION IF EXISTS pg_catalog.threadpool_status;
|
||||
|
||||
|
@ -543,36 +478,6 @@ SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 4520;
|
|||
CREATE FUNCTION pg_catalog.gs_stat_activity_timeout(IN timeout_threshold int4, OUT datid oid, OUT pid INT8, OUT sessionid INT8, OUT usesysid oid, OUT application_name text, OUT query text, OUT xact_start timestamptz, OUT query_start timestamptz, OUT query_id INT8)
|
||||
RETURNS SETOF RECORD LANGUAGE INTERNAL as 'pg_stat_get_activity_timeout';
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.global_stat_activity_timeout(in execute_time int4, out nodename text, out datid oid, out pid int8, out sessionid int8, out usesysid oid, out application_name text, out query text, out xact_start timestamptz, out query_start timestamptz, out query_id int8)
|
||||
RETURNS setof record
|
||||
AS $$
|
||||
DECLARE
|
||||
query_str text;
|
||||
node_data record;
|
||||
row_data record;
|
||||
BEGIN
|
||||
--Get the node names of all CNs
|
||||
query_str := 'SELECT node_name FROM pgxc_node WHERE node_type=''C'' AND nodeis_active = true';
|
||||
FOR node_data IN EXECUTE(query_str) LOOP
|
||||
query_str := 'EXECUTE DIRECT ON (' || node_data.node_name || ') ''SELECT * FROM gs_stat_activity_timeout(' || execute_time || ')''';
|
||||
FOR row_data IN EXECUTE(query_str) LOOP
|
||||
nodename := node_data.node_name;
|
||||
datid := row_data.datid;
|
||||
pid := row_data.pid;
|
||||
sessionid := row_data.sessionid;
|
||||
usesysid := row_data.usesysid;
|
||||
application_name := row_data.application_name;
|
||||
query := row_data.query;
|
||||
xact_start := row_data.xact_start;
|
||||
query_start := row_data.query_start;
|
||||
query_id := row_data.query_id;
|
||||
return next;
|
||||
END LOOP;
|
||||
END LOOP;
|
||||
return;
|
||||
END; $$
|
||||
LANGUAGE 'plpgsql' NOT FENCED;
|
||||
|
||||
DROP VIEW IF EXISTS pg_catalog.pgxc_wlm_session_history CASCADE;
|
||||
DROP FUNCTION IF EXISTS pg_catalog.pgxc_get_wlm_session_history() CASCADE;
|
||||
DROP VIEW IF EXISTS pg_catalog.gs_wlm_session_history CASCADE;
|
||||
|
@ -917,122 +822,6 @@ SELECT
|
|||
S.top_cpu_dn
|
||||
FROM pg_catalog.gs_wlm_session_info_all S;
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.pgxc_get_wlm_session_history()
|
||||
RETURNS setof record
|
||||
AS $$
|
||||
DECLARE
|
||||
row_data record;
|
||||
row_name record;
|
||||
query_str text;
|
||||
query_str_nodes text;
|
||||
BEGIN
|
||||
--Get all the node names
|
||||
query_str_nodes := 'SELECT node_name FROM pgxc_node WHERE node_type=''C'' AND nodeis_active = true';
|
||||
FOR row_name IN EXECUTE(query_str_nodes) LOOP
|
||||
query_str := 'EXECUTE DIRECT ON (' || row_name.node_name || ') ''SELECT * FROM pg_catalog.gs_wlm_session_history''';
|
||||
FOR row_data IN EXECUTE(query_str) LOOP
|
||||
return next row_data;
|
||||
END LOOP;
|
||||
END LOOP;
|
||||
return;
|
||||
END; $$
|
||||
LANGUAGE 'plpgsql' NOT FENCED;
|
||||
|
||||
CREATE VIEW pg_catalog.pgxc_wlm_session_history AS
|
||||
SELECT * FROM pg_catalog.pgxc_get_wlm_session_history() AS
|
||||
(
|
||||
datid Oid,
|
||||
dbname text,
|
||||
schemaname text,
|
||||
nodename text,
|
||||
username text,
|
||||
application_name text,
|
||||
client_addr inet,
|
||||
client_hostname text,
|
||||
client_port int,
|
||||
query_band text,
|
||||
block_time bigint,
|
||||
start_time timestamp with time zone,
|
||||
finish_time timestamp with time zone,
|
||||
duration bigint,
|
||||
estimate_total_time bigint,
|
||||
status text,
|
||||
abort_info text,
|
||||
resource_pool text,
|
||||
control_group text,
|
||||
estimate_memory int,
|
||||
min_peak_memory int,
|
||||
max_peak_memory int,
|
||||
average_peak_memory int,
|
||||
memory_skew_percent int,
|
||||
spill_info text,
|
||||
min_spill_size int,
|
||||
max_spill_size int,
|
||||
average_spill_size int,
|
||||
spill_skew_percent int,
|
||||
min_dn_time bigint,
|
||||
max_dn_time bigint,
|
||||
average_dn_time bigint,
|
||||
dntime_skew_percent int,
|
||||
min_cpu_time bigint,
|
||||
max_cpu_time bigint,
|
||||
total_cpu_time bigint,
|
||||
cpu_skew_percent int,
|
||||
min_peak_iops int,
|
||||
max_peak_iops int,
|
||||
average_peak_iops int,
|
||||
iops_skew_percent int,
|
||||
warning text,
|
||||
queryid bigint,
|
||||
query text,
|
||||
query_plan text,
|
||||
node_group text,
|
||||
cpu_top1_node_name text,
|
||||
cpu_top2_node_name text,
|
||||
cpu_top3_node_name text,
|
||||
cpu_top4_node_name text,
|
||||
cpu_top5_node_name text,
|
||||
mem_top1_node_name text,
|
||||
mem_top2_node_name text,
|
||||
mem_top3_node_name text,
|
||||
mem_top4_node_name text,
|
||||
mem_top5_node_name text,
|
||||
cpu_top1_value bigint,
|
||||
cpu_top2_value bigint,
|
||||
cpu_top3_value bigint,
|
||||
cpu_top4_value bigint,
|
||||
cpu_top5_value bigint,
|
||||
mem_top1_value bigint,
|
||||
mem_top2_value bigint,
|
||||
mem_top3_value bigint,
|
||||
mem_top4_value bigint,
|
||||
mem_top5_value bigint,
|
||||
top_mem_dn text,
|
||||
top_cpu_dn text
|
||||
);
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.pgxc_get_wlm_session_info()
|
||||
RETURNS setof record
|
||||
AS $$
|
||||
DECLARE
|
||||
row_data record;
|
||||
row_name record;
|
||||
query_str text;
|
||||
query_str_nodes text;
|
||||
BEGIN
|
||||
--Get all the node names
|
||||
query_str_nodes := 'SELECT node_name FROM pgxc_node WHERE node_type=''C'' AND nodeis_active = true';
|
||||
FOR row_name IN EXECUTE(query_str_nodes) LOOP
|
||||
query_str := 'EXECUTE DIRECT ON (' || row_name.node_name || ') ''SELECT * FROM pg_catalog.gs_wlm_session_info''';
|
||||
FOR row_data IN EXECUTE(query_str) LOOP
|
||||
return next row_data;
|
||||
END LOOP;
|
||||
END LOOP;
|
||||
return;
|
||||
END; $$
|
||||
LANGUAGE 'plpgsql' NOT FENCED;
|
||||
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.create_wlm_session_info(IN flag int)
|
||||
RETURNS int
|
||||
AS $$
|
||||
|
@ -1054,115 +843,10 @@ DECLARE
|
|||
END; $$
|
||||
LANGUAGE plpgsql NOT FENCED;
|
||||
|
||||
CREATE VIEW pg_catalog.pgxc_wlm_session_info AS
|
||||
SELECT * FROM pg_catalog.pgxc_get_wlm_session_info() AS
|
||||
(
|
||||
datid Oid,
|
||||
dbname text,
|
||||
schemaname text,
|
||||
nodename text,
|
||||
username text,
|
||||
application_name text,
|
||||
client_addr inet,
|
||||
client_hostname text,
|
||||
client_port int,
|
||||
query_band text,
|
||||
block_time bigint,
|
||||
start_time timestamp with time zone,
|
||||
finish_time timestamp with time zone,
|
||||
duration bigint,
|
||||
estimate_total_time bigint,
|
||||
status text,
|
||||
abort_info text,
|
||||
resource_pool text,
|
||||
control_group text,
|
||||
estimate_memory int,
|
||||
min_peak_memory int,
|
||||
max_peak_memory int,
|
||||
average_peak_memory int,
|
||||
memory_skew_percent int,
|
||||
spill_info text,
|
||||
min_spill_size int,
|
||||
max_spill_size int,
|
||||
average_spill_size int,
|
||||
spill_skew_percent int,
|
||||
min_dn_time bigint,
|
||||
max_dn_time bigint,
|
||||
average_dn_time bigint,
|
||||
dntime_skew_percent int,
|
||||
min_cpu_time bigint,
|
||||
max_cpu_time bigint,
|
||||
total_cpu_time bigint,
|
||||
cpu_skew_percent int,
|
||||
min_peak_iops int,
|
||||
max_peak_iops int,
|
||||
average_peak_iops int,
|
||||
iops_skew_percent int,
|
||||
warning text,
|
||||
queryid bigint,
|
||||
query text,
|
||||
query_plan text,
|
||||
node_group text,
|
||||
cpu_top1_node_name text,
|
||||
cpu_top2_node_name text,
|
||||
cpu_top3_node_name text,
|
||||
cpu_top4_node_name text,
|
||||
cpu_top5_node_name text,
|
||||
mem_top1_node_name text,
|
||||
mem_top2_node_name text,
|
||||
mem_top3_node_name text,
|
||||
mem_top4_node_name text,
|
||||
mem_top5_node_name text,
|
||||
cpu_top1_value bigint,
|
||||
cpu_top2_value bigint,
|
||||
cpu_top3_value bigint,
|
||||
cpu_top4_value bigint,
|
||||
cpu_top5_value bigint,
|
||||
mem_top1_value bigint,
|
||||
mem_top2_value bigint,
|
||||
mem_top3_value bigint,
|
||||
mem_top4_value bigint,
|
||||
mem_top5_value bigint,
|
||||
top_mem_dn text,
|
||||
top_cpu_dn text
|
||||
);
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.pgxc_get_wlm_session_info_bytime(text, TIMESTAMP, TIMESTAMP, int)
|
||||
RETURNS setof pg_catalog.gs_wlm_session_info
|
||||
AS $$
|
||||
DECLARE
|
||||
row_data gs_wlm_session_info%rowtype;
|
||||
row_name record;
|
||||
query_str text;
|
||||
query_str_nodes text;
|
||||
query_str_cn text;
|
||||
BEGIN
|
||||
IF $1 IN ('start_time', 'finish_time') THEN
|
||||
|
||||
ELSE
|
||||
raise WARNING 'Illegal character entered for function, colname must be start_time or finish_time';
|
||||
return;
|
||||
END IF;
|
||||
|
||||
--Get all the node names
|
||||
query_str_nodes := 'SELECT node_name FROM pgxc_node WHERE node_type=''C'' AND nodeis_active = true';
|
||||
query_str_cn := 'SELECT * FROM pg_catalog.gs_wlm_session_info where '||$1||'>'''''||$2||''''' and '||$1||'<'''''||$3||''''' limit '||$4;
|
||||
FOR row_name IN EXECUTE(query_str_nodes) LOOP
|
||||
query_str := 'EXECUTE DIRECT ON (' || row_name.node_name || ') ''' || query_str_cn||''';';
|
||||
FOR row_data IN EXECUTE(query_str) LOOP
|
||||
return next row_data;
|
||||
END LOOP;
|
||||
END LOOP;
|
||||
return;
|
||||
END; $$
|
||||
LANGUAGE 'plpgsql' NOT FENCED;
|
||||
|
||||
GRANT SELECT ON TABLE pg_catalog.gs_wlm_session_query_info_all TO PUBLIC;
|
||||
GRANT SELECT ON TABLE pg_catalog.gs_wlm_session_history TO PUBLIC;
|
||||
GRANT SELECT ON TABLE pg_catalog.gs_wlm_session_info TO PUBLIC;
|
||||
GRANT SELECT ON TABLE pg_catalog.gs_wlm_session_info_all TO PUBLIC;
|
||||
GRANT SELECT ON TABLE pg_catalog.pgxc_wlm_session_history TO PUBLIC;
|
||||
GRANT SELECT ON TABLE pg_catalog.pgxc_wlm_session_info TO PUBLIC;
|
||||
|
||||
DROP INDEX IF EXISTS pg_catalog.pg_asp_oid_index;
|
||||
DROP TYPE IF EXISTS pg_catalog.pg_asp;
|
||||
|
@ -1397,23 +1081,9 @@ GRANT SELECT ON TABLE pg_catalog.gs_auditing_access TO PUBLIC;
|
|||
GRANT SELECT ON TABLE pg_catalog.gs_auditing_privilege TO PUBLIC;
|
||||
GRANT SELECT ON TABLE pg_catalog.gs_auditing TO PUBLIC;
|
||||
|
||||
DROP FUNCTION IF EXISTS dbms_job.isubmit_on_nodes(bigint, name, name, text, timestamp without time zone, text) cascade;
|
||||
DROP FUNCTION IF EXISTS dbms_job.submit_on_nodes(name, name, text, timestamp without time zone, text, OUT integer) cascade;
|
||||
DROP FUNCTION IF EXISTS pg_catalog.capture_view_to_json(text, integer) cascade;
|
||||
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 5717;
|
||||
CREATE FUNCTION dbms_job.submit_on_nodes(node_name name, database name, what text, next_date timestamp without time zone, job_interval text, OUT job integer)
|
||||
RETURNS integer
|
||||
LANGUAGE internal
|
||||
NOT FENCED NOT SHIPPABLE
|
||||
AS 'submit_job_on_nodes';
|
||||
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 5718;
|
||||
CREATE FUNCTION dbms_job.isubmit_on_nodes(job bigint, node_name name, database name, what text, next_date timestamp without time zone, job_interval text)
|
||||
RETURNS integer
|
||||
LANGUAGE internal
|
||||
NOT FENCED NOT SHIPPABLE
|
||||
AS 'isubmit_job_on_nodes';
|
||||
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 5719;
|
||||
CREATE FUNCTION pg_catalog.capture_view_to_json(view_name text, is_all_db integer)
|
||||
|
@ -1559,15 +1229,6 @@ SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0,
|
|||
GRANT SELECT ON TABLE pg_catalog.streaming_stream TO PUBLIC;
|
||||
GRANT SELECT ON TABLE pg_catalog.streaming_cont_query TO PUBLIC;
|
||||
|
||||
DROP FUNCTION IF EXISTS dbms_job.isubmit_on_nodes_internal(bigint, name, name, text, timestamp without time zone, text) cascade;
|
||||
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 6007;
|
||||
CREATE FUNCTION dbms_job.isubmit_on_nodes_internal(job bigint, node_name name, database name, what text, next_date timestamp without time zone, job_interval text)
|
||||
RETURNS integer
|
||||
LANGUAGE internal
|
||||
NOT FENCED NOT SHIPPABLE
|
||||
AS 'isubmit_job_on_nodes_internal';
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.proc_add_depend(
|
||||
IN relationname name,
|
||||
IN dbname name
|
||||
|
@ -1706,17 +1367,6 @@ DROP VIEW IF EXISTS pg_catalog.user_views CASCADE;
|
|||
drop view if exists pg_catalog.v$session CASCADE;
|
||||
drop view if exists pg_catalog.V$SESSION_LONGOPS CASCADE;
|
||||
|
||||
DROP FUNCTION IF EXISTS dbms_job.remove(bigint) cascade;
|
||||
DROP FUNCTION IF EXISTS dbms_job.change(bigint, text, timestamp, text) cascade;
|
||||
DROP FUNCTION IF EXISTS dbms_job.what(bigint, text) cascade;
|
||||
DROP FUNCTION IF EXISTS dbms_job.next_date(bigint, timestamp) cascade;
|
||||
DROP FUNCTION IF EXISTS dbms_job.interval(bigint, text) cascade;
|
||||
DROP FUNCTION IF EXISTS dbms_job.broken(bigint, boolean, timestamp) cascade;
|
||||
DROP FUNCTION IF EXISTS dbms_job.isubmit(bigint, text, timestamp, text) cascade;
|
||||
DROP FUNCTION IF EXISTS dbms_job.submit(text, timestamp, text, out integer) cascade;
|
||||
DROP FUNCTION IF EXISTS dbms_job.isubmit_on_nodes(bigint, name, name, text, timestamp without time zone, text) cascade;
|
||||
DROP FUNCTION IF EXISTS dbms_job.submit_on_nodes(name, name, text, timestamp without time zone, text, OUT integer) cascade;
|
||||
DROP FUNCTION IF EXISTS dbms_job.isubmit_on_nodes_internal(bigint, name, name, text, timestamp without time zone, text) cascade;
|
||||
DROP SCHEMA IF EXISTS dbms_job cascade;
|
||||
|
||||
CREATE OR REPLACE VIEW pg_catalog.gs_wlm_user_session_info AS
|
||||
|
@ -2108,84 +1758,6 @@ CREATE UNIQUE INDEX gs_asp_sample_time_index ON pg_catalog.gs_asp USING BTREE(sa
|
|||
GRANT SELECT ON pg_catalog.gs_asp TO PUBLIC;
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 0;
|
||||
|
||||
DO $DO$
|
||||
DECLARE
|
||||
ans boolean;
|
||||
BEGIN
|
||||
select case when count(*)=1 then true else false end as ans from (select nspname from pg_namespace where nspname='dbe_perf' limit 1) into ans;
|
||||
if ans = true then
|
||||
CREATE OR REPLACE FUNCTION DBE_PERF.get_global_gs_asp
|
||||
(in start_ts timestamp without time zone,
|
||||
in end_ts timestamp without time zone,
|
||||
OUT node_name text,
|
||||
OUT sampleid bigint,
|
||||
OUT sample_time timestamp without time zone,
|
||||
OUT need_flush_sample boolean,
|
||||
OUT databaseid oid,
|
||||
OUT thread_id bigint,
|
||||
OUT sessionid bigint,
|
||||
OUT start_time timestamp without time zone,
|
||||
OUT event text,
|
||||
OUT lwtid integer,
|
||||
OUT psessionid bigint,
|
||||
OUT tlevel integer,
|
||||
OUT smpid integer,
|
||||
OUT userid oid,
|
||||
OUT application_name text,
|
||||
OUT client_addr inet,
|
||||
OUT client_hostname text,
|
||||
OUT client_port integer,
|
||||
OUT query_id bigint,
|
||||
OUT unique_query_id bigint,
|
||||
OUT user_id oid,
|
||||
OUT cn_id integer,
|
||||
OUT unique_query text)
|
||||
RETURNS SETOF record
|
||||
AS $$
|
||||
DECLARE
|
||||
ROW_DATA pg_catalog.gs_asp%ROWTYPE;
|
||||
ROW_NAME RECORD;
|
||||
QUERY_STR TEXT;
|
||||
QUERY_STR_NODES TEXT;
|
||||
node_str TEXT;
|
||||
BEGIN
|
||||
QUERY_STR_NODES := 'SELECT NODE_NAME FROM PGXC_NODE WHERE NODE_TYPE IN (''C'', ''D'')';
|
||||
node_str := 'SELECT * FROM pg_catalog.gs_asp where sample_time > '''''||$1||''''' and sample_time < '''''||$2||'''';
|
||||
FOR ROW_NAME IN EXECUTE(QUERY_STR_NODES) LOOP
|
||||
QUERY_STR := 'EXECUTE DIRECT ON (' || ROW_NAME.NODE_NAME || ') '''|| node_str ||''''';';
|
||||
FOR ROW_DATA IN EXECUTE(QUERY_STR) LOOP
|
||||
node_name := ROW_NAME.NODE_NAME;
|
||||
sampleid := ROW_DATA.sampleid;
|
||||
sample_time := ROW_DATA.sample_time;
|
||||
need_flush_sample := ROW_DATA.need_flush_sample;
|
||||
databaseid := ROW_DATA.databaseid;
|
||||
thread_id := ROW_DATA.thread_id;
|
||||
sessionid := ROW_DATA.sessionid;
|
||||
start_time := ROW_DATA.start_time;
|
||||
event := ROW_DATA.event;
|
||||
lwtid := ROW_DATA.lwtid;
|
||||
psessionid := ROW_DATA.psessionid;
|
||||
tlevel := ROW_DATA.tlevel;
|
||||
smpid := ROW_DATA.smpid;
|
||||
userid := ROW_DATA.userid;
|
||||
application_name := ROW_DATA.application_name;
|
||||
client_addr := ROW_DATA.client_addr;
|
||||
client_hostname := ROW_DATA.client_hostname;
|
||||
client_port := ROW_DATA.client_port;
|
||||
query_id := ROW_DATA.query_id;
|
||||
unique_query_id := ROW_DATA.unique_query_id;
|
||||
user_id := ROW_DATA.user_id;
|
||||
cn_id := ROW_DATA.cn_id;
|
||||
unique_query := ROW_DATA.unique_query;
|
||||
RETURN NEXT;
|
||||
END LOOP;
|
||||
END LOOP;
|
||||
RETURN;
|
||||
END; $$
|
||||
LANGUAGE 'plpgsql';
|
||||
end if;
|
||||
END$DO$;
|
||||
|
||||
-- use relfilenode to get schemane.tablename if the table is larger than threshold_size_gb
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.get_large_table_name(relfile_node text, threshold_size_gb int8)
|
||||
RETURNS text
|
||||
|
@ -2817,23 +2389,6 @@ DECLARE
|
|||
END;
|
||||
$$LANGUAGE plpgsql NOT FENCED;
|
||||
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC,3466;
|
||||
CREATE FUNCTION pg_catalog.check_engine_status(IN text, IN text) RETURNS text LANGUAGE INTERNAL STABLE STRICT as 'check_engine_status';
|
||||
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC,3467;
|
||||
CREATE FUNCTION pg_catalog.encode_plan_node(IN text, IN text, IN text, IN text, IN int8, IN text, IN text) RETURNS text LANGUAGE INTERNAL STABLE as 'encode_plan_node';
|
||||
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC,3481;
|
||||
CREATE FUNCTION pg_catalog.model_train_opt(IN text, IN text, OUT startup_time_accuracy FLOAT8, OUT total_time_accuracy FLOAT8, OUT rows_accuracy FLOAT8, OUT peak_memory_accuracy FLOAT8) RETURNS SETOF RECORD LANGUAGE INTERNAL STABLE ROWS 1 STRICT as 'model_train_opt';
|
||||
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC,5033;
|
||||
CREATE FUNCTION pg_catalog.gs_stat_get_wlm_plan_operator_info(IN OID, OUT datname text, OUT queryid int8, OUT plan_node_id int4, OUT startup_time int8, OUT total_time int8, OUT actual_rows int8, OUT max_peak_memory int4, OUT query_dop int4, OUT parent_node_id int4, OUT left_child_id int4, OUT right_child_id int4, OUT operation text, OUT orientation text, OUT strategy text, OUT options text, OUT condition text, OUT projection text) RETURNS SETOF RECORD LANGUAGE INTERNAL STABLE ROWS 100 STRICT as 'gs_stat_get_wlm_plan_operator_info';
|
||||
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC,3468;
|
||||
CREATE FUNCTION pg_catalog.track_model_train_opt(IN text, IN text) RETURNS text LANGUAGE INTERNAL STABLE STRICT as 'track_model_train_opt';
|
||||
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 0;
|
||||
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3442;
|
||||
DROP FUNCTION IF EXISTS pg_catalog.pg_control_checkpoint() CASCADE;
|
||||
DROP FUNCTION IF EXISTS pg_catalog.pg_control_system() CASCADE;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -98,71 +98,6 @@ RETURNS BOOL LANGUAGE INTERNAL strict volatile as 'pgxc_unlock_for_transfer';
|
|||
DROP FUNCTION IF EXISTS pg_catalog.table_skewness(text, OUT DNName text, OUT Num text, OUT Ratio text);
|
||||
DROP FUNCTION IF EXISTS pg_catalog.distributed_count(IN _table_name text, OUT DNName text, OUT Num text, OUT Ratio text);
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.distributed_count(IN _table_name text, OUT DNName text, OUT Num text, OUT Ratio text)
|
||||
RETURNS setof record
|
||||
AS $$
|
||||
DECLARE
|
||||
row_data record;
|
||||
row_name record;
|
||||
query_str text;
|
||||
query_str_nodes text;
|
||||
total_num bigint;
|
||||
flag boolean;
|
||||
special text := '[;|-]';
|
||||
BEGIN
|
||||
EXECUTE IMMEDIATE 'SELECT regexp_like(:1,:2);' INTO flag USING IN _table_name, IN special;
|
||||
IF flag = true THEN
|
||||
raise WARNING 'illegal character entered for function';
|
||||
RETURN;
|
||||
END IF;
|
||||
EXECUTE 'SELECT count(1) FROM ' || _table_name
|
||||
INTO total_num;
|
||||
|
||||
--Get the node names
|
||||
query_str_nodes := 'SELECT node_name FROM pgxc_node, pgxc_class where node_type IN (''C'', ''D'') AND is_oid_in_group_members(oid, nodeoids) AND
|
||||
pcrelid=''' || _table_name || '''::regclass::oid';
|
||||
|
||||
FOR row_name IN EXECUTE(query_str_nodes) LOOP
|
||||
query_str := 'EXECUTE DIRECT ON (' || row_name.node_name || ') ''select ''''DN_name'''' as dnname1, count(1) as count1 from ' || $1 || '''';
|
||||
|
||||
FOR row_data IN EXECUTE(query_str) LOOP
|
||||
row_data.dnname1 := CASE
|
||||
WHEN LENGTH(row_name.node_name)<20
|
||||
THEN row_name.node_name || right(' ',20-length(row_name.node_name))
|
||||
ELSE SUBSTR(row_name.node_name,1,20)
|
||||
END;
|
||||
DNName := row_data.dnname1;
|
||||
Num := row_data.count1;
|
||||
IF total_num = 0 THEN
|
||||
Ratio := 0.000 ||'%';
|
||||
ELSE
|
||||
Ratio := ROUND(row_data.count1/total_num*100,3) || '%';
|
||||
END IF;
|
||||
RETURN next;
|
||||
END LOOP;
|
||||
END LOOP;
|
||||
|
||||
RETURN;
|
||||
END; $$
|
||||
LANGUAGE plpgsql NOT FENCED;
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.table_skewness(text, OUT DNName text, OUT Num text, OUT Ratio text)
|
||||
RETURNS setof record
|
||||
AS $$
|
||||
declare
|
||||
flag boolean;
|
||||
special text := '[;|-]';
|
||||
BEGIN
|
||||
EXECUTE IMMEDIATE 'SELECT regexp_like(:1,:2);' INTO flag USING IN $1, IN special;
|
||||
IF flag = true THEN
|
||||
raise WARNING 'illegal character entered for function';
|
||||
return NEXT;
|
||||
ELSE
|
||||
RETURN QUERY EXECUTE 'SELECT * FROM distributed_count(''' || $1 || ''') ORDER BY num DESC, dnname';
|
||||
END IF;
|
||||
END; $$
|
||||
LANGUAGE plpgsql NOT FENCED;
|
||||
|
||||
-- upgrade 3956
|
||||
DROP FUNCTION IF EXISTS pg_catalog.threadpool_status;
|
||||
|
||||
|
@ -544,36 +479,6 @@ SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 4520;
|
|||
CREATE FUNCTION pg_catalog.gs_stat_activity_timeout(IN timeout_threshold int4, OUT datid oid, OUT pid INT8, OUT sessionid INT8, OUT usesysid oid, OUT application_name text, OUT query text, OUT xact_start timestamptz, OUT query_start timestamptz, OUT query_id INT8)
|
||||
RETURNS SETOF RECORD LANGUAGE INTERNAL as 'pg_stat_get_activity_timeout';
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.global_stat_activity_timeout(in execute_time int4, out nodename text, out datid oid, out pid int8, out sessionid int8, out usesysid oid, out application_name text, out query text, out xact_start timestamptz, out query_start timestamptz, out query_id int8)
|
||||
RETURNS setof record
|
||||
AS $$
|
||||
DECLARE
|
||||
query_str text;
|
||||
node_data record;
|
||||
row_data record;
|
||||
BEGIN
|
||||
--Get the node names of all CNs
|
||||
query_str := 'SELECT node_name FROM pgxc_node WHERE node_type=''C'' AND nodeis_active = true';
|
||||
FOR node_data IN EXECUTE(query_str) LOOP
|
||||
query_str := 'EXECUTE DIRECT ON (' || node_data.node_name || ') ''SELECT * FROM gs_stat_activity_timeout(' || execute_time || ')''';
|
||||
FOR row_data IN EXECUTE(query_str) LOOP
|
||||
nodename := node_data.node_name;
|
||||
datid := row_data.datid;
|
||||
pid := row_data.pid;
|
||||
sessionid := row_data.sessionid;
|
||||
usesysid := row_data.usesysid;
|
||||
application_name := row_data.application_name;
|
||||
query := row_data.query;
|
||||
xact_start := row_data.xact_start;
|
||||
query_start := row_data.query_start;
|
||||
query_id := row_data.query_id;
|
||||
return next;
|
||||
END LOOP;
|
||||
END LOOP;
|
||||
return;
|
||||
END; $$
|
||||
LANGUAGE 'plpgsql' NOT FENCED;
|
||||
|
||||
DROP VIEW IF EXISTS pg_catalog.pgxc_wlm_session_history CASCADE;
|
||||
DROP FUNCTION IF EXISTS pg_catalog.pgxc_get_wlm_session_history() CASCADE;
|
||||
DROP VIEW IF EXISTS pg_catalog.gs_wlm_session_history CASCADE;
|
||||
|
@ -918,122 +823,6 @@ SELECT
|
|||
S.top_cpu_dn
|
||||
FROM pg_catalog.gs_wlm_session_info_all S;
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.pgxc_get_wlm_session_history()
|
||||
RETURNS setof record
|
||||
AS $$
|
||||
DECLARE
|
||||
row_data record;
|
||||
row_name record;
|
||||
query_str text;
|
||||
query_str_nodes text;
|
||||
BEGIN
|
||||
--Get all the node names
|
||||
query_str_nodes := 'SELECT node_name FROM pgxc_node WHERE node_type=''C'' AND nodeis_active = true';
|
||||
FOR row_name IN EXECUTE(query_str_nodes) LOOP
|
||||
query_str := 'EXECUTE DIRECT ON (' || row_name.node_name || ') ''SELECT * FROM pg_catalog.gs_wlm_session_history''';
|
||||
FOR row_data IN EXECUTE(query_str) LOOP
|
||||
return next row_data;
|
||||
END LOOP;
|
||||
END LOOP;
|
||||
return;
|
||||
END; $$
|
||||
LANGUAGE 'plpgsql' NOT FENCED;
|
||||
|
||||
CREATE VIEW pg_catalog.pgxc_wlm_session_history AS
|
||||
SELECT * FROM pg_catalog.pgxc_get_wlm_session_history() AS
|
||||
(
|
||||
datid Oid,
|
||||
dbname text,
|
||||
schemaname text,
|
||||
nodename text,
|
||||
username text,
|
||||
application_name text,
|
||||
client_addr inet,
|
||||
client_hostname text,
|
||||
client_port int,
|
||||
query_band text,
|
||||
block_time bigint,
|
||||
start_time timestamp with time zone,
|
||||
finish_time timestamp with time zone,
|
||||
duration bigint,
|
||||
estimate_total_time bigint,
|
||||
status text,
|
||||
abort_info text,
|
||||
resource_pool text,
|
||||
control_group text,
|
||||
estimate_memory int,
|
||||
min_peak_memory int,
|
||||
max_peak_memory int,
|
||||
average_peak_memory int,
|
||||
memory_skew_percent int,
|
||||
spill_info text,
|
||||
min_spill_size int,
|
||||
max_spill_size int,
|
||||
average_spill_size int,
|
||||
spill_skew_percent int,
|
||||
min_dn_time bigint,
|
||||
max_dn_time bigint,
|
||||
average_dn_time bigint,
|
||||
dntime_skew_percent int,
|
||||
min_cpu_time bigint,
|
||||
max_cpu_time bigint,
|
||||
total_cpu_time bigint,
|
||||
cpu_skew_percent int,
|
||||
min_peak_iops int,
|
||||
max_peak_iops int,
|
||||
average_peak_iops int,
|
||||
iops_skew_percent int,
|
||||
warning text,
|
||||
queryid bigint,
|
||||
query text,
|
||||
query_plan text,
|
||||
node_group text,
|
||||
cpu_top1_node_name text,
|
||||
cpu_top2_node_name text,
|
||||
cpu_top3_node_name text,
|
||||
cpu_top4_node_name text,
|
||||
cpu_top5_node_name text,
|
||||
mem_top1_node_name text,
|
||||
mem_top2_node_name text,
|
||||
mem_top3_node_name text,
|
||||
mem_top4_node_name text,
|
||||
mem_top5_node_name text,
|
||||
cpu_top1_value bigint,
|
||||
cpu_top2_value bigint,
|
||||
cpu_top3_value bigint,
|
||||
cpu_top4_value bigint,
|
||||
cpu_top5_value bigint,
|
||||
mem_top1_value bigint,
|
||||
mem_top2_value bigint,
|
||||
mem_top3_value bigint,
|
||||
mem_top4_value bigint,
|
||||
mem_top5_value bigint,
|
||||
top_mem_dn text,
|
||||
top_cpu_dn text
|
||||
);
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.pgxc_get_wlm_session_info()
|
||||
RETURNS setof record
|
||||
AS $$
|
||||
DECLARE
|
||||
row_data record;
|
||||
row_name record;
|
||||
query_str text;
|
||||
query_str_nodes text;
|
||||
BEGIN
|
||||
--Get all the node names
|
||||
query_str_nodes := 'SELECT node_name FROM pgxc_node WHERE node_type=''C'' AND nodeis_active = true';
|
||||
FOR row_name IN EXECUTE(query_str_nodes) LOOP
|
||||
query_str := 'EXECUTE DIRECT ON (' || row_name.node_name || ') ''SELECT * FROM pg_catalog.gs_wlm_session_info''';
|
||||
FOR row_data IN EXECUTE(query_str) LOOP
|
||||
return next row_data;
|
||||
END LOOP;
|
||||
END LOOP;
|
||||
return;
|
||||
END; $$
|
||||
LANGUAGE 'plpgsql' NOT FENCED;
|
||||
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.create_wlm_session_info(IN flag int)
|
||||
RETURNS int
|
||||
AS $$
|
||||
|
@ -1055,115 +844,10 @@ DECLARE
|
|||
END; $$
|
||||
LANGUAGE plpgsql NOT FENCED;
|
||||
|
||||
CREATE VIEW pg_catalog.pgxc_wlm_session_info AS
|
||||
SELECT * FROM pg_catalog.pgxc_get_wlm_session_info() AS
|
||||
(
|
||||
datid Oid,
|
||||
dbname text,
|
||||
schemaname text,
|
||||
nodename text,
|
||||
username text,
|
||||
application_name text,
|
||||
client_addr inet,
|
||||
client_hostname text,
|
||||
client_port int,
|
||||
query_band text,
|
||||
block_time bigint,
|
||||
start_time timestamp with time zone,
|
||||
finish_time timestamp with time zone,
|
||||
duration bigint,
|
||||
estimate_total_time bigint,
|
||||
status text,
|
||||
abort_info text,
|
||||
resource_pool text,
|
||||
control_group text,
|
||||
estimate_memory int,
|
||||
min_peak_memory int,
|
||||
max_peak_memory int,
|
||||
average_peak_memory int,
|
||||
memory_skew_percent int,
|
||||
spill_info text,
|
||||
min_spill_size int,
|
||||
max_spill_size int,
|
||||
average_spill_size int,
|
||||
spill_skew_percent int,
|
||||
min_dn_time bigint,
|
||||
max_dn_time bigint,
|
||||
average_dn_time bigint,
|
||||
dntime_skew_percent int,
|
||||
min_cpu_time bigint,
|
||||
max_cpu_time bigint,
|
||||
total_cpu_time bigint,
|
||||
cpu_skew_percent int,
|
||||
min_peak_iops int,
|
||||
max_peak_iops int,
|
||||
average_peak_iops int,
|
||||
iops_skew_percent int,
|
||||
warning text,
|
||||
queryid bigint,
|
||||
query text,
|
||||
query_plan text,
|
||||
node_group text,
|
||||
cpu_top1_node_name text,
|
||||
cpu_top2_node_name text,
|
||||
cpu_top3_node_name text,
|
||||
cpu_top4_node_name text,
|
||||
cpu_top5_node_name text,
|
||||
mem_top1_node_name text,
|
||||
mem_top2_node_name text,
|
||||
mem_top3_node_name text,
|
||||
mem_top4_node_name text,
|
||||
mem_top5_node_name text,
|
||||
cpu_top1_value bigint,
|
||||
cpu_top2_value bigint,
|
||||
cpu_top3_value bigint,
|
||||
cpu_top4_value bigint,
|
||||
cpu_top5_value bigint,
|
||||
mem_top1_value bigint,
|
||||
mem_top2_value bigint,
|
||||
mem_top3_value bigint,
|
||||
mem_top4_value bigint,
|
||||
mem_top5_value bigint,
|
||||
top_mem_dn text,
|
||||
top_cpu_dn text
|
||||
);
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.pgxc_get_wlm_session_info_bytime(text, TIMESTAMP, TIMESTAMP, int)
|
||||
RETURNS setof pg_catalog.gs_wlm_session_info
|
||||
AS $$
|
||||
DECLARE
|
||||
row_data gs_wlm_session_info%rowtype;
|
||||
row_name record;
|
||||
query_str text;
|
||||
query_str_nodes text;
|
||||
query_str_cn text;
|
||||
BEGIN
|
||||
IF $1 IN ('start_time', 'finish_time') THEN
|
||||
|
||||
ELSE
|
||||
raise WARNING 'Illegal character entered for function, colname must be start_time or finish_time';
|
||||
return;
|
||||
END IF;
|
||||
|
||||
--Get all the node names
|
||||
query_str_nodes := 'SELECT node_name FROM pgxc_node WHERE node_type=''C'' AND nodeis_active = true';
|
||||
query_str_cn := 'SELECT * FROM pg_catalog.gs_wlm_session_info where '||$1||'>'''''||$2||''''' and '||$1||'<'''''||$3||''''' limit '||$4;
|
||||
FOR row_name IN EXECUTE(query_str_nodes) LOOP
|
||||
query_str := 'EXECUTE DIRECT ON (' || row_name.node_name || ') ''' || query_str_cn||''';';
|
||||
FOR row_data IN EXECUTE(query_str) LOOP
|
||||
return next row_data;
|
||||
END LOOP;
|
||||
END LOOP;
|
||||
return;
|
||||
END; $$
|
||||
LANGUAGE 'plpgsql' NOT FENCED;
|
||||
|
||||
GRANT SELECT ON TABLE pg_catalog.gs_wlm_session_query_info_all TO PUBLIC;
|
||||
GRANT SELECT ON TABLE pg_catalog.gs_wlm_session_history TO PUBLIC;
|
||||
GRANT SELECT ON TABLE pg_catalog.gs_wlm_session_info TO PUBLIC;
|
||||
GRANT SELECT ON TABLE pg_catalog.gs_wlm_session_info_all TO PUBLIC;
|
||||
GRANT SELECT ON TABLE pg_catalog.pgxc_wlm_session_history TO PUBLIC;
|
||||
GRANT SELECT ON TABLE pg_catalog.pgxc_wlm_session_info TO PUBLIC;
|
||||
|
||||
DROP INDEX IF EXISTS pg_catalog.pg_asp_oid_index;
|
||||
DROP TYPE IF EXISTS pg_catalog.pg_asp;
|
||||
|
@ -1399,25 +1083,8 @@ GRANT SELECT ON TABLE pg_catalog.gs_auditing_policy_privileges TO PUBLIC;
|
|||
GRANT SELECT ON TABLE pg_catalog.gs_auditing_access TO PUBLIC;
|
||||
GRANT SELECT ON TABLE pg_catalog.gs_auditing_privilege TO PUBLIC;
|
||||
GRANT SELECT ON TABLE pg_catalog.gs_auditing TO PUBLIC;
|
||||
|
||||
DROP FUNCTION IF EXISTS dbms_job.isubmit_on_nodes(bigint, name, name, text, timestamp without time zone, text) cascade;
|
||||
DROP FUNCTION IF EXISTS dbms_job.submit_on_nodes(name, name, text, timestamp without time zone, text, OUT integer) cascade;
|
||||
DROP FUNCTION IF EXISTS pg_catalog.capture_view_to_json(text, integer) cascade;
|
||||
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 5717;
|
||||
CREATE FUNCTION dbms_job.submit_on_nodes(node_name name, database name, what text, next_date timestamp without time zone, job_interval text, OUT job integer)
|
||||
RETURNS integer
|
||||
LANGUAGE internal
|
||||
NOT FENCED NOT SHIPPABLE
|
||||
AS 'submit_job_on_nodes';
|
||||
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 5718;
|
||||
CREATE FUNCTION dbms_job.isubmit_on_nodes(job bigint, node_name name, database name, what text, next_date timestamp without time zone, job_interval text)
|
||||
RETURNS integer
|
||||
LANGUAGE internal
|
||||
NOT FENCED NOT SHIPPABLE
|
||||
AS 'isubmit_job_on_nodes';
|
||||
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 5719;
|
||||
CREATE FUNCTION pg_catalog.capture_view_to_json(view_name text, is_all_db integer)
|
||||
RETURNS integer
|
||||
|
@ -1563,15 +1230,6 @@ SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0,
|
|||
GRANT SELECT ON TABLE pg_catalog.streaming_stream TO PUBLIC;
|
||||
GRANT SELECT ON TABLE pg_catalog.streaming_cont_query TO PUBLIC;
|
||||
|
||||
DROP FUNCTION IF EXISTS dbms_job.isubmit_on_nodes_internal(bigint, name, name, text, timestamp without time zone, text) cascade;
|
||||
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 6007;
|
||||
CREATE FUNCTION dbms_job.isubmit_on_nodes_internal(job bigint, node_name name, database name, what text, next_date timestamp without time zone, job_interval text)
|
||||
RETURNS integer
|
||||
LANGUAGE internal
|
||||
NOT FENCED NOT SHIPPABLE
|
||||
AS 'isubmit_job_on_nodes_internal';
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.proc_add_depend(
|
||||
IN relationname name,
|
||||
IN dbname name
|
||||
|
@ -1711,17 +1369,6 @@ DROP VIEW IF EXISTS pg_catalog.user_views CASCADE;
|
|||
drop view if exists pg_catalog.v$session CASCADE;
|
||||
drop view if exists pg_catalog.V$SESSION_LONGOPS CASCADE;
|
||||
|
||||
DROP FUNCTION IF EXISTS dbms_job.remove(bigint) cascade;
|
||||
DROP FUNCTION IF EXISTS dbms_job.change(bigint, text, timestamp, text) cascade;
|
||||
DROP FUNCTION IF EXISTS dbms_job.what(bigint, text) cascade;
|
||||
DROP FUNCTION IF EXISTS dbms_job.next_date(bigint, timestamp) cascade;
|
||||
DROP FUNCTION IF EXISTS dbms_job.interval(bigint, text) cascade;
|
||||
DROP FUNCTION IF EXISTS dbms_job.broken(bigint, boolean, timestamp) cascade;
|
||||
DROP FUNCTION IF EXISTS dbms_job.isubmit(bigint, text, timestamp, text) cascade;
|
||||
DROP FUNCTION IF EXISTS dbms_job.submit(text, timestamp, text, out integer) cascade;
|
||||
DROP FUNCTION IF EXISTS dbms_job.isubmit_on_nodes(bigint, name, name, text, timestamp without time zone, text) cascade;
|
||||
DROP FUNCTION IF EXISTS dbms_job.submit_on_nodes(name, name, text, timestamp without time zone, text, OUT integer) cascade;
|
||||
DROP FUNCTION IF EXISTS dbms_job.isubmit_on_nodes_internal(bigint, name, name, text, timestamp without time zone, text) cascade;
|
||||
DROP SCHEMA IF EXISTS dbms_job cascade;
|
||||
|
||||
CREATE OR REPLACE VIEW pg_catalog.gs_wlm_user_session_info AS
|
||||
|
@ -2142,84 +1789,6 @@ CREATE UNIQUE INDEX gs_asp_sample_time_index ON pg_catalog.gs_asp USING BTREE(sa
|
|||
GRANT SELECT ON pg_catalog.gs_asp TO PUBLIC;
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 0;
|
||||
|
||||
DO $DO$
|
||||
DECLARE
|
||||
ans boolean;
|
||||
BEGIN
|
||||
select case when count(*)=1 then true else false end as ans from (select nspname from pg_namespace where nspname='dbe_perf' limit 1) into ans;
|
||||
if ans = true then
|
||||
CREATE OR REPLACE FUNCTION DBE_PERF.get_global_gs_asp
|
||||
(in start_ts timestamp without time zone,
|
||||
in end_ts timestamp without time zone,
|
||||
OUT node_name text,
|
||||
OUT sampleid bigint,
|
||||
OUT sample_time timestamp without time zone,
|
||||
OUT need_flush_sample boolean,
|
||||
OUT databaseid oid,
|
||||
OUT thread_id bigint,
|
||||
OUT sessionid bigint,
|
||||
OUT start_time timestamp without time zone,
|
||||
OUT event text,
|
||||
OUT lwtid integer,
|
||||
OUT psessionid bigint,
|
||||
OUT tlevel integer,
|
||||
OUT smpid integer,
|
||||
OUT userid oid,
|
||||
OUT application_name text,
|
||||
OUT client_addr inet,
|
||||
OUT client_hostname text,
|
||||
OUT client_port integer,
|
||||
OUT query_id bigint,
|
||||
OUT unique_query_id bigint,
|
||||
OUT user_id oid,
|
||||
OUT cn_id integer,
|
||||
OUT unique_query text)
|
||||
RETURNS SETOF record
|
||||
AS $$
|
||||
DECLARE
|
||||
ROW_DATA pg_catalog.gs_asp%ROWTYPE;
|
||||
ROW_NAME RECORD;
|
||||
QUERY_STR TEXT;
|
||||
QUERY_STR_NODES TEXT;
|
||||
node_str TEXT;
|
||||
BEGIN
|
||||
QUERY_STR_NODES := 'SELECT NODE_NAME FROM PGXC_NODE WHERE NODE_TYPE IN (''C'', ''D'')';
|
||||
node_str := 'SELECT * FROM pg_catalog.gs_asp where sample_time > '''''||$1||''''' and sample_time < '''''||$2||'''';
|
||||
FOR ROW_NAME IN EXECUTE(QUERY_STR_NODES) LOOP
|
||||
QUERY_STR := 'EXECUTE DIRECT ON (' || ROW_NAME.NODE_NAME || ') '''|| node_str ||''''';';
|
||||
FOR ROW_DATA IN EXECUTE(QUERY_STR) LOOP
|
||||
node_name := ROW_NAME.NODE_NAME;
|
||||
sampleid := ROW_DATA.sampleid;
|
||||
sample_time := ROW_DATA.sample_time;
|
||||
need_flush_sample := ROW_DATA.need_flush_sample;
|
||||
databaseid := ROW_DATA.databaseid;
|
||||
thread_id := ROW_DATA.thread_id;
|
||||
sessionid := ROW_DATA.sessionid;
|
||||
start_time := ROW_DATA.start_time;
|
||||
event := ROW_DATA.event;
|
||||
lwtid := ROW_DATA.lwtid;
|
||||
psessionid := ROW_DATA.psessionid;
|
||||
tlevel := ROW_DATA.tlevel;
|
||||
smpid := ROW_DATA.smpid;
|
||||
userid := ROW_DATA.userid;
|
||||
application_name := ROW_DATA.application_name;
|
||||
client_addr := ROW_DATA.client_addr;
|
||||
client_hostname := ROW_DATA.client_hostname;
|
||||
client_port := ROW_DATA.client_port;
|
||||
query_id := ROW_DATA.query_id;
|
||||
unique_query_id := ROW_DATA.unique_query_id;
|
||||
user_id := ROW_DATA.user_id;
|
||||
cn_id := ROW_DATA.cn_id;
|
||||
unique_query := ROW_DATA.unique_query;
|
||||
RETURN NEXT;
|
||||
END LOOP;
|
||||
END LOOP;
|
||||
RETURN;
|
||||
END; $$
|
||||
LANGUAGE 'plpgsql';
|
||||
end if;
|
||||
END$DO$;
|
||||
|
||||
-- use relfilenode to get schemane.tablename if the table is larger than threshold_size_gb
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.get_large_table_name(relfile_node text, threshold_size_gb int8)
|
||||
RETURNS text
|
||||
|
@ -2855,23 +2424,6 @@ DECLARE
|
|||
END;
|
||||
$$LANGUAGE plpgsql NOT FENCED;
|
||||
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC,3466;
|
||||
CREATE FUNCTION pg_catalog.check_engine_status(IN text, IN text) RETURNS text LANGUAGE INTERNAL STABLE STRICT as 'check_engine_status';
|
||||
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC,3467;
|
||||
CREATE FUNCTION pg_catalog.encode_plan_node(IN text, IN text, IN text, IN text, IN int8, IN text, IN text) RETURNS text LANGUAGE INTERNAL STABLE as 'encode_plan_node';
|
||||
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC,3481;
|
||||
CREATE FUNCTION pg_catalog.model_train_opt(IN text, IN text, OUT startup_time_accuracy FLOAT8, OUT total_time_accuracy FLOAT8, OUT rows_accuracy FLOAT8, OUT peak_memory_accuracy FLOAT8) RETURNS SETOF RECORD LANGUAGE INTERNAL STABLE ROWS 1 STRICT as 'model_train_opt';
|
||||
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC,5033;
|
||||
CREATE FUNCTION pg_catalog.gs_stat_get_wlm_plan_operator_info(IN OID, OUT datname text, OUT queryid int8, OUT plan_node_id int4, OUT startup_time int8, OUT total_time int8, OUT actual_rows int8, OUT max_peak_memory int4, OUT query_dop int4, OUT parent_node_id int4, OUT left_child_id int4, OUT right_child_id int4, OUT operation text, OUT orientation text, OUT strategy text, OUT options text, OUT condition text, OUT projection text) RETURNS SETOF RECORD LANGUAGE INTERNAL STABLE ROWS 100 STRICT as 'gs_stat_get_wlm_plan_operator_info';
|
||||
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC,3468;
|
||||
CREATE FUNCTION pg_catalog.track_model_train_opt(IN text, IN text) RETURNS text LANGUAGE INTERNAL STABLE STRICT as 'track_model_train_opt';
|
||||
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 0;
|
||||
|
||||
SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3442;
|
||||
DROP FUNCTION IF EXISTS pg_catalog.pg_control_checkpoint() CASCADE;
|
||||
DROP FUNCTION IF EXISTS pg_catalog.pg_control_system() CASCADE;
|
||||
|
|
Loading…
Reference in New Issue