diff --git a/README.md b/README.md index c78d2748aa6ef7ed0d722492b422d7215a8c1410..e2aced10cd0c77822017ceadd806de94bdc563db 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ openGauss is an open source relational database management system. It has multi- **High Performance** -openGauss breaks through the bottleneck of multi-core CPU, 2-way Kunpeng 128 core 1.5 million TPMC. +openGauss breaks through the bottleneck of multi-core CPU, 2-way Kunpeng 128 core 1.5 million TPMC on disk-based row store and 3.5 million TPMC on MOT (Memory-Optimized Tables) Engine. **Partitions** @@ -59,7 +59,11 @@ Under normal service loads, the RTO is less than 10 seconds, reducing the servic **Parallel Recovery** -When the Xlog is transferred to the standby node, the standby node flushs the Xlog to storage medium. At the mean time, the Xlog is sent to the redo recovery dispatch thread. The dispatch thread sends the Xlog to multiple parallel recovery threads to replay. Ensure that the redo speed of the standby node keeps up with the generation speed of the primary host. The standby node is ready in real time, which can be promoted to primary instantly. +When the Xlog is transferred to the standby node, the standby node flushs the Xlog to storage medium. At the meantime, the Xlog is sent to the redo recovery dispatch thread. The dispatch thread sends the Xlog to multiple parallel recovery threads to replay. Ensure that the redo speed of the standby node keeps up with the generation speed of the primary host. The standby node is ready in real time, which can be promoted to primary instantly. + +**MOT Engine (beta release)** + +The Memory-Optimized Tables (MOT) storage engine is a transactional rowstore optimized for many-core and large memory and delivering extreme OLTP performance and high resources utilization. With data and indexes stored totally in-memory, a NUMA-aware design, algorithms that eliminate lock and latch contention and query native compilation (JIT), MOT provides low latency data access and more efficient transaction execution. See MOT Engine documentation (https://opengauss.org/en/docs/1.0.0/docs/Developerguide/mot.html). **Security** @@ -137,10 +141,10 @@ The information of value is only an example. You can replace it as required. Eac - + - + diff --git a/configure b/configure index 16aa67d238bc5496ff48f33be1fc9f74a74c958d..dc77cd5d5ae1d6400bc95de994a5e1c36a73dd27 100755 --- a/configure +++ b/configure @@ -3317,8 +3317,7 @@ fi # this expression is set up to avoid unnecessary integer overflow # blocksize is already guaranteed to be a factor of 1024 -RELSEG_SIZE=`expr '(' 1024 / ${blocksize} ')' '*' ${segsize} '*' 1024` -test $? -eq 0 || exit 1 +RELSEG_SIZE=$[(1024 / ${blocksize}) * ${segsize} * 1024] { $as_echo "$as_me:$LINENO: result: ${segsize}GB" >&5 $as_echo "${segsize}GB" >&6; } diff --git a/doc/openGauss-architecture.png b/doc/openGauss-architecture.png index eceb08ebfa82381ee3900dfe77faa5fb8b81a2b7..de4c4d55fe41b41bb50d3e2625fb7b7e1c139163 100644 Binary files a/doc/openGauss-architecture.png and b/doc/openGauss-architecture.png differ diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000000000000000000000000000000000000..5b67840c0589cde3fd70ebbeb5e4feba07e9a6ca --- /dev/null +++ b/docker/README.md @@ -0,0 +1,34 @@ +# ARCHITECTURE AND OS VERSION + +x86-64 CentOS7.6 +ARM64 openEuler 20.03 LTS + +# BUILD IMAGE + +```console +docker build -t opengauss:1.0 . +``` + +# START INSTANCE + +```console +$ docker run --name opengauss --privileged=true -d -e GS_PASSWORD=secretpassword@123 opengauss:1.0 +``` + +# CONNECT TO THE CONTAINER DATABASE FROM OS + +```console +$ docker run −−name opengauss −−privileged=true −d −e GSPASSWORD=secretpassword@123 \ + −p8888:5432 opengauss:1.0 gsql -d postgres -U gaussdb -W'secretpassword@123' \ + -h your-host-ip -p8888 +``` + +# PERSIST DATA + +```console +$ docker run --name opengauss --privileged=true -d -e GS_PASSWORD=secretpassword@123 \ + -v /opengauss:/var/lib/opengauss opengauss:1.0 +``` + +# TODO +primary standby install diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh new file mode 100755 index 0000000000000000000000000000000000000000..df2bacbd9b7681d2bd1f4bdcf81070e78fb65f06 --- /dev/null +++ b/docker/docker-entrypoint.sh @@ -0,0 +1,321 @@ +#!/usr/bin/env bash +set -Eeo pipefail + +# usage: file_env VAR [DEFAULT] +# ie: file_env 'XYZ_DB_PASSWORD' 'example' +# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of +# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) + +export GAUSSHOME=/usr/local/opengauss +export PATH=$GAUSSHOME/bin:$PATH +export LD_LIBRARY_PATH=$GAUSSHOME/lib:$LD_LIBRARY_PATH + + +file_env() { + local var="$1" + local fileVar="${var}_FILE" + local def="${2:-}" + if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then + echo >&2 "error: both $var and $fileVar are set (but are exclusive)" + exit 1 + fi + local val="$def" + if [ "${!var:-}" ]; then + val="${!var}" + elif [ "${!fileVar:-}" ]; then + val="$(< "${!fileVar}")" + fi + export "$var"="$val" + unset "$fileVar" +} + +# check to see if this file is being run or sourced from another script +_is_sourced() { + [ "${#FUNCNAME[@]}" -ge 2 ] \ + && [ "${FUNCNAME[0]}" = '_is_sourced' ] \ + && [ "${FUNCNAME[1]}" = 'source' ] +} + +# used to create initial opengauss directories and if run as root, ensure ownership belong to the omm user +docker_create_db_directories() { + local user; user="$(id -u)" + + mkdir -p "$PGDATA" + chmod 700 "$PGDATA" + + # ignore failure since it will be fine when using the image provided directory; + mkdir -p /var/run/opengauss || : + chmod 775 /var/run/opengauss || : + + # Create the transaction log directory before initdb is run so the directory is owned by the correct user + if [ -n "$POSTGRES_INITDB_XLOGDIR" ]; then + mkdir -p "$POSTGRES_INITDB_XLOGDIR" + if [ "$user" = '0' ]; then + find "$POSTGRES_INITDB_XLOGDIR" \! -user postgres -exec chown postgres '{}' + + fi + chmod 700 "$POSTGRES_INITDB_XLOGDIR" + fi + + # allow the container to be started with `--user` + if [ "$user" = '0' ]; then + find "$PGDATA" \! -user omm -exec chown omm '{}' + + find /var/run/opengauss \! -user omm -exec chown omm '{}' + + fi +} + +# initialize empty PGDATA directory with new database via 'initdb' +# arguments to `initdb` can be passed via POSTGRES_INITDB_ARGS or as arguments to this function +# `initdb` automatically creates the "postgres", "template0", and "template1" dbnames +# this is also where the database user is created, specified by `GS_USER` env +docker_init_database_dir() { + # "initdb" is particular about the current user existing in "/etc/passwd", so we use "nss_wrapper" to fake that if necessary + if ! getent passwd "$(id -u)" &> /dev/null && [ -e /usr/lib/libnss_wrapper.so ]; then + export LD_PRELOAD='/usr/lib/libnss_wrapper.so' + export NSS_WRAPPER_PASSWD="$(mktemp)" + export NSS_WRAPPER_GROUP="$(mktemp)" + echo "postgres:x:$(id -u):$(id -g):PostgreSQL:$PGDATA:/bin/false" > "$NSS_WRAPPER_PASSWD" + echo "postgres:x:$(id -g):" > "$NSS_WRAPPER_GROUP" + fi + + if [ -n "$POSTGRES_INITDB_XLOGDIR" ]; then + set -- --xlogdir "$POSTGRES_INITDB_XLOGDIR" "$@" + fi + + eval 'gs_initdb --pwfile=<(echo "$GS_PASSWORD") --nodename=`hostname` '"$POSTGRES_INITDB_ARGS"' "$@"' + + # unset/cleanup "nss_wrapper" bits + if [ "${LD_PRELOAD:-}" = '/usr/lib/libnss_wrapper.so' ]; then + rm -f "$NSS_WRAPPER_PASSWD" "$NSS_WRAPPER_GROUP" + unset LD_PRELOAD NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP + fi +} + +# print large warning if GS_PASSWORD is long +# error if both GS_PASSWORD is empty and GS_HOST_AUTH_METHOD is not 'trust' +# print large warning if GS_HOST_AUTH_METHOD is set to 'trust' +# assumes database is not set up, ie: [ -z "$DATABASE_ALREADY_EXISTS" ] +docker_verify_minimum_env() { + # check password first so we can output the warning before postgres + # messes it up + if [ "${#GS_PASSWORD}" -ge 100 ]; then + cat >&2 <<-'EOWARN' + WARNING: The supplied GS_PASSWORD is 100+ characters. + EOWARN + fi + if [ -z "$GS_PASSWORD" ] && [ 'trust' != "$GS_HOST_AUTH_METHOD" ]; then + # The - option suppresses leading tabs but *not* spaces. :) + cat >&2 <<-'EOE' + Error: Database is uninitialized and superuser password is not specified. + You must specify GS_PASSWORD to a non-empty value for the + superuser. For example, "-e GS_PASSWORD=password" on "docker run". + You may also use "GS_HOST_AUTH_METHOD=trust" to allow all + connections without a password. This is *not* recommended. + EOE + exit 1 + fi + if [ 'trust' = "$GS_HOST_AUTH_METHOD" ]; then + cat >&2 <<-'EOWARN' + ******************************************************************************** + WARNING: GS_HOST_AUTH_METHOD has been set to "trust". This will allow + anyone with access to the Postgres port to access your database without + a password, even if GS_PASSWORD is set. + It is not recommended to use GS_HOST_AUTH_METHOD=trust. Replace + it with "-e GS_PASSWORD=password" instead to set a password in + "docker run". + ******************************************************************************** + EOWARN + fi +} + +# usage: docker_process_init_files [file [file [...]]] +# ie: docker_process_init_files /always-initdb.d/* +# process initializer files, based on file extensions and permissions +docker_process_init_files() { + # gsql here for backwards compatiblilty "${gsql[@]}" + gsql=( docker_process_sql ) + + echo + local f + for f; do + case "$f" in + *.sh) + if [ -x "$f" ]; then + echo "$0: running $f" + "$f" + else + echo "$0: sourcing $f" + . "$f" + fi + ;; + *.sql) echo "$0: running $f"; docker_process_sql -f "$f"; echo ;; + *.sql.gz) echo "$0: running $f"; gunzip -c "$f" | docker_process_sql; echo ;; + *.sql.xz) echo "$0: running $f"; xzcat "$f" | docker_process_sql; echo ;; + *) echo "$0: ignoring $f" ;; + esac + echo + done +} + +# Execute sql script, passed via stdin (or -f flag of pqsl) +# usage: docker_process_sql [gsql-cli-args] +# ie: docker_process_sql --dbname=mydb <<<'INSERT ...' +# ie: docker_process_sql -f my-file.sql +# ie: docker_process_sql > "$PGDATA/pg_hba.conf" +} + +# append parameter to postgres.conf for connections +opengauss_setup_postgresql_conf() { + { + echo + if [ 'trust' = "$GS_HOST_AUTH_METHOD" ]; then + echo '# warning trust is enabled for all connections' + fi + echo "password_encryption_type = 0" + echo "listen_addresses = '*'" + } >> "$PGDATA/postgresql.conf" +} + + + +# start socket-only postgresql server for setting up or running scripts +# all arguments will be passed along as arguments to `postgres` (via pg_ctl) +docker_temp_server_start() { + if [ "$1" = 'gaussdb' ]; then + shift + fi + + # 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}" + + PGUSER="${PGUSER:-$GS_USER}" \ + gs_ctl -D "$PGDATA" \ + -o "$(printf '%q ' "$@")" \ + -w start +} + +# stop postgresql server after done setting up user and running scripts +docker_temp_server_stop() { + PGUSER="${PGUSER:-postgres}" \ + gs_ctl -D "$PGDATA" -m fast -w stop +} + +# check arguments for an option that would cause opengauss to stop +# return true if there is one +_opengauss_want_help() { + local arg + for arg; do + case "$arg" in + # postgres --help | grep 'then exit' + # leaving out -C on purpose since it always fails and is unhelpful: + # postgres: could not access the server configuration file "/var/lib/postgresql/data/postgresql.conf": No such file or directory + -'?'|--help|--describe-config|-V|--version) + return 0 + ;; + esac + done + return 1 +} + +_main() { + # if first arg looks like a flag, assume we want to run postgres server + if [ "${1:0:1}" = '-' ]; then + set -- gaussdb "$@" + fi + + if [ "$1" = 'gaussdb' ] && ! _opengauss_want_help "$@"; then + docker_setup_env + # setup data directories and permissions (when run as root) + docker_create_db_directories + if [ "$(id -u)" = '0' ]; then + # then restart script as postgres user + exec gosu omm "$BASH_SOURCE" "$@" + fi + + # only run initialization on an empty data directory + if [ -z "$DATABASE_ALREADY_EXISTS" ]; then + docker_verify_minimum_env + + # check dir permissions to reduce likelihood of half-initialized database + ls /docker-entrypoint-initdb.d/ > /dev/null + + docker_init_database_dir + opengauss_setup_hba_conf + opengauss_setup_postgresql_conf + + # PGPASSWORD is required for gsql when authentication is required for 'local' connections via pg_hba.conf and is otherwise harmless + # e.g. when '--auth=md5' or '--auth-local=md5' is used in POSTGRES_INITDB_ARGS + export PGPASSWORD="${PGPASSWORD:-$GS_PASSWORD}" + docker_temp_server_start "$@" + + docker_setup_db + docker_process_init_files /docker-entrypoint-initdb.d/* + + docker_temp_server_stop + unset PGPASSWORD + + echo + echo 'openGauss init process complete; ready for start up.' + echo + else + echo + echo 'openGauss Database directory appears to contain a database; Skipping initialization' + echo + fi + fi + + exec "$@" +} + +if ! _is_sourced; then + _main "$@" +fi diff --git a/docker/dockerfile b/docker/dockerfile new file mode 100755 index 0000000000000000000000000000000000000000..3a5f5146c90537ce475b3384ba534eb42c7e289f --- /dev/null +++ b/docker/dockerfile @@ -0,0 +1,44 @@ +FROM centos:7.6.1810 + +COPY openGauss-1.0.0-CentOS-64bit.tar.bz2 . +ENV LANG en_US.utf8 + +#RUN yum install -y epel-release + +RUN set -eux; \ + groupadd -g 70 omm; \ + useradd -u 70 -g omm -d /home/omm omm; \ + yum install -y bzip2 bzip2-devel curl libaio && \ + mkdir -p /var/lib/opengauss && \ + mkdir -p /usr/local/opengauss && \ + tar -jxvf openGauss-1.0.0-CentOS-64bit.tar.bz2 -C /usr/local/opengauss && \ + mkdir -p /var/run/opengauss && chown -R omm:omm /var/run/opengauss && chmod 2777 /var/run/opengauss && \ + rm -rf openGauss-1.0.0-CentOS-64bit.tar.bz2 && yum clean all + +RUN set -eux; \ + echo "export GAUSSHOME=/usr/local/opengauss" >> /home/omm/.bashrc && \ + echo "export PATH=\$GAUSSHOME/bin:\$PATH " >> /home/omm/.bashrc && \ + echo "export LD_LIBRARY_PATH=\$GAUSSHOME/lib:\$LD_LIBRARY_PATH" >> /home/omm/.bashrc + +ENV GOSU_VERSION 1.12 +RUN set -eux; \ + dpkgArch=`case $(uname -m) in i386) echo "386" ;; i686) echo "386" ;; x86_64) echo "amd64";; aarch64)echo "arm64";; esac`; \ + gpg --keyserver pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ + && curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" \ + && curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc" \ + && gpg --verify /usr/local/bin/gosu.asc \ + && rm /usr/local/bin/gosu.asc \ + && rm -r /root/.gnupg/ \ + && chmod +x /usr/local/bin/gosu + +RUN mkdir /docker-entrypoint-initdb.d + +ENV PGDATA /var/lib/opengauss/data + +COPY docker-entrypoint.sh /usr/local/bin/ +RUN chmod +x /usr/local/bin/docker-entrypoint.sh;ln -s /usr/local/bin/docker-entrypoint.sh / # backwards compat + +ENTRYPOINT ["docker-entrypoint.sh"] + +EXPOSE 5432 +CMD ["gaussdb"] diff --git a/src/gausskernel/dbmind/xtuner/Readme.md b/src/gausskernel/dbmind/xtuner/Readme.md index 2ee76d113d418d35d3ea137469c35564e9c2b5e1..c4ab2c19713804326e4de60aa75a378ba669585e 100644 --- a/src/gausskernel/dbmind/xtuner/Readme.md +++ b/src/gausskernel/dbmind/xtuner/Readme.md @@ -27,11 +27,13 @@ pip install -r requirements.txt ## Dependencies python3.5+ - tensorflow==1.15.2 - keras-rl - keras + tensorflow>=2.2.0 + keras-rl2 + keras>=2.4.0 paramiko +**Suggest:** Firstly, please upgrade your pip. ```python -m pip install --upgrade pip``` + ## Start tuning 1. Start your database instance first; 2. Choose a benchmark(TPC-C, TPC-H, etc.) and store data in your database; diff --git a/src/gausskernel/dbmind/xtuner/requirements.txt b/src/gausskernel/dbmind/xtuner/requirements.txt index 772da01c0c3ba7daada654427e043c999591b9f3..eae565684835f50a207e96963a67f966c6ff4c8b 100644 --- a/src/gausskernel/dbmind/xtuner/requirements.txt +++ b/src/gausskernel/dbmind/xtuner/requirements.txt @@ -1,4 +1,4 @@ -tensorflow==1.15.2 -keras-rl -keras<=2.2.5 +tensorflow>=2.2.0 +keras-rl2 +keras>=2.4.0 paramiko diff --git a/src/gausskernel/storage/mot/core/src/infra/containers/bitmapset.cpp b/src/gausskernel/storage/mot/core/src/infra/containers/bitmapset.cpp index f0cdbb63dda976d6328f18f0246a3bdd6048585a..cb26dd5c40fd09ab733921094205a2aab8b782a3 100644 --- a/src/gausskernel/storage/mot/core/src/infra/containers/bitmapset.cpp +++ b/src/gausskernel/storage/mot/core/src/infra/containers/bitmapset.cpp @@ -39,9 +39,6 @@ BitmapSet::BitmapSet() BitmapSet::BitmapSet(uint8_t* data, uint16_t size) : m_data(data), m_size(size), m_init(true) {} -BitmapSet::BitmapSet(uint16_t size) : m_data((uint8_t*)malloc(GetLength(size))), m_size(size), m_init(true) -{} - BitmapSet::~BitmapSet() {} @@ -67,12 +64,6 @@ void BitmapSet::Reset(uint16_t size) securec_check(erc, "\0", "\0"); } -void BitmapSet::Destroy() -{ - free(m_data); - m_init = false; -} - void BitmapSet::Clear() { errno_t erc = memset_s(m_data, GetLength(), 0, GetLength()); diff --git a/src/gausskernel/storage/mot/core/src/infra/containers/bitmapset.h b/src/gausskernel/storage/mot/core/src/infra/containers/bitmapset.h index fa77d1a2a5970b8f0371c77edeb110074c0c55ca..ddc7625f53b69dfdc56b041eab30615cc21f13d0 100644 --- a/src/gausskernel/storage/mot/core/src/infra/containers/bitmapset.h +++ b/src/gausskernel/storage/mot/core/src/infra/containers/bitmapset.h @@ -55,13 +55,11 @@ public: }; BitmapSet(); - explicit BitmapSet(uint16_t size); BitmapSet(uint8_t* data, uint16_t size); ~BitmapSet(); void Init(uint8_t* data, uint16_t size); void Reset(); - void Destroy(); void Clear(); void Reset(uint16_t size); void SetBit(uint16_t bit); diff --git a/src/gausskernel/storage/mot/core/src/storage/table.cpp b/src/gausskernel/storage/mot/core/src/storage/table.cpp index ba6458669c65fd9b18493a0b4e21af29f17680fa..371f19df874888fb251657d3c54fbb26ab8bd8c7 100644 --- a/src/gausskernel/storage/mot/core/src/storage/table.cpp +++ b/src/gausskernel/storage/mot/core/src/storage/table.cpp @@ -173,8 +173,8 @@ bool Table::AddSecondaryIndex(const string& indexName, Index* index, TxnManager* { // OA: Should we check for duplicate indices with same name? // first create secondary index data - bool createdIndexData = (txn != nullptr) ? CreateSecondaryIndexData(index, txn) : - CreateSecondaryIndexDataNonTransactional(index, tid); + bool createdIndexData = + (txn != nullptr) ? CreateSecondaryIndexData(index, txn) : CreateSecondaryIndexDataNonTransactional(index, tid); if (!createdIndexData) { MOT_REPORT_ERROR(MOT_ERROR_INTERNAL, "Add Secondary Index", diff --git a/src/gausskernel/storage/mot/core/src/system/checkpoint/checkpoint_manager.cpp b/src/gausskernel/storage/mot/core/src/system/checkpoint/checkpoint_manager.cpp index bfe65eb605c044226905000cd90bce2777d93984..683dd94064b775976086c9f4ecc37a927884411d 100644 --- a/src/gausskernel/storage/mot/core/src/system/checkpoint/checkpoint_manager.cpp +++ b/src/gausskernel/storage/mot/core/src/system/checkpoint/checkpoint_manager.cpp @@ -783,6 +783,9 @@ bool CheckpointManager::CreateTpcRecoveryFile(uint64_t checkpointId) break; } + // this lock is held while serializing the in process transactions call by + // checkpoint. It prevents gs_clean removing entries from the in-process map + // while they are serialized GetRecoveryManager()->LockInProcessTxns(); CheckpointUtils::TpcFileHeader tpcFileHeader; tpcFileHeader.m_magic = CP_MGR_MAGIC; diff --git a/src/gausskernel/storage/mot/core/src/system/recovery/recovery_manager.cpp b/src/gausskernel/storage/mot/core/src/system/recovery/recovery_manager.cpp index 99ea2c22e6e5a036cb1c1d3380cece3f79d09cb9..3f382ce2a20244ca7c7063b5561f347ac102ba41 100644 --- a/src/gausskernel/storage/mot/core/src/system/recovery/recovery_manager.cpp +++ b/src/gausskernel/storage/mot/core/src/system/recovery/recovery_manager.cpp @@ -1026,10 +1026,6 @@ bool RecoveryManager::SerializeInProcessTxns(int fd) return false; } - // this lock is held while serializing the in process transactions call by - // checkpoint. It prevents gs_clean removing entries from the in-process map - // while they are serialized - std::lock_guard lock(m_inProcessTxLock); map::iterator it = m_inProcessTransactionMap.begin(); while (it != m_inProcessTransactionMap.end()) { RedoTransactionSegments* segments = it->second; diff --git a/src/gausskernel/storage/mot/core/src/system/transaction/txn_local_allocators.h b/src/gausskernel/storage/mot/core/src/system/transaction/txn_local_allocators.h index 1f24439bfaa64a5f349a7e65a6ca823f438ca142..92c8b9292efa93ae4ca30a2e45f6c672e60be60e 100644 --- a/src/gausskernel/storage/mot/core/src/system/transaction/txn_local_allocators.h +++ b/src/gausskernel/storage/mot/core/src/system/transaction/txn_local_allocators.h @@ -75,6 +75,8 @@ public: if (buf == nullptr) { return nullptr; } + errno_t erc = memset_s(buf, size, 0, size); + securec_check(erc, "\0", "\0"); return reinterpret_cast(buf); } diff --git a/src/gausskernel/storage/mot/core/src/system/transaction_logger/redo_log.cpp b/src/gausskernel/storage/mot/core/src/system/transaction_logger/redo_log.cpp index 6c486984190631ffe4928e029331ad4008aa1774..954e63fbd6d1299a88c790f49e608298048ba6d1 100644 --- a/src/gausskernel/storage/mot/core/src/system/transaction_logger/redo_log.cpp +++ b/src/gausskernel/storage/mot/core/src/system/transaction_logger/redo_log.cpp @@ -330,7 +330,7 @@ RC RedoLog::SerializeTransaction() if (m_txn->m_isLightSession) return RC_OK; - for (uint32_t index = 0; index < m_txn->m_accessMgr->m_rowCnt ; index++) { + for (uint32_t index = 0; index < m_txn->m_accessMgr->m_rowCnt; index++) { Access* access = m_txn->m_accessMgr->GetAccessPtr(index); if (access != nullptr) { switch (access->m_type) { diff --git a/src/gausskernel/storage/mot/core/src/system/transaction_logger/redo_log_writer.cpp b/src/gausskernel/storage/mot/core/src/system/transaction_logger/redo_log_writer.cpp index 87ddeb9411e999e200aa8fe75f7fe044bebe714c..10af02bf1aa5044b8c02a1a478595ee818aeb526 100644 --- a/src/gausskernel/storage/mot/core/src/system/transaction_logger/redo_log_writer.cpp +++ b/src/gausskernel/storage/mot/core/src/system/transaction_logger/redo_log_writer.cpp @@ -213,10 +213,8 @@ bool RedoLogWriter::AppendCommitPrepared(RedoLogBuffer& redoLogBuffer, TxnManage bool RedoLogWriter::AppendRollbackPrepared(RedoLogBuffer& redoLogBuffer, TxnManager* txn) { // buffer must have enough space for control entry - EndSegmentBlock block(OperationCode::ROLLBACK_PREPARED_TX, - 0, - txn->GetTransactionId(), - txn->GetInternalTransactionId()); + EndSegmentBlock block( + OperationCode::ROLLBACK_PREPARED_TX, 0, txn->GetTransactionId(), txn->GetInternalTransactionId()); redoLogBuffer.Append(block); return true; } @@ -232,10 +230,7 @@ bool RedoLogWriter::AppendRollback(RedoLogBuffer& redoLogBuffer, TxnManager* txn bool RedoLogWriter::AppendPartial(RedoLogBuffer& redoLogBuffer, TxnManager* txn) { // buffer must have enough space for control entry - EndSegmentBlock block(OperationCode::PARTIAL_REDO_TX, - 0, - txn->GetTransactionId(), - txn->GetInternalTransactionId()); + EndSegmentBlock block(OperationCode::PARTIAL_REDO_TX, 0, txn->GetTransactionId(), txn->GetInternalTransactionId()); redoLogBuffer.Append(block); return true; } diff --git a/src/gausskernel/storage/mot/jit_exec/src/jit_context.cpp b/src/gausskernel/storage/mot/jit_exec/src/jit_context.cpp index e6912141f6848125bb06620b4fa792ea620e892c..d02cd42939783abccfde89f491de82ff37eb48e0 100755 --- a/src/gausskernel/storage/mot/jit_exec/src/jit_context.cpp +++ b/src/gausskernel/storage/mot/jit_exec/src/jit_context.cpp @@ -166,9 +166,15 @@ extern bool PrepareJitContext(JitContext* jitContext) if (buf == NULL) { MOT_LOG_TRACE("Failed to allocate reusable bitmap set for JIT context, aborting jitted code execution"); return false; // safe cleanup during destroy - } else { - jitContext->m_bitmapSet = new (buf) MOT::BitmapSet(fieldCount); } + + uint8_t* bitmapData = (uint8_t*)palloc_top(MOT::BitmapSet::GetLength(fieldCount)); + if (bitmapData == NULL) { + MOT_LOG_TRACE("Failed to allocate reusable bitmap set for JIT context, aborting jitted code execution"); + pfree_top(buf); + return false; // safe cleanup during destroy + } + jitContext->m_bitmapSet = new (buf) MOT::BitmapSet(bitmapData, fieldCount); } // allocate end-iterator key object when executing range UPDATE command or special SELECT commands @@ -261,7 +267,7 @@ extern void DestroyJitContext(JitContext* jitContext) // cleanup bitmap set if (jitContext->m_bitmapSet != NULL) { - jitContext->m_bitmapSet->Destroy(); + pfree_top(jitContext->m_bitmapSet->GetData()); jitContext->m_bitmapSet->MOT::BitmapSet::~BitmapSet(); pfree_top(jitContext->m_bitmapSet); jitContext->m_bitmapSet = NULL;