Minor bug fix to setup/restore jit_context in MOT JIT

This commit is contained in:
Vinoth Veeraraghavan
2022-12-14 10:12:10 +08:00
parent 25eba6cc8e
commit 6c87699fa9
4 changed files with 13 additions and 15 deletions

View File

@ -17,14 +17,13 @@
# Makefile for the MOT storage engine core components
#
# IDENTIFICATION
# src/gausskernel/storage/mot/core/Makefile.local
# src/gausskernel/storage/mot/core/Makefile.local
#
# ---------------------------------------------------------------------------------------
UNDERPG ?= yes
UNDER_ENVELOPE ?= yes
SECURE ?= yes
DEBUG ?= no
MODE ?= PG
REPLICA ?= no
ISOLATION ?= no
CC=g++
@ -33,7 +32,7 @@ CFLAGS ?=
subdir=src/gausskernel/storage/mot/core
top_builddir ?= ../../../../../
ifeq ($(UNDERPG),yes)
ifeq ($(UNDER_ENVELOPE),yes)
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/src/gausskernel/common.mk
endif
@ -89,7 +88,7 @@ ifeq ($(HUGE_PAGES_ON), yes)
CFLAGS += -DHUGE_PAGES_ON=1
endif
#Debug and release flag definition
ifeq ($(UNDERPG), no)
ifeq ($(UNDER_ENVELOPE), no)
ifeq ($(BUILD),Release)
ifeq ($(PLATFORM_ARCH),aarch64)
CFLAGS += -O2 -DNDEBUG -D_FORTIFY_SOURCE=2
@ -119,7 +118,6 @@ CFLAGS += -L$(MASSTREE_HOME)/lib -lmasstree
# For Masstree index tests
CFLAGS += -DMASSTREE
CFLAGS += -D$(MODE)
# disable exceptions
CFLAGS += -fno-exceptions
# disable RTTI usage
@ -158,7 +156,7 @@ OBJS := $(CPPS)
OBJS := $(patsubst %.cpp, $(OBJ_DIR)/%.o, $(OBJS))
DEPS := $(OBJS:.o=.d)
ifeq ($(UNDERPG), yes)
ifeq ($(UNDER_ENVELOPE), yes)
ifeq ($(SECURE), yes)
CFLAGS += -DMOT_SECURE
LDFLAGS += -L$(LIBOBS_LIB_PATH) -l$(SECURE_C_CHECK)
@ -196,7 +194,7 @@ buildrepo:
.PHONY: show
show:
@echo "UNDERPG=${UNDERPG}"
@echo "UNDER_ENVELOPE=${UNDER_ENVELOPE}"
@echo "enable_cassert=${enable_cassert}"
@echo "CC_VERSION=${CC_VERSION}"
@echo "CC=${CC}"

View File

@ -888,7 +888,7 @@ static void ValidateCreateIndex(IndexStmt* stmt, MOT::Table* table, MOT::TxnMana
ereport(ERROR,
(errmodule(MOD_MOT),
errcode(ERRCODE_FDW_TOO_MANY_INDEXES),
errmsg("Can not create index, max number of indexes %u reached", MAX_NUM_INDEXES)));
errmsg("Cannot create index, max number of indexes %u reached", MAX_NUM_INDEXES)));
}
if (strcmp(stmt->accessMethod, "btree") != 0) {
@ -1061,7 +1061,7 @@ MOT::RC MOTAdaptor::CreateIndex(IndexStmt* stmt, ::TransactionId tid)
ereport(ERROR,
(errmodule(MOD_MOT),
errcode(ERRCODE_FDW_TOO_MANY_INDEXES),
errmsg("Can not create index, max number of indexes %u reached", MAX_NUM_INDEXES)));
errmsg("Cannot create index, max number of indexes %u reached", MAX_NUM_INDEXES)));
return MOT::RC_TABLE_EXCEEDS_MAX_INDEXES;
}
report_pg_error(txn->m_err, stmt->idxname, txn->m_errMsgBuf);

View File

@ -1613,10 +1613,6 @@ extern int JitExecFunction(
return result;
}
// setup current JIT context
volatile MotJitContext* prevContext = u_sess->mot_cxt.jit_context;
u_sess->mot_cxt.jit_context = jitContext;
// we avoid weird stuff by putting null in case of internal error
bool isFunctionContext = (jitContext->m_contextType == JitContextType::JIT_CONTEXT_TYPE_FUNCTION);
volatile JitFunctionExecState* execState =
@ -1662,6 +1658,10 @@ extern int JitExecFunction(
jitContext->m_queryString)));
}
// setup current JIT context
volatile MotJitContext* prevContext = u_sess->mot_cxt.jit_context;
u_sess->mot_cxt.jit_context = jitContext;
// invoke the jitted function
volatile MemoryContext origCxt = CurrentMemoryContext;
// since we use parts of the PG function in query invocation, we need to make sure it does not get deleted

View File

@ -46,7 +46,7 @@ create index idx7 on test_new_index (c,v);
create index idx8 on test_new_index (d,t,ts);
create index idx9 on test_new_index (intrvl);
create index idx10 on test_new_index (b);
ERROR: Can not create index, max number of indexes 10 reached
ERROR: Cannot create index, max number of indexes 10 reached
insert into test_new_index (i, i2, i4) values (generate_series(1,100), generate_series(1,100), generate_series(1,100));
ERROR: null value in column "i8" violates not-null constraint
DETAIL: Failing row contains (1, 1, 1, null, null, null, null, 1, null, null, null, null, null, null, null, null).