You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-08 14:22:09 +03:00
Merge branch 'develop' into skip_nonsupported_via_maxscale
This commit is contained in:
@@ -144,7 +144,7 @@ local Pipeline(branch, platform, event, arch='amd64', server='10.6-enterprise')
|
||||
local socket_path = if (pkg_format == 'rpm') then '/var/lib/mysql/mysql.sock' else '/run/mysqld/mysqld.sock',
|
||||
local config_path_prefix = if (pkg_format == 'rpm') then '/etc/my.cnf.d/' else '/etc/mysql/mariadb.conf.d/50-',
|
||||
local img = if (platform == 'rockylinux:8') then platform else 'detravi/' + std.strReplace(platform, '/', '-'),
|
||||
local regression_ref = if (branch == any_branch) then 'develop' else branch,
|
||||
local branch_ref = if (branch == any_branch) then 'develop' else branch,
|
||||
// local regression_tests = if (std.startsWith(platform, 'debian') || std.startsWith(platform, 'ubuntu:20')) then 'test000.sh' else 'test000.sh,test001.sh',
|
||||
|
||||
local branchp = if (branch == '**') then '' else branch + '/',
|
||||
@@ -352,7 +352,7 @@ local Pipeline(branch, platform, event, arch='amd64', server='10.6-enterprise')
|
||||
},
|
||||
upgrade(version):: {
|
||||
name: 'upgrade-test from ' + version,
|
||||
depends_on: ['smoke'],
|
||||
depends_on: ['regressionlog'],
|
||||
image: 'docker',
|
||||
failure: 'ignore',
|
||||
volumes: [pipeline._volumes.docker],
|
||||
@@ -461,7 +461,7 @@ local Pipeline(branch, platform, event, arch='amd64', server='10.6-enterprise')
|
||||
volumes: [pipeline._volumes.docker, pipeline._volumes.mdb],
|
||||
environment: {
|
||||
REGRESSION_BRANCH_REF: '${DRONE_SOURCE_BRANCH}',
|
||||
REGRESSION_REF_AUX: regression_ref,
|
||||
REGRESSION_REF_AUX: branch_ref,
|
||||
},
|
||||
commands: [
|
||||
// compute branch.
|
||||
@@ -578,8 +578,22 @@ local Pipeline(branch, platform, event, arch='amd64', server='10.6-enterprise')
|
||||
depends_on: ['publish pkg', 'publish cmapi build'],
|
||||
//failure: 'ignore',
|
||||
image: 'alpine/git',
|
||||
environment: {
|
||||
DOCKER_BRANCH_REF: '${DRONE_SOURCE_BRANCH}',
|
||||
DOCKER_REF_AUX: branch_ref,
|
||||
},
|
||||
commands: [
|
||||
'git clone --depth 1 https://github.com/mariadb-corporation/mariadb-columnstore-docker docker',
|
||||
// compute branch.
|
||||
'echo "$$DOCKER_REF"',
|
||||
'echo "$$DOCKER_BRANCH_REF"',
|
||||
// if DOCKER_REF is empty, try to see whether docker repository has a branch named as one we PR.
|
||||
'export DOCKER_REF=$${DOCKER_REF:-$$(git ls-remote https://github.com/mariadb-corporation/mariadb-columnstore-docker --h --sort origin "refs/heads/$$DOCKER_BRANCH_REF" | grep -E -o "[^/]+$$")}',
|
||||
'echo "$$DOCKER_REF"',
|
||||
// DOCKER_REF can be empty if there is no appropriate branch in docker repository.
|
||||
// assign what is appropriate by default.
|
||||
'export DOCKER_REF=$${DOCKER_REF:-$$DOCKER_REF_AUX}',
|
||||
'echo "$$DOCKER_REF"',
|
||||
'git clone --branch $$DOCKER_REF --depth 1 https://github.com/mariadb-corporation/mariadb-columnstore-docker docker',
|
||||
'touch docker/.secrets',
|
||||
],
|
||||
},
|
||||
@@ -590,10 +604,12 @@ local Pipeline(branch, platform, event, arch='amd64', server='10.6-enterprise')
|
||||
image: 'plugins/docker',
|
||||
environment: {
|
||||
VERSION: container_version,
|
||||
MCS_REPO: 'columnstore',
|
||||
DEV: 'true',
|
||||
MCS_REPO: 'columnstore',
|
||||
// branchp has slash if not empty
|
||||
MCS_BASEURL: 'https://cspkg.s3.amazonaws.com/' + branchp + event + '/${DRONE_BUILD_NUMBER}/' + server + '/' + arch + '/' + result + '/',
|
||||
FDB_REPO: 'foundationdb',
|
||||
FDB_BASEURL: 'https://cspkg.s3.amazonaws.com/FoundationDB/' + arch + '/' + result + '/',
|
||||
CMAPI_REPO: 'cmapi',
|
||||
CMAPI_BASEURL: 'https://cspkg.s3.amazonaws.com/' + branchp + event + '/${DRONE_BUILD_NUMBER}/' + server + '/' + arch + '/' + result + '/',
|
||||
},
|
||||
@@ -601,7 +617,7 @@ local Pipeline(branch, platform, event, arch='amd64', server='10.6-enterprise')
|
||||
repo: 'mariadb/enterprise-columnstore-dev',
|
||||
context: 'docker',
|
||||
dockerfile: 'docker/Dockerfile',
|
||||
build_args_from_env: ['VERSION', 'MCS_REPO', 'MCS_BASEURL', 'CMAPI_REPO', 'CMAPI_BASEURL', 'DEV'],
|
||||
build_args_from_env: ['VERSION', 'MCS_REPO', 'MCS_BASEURL', 'CMAPI_REPO', 'CMAPI_BASEURL', 'DEV', 'FDB_REPO', 'FDB_BASEURL'],
|
||||
tags: container_tags,
|
||||
username: {
|
||||
from_secret: 'dockerhub_user',
|
||||
@@ -708,7 +724,7 @@ local Pipeline(branch, platform, event, arch='amd64', server='10.6-enterprise')
|
||||
'docker exec -t mcs1 mariadb -e "create database if not exists test;"',
|
||||
// delay for manual debugging on live instance
|
||||
'sleep $${COMPOSE_DELAY_SECONDS:-1s}',
|
||||
'docker exec -t mcs1 bash -c "cd ' + mtr_path + ' && ./mtr --extern socket=' + socket_path + ' --force --print-core=detailed --print-method=gdb --max-test-fail=0 --suite=columnstore/basic,columnstore/bugfixes"',
|
||||
'docker exec -t mcs1 bash -c "cd ' + mtr_path + ' && ./mtr --skip-test=' + "'.*parquet.*|.*fdb_api.*'" + ' --extern socket=' + socket_path + ' --force --print-core=detailed --print-method=gdb --max-test-fail=0 --suite=columnstore/basic,columnstore/bugfixes"',
|
||||
],
|
||||
},
|
||||
|
||||
@@ -828,11 +844,19 @@ local Pipeline(branch, platform, event, arch='amd64', server='10.6-enterprise')
|
||||
status: ['success', 'failure'],
|
||||
},
|
||||
volumes: [pipeline._volumes.mdb],
|
||||
environment: {
|
||||
SERVER_REF: '${SERVER_REF:-' + server + '}',
|
||||
SERVER_REMOTE: '${SERVER_REMOTE:-' + server_remote + '}',
|
||||
},
|
||||
commands: [
|
||||
'cd /mdb/' + builddir,
|
||||
'echo "engine: $DRONE_COMMIT" > buildinfo.txt',
|
||||
'echo "server: $$(git rev-parse HEAD)" >> buildinfo.txt',
|
||||
'echo "buildNo: $DRONE_BUILD_NUMBER" >> buildinfo.txt',
|
||||
'echo "serverBranch: $$SERVER_REF" >> buildinfo.txt',
|
||||
'echo "serverRepo: $$SERVER_REMOTE" >> buildinfo.txt',
|
||||
'echo "engineBranch: $DRONE_SOURCE_BRANCH" >> buildinfo.txt',
|
||||
'echo "engineRepo: https://github.com/$DRONE_REPO" >> buildinfo.txt',
|
||||
'mv buildinfo.txt ./%s/' % result,
|
||||
'yes | cp -vr ./%s/. /drone/src/%s/' % [result, result],
|
||||
'ls -l /drone/src/' + result,
|
||||
@@ -864,14 +888,14 @@ local Pipeline(branch, platform, event, arch='amd64', server='10.6-enterprise')
|
||||
[pipeline.cmapitest] +
|
||||
[pipeline.cmapilog] +
|
||||
[pipeline.publish('cmapilog')] +
|
||||
[pipeline.upgrade(mdb_server_versions[i]) for i in indexes(mdb_server_versions)] +
|
||||
(if (std.length(mdb_server_versions) == 0) then [] else [pipeline.upgradelog] + [pipeline.publish('upgradelog')]) +
|
||||
(if (platform == 'rockylinux:8' && arch == 'amd64') then [pipeline.dockerfile] + [pipeline.dockerhub] + [pipeline.multi_node_mtr] else [pipeline.mtr] + [pipeline.publish('mtr')] + [pipeline.mtrlog] + [pipeline.publish('mtrlog')]) +
|
||||
(if (event == 'cron' && platform == 'rockylinux:8' && arch == 'amd64') then [pipeline.publish('mtr latest', 'latest')] else []) +
|
||||
[pipeline.prepare_regression] +
|
||||
[pipeline.regression(regression_tests[i], [if (i == 0) then 'prepare regression' else regression_tests[i - 1]]) for i in indexes(regression_tests)] +
|
||||
[pipeline.regressionlog] +
|
||||
[pipeline.publish('regressionlog')] +
|
||||
[pipeline.upgrade(mdb_server_versions[i]) for i in indexes(mdb_server_versions)] +
|
||||
(if (std.length(mdb_server_versions) == 0) then [] else [pipeline.upgradelog] + [pipeline.publish('upgradelog')]) +
|
||||
(if (event == 'cron') then [pipeline.publish('regressionlog latest', 'latest')] else []),
|
||||
|
||||
volumes: [pipeline._volumes.mdb { temp: {} }, pipeline._volumes.docker { host: { path: '/var/run/docker.sock' } }],
|
||||
|
@@ -357,6 +357,7 @@ SET (ENGINE_UTILS_BATCHLDR_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/utils/batchlo
|
||||
SET (ENGINE_UTILS_DDLCLEANUP_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/utils/ddlcleanup")
|
||||
SET (ENGINE_UTILS_QUERYSTATS_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/utils/querystats")
|
||||
SET (ENGINE_UTILS_LIBMYSQL_CL_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/utils/libmysql_client")
|
||||
SET (ENGINE_UTILS_FDB_WRAPPER "${CMAKE_CURRENT_SOURCE_DIR}/utils/fdb_wrapper_cpp/include")
|
||||
SET (ENGINE_WE_CONFIGCPP_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/writeengine/xml")
|
||||
SET (ENGINE_DATATYPES_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/datatypes")
|
||||
SET (ENGINE_BLOCKCACHE_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/primitives/blockcache")
|
||||
@@ -374,7 +375,7 @@ SET (ENGINE_UTILS_UDFSDK_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/utils/udfsdk"
|
||||
|
||||
SET (ENGINE_DEFAULT_INCLUDES ${CMAKE_CURRENT_BINARY_DIR} "." "../" "../../" ${SERVER_BUILD_INCLUDE_DIR})
|
||||
|
||||
SET (ENGINE_COMMON_INCLUDES ${ENGINE_DEFAULT_INCLUDES} ${Boost_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIR} ${ENGINE_UTILS_MESSAGEQCPP_INCLUDE} ${ENGINE_WE_SHARED_INCLUDE} ${ENGINE_UTILS_IDBDATAFILE_INCLUDE} ${ENGINE_UTILS_LOGGINGCPP_INCLUDE} ${ENGINE_UTILS_CONFIGCPP_INCLUDE} ${ENGINE_UTILS_COMPRESS_INCLUDE} ${ENGINE_VERSIONING_BRM_INCLUDE} ${ENGINE_UTILS_ROWGROUP_INCLUDE} ${ENGINE_UTILS_COMMON_INCLUDE} ${ENGINE_UTILS_DATACONVERT_INCLUDE} ${ENGINE_UTILS_RWLOCK_INCLUDE} ${ENGINE_UTILS_FUNCEXP_INCLUDE} ${ENGINE_OAMAPPS_ALARMMANAGER_INCLUDE} ${ENGINE_UTILS_INCLUDE} ${ENGINE_OAM_OAMCPP_INCLUDE} ${ENGINE_DBCON_DDLPKGPROC_INCLUDE} ${ENGINE_DBCON_DDLPKG_INCLUDE} ${ENGINE_DBCON_EXECPLAN_INCLUDE} ${ENGINE_UTILS_STARTUP_INCLUDE} ${ENGINE_DBCON_JOBLIST_INCLUDE} ${ENGINE_WE_WRAPPER_INCLUDE} ${ENGINE_WE_SERVER_INCLUDE} ${ENGINE_DBCON_DMLPKG_INCLUDE} ${ENGINE_WE_CLIENT_INCLUDE} ${ENGINE_DBCON_DMLPKGPROC_INCLUDE} ${ENGINE_UTILS_CACHEUTILS_INCLUDE} ${ENGINE_UTILS_MYSQLCL_INCLUDE} ${ENGINE_UTILS_QUERYTELE_INCLUDE} ${ENGINE_UTILS_THRIFT_INCLUDE} ${ENGINE_UTILS_JOINER_INCLUDE} ${ENGINE_UTILS_THREADPOOL_INCLUDE} ${ENGINE_UTILS_BATCHLDR_INCLUDE} ${ENGINE_UTILS_DDLCLEANUP_INCLUDE} ${ENGINE_UTILS_QUERYSTATS_INCLUDE} ${ENGINE_WE_CONFIGCPP_INCLUDE} ${ENGINE_SERVER_SQL_INCLUDE} ${ENGINE_SERVER_INCLUDE_INCLUDE} ${ENGINE_SERVER_PCRE_INCLUDE} ${ENGINE_SERVER_WSREP_API_INCLUDE} ${ENGINE_SERVER_WSREP_INCLUDE} ${ENGINE_UTILS_UDFSDK_INCLUDE} ${ENGINE_UTILS_LIBMYSQL_CL_INCLUDE} ${ENGINE_DATATYPES_INCLUDE})
|
||||
SET (ENGINE_COMMON_INCLUDES ${ENGINE_DEFAULT_INCLUDES} ${Boost_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIR} ${ENGINE_UTILS_MESSAGEQCPP_INCLUDE} ${ENGINE_WE_SHARED_INCLUDE} ${ENGINE_UTILS_IDBDATAFILE_INCLUDE} ${ENGINE_UTILS_LOGGINGCPP_INCLUDE} ${ENGINE_UTILS_CONFIGCPP_INCLUDE} ${ENGINE_UTILS_COMPRESS_INCLUDE} ${ENGINE_VERSIONING_BRM_INCLUDE} ${ENGINE_UTILS_ROWGROUP_INCLUDE} ${ENGINE_UTILS_COMMON_INCLUDE} ${ENGINE_UTILS_DATACONVERT_INCLUDE} ${ENGINE_UTILS_RWLOCK_INCLUDE} ${ENGINE_UTILS_FUNCEXP_INCLUDE} ${ENGINE_OAMAPPS_ALARMMANAGER_INCLUDE} ${ENGINE_UTILS_INCLUDE} ${ENGINE_OAM_OAMCPP_INCLUDE} ${ENGINE_DBCON_DDLPKGPROC_INCLUDE} ${ENGINE_DBCON_DDLPKG_INCLUDE} ${ENGINE_DBCON_EXECPLAN_INCLUDE} ${ENGINE_UTILS_STARTUP_INCLUDE} ${ENGINE_DBCON_JOBLIST_INCLUDE} ${ENGINE_WE_WRAPPER_INCLUDE} ${ENGINE_WE_SERVER_INCLUDE} ${ENGINE_DBCON_DMLPKG_INCLUDE} ${ENGINE_WE_CLIENT_INCLUDE} ${ENGINE_DBCON_DMLPKGPROC_INCLUDE} ${ENGINE_UTILS_CACHEUTILS_INCLUDE} ${ENGINE_UTILS_MYSQLCL_INCLUDE} ${ENGINE_UTILS_QUERYTELE_INCLUDE} ${ENGINE_UTILS_THRIFT_INCLUDE} ${ENGINE_UTILS_JOINER_INCLUDE} ${ENGINE_UTILS_THREADPOOL_INCLUDE} ${ENGINE_UTILS_BATCHLDR_INCLUDE} ${ENGINE_UTILS_DDLCLEANUP_INCLUDE} ${ENGINE_UTILS_QUERYSTATS_INCLUDE} ${ENGINE_WE_CONFIGCPP_INCLUDE} ${ENGINE_SERVER_SQL_INCLUDE} ${ENGINE_SERVER_INCLUDE_INCLUDE} ${ENGINE_SERVER_PCRE_INCLUDE} ${ENGINE_SERVER_WSREP_API_INCLUDE} ${ENGINE_SERVER_WSREP_INCLUDE} ${ENGINE_UTILS_UDFSDK_INCLUDE} ${ENGINE_UTILS_LIBMYSQL_CL_INCLUDE} ${ENGINE_DATATYPES_INCLUDE} ${ENGINE_UTILS_FDB_WRAPPER})
|
||||
|
||||
ADD_SUBDIRECTORY(dbcon/mysql)
|
||||
IF(NOT TARGET columnstore)
|
||||
|
@@ -49,6 +49,9 @@ optparse.define short=F long=show-build-flags desc="Print CMake flags, while bui
|
||||
optparse.define short=c long=cloud desc="Enable cloud storage" variable=CLOUD_STORAGE_ENABLED default=false value=true
|
||||
optparse.define short=f long=do-not-freeze-revision desc="Disable revision freezing, or do not set 'update none' for columnstore submodule in MDB repository" variable=DO_NOT_FREEZE_REVISION default=false value=true
|
||||
optparse.define short=a long=build-path variable=MARIA_BUILD_PATH default=$MDB_SOURCE_PATH/../MariaDBBuild
|
||||
optparse.define short=o long=recompile-only variable=RECOMPILE_ONLY default=false value=true
|
||||
optparse.define short=r long=restart-services variable=RESTART_SERVICES default=true value=false
|
||||
|
||||
|
||||
source $( optparse.build )
|
||||
|
||||
@@ -212,6 +215,7 @@ clean_old_installation()
|
||||
rm -rf /etc/mysql
|
||||
rm -rf /etc/my.cnf.d/columnstore.cnf
|
||||
rm -rf /etc/mysql/mariadb.conf.d/columnstore.cnf
|
||||
fdbcli --exec "writemode on; clearrange \x00 \xff"
|
||||
}
|
||||
|
||||
build()
|
||||
@@ -449,9 +453,10 @@ fix_config_files()
|
||||
message "UBSAN options were added to $MDB_SERVICE_FILE"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $RECOMPILE_ONLY = false ]] ; then
|
||||
message Reloading systemd
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
}
|
||||
|
||||
make_dir()
|
||||
@@ -462,6 +467,7 @@ make_dir()
|
||||
|
||||
install()
|
||||
{
|
||||
if [[ $RECOMPILE_ONLY = false ]] ; then
|
||||
message_split
|
||||
message "Installing MariaDB"
|
||||
disable_plugins_for_bootstrap
|
||||
@@ -476,7 +482,7 @@ install()
|
||||
make_dir $CONFIG_DIR
|
||||
|
||||
echo "[client-server]
|
||||
socket=/run/mysqld/mysqld.sock" > $CONFIG_DIR/socket.cnf
|
||||
socket=/run/mysqld/mysqld.sock" > $CONFIG_DIR/socket.cnf
|
||||
|
||||
mv $INSTALL_PREFIX/lib/mysql/plugin/ha_columnstore.so /tmp/ha_columnstore_1.so || mv $INSTALL_PREFIX/lib64/mysql/plugin/ha_columnstore.so /tmp/ha_columnstore_2.so
|
||||
make_dir /var/lib/mysql
|
||||
@@ -533,6 +539,7 @@ socket=/run/mysqld/mysqld.sock" > $CONFIG_DIR/socket.cnf
|
||||
columnstore-post-install --rpmmode=install
|
||||
message "Running install_mcs_mysql"
|
||||
install_mcs_mysql.sh
|
||||
fi
|
||||
|
||||
chown -R syslog:syslog /var/log/mariadb/
|
||||
chmod 777 /var/log/mariadb/
|
||||
@@ -578,7 +585,9 @@ if [[ $INSTALL_DEPS = true ]] ; then
|
||||
install_deps
|
||||
fi
|
||||
|
||||
stop_service
|
||||
if [[ $RESTART_SERVICES = true ]] ; then
|
||||
stop_service
|
||||
fi
|
||||
|
||||
if [[ $NO_CLEAN = false ]] ; then
|
||||
clean_old_installation
|
||||
@@ -588,8 +597,10 @@ build
|
||||
run_unit_tests
|
||||
run_microbenchmarks_tests
|
||||
install
|
||||
start_service
|
||||
smoke
|
||||
generate_svgs
|
||||
if [[ $RESTART_SERVICES = true ]] ; then
|
||||
start_service
|
||||
smoke
|
||||
generate_svgs
|
||||
fi
|
||||
|
||||
message_splitted "FINISHED"
|
||||
|
@@ -1,3 +1,19 @@
|
||||
set(WITH_THRIFT "auto" CACHE STRING
|
||||
"Which Thrift to use (possible values are 'bundled', 'system', or 'auto')")
|
||||
|
||||
if(WITH_THRIFT STREQUAL "system" OR WITH_THRIFT STREQUAL "auto")
|
||||
FIND_PACKAGE(Thrift)
|
||||
|
||||
if (Thrift_FOUND)
|
||||
add_custom_target(external_thrift)
|
||||
set(THRIFT_INCLUDE_DIR "${THRIFT_INCLUDE_DIR}")
|
||||
set(THRIFT_LIBRARY "${THRIFT_LIBRARIES}")
|
||||
return()
|
||||
elseif(WITH_THRIFT STREQUAL "system")
|
||||
message(FATAL_ERROR "System Thrift requested but not found!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(ExternalProject)
|
||||
|
||||
set(INSTALL_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/external/thrift)
|
||||
|
@@ -48,6 +48,7 @@ SET(CMAPI_DIR "${SHARE_DIR}/cmapi")
|
||||
SET(SYSTEMD_UNIT_DIR "/usr/lib/systemd/system")
|
||||
SET(SYSTEMD_ENGINE_UNIT_NAME "mariadb-columnstore")
|
||||
SET(CMAPI_CONF_FILEPATH "${ETC_DIR}/cmapi_server.conf")
|
||||
SET(MAN_DIR "/usr/share/man/man1")
|
||||
|
||||
STRING(TOLOWER ${CPACK_PACKAGE_NAME} SYSTEMD_UNIT_NAME)
|
||||
|
||||
@@ -65,7 +66,8 @@ INSTALL(DIRECTORY python deps mcs_node_control failover cmapi_server engine_file
|
||||
DESTINATION ${CMAPI_DIR}
|
||||
USE_SOURCE_PERMISSIONS
|
||||
PATTERN "test" EXCLUDE
|
||||
PATTERN "cmapi_server.conf" EXCLUDE)
|
||||
PATTERN "cmapi_server.conf" EXCLUDE
|
||||
PATTERN "README" EXCLUDE)
|
||||
INSTALL(FILES LICENSE.GPL2 VERSION
|
||||
DESTINATION ${CMAPI_DIR})
|
||||
INSTALL(FILES check_ready.sh
|
||||
@@ -87,6 +89,7 @@ INSTALL(FILES mcs_gsutil
|
||||
INSTALL(FILES scripts/mcs_backup_manager.sh scripts/cs_package_manager.sh
|
||||
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
|
||||
DESTINATION ${BIN_DIR})
|
||||
INSTALL(FILES mcs_cluster_tool/mcs.1 DESTINATION ${MAN_DIR})
|
||||
|
||||
OPTION(RPM "Build an RPM" OFF)
|
||||
IF(RPM)
|
||||
@@ -132,13 +135,13 @@ IF(RPM)
|
||||
SET(CPACK_RPM_USER_FILELIST "%config(noreplace) ${CMAPI_CONF_FILEPATH}")
|
||||
|
||||
SET(CPACK_RPM_PACKAGE_OBSOLETES "mariadb-columnstore-cmapi")
|
||||
SET(CPACK_RPM_PACKAGE_REQUIRES "curl")
|
||||
SET(CPACK_RPM_PACKAGE_REQUIRES "curl, foundationdb-server")
|
||||
STRING(REPLACE "-" "_" SERVER_VERSION ${SERVER_VERSION})
|
||||
get_linux_lsb_release_information()
|
||||
|
||||
STRING(REGEX MATCH "^." OS_VERSION_MAJOR "${LSB_RELEASE_VERSION_SHORT}")
|
||||
MESSAGE(STATUS ${OS_VERSION_MAJOR})
|
||||
IF (LSB_RELEASE_ID_SHORT MATCHES "centos|rocky|rhel|alma")
|
||||
IF (LSB_RELEASE_ID_SHORT MATCHES "centos|rocky|rhel|alma|RedHatEnterprise")
|
||||
SET(OS_NAME_SHORT "el")
|
||||
IF (OS_VERSION_MAJOR MATCHES "9")
|
||||
SET(CPACK_RPM_PACKAGE_REQUIRES "libxcrypt-compat")
|
||||
@@ -174,7 +177,7 @@ IF(DEB)
|
||||
SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postinst;${CMAKE_CURRENT_SOURCE_DIR}/conffiles")
|
||||
|
||||
SET(CPACK_DEBIAN_PACKAGE_REPLACES "mariadb-columnstore-cmapi")
|
||||
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "curl")
|
||||
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "curl, foundationdb-server")
|
||||
STRING(REPLACE "-" "." SERVER_VERSION ${SERVER_VERSION})
|
||||
SET(PATCHLEVEL "+maria")
|
||||
get_linux_lsb_release_information()
|
||||
|
@@ -82,3 +82,10 @@ MCS_INSTALL_BIN = '/usr/bin'
|
||||
IFLAG = os.path.join(MCS_ETC_PATH, 'container-initialized')
|
||||
LIBJEMALLOC_DEFAULT_PATH = os.path.join(MCS_DATA_PATH, 'libjemalloc.so.2')
|
||||
MCS_LOG_PATH = '/var/log/mariadb/columnstore'
|
||||
|
||||
|
||||
# client constants
|
||||
CMAPI_PORT = 8640 #TODO: use it in all places
|
||||
CURRENT_NODE_CMAPI_URL = f'https://localhost:{CMAPI_PORT}'
|
||||
REQUEST_TIMEOUT: float = 30.0
|
||||
TRANSACTION_TIMEOUT: float = 300.0 # 5 minutes
|
150
cmapi/cmapi_server/controllers/api_clients.py
Normal file
150
cmapi/cmapi_server/controllers/api_clients.py
Normal file
@@ -0,0 +1,150 @@
|
||||
import requests
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import pyotp
|
||||
|
||||
from cmapi_server.controllers.dispatcher import _version
|
||||
from cmapi_server.constants import (
|
||||
CMAPI_CONF_PATH, CURRENT_NODE_CMAPI_URL, SECRET_KEY,
|
||||
)
|
||||
from cmapi_server.helpers import get_config_parser, get_current_key
|
||||
|
||||
|
||||
class ClusterControllerClient:
|
||||
def __init__(
|
||||
self, base_url: str = CURRENT_NODE_CMAPI_URL,
|
||||
request_timeout: Optional[float] = None
|
||||
):
|
||||
"""Initialize the ClusterControllerClient with the base URL.
|
||||
|
||||
WARNING: This class only handles the API requests, it does not
|
||||
handle the transaction management. So it should be started
|
||||
at level above using TransactionManager (decorator or context manager).
|
||||
|
||||
:param base_url: The base URL for the API endpoints,
|
||||
defaults to CURRENT_NODE_CMAPI_URL
|
||||
:type base_url: str, optional
|
||||
:param request_timeout: request timeout, defaults to None
|
||||
:type request_timeout: Optional[float], optional
|
||||
"""
|
||||
self.base_url = base_url
|
||||
self.request_timeout = request_timeout
|
||||
|
||||
def start_cluster(
|
||||
self, extra: Dict[str, Any] = dict()
|
||||
) -> Union[Dict[str, Any], Dict[str, str]]:
|
||||
"""Start the cluster.
|
||||
|
||||
:return: The response from the API.
|
||||
"""
|
||||
return self._request('PUT', 'start', extra)
|
||||
|
||||
def shutdown_cluster(
|
||||
self, extra: Dict[str, Any] = dict()
|
||||
) -> Union[Dict[str, Any], Dict[str, str]]:
|
||||
"""Shutdown the cluster.
|
||||
|
||||
:return: The response from the API.
|
||||
"""
|
||||
return self._request('PUT', 'shutdown', extra)
|
||||
|
||||
def set_mode(
|
||||
self, mode: str, extra: Dict[str, Any] = dict()
|
||||
) -> Union[Dict[str, Any], Dict[str, str]]:
|
||||
"""Set the cluster mode.
|
||||
|
||||
:param mode: The mode to set.
|
||||
:return: The response from the API.
|
||||
"""
|
||||
return self._request('PUT', 'mode-set', {'mode': mode, **extra})
|
||||
|
||||
def add_node(
|
||||
self, node_info: Dict[str, Any], extra: Dict[str, Any] = dict()
|
||||
) -> Union[Dict[str, Any], Dict[str, str]]:
|
||||
"""Add a node to the cluster.
|
||||
|
||||
:param node_info: Information about the node to add.
|
||||
:return: The response from the API.
|
||||
"""
|
||||
return self._request('PUT', 'node', {**node_info, **extra})
|
||||
|
||||
def remove_node(
|
||||
self, node: str, extra: Dict[str, Any] = dict()
|
||||
) -> Union[Dict[str, Any], Dict[str, str]]:
|
||||
"""Remove a node from the cluster.
|
||||
|
||||
:param node: node IP, name or FQDN.
|
||||
:return: The response from the API.
|
||||
"""
|
||||
return self._request('DELETE', 'node', {'node': node, **extra})
|
||||
|
||||
def get_status(self) -> Union[Dict[str, Any], Dict[str, str]]:
|
||||
"""Get the status of the cluster.
|
||||
|
||||
:return: The response from the API.
|
||||
"""
|
||||
return self._request('GET', 'status')
|
||||
|
||||
def set_api_key(
|
||||
self, api_key: str
|
||||
) -> Union[Dict[str, Any], Dict[str, str]]:
|
||||
"""Set the API key for the cluster.
|
||||
|
||||
:param api_key: The API key to set.
|
||||
:return: The response from the API.
|
||||
"""
|
||||
totp = pyotp.TOTP(SECRET_KEY)
|
||||
payload = {
|
||||
'api_key': api_key,
|
||||
'verification_key': totp.now()
|
||||
}
|
||||
return self._request('put', 'apikey-set', payload)
|
||||
|
||||
def set_log_level(
|
||||
self, log_level: str
|
||||
) -> Union[Dict[str, Any], Dict[str, str]]:
|
||||
"""Set the log level for the cluster.
|
||||
|
||||
:param log_level: The log level to set.
|
||||
:return: The response from the API.
|
||||
"""
|
||||
return self._request('put', 'log-level', {'log_level': log_level})
|
||||
|
||||
def load_s3data(
|
||||
self, s3data_info: Dict[str, Any]
|
||||
) -> Union[Dict[str, Any], Dict[str, str]]:
|
||||
"""Load S3 data into the cluster.
|
||||
|
||||
:param s3data_info: Information about the S3 data to load.
|
||||
:return: The response from the API.
|
||||
"""
|
||||
return self._request('put', 'load_s3data', s3data_info)
|
||||
|
||||
def _request(
|
||||
self, method: str, endpoint: str,
|
||||
data: Optional[Dict[str, Any]] = None
|
||||
) -> Union[Dict[str, Any], Dict[str, str]]:
|
||||
"""Make a request to the API.
|
||||
|
||||
:param method: The HTTP method to use.
|
||||
:param endpoint: The API endpoint to call.
|
||||
:param data: The data to send with the request.
|
||||
:return: The response from the API.
|
||||
"""
|
||||
url = f'{self.base_url}/cmapi/{_version}/cluster/{endpoint}'
|
||||
cmapi_cfg_parser = get_config_parser(CMAPI_CONF_PATH)
|
||||
key = get_current_key(cmapi_cfg_parser)
|
||||
headers = {'x-api-key': key}
|
||||
if method in ['PUT', 'POST', 'DELETE']:
|
||||
headers['Content-Type'] = 'application/json'
|
||||
data = {'in_transaction': True, **(data or {})}
|
||||
try:
|
||||
response = requests.request(
|
||||
method, url, headers=headers, json=data,
|
||||
timeout=self.request_timeout, verify=False
|
||||
)
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
# TODO: different handler for timeout exception?
|
||||
except requests.exceptions.RequestException as e:
|
||||
return {'error': str(e)}
|
@@ -14,19 +14,21 @@ import requests
|
||||
|
||||
from cmapi_server.exceptions import CMAPIBasicError
|
||||
from cmapi_server.constants import (
|
||||
DEFAULT_SM_CONF_PATH, EM_PATH_SUFFIX, DEFAULT_MCS_CONF_PATH, MCS_EM_PATH,
|
||||
MCS_BRM_CURRENT_PATH, S3_BRM_CURRENT_PATH, CMAPI_CONF_PATH, SECRET_KEY,
|
||||
DEFAULT_MCS_CONF_PATH, DEFAULT_SM_CONF_PATH, EM_PATH_SUFFIX,
|
||||
MCS_BRM_CURRENT_PATH, MCS_EM_PATH, S3_BRM_CURRENT_PATH, SECRET_KEY,
|
||||
)
|
||||
from cmapi_server.controllers.error import APIError
|
||||
from cmapi_server.handlers.cej import CEJError
|
||||
from cmapi_server.handlers.cluster import ClusterHandler
|
||||
from cmapi_server.helpers import (
|
||||
cmapi_config_check, get_config_parser, get_current_key, get_dbroots,
|
||||
system_ready, save_cmapi_conf_file, dequote, in_maintenance_state,
|
||||
cmapi_config_check, dequote, get_active_nodes, get_config_parser,
|
||||
get_current_key, get_dbroots, in_maintenance_state, save_cmapi_conf_file,
|
||||
system_ready,
|
||||
)
|
||||
from cmapi_server.logging_management import change_loggers_level
|
||||
from cmapi_server.managers.process import MCSProcessManager
|
||||
from cmapi_server.managers.application import AppManager
|
||||
from cmapi_server.managers.process import MCSProcessManager
|
||||
from cmapi_server.managers.transaction import TransactionManager
|
||||
from cmapi_server.node_manipulation import is_master, switch_node_maintenance
|
||||
from mcs_node_control.models.dbrm import set_cluster_mode
|
||||
from mcs_node_control.models.node_config import NodeConfig
|
||||
@@ -59,6 +61,9 @@ def raise_422_error(
|
||||
:type exc_info: bool
|
||||
:raises APIError: everytime with custom error message
|
||||
"""
|
||||
# TODO: change:
|
||||
# - func name to inspect.stack(0)[1][3]
|
||||
# - make something to logger, seems passing here is useless
|
||||
logger.error(f'{func_name} {err_msg}', exc_info=exc_info)
|
||||
raise APIError(422, err_msg)
|
||||
|
||||
@@ -145,7 +150,27 @@ def active_operation():
|
||||
if txn_section is not None:
|
||||
txn_manager_address = app.config['txn'].get('manager_address', None)
|
||||
if txn_manager_address is not None and len(txn_manager_address) > 0:
|
||||
raise APIError(422, "There is an active operation.")
|
||||
raise_422_error(
|
||||
module_logger, 'active_operation', 'There is an active operation.'
|
||||
)
|
||||
|
||||
|
||||
@cherrypy.tools.register('before_handler', priority=82)
|
||||
def has_active_nodes():
|
||||
"""Check if there are any active nodes in the cluster.
|
||||
|
||||
TODO: Remove in next releases due to never used.
|
||||
Now TransactionManager has this check inside.
|
||||
Before removing, have to check all API endpoints without transaction
|
||||
mechanics to potential use of this handler.
|
||||
"""
|
||||
active_nodes = get_active_nodes()
|
||||
|
||||
if len(active_nodes) == 0:
|
||||
raise_422_error(
|
||||
module_logger, 'has_active_nodes',
|
||||
'No active nodes in the cluster.'
|
||||
)
|
||||
|
||||
|
||||
class TimingTool(cherrypy.Tool):
|
||||
@@ -797,8 +822,13 @@ class ClusterController:
|
||||
request = cherrypy.request
|
||||
request_body = request.json
|
||||
config = request_body.get('config', DEFAULT_MCS_CONF_PATH)
|
||||
in_transaction = request_body.get('in_transaction', False)
|
||||
|
||||
try:
|
||||
if not in_transaction:
|
||||
with TransactionManager():
|
||||
response = ClusterHandler.start(config)
|
||||
else:
|
||||
response = ClusterHandler.start(config)
|
||||
except CMAPIBasicError as err:
|
||||
raise_422_error(module_logger, func_name, err.message)
|
||||
@@ -816,9 +846,16 @@ class ClusterController:
|
||||
|
||||
request = cherrypy.request
|
||||
request_body = request.json
|
||||
timeout = request_body.get('timeout', None)
|
||||
force = request_body.get('force', False)
|
||||
config = request_body.get('config', DEFAULT_MCS_CONF_PATH)
|
||||
in_transaction = request_body.get('in_transaction', False)
|
||||
|
||||
try:
|
||||
if not in_transaction:
|
||||
with TransactionManager():
|
||||
response = ClusterHandler.shutdown(config, timeout)
|
||||
else:
|
||||
response = ClusterHandler.shutdown(config)
|
||||
except CMAPIBasicError as err:
|
||||
raise_422_error(module_logger, func_name, err.message)
|
||||
@@ -838,8 +875,13 @@ class ClusterController:
|
||||
request_body = request.json
|
||||
mode = request_body.get('mode', 'readonly')
|
||||
config = request_body.get('config', DEFAULT_MCS_CONF_PATH)
|
||||
in_transaction = request_body.get('in_transaction', False)
|
||||
|
||||
try:
|
||||
if not in_transaction:
|
||||
with TransactionManager():
|
||||
response = ClusterHandler.set_mode(mode, config=config)
|
||||
else:
|
||||
response = ClusterHandler.set_mode(mode, config=config)
|
||||
except CMAPIBasicError as err:
|
||||
raise_422_error(module_logger, func_name, err.message)
|
||||
@@ -859,11 +901,16 @@ class ClusterController:
|
||||
request_body = request.json
|
||||
node = request_body.get('node', None)
|
||||
config = request_body.get('config', DEFAULT_MCS_CONF_PATH)
|
||||
in_transaction = request_body.get('in_transaction', False)
|
||||
|
||||
if node is None:
|
||||
raise_422_error(module_logger, func_name, 'missing node argument')
|
||||
|
||||
try:
|
||||
if not in_transaction:
|
||||
with TransactionManager(extra_nodes=[node]):
|
||||
response = ClusterHandler.add_node(node, config)
|
||||
else:
|
||||
response = ClusterHandler.add_node(node, config)
|
||||
except CMAPIBasicError as err:
|
||||
raise_422_error(module_logger, func_name, err.message)
|
||||
@@ -882,13 +929,17 @@ class ClusterController:
|
||||
request_body = request.json
|
||||
node = request_body.get('node', None)
|
||||
config = request_body.get('config', DEFAULT_MCS_CONF_PATH)
|
||||
response = {'timestamp': str(datetime.now())}
|
||||
in_transaction = request_body.get('in_transaction', False)
|
||||
|
||||
#TODO: add arguments verification decorator
|
||||
if node is None:
|
||||
raise_422_error(module_logger, func_name, 'missing node argument')
|
||||
|
||||
try:
|
||||
if not in_transaction:
|
||||
with TransactionManager(remove_nodes=[node]):
|
||||
response = ClusterHandler.remove_node(node, config)
|
||||
else:
|
||||
response = ClusterHandler.remove_node(node, config)
|
||||
except CMAPIBasicError as err:
|
||||
raise_422_error(module_logger, func_name, err.message)
|
||||
@@ -999,7 +1050,7 @@ class ClusterController:
|
||||
|
||||
if not totp_key or not new_api_key:
|
||||
# not show which arguments in error message because endpoint for
|
||||
# internal usage only
|
||||
# cli tool or internal usage only
|
||||
raise_422_error(
|
||||
module_logger, func_name, 'Missing required arguments.'
|
||||
)
|
||||
|
@@ -1,6 +1,7 @@
|
||||
"""Module contains Cluster business logic functions."""
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from enum import Enum
|
||||
from typing import Optional
|
||||
|
||||
import requests
|
||||
@@ -10,11 +11,9 @@ from cmapi_server.constants import (
|
||||
)
|
||||
from cmapi_server.exceptions import CMAPIBasicError
|
||||
from cmapi_server.helpers import (
|
||||
broadcast_new_config, commit_transaction, get_active_nodes, get_dbroots,
|
||||
get_config_parser, get_current_key, get_id, get_version, start_transaction,
|
||||
rollback_transaction, update_revision_and_manager,
|
||||
broadcast_new_config, get_active_nodes, get_dbroots, get_config_parser,
|
||||
get_current_key, get_version, update_revision_and_manager,
|
||||
)
|
||||
from cmapi_server.managers.transaction import TransactionManager
|
||||
from cmapi_server.node_manipulation import (
|
||||
add_node, add_dbroot, remove_node, switch_node_maintenance,
|
||||
)
|
||||
@@ -22,26 +21,61 @@ from mcs_node_control.models.misc import get_dbrm_master
|
||||
from mcs_node_control.models.node_config import NodeConfig
|
||||
|
||||
|
||||
class ClusterAction(Enum):
|
||||
START = 'start'
|
||||
STOP = 'stop'
|
||||
|
||||
|
||||
def toggle_cluster_state(
|
||||
action: ClusterAction, config: str) -> dict:
|
||||
"""Toggle the state of the cluster (start or stop).
|
||||
|
||||
:param action: The cluster action to perform.
|
||||
(ClusterAction.START or ClusterAction.STOP).
|
||||
:type action: ClusterAction
|
||||
:param config: The path to the MariaDB Columnstore configuration file.
|
||||
:type config: str
|
||||
"""
|
||||
if action == ClusterAction.START:
|
||||
maintainance_flag = False
|
||||
elif action == ClusterAction.STOP:
|
||||
maintainance_flag = True
|
||||
else:
|
||||
raise ValueError(
|
||||
'Invalid action. Use ClusterAction.START or ClusterAction.STOP.'
|
||||
)
|
||||
|
||||
switch_node_maintenance(maintainance_flag)
|
||||
update_revision_and_manager()
|
||||
|
||||
# TODO: move this from multiple places to one
|
||||
try:
|
||||
broadcast_successful = broadcast_new_config(config)
|
||||
except Exception as err:
|
||||
raise CMAPIBasicError(
|
||||
'Error while distributing config file.'
|
||||
) from err
|
||||
|
||||
if not broadcast_successful:
|
||||
raise CMAPIBasicError('Config distribution isn\'t successful.')
|
||||
|
||||
|
||||
class ClusterHandler():
|
||||
"""Class for handling MCS Cluster operations."""
|
||||
|
||||
@staticmethod
|
||||
def status(
|
||||
config: str = DEFAULT_MCS_CONF_PATH,
|
||||
logger: logging.Logger = logging.getLogger('cmapi_server')
|
||||
) -> dict:
|
||||
def status(config: str = DEFAULT_MCS_CONF_PATH) -> dict:
|
||||
"""Method to get MCS Cluster status information
|
||||
|
||||
:param config: columnstore xml config file path,
|
||||
defaults to DEFAULT_MCS_CONF_PATH
|
||||
:type config: str, optional
|
||||
:param logger: logger, defaults to logging.getLogger('cmapi_server')
|
||||
:type logger: logging.Logger, optional
|
||||
:raises CMAPIBasicError: if catch some exception while getting status
|
||||
from each node separately
|
||||
:return: status result
|
||||
:rtype: dict
|
||||
"""
|
||||
logger: logging.Logger = logging.getLogger('cmapi_server')
|
||||
logger.debug('Cluster status command called. Getting status.')
|
||||
|
||||
response = {'timestamp': str(datetime.now())}
|
||||
@@ -72,132 +106,50 @@ class ClusterHandler():
|
||||
return response
|
||||
|
||||
@staticmethod
|
||||
def start(
|
||||
config: str = DEFAULT_MCS_CONF_PATH,
|
||||
logger: logging.Logger = logging.getLogger('cmapi_server')
|
||||
) -> dict:
|
||||
def start(config: str = DEFAULT_MCS_CONF_PATH) -> dict:
|
||||
"""Method to start MCS Cluster.
|
||||
|
||||
:param config: columnstore xml config file path,
|
||||
defaults to DEFAULT_MCS_CONF_PATH
|
||||
:type config: str, optional
|
||||
:param logger: logger, defaults to logging.getLogger('cmapi_server')
|
||||
:type logger: logging.Logger, optional
|
||||
:raises CMAPIBasicError: on exception while starting transaction
|
||||
:raises CMAPIBasicError: if transaction start isn't successful
|
||||
:raises CMAPIBasicError: if no nodes in the cluster
|
||||
:raises CMAPIBasicError: on exception while distributing new config
|
||||
:raises CMAPIBasicError: on unsuccessful distibuting config file
|
||||
:raises CMAPIBasicError: on exception while committing transaction
|
||||
:return: start timestamp
|
||||
:rtype: dict
|
||||
"""
|
||||
logger.debug('Cluster start command called. Starting the cluster.')
|
||||
start_time = str(datetime.now())
|
||||
transaction_id = get_id()
|
||||
|
||||
try:
|
||||
suceeded, transaction_id, successes = start_transaction(
|
||||
cs_config_filename=config, txn_id=transaction_id
|
||||
)
|
||||
except Exception as err:
|
||||
rollback_transaction(transaction_id, cs_config_filename=config)
|
||||
raise CMAPIBasicError(
|
||||
'Error while starting the transaction.'
|
||||
) from err
|
||||
if not suceeded:
|
||||
rollback_transaction(transaction_id, cs_config_filename=config)
|
||||
raise CMAPIBasicError('Starting transaction isn\'t successful.')
|
||||
|
||||
if suceeded and len(successes) == 0:
|
||||
rollback_transaction(transaction_id, cs_config_filename=config)
|
||||
raise CMAPIBasicError('There are no nodes in the cluster.')
|
||||
|
||||
switch_node_maintenance(False)
|
||||
update_revision_and_manager()
|
||||
|
||||
# TODO: move this from multiple places to one, eg to helpers
|
||||
try:
|
||||
broadcast_successful = broadcast_new_config(config)
|
||||
except Exception as err:
|
||||
rollback_transaction(transaction_id, cs_config_filename=config)
|
||||
raise CMAPIBasicError(
|
||||
'Error while distributing config file.'
|
||||
) from err
|
||||
|
||||
if not broadcast_successful:
|
||||
rollback_transaction(transaction_id, cs_config_filename=config)
|
||||
raise CMAPIBasicError('Config distribution isn\'t successful.')
|
||||
|
||||
try:
|
||||
commit_transaction(transaction_id, cs_config_filename=config)
|
||||
except Exception as err:
|
||||
rollback_transaction(transaction_id, cs_config_filename=config)
|
||||
raise CMAPIBasicError(
|
||||
'Error while committing transaction.'
|
||||
) from err
|
||||
|
||||
logger.debug('Successfully finished cluster start.')
|
||||
return {'timestamp': start_time}
|
||||
logger: logging.Logger = logging.getLogger('cmapi_server')
|
||||
logger.info('Cluster start command called. Starting the cluster.')
|
||||
operation_start_time = str(datetime.now())
|
||||
toggle_cluster_state(ClusterAction.START, config)
|
||||
logger.info('Successfully finished cluster start.')
|
||||
return {'timestamp': operation_start_time}
|
||||
|
||||
@staticmethod
|
||||
def shutdown(
|
||||
config: str = DEFAULT_MCS_CONF_PATH,
|
||||
logger: logging.Logger = logging.getLogger('cmapi_server'),
|
||||
in_transaction: bool = False,
|
||||
timeout: int = 15
|
||||
config: str = DEFAULT_MCS_CONF_PATH, timeout: Optional[int] = None
|
||||
) -> dict:
|
||||
"""Method to stop the MCS Cluster.
|
||||
|
||||
:param config: columnstore xml config file path,
|
||||
defaults to DEFAULT_MCS_CONF_PATH
|
||||
:type config: str, optional
|
||||
:param logger: logger, defaults to logging.getLogger('cmapi_server')
|
||||
:type logger: logging.Logger, optional
|
||||
:param in_transaction: is function called in existing transaction or no
|
||||
:type in_transaction: bool
|
||||
:param timeout: timeout in seconds to gracefully stop DMLProc
|
||||
TODO: for next releases
|
||||
:type timeout: int
|
||||
:param timeout: timeout in seconds to gracefully stop DMLProc,
|
||||
defaults to None
|
||||
:type timeout: Optional[int], optional
|
||||
:raises CMAPIBasicError: if no nodes in the cluster
|
||||
:return: start timestamp
|
||||
:rtype: dict
|
||||
"""
|
||||
logger: logging.Logger = logging.getLogger('cmapi_server')
|
||||
logger.debug(
|
||||
'Cluster shutdown command called. Shutting down the cluster.'
|
||||
)
|
||||
|
||||
def process_shutdown():
|
||||
"""Raw node shutdown processing."""
|
||||
switch_node_maintenance(True)
|
||||
update_revision_and_manager()
|
||||
|
||||
# TODO: move this from multiple places to one, eg to helpers
|
||||
try:
|
||||
broadcast_successful = broadcast_new_config(config)
|
||||
except Exception as err:
|
||||
raise CMAPIBasicError(
|
||||
'Error while distributing config file.'
|
||||
) from err
|
||||
|
||||
if not broadcast_successful:
|
||||
raise CMAPIBasicError('Config distribution isn\'t successful.')
|
||||
|
||||
start_time = str(datetime.now())
|
||||
if not in_transaction:
|
||||
with TransactionManager():
|
||||
process_shutdown()
|
||||
else:
|
||||
process_shutdown()
|
||||
|
||||
operation_start_time = str(datetime.now())
|
||||
toggle_cluster_state(ClusterAction.STOP, config)
|
||||
logger.debug('Successfully finished shutting down the cluster.')
|
||||
return {'timestamp': start_time}
|
||||
return {'timestamp': operation_start_time}
|
||||
|
||||
@staticmethod
|
||||
def add_node(
|
||||
node: str, config: str = DEFAULT_MCS_CONF_PATH,
|
||||
logger: logging.Logger = logging.getLogger('cmapi_server')
|
||||
) -> dict:
|
||||
def add_node(node: str, config: str = DEFAULT_MCS_CONF_PATH) -> dict:
|
||||
"""Method to add node to MCS CLuster.
|
||||
|
||||
:param node: node IP or name or FQDN
|
||||
@@ -205,8 +157,6 @@ class ClusterHandler():
|
||||
:param config: columnstore xml config file path,
|
||||
defaults to DEFAULT_MCS_CONF_PATH
|
||||
:type config: str, optional
|
||||
:param logger: logger, defaults to logging.getLogger('cmapi_server')
|
||||
:type logger: logging.Logger, optional
|
||||
:raises CMAPIBasicError: on exception while starting transaction
|
||||
:raises CMAPIBasicError: if transaction start isn't successful
|
||||
:raises CMAPIBasicError: on exception while adding node
|
||||
@@ -216,24 +166,10 @@ class ClusterHandler():
|
||||
:return: result of adding node
|
||||
:rtype: dict
|
||||
"""
|
||||
logger: logging.Logger = logging.getLogger('cmapi_server')
|
||||
logger.debug(f'Cluster add node command called. Adding node {node}.')
|
||||
|
||||
response = {'timestamp': str(datetime.now())}
|
||||
transaction_id = get_id()
|
||||
|
||||
try:
|
||||
suceeded, transaction_id, successes = start_transaction(
|
||||
cs_config_filename=config, extra_nodes=[node],
|
||||
txn_id=transaction_id
|
||||
)
|
||||
except Exception as err:
|
||||
rollback_transaction(transaction_id, cs_config_filename=config)
|
||||
raise CMAPIBasicError(
|
||||
'Error while starting the transaction.'
|
||||
) from err
|
||||
if not suceeded:
|
||||
rollback_transaction(transaction_id, cs_config_filename=config)
|
||||
raise CMAPIBasicError('Starting transaction isn\'t successful.')
|
||||
|
||||
try:
|
||||
add_node(
|
||||
@@ -246,7 +182,6 @@ class ClusterHandler():
|
||||
output_config_filename=config
|
||||
)
|
||||
except Exception as err:
|
||||
rollback_transaction(transaction_id, cs_config_filename=config)
|
||||
raise CMAPIBasicError('Error while adding node.') from err
|
||||
|
||||
response['node_id'] = node
|
||||
@@ -257,31 +192,18 @@ class ClusterHandler():
|
||||
try:
|
||||
broadcast_successful = broadcast_new_config(config)
|
||||
except Exception as err:
|
||||
rollback_transaction(transaction_id, cs_config_filename=config)
|
||||
raise CMAPIBasicError(
|
||||
'Error while distributing config file.'
|
||||
) from err
|
||||
|
||||
if not broadcast_successful:
|
||||
rollback_transaction(transaction_id, cs_config_filename=config)
|
||||
raise CMAPIBasicError('Config distribution isn\'t successful.')
|
||||
|
||||
try:
|
||||
commit_transaction(transaction_id, cs_config_filename=config)
|
||||
except Exception as err:
|
||||
rollback_transaction(transaction_id, cs_config_filename=config)
|
||||
raise CMAPIBasicError(
|
||||
'Error while committing transaction.'
|
||||
) from err
|
||||
|
||||
logger.debug(f'Successfully finished adding node {node}.')
|
||||
return response
|
||||
|
||||
@staticmethod
|
||||
def remove_node(
|
||||
node: str, config: str = DEFAULT_MCS_CONF_PATH,
|
||||
logger: logging.Logger = logging.getLogger('cmapi_server')
|
||||
) -> dict:
|
||||
def remove_node(node: str, config: str = DEFAULT_MCS_CONF_PATH) -> dict:
|
||||
"""Method to remove node from MCS CLuster.
|
||||
|
||||
:param node: node IP or name or FQDN
|
||||
@@ -289,8 +211,6 @@ class ClusterHandler():
|
||||
:param config: columnstore xml config file path,
|
||||
defaults to DEFAULT_MCS_CONF_PATH
|
||||
:type config: str, optional
|
||||
:param logger: logger, defaults to logging.getLogger('cmapi_server')
|
||||
:type logger: logging.Logger, optional
|
||||
:raises CMAPIBasicError: on exception while starting transaction
|
||||
:raises CMAPIBasicError: if transaction start isn't successful
|
||||
:raises CMAPIBasicError: on exception while removing node
|
||||
@@ -300,25 +220,13 @@ class ClusterHandler():
|
||||
:return: result of node removing
|
||||
:rtype: dict
|
||||
"""
|
||||
#TODO: This method will be moved to transaction manager in next release
|
||||
# Due to specific use of txn_nodes inside.
|
||||
logger: logging.Logger = logging.getLogger('cmapi_server')
|
||||
logger.debug(
|
||||
f'Cluster remove node command called. Removing node {node}.'
|
||||
)
|
||||
response = {'timestamp': str(datetime.now())}
|
||||
transaction_id = get_id()
|
||||
|
||||
try:
|
||||
suceeded, transaction_id, txn_nodes = start_transaction(
|
||||
cs_config_filename=config, remove_nodes=[node],
|
||||
txn_id=transaction_id
|
||||
)
|
||||
except Exception as err:
|
||||
rollback_transaction(transaction_id, cs_config_filename=config)
|
||||
raise CMAPIBasicError(
|
||||
'Error while starting the transaction.'
|
||||
) from err
|
||||
if not suceeded:
|
||||
rollback_transaction(transaction_id, cs_config_filename=config)
|
||||
raise CMAPIBasicError('Starting transaction isn\'t successful.')
|
||||
|
||||
try:
|
||||
remove_node(
|
||||
@@ -326,50 +234,31 @@ class ClusterHandler():
|
||||
output_config_filename=config
|
||||
)
|
||||
except Exception as err:
|
||||
rollback_transaction(
|
||||
transaction_id, nodes=txn_nodes, cs_config_filename=config
|
||||
)
|
||||
raise CMAPIBasicError('Error while removing node.') from err
|
||||
|
||||
response['node_id'] = node
|
||||
if len(txn_nodes) > 0:
|
||||
active_nodes = get_active_nodes(config)
|
||||
if len(active_nodes) > 0:
|
||||
update_revision_and_manager(
|
||||
input_config_filename=config, output_config_filename=config
|
||||
)
|
||||
try:
|
||||
broadcast_successful = broadcast_new_config(
|
||||
config, nodes=txn_nodes
|
||||
config, nodes=active_nodes
|
||||
)
|
||||
except Exception as err:
|
||||
rollback_transaction(
|
||||
transaction_id, nodes=txn_nodes, cs_config_filename=config
|
||||
)
|
||||
raise CMAPIBasicError(
|
||||
'Error while distributing config file.'
|
||||
) from err
|
||||
if not broadcast_successful:
|
||||
rollback_transaction(
|
||||
transaction_id, nodes=txn_nodes, cs_config_filename=config
|
||||
)
|
||||
raise CMAPIBasicError('Config distribution isn\'t successful.')
|
||||
|
||||
try:
|
||||
commit_transaction(transaction_id, cs_config_filename=config)
|
||||
except Exception as err:
|
||||
rollback_transaction(
|
||||
transaction_id, nodes=txn_nodes, cs_config_filename=config
|
||||
)
|
||||
raise CMAPIBasicError(
|
||||
'Error while committing transaction.'
|
||||
) from err
|
||||
|
||||
logger.debug(f'Successfully finished removing node {node}.')
|
||||
return response
|
||||
|
||||
@staticmethod
|
||||
def set_mode(
|
||||
mode: str, timeout:int = 60, config: str = DEFAULT_MCS_CONF_PATH,
|
||||
logger: logging.Logger = logging.getLogger('cmapi_server')
|
||||
mode: str, timeout: int = 60, config: str = DEFAULT_MCS_CONF_PATH,
|
||||
) -> dict:
|
||||
"""Method to set MCS CLuster mode.
|
||||
|
||||
@@ -378,8 +267,6 @@ class ClusterHandler():
|
||||
:param config: columnstore xml config file path,
|
||||
defaults to DEFAULT_MCS_CONF_PATH
|
||||
:type config: str, optional
|
||||
:param logger: logger, defaults to logging.getLogger('cmapi_server')
|
||||
:type logger: logging.Logger, optional
|
||||
:raises CMAPIBasicError: if no master found in the cluster
|
||||
:raises CMAPIBasicError: on exception while starting transaction
|
||||
:raises CMAPIBasicError: if transaction start isn't successful
|
||||
@@ -390,6 +277,7 @@ class ClusterHandler():
|
||||
:return: result of adding node
|
||||
:rtype: dict
|
||||
"""
|
||||
logger: logging.Logger = logging.getLogger('cmapi_server')
|
||||
logger.debug(
|
||||
f'Cluster mode set command called. Setting mode to {mode}.'
|
||||
)
|
||||
@@ -398,7 +286,6 @@ class ClusterHandler():
|
||||
cmapi_cfg_parser = get_config_parser(CMAPI_CONF_PATH)
|
||||
api_key = get_current_key(cmapi_cfg_parser)
|
||||
headers = {'x-api-key': api_key}
|
||||
transaction_id = get_id()
|
||||
|
||||
master = None
|
||||
if len(get_active_nodes(config)) != 0:
|
||||
@@ -411,19 +298,6 @@ class ClusterHandler():
|
||||
payload = {'cluster_mode': mode}
|
||||
url = f'https://{master}:8640/cmapi/{get_version()}/node/config'
|
||||
|
||||
try:
|
||||
suceeded, transaction_id, successes = start_transaction(
|
||||
cs_config_filename=config, txn_id=transaction_id
|
||||
)
|
||||
except Exception as err:
|
||||
rollback_transaction(transaction_id, cs_config_filename=config)
|
||||
raise CMAPIBasicError(
|
||||
'Error while starting the transaction.'
|
||||
) from err
|
||||
if not suceeded:
|
||||
rollback_transaction(transaction_id, cs_config_filename=config)
|
||||
raise CMAPIBasicError('Starting transaction isn\'t successful.')
|
||||
|
||||
nc = NodeConfig()
|
||||
root = nc.get_current_config_root(config_filename=config)
|
||||
payload['manager'] = root.find('./ClusterManager').text
|
||||
@@ -436,19 +310,10 @@ class ClusterHandler():
|
||||
r.raise_for_status()
|
||||
response['cluster-mode'] = mode
|
||||
except Exception as err:
|
||||
rollback_transaction(transaction_id, cs_config_filename=config)
|
||||
raise CMAPIBasicError(
|
||||
f'Error while setting cluster mode to {mode}'
|
||||
) from err
|
||||
|
||||
try:
|
||||
commit_transaction(transaction_id, cs_config_filename=config)
|
||||
except Exception as err:
|
||||
rollback_transaction(transaction_id, cs_config_filename=config)
|
||||
raise CMAPIBasicError(
|
||||
'Error while committing transaction.'
|
||||
) from err
|
||||
|
||||
logger.debug(f'Successfully set cluster mode to {mode}.')
|
||||
return response
|
||||
|
||||
@@ -456,7 +321,6 @@ class ClusterHandler():
|
||||
def set_api_key(
|
||||
api_key: str, verification_key: str,
|
||||
config: str = DEFAULT_MCS_CONF_PATH,
|
||||
logger: logging.Logger = logging.getLogger('cmapi_server')
|
||||
) -> dict:
|
||||
"""Method to set API key for each CMAPI node in cluster.
|
||||
|
||||
@@ -467,13 +331,12 @@ class ClusterHandler():
|
||||
:param config: columnstore xml config file path,
|
||||
defaults to DEFAULT_MCS_CONF_PATH
|
||||
:type config: str, optional
|
||||
:param logger: logger, defaults to logging.getLogger('cmapi_server')
|
||||
:type logger: logging.Logger, optional
|
||||
:raises CMAPIBasicError: if catch some exception while setting API key
|
||||
to each node
|
||||
:return: status result
|
||||
:rtype: dict
|
||||
"""
|
||||
logger: logging.Logger = logging.getLogger('cmapi_server')
|
||||
logger.debug('Cluster set API key command called.')
|
||||
|
||||
active_nodes = get_active_nodes(config)
|
||||
|
@@ -290,7 +290,7 @@ def broadcast_new_config(
|
||||
sm_config_filename: str = DEFAULT_SM_CONF_PATH,
|
||||
test_mode: bool = False,
|
||||
nodes: Optional[list] = None,
|
||||
timeout: int = 10
|
||||
timeout: Optional[int] = None
|
||||
) -> bool:
|
||||
"""Send new config to nodes. Now in async way.
|
||||
|
||||
@@ -314,6 +314,7 @@ def broadcast_new_config(
|
||||
:rtype: bool
|
||||
"""
|
||||
|
||||
# TODO: move this from multiple places to one, eg to helpers
|
||||
cfg_parser = get_config_parser(cmapi_config_filename)
|
||||
key = get_current_key(cfg_parser)
|
||||
version = get_version()
|
||||
@@ -490,7 +491,7 @@ def save_cmapi_conf_file(cfg_parser, config_filepath: str = CMAPI_CONF_PATH):
|
||||
)
|
||||
|
||||
|
||||
def get_active_nodes(config:str = DEFAULT_MCS_CONF_PATH) -> list:
|
||||
def get_active_nodes(config: str = DEFAULT_MCS_CONF_PATH) -> list:
|
||||
"""Get active nodes from Columnstore.xml.
|
||||
|
||||
Actually this is only names of nodes by which node have been added.
|
||||
|
@@ -6,7 +6,7 @@ from signal import (
|
||||
)
|
||||
from typing import Optional, Type
|
||||
|
||||
from cmapi_server.constants import DEFAULT_MCS_CONF_PATH
|
||||
from cmapi_server.constants import DEFAULT_MCS_CONF_PATH, TRANSACTION_TIMEOUT
|
||||
from cmapi_server.exceptions import CMAPIBasicError
|
||||
from cmapi_server.helpers import (
|
||||
get_id, commit_transaction, rollback_transaction, start_transaction
|
||||
@@ -17,7 +17,7 @@ class TransactionManager(ContextDecorator):
|
||||
"""Context manager and decorator to put any code inside CMAPI transaction.
|
||||
|
||||
:param timeout: time in sec after transaction will be autocommitted,
|
||||
defaults to 300.0
|
||||
defaults to 300.0 (TRANSACTION_TIMEOUT)
|
||||
|
||||
:param timeout: _description_, defaults to 300
|
||||
:type timeout: float, optional
|
||||
@@ -25,16 +25,34 @@ class TransactionManager(ContextDecorator):
|
||||
:type txn_id: Optional[int], optional
|
||||
:param handle_signals: handle specific signals or not, defaults to False
|
||||
:type handle_signals: bool, optional
|
||||
:param extra_nodes: extra nodes to start transaction at, defaults to None
|
||||
:type extra_nodes: Optional[list], optional
|
||||
:param remove_nodes: nodes to remove from transaction, defaults to None
|
||||
:type remove_nodes: Optional[list], optional
|
||||
:param optional_nodes: nodes to add to transaction, defaults to None
|
||||
:type optional_nodes: Optional[list], optional
|
||||
:raises CMAPIBasicError: if there are no nodes in the cluster
|
||||
:raises CMAPIBasicError: if starting transaction isn't succesful
|
||||
:raises Exception: if error while starting the transaction
|
||||
:raises Exception: if error while committing transaction
|
||||
:raises Exception: if error while rollback transaction
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, timeout: float = 300, txn_id: Optional[int] = None,
|
||||
handle_signals: bool = False
|
||||
self, timeout: float = TRANSACTION_TIMEOUT,
|
||||
txn_id: Optional[int] = None, handle_signals: bool = False,
|
||||
extra_nodes: Optional[list] = None,
|
||||
remove_nodes: Optional[list] = None,
|
||||
optional_nodes: Optional[list] = None,
|
||||
):
|
||||
self.timeout = timeout
|
||||
self.txn_id = txn_id or get_id()
|
||||
self.handle_signals = handle_signals
|
||||
self.active_transaction = False
|
||||
self.extra_nodes = extra_nodes
|
||||
self.remove_nodes = remove_nodes
|
||||
self.optional_nodes = optional_nodes
|
||||
self.success_txn_nodes = None
|
||||
|
||||
def _handle_exception(
|
||||
self, exc: Optional[Type[Exception]] = None,
|
||||
@@ -53,7 +71,7 @@ class TransactionManager(ContextDecorator):
|
||||
"""
|
||||
# message = 'Got exception in transaction manager'
|
||||
if (exc or signum) and self.active_transaction:
|
||||
self.rollback_transaction()
|
||||
self.rollback_transaction(nodes=self.success_txn_nodes)
|
||||
self.set_default_signals()
|
||||
raise exc
|
||||
|
||||
@@ -79,10 +97,14 @@ class TransactionManager(ContextDecorator):
|
||||
signal(SIGTERM, SIG_DFL)
|
||||
signal(SIGHUP, SIG_DFL)
|
||||
|
||||
def rollback_transaction(self) -> None:
|
||||
"""Rollback transaction."""
|
||||
def rollback_transaction(self, nodes: Optional[list] = None) -> None:
|
||||
"""Rollback transaction.
|
||||
|
||||
:param nodes: nodes to rollback transaction, defaults to None
|
||||
:type nodes: Optional[list], optional
|
||||
"""
|
||||
try:
|
||||
rollback_transaction(self.txn_id)
|
||||
rollback_transaction(self.txn_id, nodes=nodes)
|
||||
self.active_transaction = False
|
||||
logging.debug(f'Success rollback of transaction "{self.txn_id}".')
|
||||
except Exception:
|
||||
@@ -91,15 +113,20 @@ class TransactionManager(ContextDecorator):
|
||||
exc_info=True
|
||||
)
|
||||
|
||||
def commit_transaction(self):
|
||||
"""Commit transaction."""
|
||||
def commit_transaction(self, nodes: Optional[list] = None) -> None:
|
||||
"""Commit transaction.
|
||||
|
||||
:param nodes: nodes to commit transaction, defaults to None
|
||||
:type nodes: Optional[list], optional
|
||||
"""
|
||||
try:
|
||||
commit_transaction(
|
||||
self.txn_id, cs_config_filename=DEFAULT_MCS_CONF_PATH
|
||||
self.txn_id, cs_config_filename=DEFAULT_MCS_CONF_PATH,
|
||||
nodes=nodes
|
||||
)
|
||||
except Exception:
|
||||
logging.error(f'Error while committing transaction {self.txn_id}')
|
||||
self.rollback_transaction()
|
||||
self.rollback_transaction(nodes=self.success_txn_nodes)
|
||||
self.set_default_signals()
|
||||
raise
|
||||
|
||||
@@ -107,9 +134,11 @@ class TransactionManager(ContextDecorator):
|
||||
if self.handle_signals:
|
||||
self.set_custom_signals()
|
||||
try:
|
||||
suceeded, _transaction_id, successes = start_transaction(
|
||||
suceeded, _, success_txn_nodes = start_transaction(
|
||||
cs_config_filename=DEFAULT_MCS_CONF_PATH,
|
||||
txn_id=self.txn_id, timeout=self.timeout
|
||||
extra_nodes=self.extra_nodes, remove_nodes=self.remove_nodes,
|
||||
optional_nodes=self.optional_nodes,
|
||||
txn_id=self.txn_id, timeout=self.timeout,
|
||||
)
|
||||
except Exception as exc:
|
||||
logging.error('Error while starting the transaction.')
|
||||
@@ -118,19 +147,26 @@ class TransactionManager(ContextDecorator):
|
||||
self._handle_exception(
|
||||
exc=CMAPIBasicError('Starting transaction isn\'t succesful.')
|
||||
)
|
||||
if suceeded and len(successes) == 0:
|
||||
if suceeded and len(success_txn_nodes) == 0:
|
||||
# corner case when deleting last node in the cluster
|
||||
# TODO: remove node mechanics potentially has a vulnerability
|
||||
# because no transaction started for removing node.
|
||||
# Probably in some cases rollback never works for removing
|
||||
# node, because it never exist in success_txn_nodes.
|
||||
if not self.remove_nodes:
|
||||
self._handle_exception(
|
||||
exc=CMAPIBasicError('There are no nodes in the cluster.')
|
||||
)
|
||||
self.active_transaction = True
|
||||
self.success_txn_nodes = success_txn_nodes
|
||||
return self
|
||||
|
||||
def __exit__(self, *exc):
|
||||
if exc[0] and self.active_transaction:
|
||||
self.rollback_transaction()
|
||||
self.rollback_transaction(nodes=self.success_txn_nodes)
|
||||
self.set_default_signals()
|
||||
return False
|
||||
if self.active_transaction:
|
||||
self.commit_transaction()
|
||||
self.commit_transaction(nodes=self.success_txn_nodes)
|
||||
self.set_default_signals()
|
||||
return True
|
||||
|
@@ -61,7 +61,7 @@ def switch_node_maintenance(
|
||||
def add_node(
|
||||
node: str, input_config_filename: str = DEFAULT_MCS_CONF_PATH,
|
||||
output_config_filename: Optional[str] = None,
|
||||
rebalance_dbroots: bool = True
|
||||
use_rebalance_dbroots: bool = True
|
||||
):
|
||||
"""Add node to a cluster.
|
||||
|
||||
@@ -86,8 +86,8 @@ def add_node(
|
||||
:type input_config_filename: str, optional
|
||||
:param output_config_filename: mcs output config path, defaults to None
|
||||
:type output_config_filename: Optional[str], optional
|
||||
:param rebalance_dbroots: rebalance dbroots or not, defaults to True
|
||||
:type rebalance_dbroots: bool, optional
|
||||
:param use_rebalance_dbroots: rebalance dbroots or not, defaults to True
|
||||
:type use_rebalance_dbroots: bool, optional
|
||||
"""
|
||||
node_config = NodeConfig()
|
||||
c_root = node_config.get_current_config_root(input_config_filename)
|
||||
@@ -100,7 +100,7 @@ def add_node(
|
||||
_add_Module_entries(c_root, node)
|
||||
_add_active_node(c_root, node)
|
||||
_add_node_to_ExeMgrs(c_root, node)
|
||||
if rebalance_dbroots:
|
||||
if use_rebalance_dbroots:
|
||||
_rebalance_dbroots(c_root)
|
||||
_move_primary_node(c_root)
|
||||
except Exception:
|
||||
@@ -116,25 +116,41 @@ def add_node(
|
||||
node_config.write_config(c_root, filename=output_config_filename)
|
||||
|
||||
|
||||
# deactivate_only is a bool that indicates whether the node is being removed completely from
|
||||
# the cluster, or whether it has gone offline and should still be monitored in case it comes back.
|
||||
# Note! this does not pick a new primary node, use the move_primary_node() fcn to change that.
|
||||
def remove_node(
|
||||
node, input_config_filename=DEFAULT_MCS_CONF_PATH,
|
||||
output_config_filename=None, deactivate_only=False,
|
||||
rebalance_dbroots = True, **kwargs
|
||||
node: str, input_config_filename: str = DEFAULT_MCS_CONF_PATH,
|
||||
output_config_filename: Optional[str] = None,
|
||||
deactivate_only: bool = True,
|
||||
use_rebalance_dbroots: bool = True, **kwargs
|
||||
):
|
||||
"""Remove node from a cluster.
|
||||
|
||||
- Rebuild the PMS section w/o node
|
||||
- Remove the DBRM_Worker entry
|
||||
- Remove the WES entry
|
||||
- Rebuild the "Module*" entries w/o node
|
||||
- Update the list of active / inactive / desired nodes
|
||||
|
||||
:param node: node address or hostname
|
||||
:type node: str
|
||||
:param input_config_filename: mcs input config path,
|
||||
defaults to DEFAULT_MCS_CONF_PATH
|
||||
:type input_config_filename: str, optional
|
||||
:param output_config_filename: mcs output config path, defaults to None
|
||||
:type output_config_filename: Optional[str], optional
|
||||
:param deactivate_only: indicates whether the node is being removed
|
||||
completely from the cluster, or whether it has gone
|
||||
offline and should still be monitored in case it
|
||||
comes back.
|
||||
Note! this does not pick a new primary node,
|
||||
use the move_primary_node() fcn to change that.,
|
||||
defaults to True
|
||||
:type deactivate_only: bool, optional
|
||||
:param use_rebalance_dbroots: rebalance dbroots or not, defaults to True
|
||||
:type use_rebalance_dbroots: bool, optional
|
||||
"""
|
||||
node_config = NodeConfig()
|
||||
c_root = node_config.get_current_config_root(input_config_filename)
|
||||
|
||||
'''
|
||||
Rebuild the PMS section w/o node
|
||||
Remove the DBRM_Worker entry
|
||||
Remove the WES entry
|
||||
Rebuild the "Module*" entries w/o node
|
||||
Update the list of active / inactive / desired nodes
|
||||
'''
|
||||
|
||||
try:
|
||||
active_nodes = helpers.get_active_nodes(input_config_filename)
|
||||
|
||||
@@ -151,7 +167,7 @@ def remove_node(
|
||||
# TODO: unspecific name, need to think of a better one
|
||||
_remove_node(c_root, node)
|
||||
|
||||
if rebalance_dbroots:
|
||||
if use_rebalance_dbroots:
|
||||
_rebalance_dbroots(c_root)
|
||||
_move_primary_node(c_root)
|
||||
else:
|
||||
|
@@ -43,8 +43,3 @@ body = {
|
||||
'timeout': 0,
|
||||
'config': config,
|
||||
}
|
||||
|
||||
#print(config)
|
||||
|
||||
#r = requests.put(url, verify=False, headers=headers, json=body)
|
||||
|
||||
|
@@ -147,7 +147,7 @@ class ClusterModesetTestCase(BaseClusterTestCase):
|
||||
)
|
||||
error = resp.json()['error']
|
||||
self.assertEqual(resp.status_code, 422)
|
||||
self.assertEqual(error, 'No master found in the cluster.')
|
||||
self.assertEqual(error, 'There are no nodes in the cluster.')
|
||||
|
||||
def test_add_node_and_set_readonly(self):
|
||||
payload = {'node': socket.gethostname()}
|
||||
|
581
cmapi/mcs_cluster_tool/README.md
Normal file
581
cmapi/mcs_cluster_tool/README.md
Normal file
@@ -0,0 +1,581 @@
|
||||
# `mcs`
|
||||
|
||||
The MCS Command Line Interface is a unified tool to manage your MCS services
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs [OPTIONS] COMMAND [ARGS]...
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
**Commands**:
|
||||
|
||||
* `backup`: Backup Columnstore and/or MariDB data.
|
||||
* `dbrm_backup`: Columnstore DBRM Backup.
|
||||
* `restore`: Restore Columnstore (and/or MariaDB) data.
|
||||
* `dbrm_restore`: Restore Columnstore DBRM data.
|
||||
* `help-all`: Show help for all commands in man page style.
|
||||
* `status`: Get status information.
|
||||
* `stop`: Stop the Columnstore cluster.
|
||||
* `start`: Start the Columnstore cluster.
|
||||
* `restart`: Restart the Columnstore cluster.
|
||||
* `node`: Cluster nodes management.
|
||||
* `set`: Set cluster parameters.
|
||||
* `cluster`: MariaDB Columnstore cluster management...
|
||||
* `cmapi`: CMAPI itself related commands.
|
||||
|
||||
## `mcs backup`
|
||||
|
||||
Backup Columnstore and/or MariDB data.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs backup [OPTIONS]
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `-bl, --backup-location TEXT`: What directory to store the backups on this machine or the target machine.
|
||||
Consider write permissions of the scp user and the user running this script.
|
||||
Mariadb-backup will use this location as a tmp dir for S3 and remote backups temporarily.
|
||||
Example: /mnt/backups/ [default: /tmp/backups/]
|
||||
* `-bd, --backup-destination TEXT`: Are the backups going to be stored on the same machine this script is running on or another server - if Remote you need to setup scp=Options: "Local" or "Remote" [default: Local]
|
||||
* `-scp TEXT`: Used only if --backup-destination="Remote".
|
||||
The user/credentials that will be used to scp the backup files
|
||||
Example: "centos@10.14.51.62"
|
||||
* `-bb, --backup-bucket TEXT`: Only used if --storage=S3
|
||||
Name of the bucket to store the columnstore backups.
|
||||
Example: "s3://my-cs-backups"
|
||||
* `-url, --endpoint-url TEXT`: Used by on premise S3 vendors.
|
||||
Example: "http://127.0.0.1:8000"
|
||||
* `-s, --storage TEXT`: What storage topogoly is being used by Columnstore - found in /etc/columnstore/storagemanager.cnf.
|
||||
Options: "LocalStorage" or "S3" [default: LocalStorage]
|
||||
* `-i, --incremental TEXT`: Adds columnstore deltas to an existing full backup. Backup folder to apply increment could be a value or "auto_most_recent" - the incremental backup applies to last full backup.
|
||||
* `-P, --parallel INTEGER`: Determines if columnstore data directories will have multiple rsync running at the same time for different subfolders to parallelize writes. Ignored if "-c/--compress" argument not set. [default: 4]
|
||||
* `-ha, --highavilability / -no-ha, --no-highavilability`: Hint wether shared storage is attached @ below on all nodes to see all data
|
||||
HA LocalStorage ( /var/lib/columnstore/dataX/ )
|
||||
HA S3 ( /var/lib/columnstore/storagemanager/ ) [default: no-ha]
|
||||
* `-f, --config-file TEXT`: Path to backup configuration file to load variables from - relative or full path accepted.
|
||||
* `-sbrm, --skip-save-brm / -no-sbrm, --no-skip-save-brm`: Skip saving brm prior to running a backup - ideal for dirty backups. [default: no-sbrm]
|
||||
* `-spoll, --skip-polls / -no-spoll, --no-skip-polls`: Skip sql checks confirming no write/cpimports running. [default: no-spoll]
|
||||
* `-slock, --skip-locks / -no-slock, --no-skip-locks`: Skip issuing write locks - ideal for dirty backups. [default: no-slock]
|
||||
* `-smdb, --skip-mariadb-backup / -no-smdb, --no-skip-mariadb-backup`: Skip running a mariadb-backup for innodb data - ideal for incremental dirty backups. [default: no-smdb]
|
||||
* `-sb, --skip-bucket-data / -no-sb, --no-skip-bucket-data`: Skip taking a copy of the columnstore data in the bucket. [default: no-sb]
|
||||
* `-nb, --name-backup TEXT`: Define the name of the backup - default: $(date +%m-%d-%Y) [default: 03-20-2025]
|
||||
* `-c, --compress TEXT`: Compress backup in X format - Options: [ pigz ].
|
||||
* `-q, --quiet / -no-q, --no-quiet`: Silence verbose copy command outputs. [default: no-q]
|
||||
* `-nv-ssl, --no-verify-ssl / -v-ssl, --verify-ssl`: Skips verifying ssl certs, useful for onpremise s3 storage. [default: v-ssl]
|
||||
* `-pi, --poll-interval INTEGER`: Number of seconds between poll checks for active writes & cpimports. [default: 5]
|
||||
* `-pmw, --poll-max-wait INTEGER`: Max number of minutes for polling checks for writes to wait before exiting as a failed backup attempt. [default: 60]
|
||||
* `-r, --retention-days INTEGER`: Retain backups created within the last X days, default 0 == keep all backups. [default: 0]
|
||||
* `-aro, --apply-retention-only`: Only apply retention policy to existing backups, does not run a backup.
|
||||
* `-li, --list`: List backups.
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
## `mcs dbrm_backup`
|
||||
|
||||
Columnstore DBRM Backup.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs dbrm_backup [OPTIONS]
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `-i, --interval INTEGER`: Number of minutes to sleep when --mode=loop. [default: 90]
|
||||
* `-r, --retention-days INTEGER`: Retain dbrm backups created within the last X days, the rest are deleted [default: 7]
|
||||
* `-bl, --backup-location TEXT`: Path of where to save the dbrm backups on disk. [default: /tmp/dbrm_backups]
|
||||
* `-m, --mode TEXT`: "loop" or "once" ; Determines if this script runs in a forever loop sleeping -i minutes or just once. [default: once]
|
||||
* `-nb, --name-backup TEXT`: Define the prefix of the backup - default: dbrm_backup+date +%Y%m%d_%H%M%S [default: dbrm_backup]
|
||||
* `-ssm, --skip-storage-manager / -no-ssm, --no-skip-storage-manager`: Skip backing up storagemanager directory. [default: no-ssm]
|
||||
* `-q, --quiet / -no-q, --no-quiet`: Silence verbose copy command outputs. [default: no-q]
|
||||
* `-li, --list`: List backups.
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
## `mcs restore`
|
||||
|
||||
Restore Columnstore (and/or MariaDB) data.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs restore [OPTIONS]
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `-l, --load TEXT`: What date folder to load from the backup_location.
|
||||
* `-bl, --backup-location TEXT`: Where the backup to load is found.
|
||||
Example: /mnt/backups/ [default: /tmp/backups/]
|
||||
* `-bd, --backup_destination TEXT`: Is this backup on the same or remote server compared to where this script is running.
|
||||
Options: "Local" or "Remote" [default: Local]
|
||||
* `-scp, --secure-copy-protocol TEXT`: Used only if --backup-destination=RemoteThe user/credentials that will be used to scp the backup files.Example: "centos@10.14.51.62"
|
||||
* `-bb, --backup-bucket TEXT`: Only used if --storage=S3
|
||||
Name of the bucket to store the columnstore backups.
|
||||
Example: "s3://my-cs-backups"
|
||||
* `-url, --endpoint-url TEXT`: Used by on premise S3 vendors.
|
||||
Example: "http://127.0.0.1:8000"
|
||||
* `-s, --storage TEXT`: What storage topogoly is being used by Columnstore - found in /etc/columnstore/storagemanager.cnf.
|
||||
Options: "LocalStorage" or "S3" [default: LocalStorage]
|
||||
* `-dbs, --dbroots INTEGER`: Number of database roots in the backup. [default: 1]
|
||||
* `-pm, --nodeid TEXT`: Forces the handling of the restore as this node as opposed to whats detected on disk.
|
||||
* `-nb, --new-bucket TEXT`: Defines the new bucket to copy the s3 data to from the backup bucket. Use -nb if the new restored cluster should use a different bucket than the backup bucket itself.
|
||||
* `-nr, --new-region TEXT`: Defines the region of the new bucket to copy the s3 data to from the backup bucket.
|
||||
* `-nk, --new-key TEXT`: Defines the aws key to connect to the new_bucket.
|
||||
* `-ns, --new-secret TEXT`: Defines the aws secret of the aws key to connect to the new_bucket.
|
||||
* `-P, --parallel INTEGER`: Determines number of decompression and mdbstream threads. Ignored if "-c/--compress" argument not set. [default: 4]
|
||||
* `-ha, --highavilability / -no-ha, --no-highavilability`: Flag for high available systems (meaning shared storage exists supporting the topology so that each node sees all data) [default: no-ha]
|
||||
* `-cont, --continue / -no-cont, --no-continue`: This acknowledges data in your --new_bucket is ok to delete when restoring S3. When set to true skips the enforcement that new_bucket should be empty prior to starting a restore. [default: no-cont]
|
||||
* `-f, --config-file TEXT`: Path to backup configuration file to load variables from - relative or full path accepted.
|
||||
* `-smdb, --skip-mariadb-backup / -no-smdb, --no-skip-mariadb-backup`: Skip restoring mariadb server via mariadb-backup - ideal for only restoring columnstore. [default: no-smdb]
|
||||
* `-sb, --skip-bucket-data / -no-sb, --no-skip-bucket-data`: Skip restoring columnstore data in the bucket - ideal if looking to only restore mariadb server. [default: no-sb]
|
||||
* `-c, --compress TEXT`: Hint that the backup is compressed in X format. Options: [ pigz ].
|
||||
* `-q, --quiet / -no-q, --no-quiet`: Silence verbose copy command outputs. [default: no-q]
|
||||
* `-nv-ssl, --no-verify-ssl / -v-ssl, --verify-ssl`: Skips verifying ssl certs, useful for onpremise s3 storage. [default: v-ssl]
|
||||
* `-li, --list`: List backups.
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
## `mcs dbrm_restore`
|
||||
|
||||
Restore Columnstore DBRM data.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs dbrm_restore [OPTIONS]
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `-bl, --backup-location TEXT`: Path of where dbrm backups exist on disk. [default: /tmp/dbrm_backups]
|
||||
* `-l, --load TEXT`: Name of the directory to restore from -bl
|
||||
* `-ns, --no-start`: Do not attempt columnstore startup post dbrm_restore.
|
||||
* `-sdbk, --skip-dbrm-backup / -no-sdbk, --no-skip-dbrm-backup`: Skip backing up dbrms before restoring. [default: sdbk]
|
||||
* `-ssm, --skip-storage-manager / -no-ssm, --no-skip-storage-manager`: Skip backing up storagemanager directory. [default: ssm]
|
||||
* `-li, --list`: List backups.
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
## `mcs help-all`
|
||||
|
||||
Show help for all commands in man page style.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs help-all [OPTIONS]
|
||||
```
|
||||
|
||||
## `mcs status`
|
||||
|
||||
Get status information.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs status [OPTIONS]
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
## `mcs stop`
|
||||
|
||||
Stop the Columnstore cluster.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs stop [OPTIONS]
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `-i, --interactive / -no-i, --no-interactive`: Use this option on active cluster as interactive stop waits for current writes to complete in DMLProc before shutting down. Ensuring consistency, preventing data loss of active writes. [default: no-interactive]
|
||||
* `-t, --timeout INTEGER`: Time in seconds to wait for DMLproc to gracefully stop.Warning: Low wait timeout values could result in data loss if the cluster is very active.In interactive mode means delay time between promts. [default: 15]
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
## `mcs start`
|
||||
|
||||
Start the Columnstore cluster.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs start [OPTIONS]
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
## `mcs restart`
|
||||
|
||||
Restart the Columnstore cluster.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs restart [OPTIONS]
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
## `mcs node`
|
||||
|
||||
Cluster nodes management.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs node [OPTIONS] COMMAND [ARGS]...
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
**Commands**:
|
||||
|
||||
* `add`: Add nodes to the Columnstore cluster.
|
||||
* `remove`: Remove nodes from the Columnstore cluster.
|
||||
|
||||
### `mcs node add`
|
||||
|
||||
Add nodes to the Columnstore cluster.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs node add [OPTIONS]
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `--node TEXT`: node IP, name or FQDN. Can be used multiple times to add several nodes at a time. [required]
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
### `mcs node remove`
|
||||
|
||||
Remove nodes from the Columnstore cluster.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs node remove [OPTIONS]
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `--node TEXT`: node IP, name or FQDN. Can be used multiple times to remove several nodes at a time. [required]
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
## `mcs set`
|
||||
|
||||
Set cluster parameters.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs set [OPTIONS] COMMAND [ARGS]...
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
**Commands**:
|
||||
|
||||
* `mode`: Set Columnstore cluster mode.
|
||||
* `api-key`: Set API key for communication with cluster...
|
||||
* `log-level`: Set logging level on all cluster nodes for...
|
||||
|
||||
### `mcs set mode`
|
||||
|
||||
Set Columnstore cluster mode.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs set mode [OPTIONS]
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `--mode TEXT`: cluster mode to set. "readonly" or "readwrite" are the only acceptable values. [required]
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
### `mcs set api-key`
|
||||
|
||||
Set API key for communication with cluster nodes via API.
|
||||
|
||||
WARNING: this command will affect API key value on all cluster nodes.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs set api-key [OPTIONS]
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `--key TEXT`: API key to set. [required]
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
### `mcs set log-level`
|
||||
|
||||
Set logging level on all cluster nodes for develop purposes.
|
||||
|
||||
WARNING: this could dramatically affect the number of log lines.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs set log-level [OPTIONS]
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `--level TEXT`: Logging level to set. [required]
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
## `mcs cluster`
|
||||
|
||||
MariaDB Columnstore cluster management command line tool.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs cluster [OPTIONS] COMMAND [ARGS]...
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
**Commands**:
|
||||
|
||||
* `status`: Get status information.
|
||||
* `stop`: Stop the Columnstore cluster.
|
||||
* `start`: Start the Columnstore cluster.
|
||||
* `restart`: Restart the Columnstore cluster.
|
||||
* `node`: Cluster nodes management.
|
||||
* `set`: Set cluster parameters.
|
||||
|
||||
### `mcs cluster status`
|
||||
|
||||
Get status information.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs cluster status [OPTIONS]
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
### `mcs cluster stop`
|
||||
|
||||
Stop the Columnstore cluster.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs cluster stop [OPTIONS]
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `-i, --interactive / -no-i, --no-interactive`: Use this option on active cluster as interactive stop waits for current writes to complete in DMLProc before shutting down. Ensuring consistency, preventing data loss of active writes. [default: no-interactive]
|
||||
* `-t, --timeout INTEGER`: Time in seconds to wait for DMLproc to gracefully stop.Warning: Low wait timeout values could result in data loss if the cluster is very active.In interactive mode means delay time between promts. [default: 15]
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
### `mcs cluster start`
|
||||
|
||||
Start the Columnstore cluster.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs cluster start [OPTIONS]
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
### `mcs cluster restart`
|
||||
|
||||
Restart the Columnstore cluster.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs cluster restart [OPTIONS]
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
### `mcs cluster node`
|
||||
|
||||
Cluster nodes management.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs cluster node [OPTIONS] COMMAND [ARGS]...
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
**Commands**:
|
||||
|
||||
* `add`: Add nodes to the Columnstore cluster.
|
||||
* `remove`: Remove nodes from the Columnstore cluster.
|
||||
|
||||
#### `mcs cluster node add`
|
||||
|
||||
Add nodes to the Columnstore cluster.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs cluster node add [OPTIONS]
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `--node TEXT`: node IP, name or FQDN. Can be used multiple times to add several nodes at a time. [required]
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
#### `mcs cluster node remove`
|
||||
|
||||
Remove nodes from the Columnstore cluster.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs cluster node remove [OPTIONS]
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `--node TEXT`: node IP, name or FQDN. Can be used multiple times to remove several nodes at a time. [required]
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
### `mcs cluster set`
|
||||
|
||||
Set cluster parameters.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs cluster set [OPTIONS] COMMAND [ARGS]...
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
**Commands**:
|
||||
|
||||
* `mode`: Set Columnstore cluster mode.
|
||||
* `api-key`: Set API key for communication with cluster...
|
||||
* `log-level`: Set logging level on all cluster nodes for...
|
||||
|
||||
#### `mcs cluster set mode`
|
||||
|
||||
Set Columnstore cluster mode.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs cluster set mode [OPTIONS]
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `--mode TEXT`: cluster mode to set. "readonly" or "readwrite" are the only acceptable values. [required]
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
#### `mcs cluster set api-key`
|
||||
|
||||
Set API key for communication with cluster nodes via API.
|
||||
|
||||
WARNING: this command will affect API key value on all cluster nodes.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs cluster set api-key [OPTIONS]
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `--key TEXT`: API key to set. [required]
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
#### `mcs cluster set log-level`
|
||||
|
||||
Set logging level on all cluster nodes for develop purposes.
|
||||
|
||||
WARNING: this could dramatically affect the number of log lines.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs cluster set log-level [OPTIONS]
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `--level TEXT`: Logging level to set. [required]
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
## `mcs cmapi`
|
||||
|
||||
CMAPI itself related commands.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs cmapi [OPTIONS] COMMAND [ARGS]...
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `--help`: Show this message and exit.
|
||||
|
||||
**Commands**:
|
||||
|
||||
* `is-ready`: Check CMAPI is ready to handle requests.
|
||||
|
||||
### `mcs cmapi is-ready`
|
||||
|
||||
Check CMAPI is ready to handle requests.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```console
|
||||
$ mcs cmapi is-ready [OPTIONS]
|
||||
```
|
||||
|
||||
**Options**:
|
||||
|
||||
* `--node TEXT`: Which node to check the CMAPI is ready to handle requests. [default: 127.0.0.1]
|
||||
* `--help`: Show this message and exit.
|
19
cmapi/mcs_cluster_tool/README_DEV.md
Normal file
19
cmapi/mcs_cluster_tool/README_DEV.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Generating documentation for MCS cli tool
|
||||
- install cmapi requirements
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
- generate markdown
|
||||
```bash
|
||||
typer mcs_cluster_tool/__main__.py utils docs --name mcs --output README.md
|
||||
```
|
||||
- install `md2man` (for now it's the only one tool that make convertation without any issues)
|
||||
```bash
|
||||
sudo yum install -y ruby ruby-devel
|
||||
gem install md2man
|
||||
```
|
||||
- convert to perfect `.roff` file (`man` page)
|
||||
```bash
|
||||
md2man README.md > mcs.1
|
||||
```
|
||||
- enjoy =)
|
@@ -1,4 +1,5 @@
|
||||
import logging
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import typer
|
||||
@@ -17,15 +18,27 @@ app = typer.Typer(
|
||||
'The MCS Command Line Interface is a unified tool to manage your '
|
||||
'MCS services'
|
||||
),
|
||||
rich_markup_mode='rich',
|
||||
)
|
||||
app.add_typer(cluster_app.app, name='cluster')
|
||||
app.add_typer(cluster_app.app)
|
||||
# TODO: keep this only for potential backward compatibility
|
||||
app.add_typer(cluster_app.app, name='cluster', hidden=True)
|
||||
app.add_typer(cmapi_app.app, name='cmapi')
|
||||
app.command()(backup_commands.backup)
|
||||
app.command('backup')(backup_commands.backup)
|
||||
app.command('dbrm_backup')(backup_commands.dbrm_backup)
|
||||
app.command()(restore_commands.restore)
|
||||
app.command('restore')(restore_commands.restore)
|
||||
app.command('dbrm_restore')(restore_commands.dbrm_restore)
|
||||
|
||||
|
||||
@app.command(
|
||||
name='help-all', help='Show help for all commands in man page style.',
|
||||
add_help_option=False
|
||||
)
|
||||
def help_all():
|
||||
# Open the man page in interactive mode
|
||||
subprocess.run(['man', 'mcs'])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
add_logging_level('TRACE', 5) #TODO: remove when stadalone mode added.
|
||||
dict_config(MCS_CLI_LOG_CONF_PATH)
|
||||
|
@@ -76,13 +76,6 @@ def backup(
|
||||
)
|
||||
)
|
||||
] = '',
|
||||
nv_ssl: Annotated[
|
||||
bool,
|
||||
typer.Option(
|
||||
'-nv-ssl/-v-ssl','--no-verify-ssl/--verify-ssl',
|
||||
help='Skips verifying ssl certs, useful for onpremise s3 storage.'
|
||||
)
|
||||
] = False,
|
||||
s: Annotated[
|
||||
str,
|
||||
typer.Option(
|
||||
@@ -107,6 +100,18 @@ def backup(
|
||||
show_default=False
|
||||
)
|
||||
] = '',
|
||||
P: Annotated[
|
||||
int,
|
||||
typer.Option(
|
||||
'-P', '--parallel',
|
||||
help=(
|
||||
'Determines if columnstore data directories will have '
|
||||
'multiple rsync running at the same time for different '
|
||||
'subfolders to parallelize writes. '
|
||||
'Ignored if "-c/--compress" argument not set.'
|
||||
)
|
||||
)
|
||||
] = 4,
|
||||
ha: Annotated[
|
||||
bool,
|
||||
typer.Option(
|
||||
@@ -123,7 +128,10 @@ def backup(
|
||||
str,
|
||||
typer.Option(
|
||||
'-f', '--config-file',
|
||||
help='Path to backup configuration file to load variables from.',
|
||||
help=(
|
||||
'Path to backup configuration file to load variables from - '
|
||||
'relative or full path accepted.'
|
||||
),
|
||||
show_default=False
|
||||
)
|
||||
] = '',
|
||||
@@ -168,53 +176,6 @@ def backup(
|
||||
help='Skip taking a copy of the columnstore data in the bucket.'
|
||||
)
|
||||
] = False,
|
||||
pi: Annotated[
|
||||
int,
|
||||
typer.Option(
|
||||
'-pi', '--poll-interval',
|
||||
help=(
|
||||
'Number of seconds between poll checks for active writes & '
|
||||
'cpimports.'
|
||||
)
|
||||
)
|
||||
] = 5,
|
||||
pmw: Annotated[
|
||||
int,
|
||||
typer.Option(
|
||||
'-pmw', '--poll-max-wait',
|
||||
help=(
|
||||
'Max number of minutes for polling checks for writes to wait '
|
||||
'before exiting as a failed backup attempt.'
|
||||
)
|
||||
)
|
||||
] = 60,
|
||||
q: Annotated[
|
||||
bool,
|
||||
typer.Option(
|
||||
'-q/-no-q', '--quiet/--no-quiet',
|
||||
help='Silence verbose copy command outputs.'
|
||||
)
|
||||
] = False,
|
||||
c: Annotated[
|
||||
str,
|
||||
typer.Option(
|
||||
'-c', '--compress',
|
||||
help='Compress backup in X format - Options: [ pigz ].',
|
||||
show_default=False
|
||||
)
|
||||
] = '',
|
||||
P: Annotated[
|
||||
int,
|
||||
typer.Option(
|
||||
'-P', '--parallel',
|
||||
help=(
|
||||
'Determines if columnstore data directories will have '
|
||||
'multiple rsync running at the same time for different '
|
||||
'subfolders to parallelize writes. '
|
||||
'Ignored if "-c/--compress" argument not set.'
|
||||
)
|
||||
)
|
||||
] = 4,
|
||||
nb: Annotated[
|
||||
str,
|
||||
typer.Option(
|
||||
@@ -235,6 +196,48 @@ def backup(
|
||||
hidden=True
|
||||
)
|
||||
] = 'direct',
|
||||
c: Annotated[
|
||||
str,
|
||||
typer.Option(
|
||||
'-c', '--compress',
|
||||
help='Compress backup in X format - Options: [ pigz ].',
|
||||
show_default=False
|
||||
)
|
||||
] = '',
|
||||
q: Annotated[
|
||||
bool,
|
||||
typer.Option(
|
||||
'-q/-no-q', '--quiet/--no-quiet',
|
||||
help='Silence verbose copy command outputs.'
|
||||
)
|
||||
] = False,
|
||||
nv_ssl: Annotated[
|
||||
bool,
|
||||
typer.Option(
|
||||
'-nv-ssl/-v-ssl','--no-verify-ssl/--verify-ssl',
|
||||
help='Skips verifying ssl certs, useful for onpremise s3 storage.'
|
||||
)
|
||||
] = False,
|
||||
pi: Annotated[
|
||||
int,
|
||||
typer.Option(
|
||||
'-pi', '--poll-interval',
|
||||
help=(
|
||||
'Number of seconds between poll checks for active writes & '
|
||||
'cpimports.'
|
||||
)
|
||||
)
|
||||
] = 5,
|
||||
pmw: Annotated[
|
||||
int,
|
||||
typer.Option(
|
||||
'-pmw', '--poll-max-wait',
|
||||
help=(
|
||||
'Max number of minutes for polling checks for writes to wait '
|
||||
'before exiting as a failed backup attempt.'
|
||||
)
|
||||
)
|
||||
] = 60,
|
||||
r: Annotated[
|
||||
int,
|
||||
typer.Option(
|
||||
@@ -245,6 +248,23 @@ def backup(
|
||||
)
|
||||
)
|
||||
] = 0,
|
||||
aro: Annotated[
|
||||
bool,
|
||||
typer.Option(
|
||||
'-aro', '--apply-retention-only',
|
||||
help=(
|
||||
'Only apply retention policy to existing backups, '
|
||||
'does not run a backup.'
|
||||
)
|
||||
)
|
||||
] = False,
|
||||
list: Annotated[
|
||||
bool,
|
||||
typer.Option(
|
||||
'-li', '--list',
|
||||
help='List backups.'
|
||||
)
|
||||
] = False,
|
||||
):
|
||||
"""Backup Columnstore and/or MariDB data."""
|
||||
|
||||
@@ -276,16 +296,6 @@ def backup(
|
||||
|
||||
@handle_output
|
||||
def dbrm_backup(
|
||||
m: Annotated[
|
||||
str,
|
||||
typer.Option(
|
||||
'-m', '--mode',
|
||||
help=(
|
||||
'"loop" or "once" ; Determines if this script runs in a '
|
||||
'forever loop sleeping -i minutes or just once.'
|
||||
),
|
||||
)
|
||||
] = 'once',
|
||||
i: Annotated[
|
||||
int,
|
||||
typer.Option(
|
||||
@@ -303,27 +313,33 @@ def dbrm_backup(
|
||||
)
|
||||
)
|
||||
] = 7,
|
||||
p: Annotated[
|
||||
bl: Annotated[
|
||||
str,
|
||||
typer.Option(
|
||||
'-p', '--path',
|
||||
'-bl', '--backup-location',
|
||||
help='Path of where to save the dbrm backups on disk.'
|
||||
)
|
||||
] = '/tmp/dbrm_backups',
|
||||
m: Annotated[
|
||||
str,
|
||||
typer.Option(
|
||||
'-m', '--mode',
|
||||
help=(
|
||||
'"loop" or "once" ; Determines if this script runs in a '
|
||||
'forever loop sleeping -i minutes or just once.'
|
||||
),
|
||||
)
|
||||
] = 'once',
|
||||
nb: Annotated[
|
||||
str,
|
||||
typer.Option(
|
||||
'-nb', '--name-backup',
|
||||
help='Custom name to prefex dbrm backups with.'
|
||||
help=(
|
||||
'Define the prefix of the backup - '
|
||||
'default: dbrm_backup+date +%Y%m%d_%H%M%S'
|
||||
)
|
||||
)
|
||||
] = 'dbrm_backup',
|
||||
q: Annotated[
|
||||
bool,
|
||||
typer.Option(
|
||||
'-q/-no-q', '--quiet/--no-quiet',
|
||||
help='Silence verbose copy command outputs.'
|
||||
)
|
||||
] = False,
|
||||
ssm: Annotated[
|
||||
bool,
|
||||
typer.Option(
|
||||
@@ -331,17 +347,32 @@ def dbrm_backup(
|
||||
help='Skip backing up storagemanager directory.'
|
||||
)
|
||||
] = False,
|
||||
q: Annotated[
|
||||
bool,
|
||||
typer.Option(
|
||||
'-q/-no-q', '--quiet/--no-quiet',
|
||||
help='Silence verbose copy command outputs.'
|
||||
)
|
||||
] = False,
|
||||
list: Annotated[
|
||||
bool,
|
||||
typer.Option(
|
||||
'-li', '--list',
|
||||
help='List backups.'
|
||||
)
|
||||
] = False,
|
||||
):
|
||||
"""Columnstore DBRM Backup."""
|
||||
|
||||
# Default: ./$0 dbrm_backup -m once --retention-days 7 --path /tmp/dbrm_backups
|
||||
# Default: ./$0 dbrm_backup -m once --retention-days 0 --backup-location /tmp/dbrm_backups
|
||||
|
||||
# Examples:
|
||||
# ./$0 dbrm_backup --mode loop --interval 90 --retention-days 7 --path /mnt/dbrm_backups
|
||||
# ./$0 dbrm_backup --mode once --retention-days 7 --path /mnt/dbrm_backups -nb my-one-off-backup
|
||||
# ./$0 dbrm_backup --backup-location /mnt/columnstore/dbrm_backups
|
||||
# ./$0 dbrm_backup --retention-days 7 --backup-location /mnt/dbrm_backups --mode once -nb my-one-off-backup-before-upgrade
|
||||
# ./$0 dbrm_backup --retention-days 7 --backup-location /mnt/dbrm_backups --mode loop --interval 90brm_backup --mode once --retention-days 7 --path /mnt/dbrm_backups -nb my-one-off-backup
|
||||
|
||||
# Cron Example:
|
||||
# */60 */3 * * * root bash /root/$0 dbrm_backup -m once --retention-days 7 --path /tmp/dbrm_backups >> /tmp/dbrm_backups/cs_backup.log 2>&1
|
||||
# */60 */3 * * * root bash /root/$0 dbrm_backup -m once --retention-days 7 --backup-location /tmp/dbrm_backups >> /tmp/dbrm_backups/cs_backup.log 2>&1
|
||||
arguments = []
|
||||
for arg_name, value in locals().items():
|
||||
sh_arg = cook_sh_arg(arg_name, value)
|
||||
|
@@ -13,16 +13,16 @@ import typer
|
||||
from typing_extensions import Annotated
|
||||
|
||||
from cmapi_server.constants import (
|
||||
CMAPI_CONF_PATH, DEFAULT_MCS_CONF_PATH, SECRET_KEY
|
||||
CMAPI_CONF_PATH, DEFAULT_MCS_CONF_PATH, REQUEST_TIMEOUT
|
||||
)
|
||||
from cmapi_server.exceptions import CMAPIBasicError
|
||||
from cmapi_server.handlers.cluster import ClusterHandler
|
||||
from cmapi_server.helpers import (
|
||||
get_config_parser, get_current_key, get_version, build_url
|
||||
)
|
||||
from cmapi_server.managers.transaction import TransactionManager
|
||||
from mcs_cluster_tool.decorators import handle_output
|
||||
from mcs_node_control.models.node_config import NodeConfig
|
||||
from cmapi_server.controllers.api_clients import ClusterControllerClient
|
||||
|
||||
|
||||
logger = logging.getLogger('mcs_cli')
|
||||
@@ -33,16 +33,18 @@ node_app = typer.Typer(help='Cluster nodes management.')
|
||||
app.add_typer(node_app, name='node')
|
||||
set_app = typer.Typer(help='Set cluster parameters.')
|
||||
app.add_typer(set_app, name='set')
|
||||
client = ClusterControllerClient()
|
||||
|
||||
|
||||
@app.command()
|
||||
@app.command(rich_help_panel='cluster and single node commands')
|
||||
@handle_output
|
||||
def status():
|
||||
"""Get status information."""
|
||||
return ClusterHandler.status(logger=logger)
|
||||
client.request_timeout = REQUEST_TIMEOUT
|
||||
return client.get_status()
|
||||
|
||||
|
||||
@app.command()
|
||||
@app.command(rich_help_panel='cluster and single node commands')
|
||||
@handle_output
|
||||
@TransactionManager(
|
||||
timeout=timedelta(days=1).total_seconds(), handle_signals=True
|
||||
@@ -157,30 +159,37 @@ def stop(
|
||||
# TODO: investigate more on how changing the hardcoded timeout
|
||||
# could affect put_config (helpers.py broadcast_config) operation
|
||||
timeout = 0
|
||||
_ = ClusterHandler.shutdown(logger=logger, in_transaction=True)
|
||||
|
||||
resp = client.shutdown_cluster({'in_transaction': True})
|
||||
return {'timestamp': start_time}
|
||||
|
||||
|
||||
@app.command()
|
||||
@app.command(rich_help_panel='cluster and single node commands')
|
||||
@handle_output
|
||||
@TransactionManager(
|
||||
timeout=timedelta(days=1).total_seconds(), handle_signals=True
|
||||
)
|
||||
def start():
|
||||
"""Start the Columnstore cluster."""
|
||||
return ClusterHandler.start(logger=logger)
|
||||
return client.start_cluster({'in_transaction': True})
|
||||
|
||||
|
||||
@app.command()
|
||||
@app.command(rich_help_panel='cluster and single node commands')
|
||||
@handle_output
|
||||
@TransactionManager(
|
||||
timeout=timedelta(days=1).total_seconds(), handle_signals=True
|
||||
)
|
||||
def restart():
|
||||
"""Restart the Columnstore cluster."""
|
||||
stop_result = ClusterHandler.shutdown(logger=logger)
|
||||
stop_result = client.shutdown_cluster({'in_transaction': True})
|
||||
if 'error' in stop_result:
|
||||
return stop_result
|
||||
result = ClusterHandler.start(logger=logger)
|
||||
result = client.start_cluster({'in_transaction': True})
|
||||
result['stop_timestamp'] = stop_result['timestamp']
|
||||
return result
|
||||
|
||||
|
||||
@node_app.command()
|
||||
@node_app.command(rich_help_panel='cluster node commands')
|
||||
@handle_output
|
||||
def add(
|
||||
nodes: Optional[List[str]] = typer.Option(
|
||||
@@ -194,12 +203,16 @@ def add(
|
||||
):
|
||||
"""Add nodes to the Columnstore cluster."""
|
||||
result = []
|
||||
with TransactionManager(
|
||||
timeout=timedelta(days=1).total_seconds(), handle_signals=True,
|
||||
extra_nodes=nodes
|
||||
):
|
||||
for node in nodes:
|
||||
result.append(ClusterHandler.add_node(node, logger=logger))
|
||||
result.append(client.add_node({'node': node}))
|
||||
return result
|
||||
|
||||
|
||||
@node_app.command()
|
||||
@node_app.command(rich_help_panel='cluster node commands')
|
||||
@handle_output
|
||||
def remove(nodes: Optional[List[str]] = typer.Option(
|
||||
...,
|
||||
@@ -212,13 +225,20 @@ def remove(nodes: Optional[List[str]] = typer.Option(
|
||||
):
|
||||
"""Remove nodes from the Columnstore cluster."""
|
||||
result = []
|
||||
with TransactionManager(
|
||||
timeout=timedelta(days=1).total_seconds(), handle_signals=True,
|
||||
remove_nodes=nodes
|
||||
):
|
||||
for node in nodes:
|
||||
result.append(ClusterHandler.remove_node(node, logger=logger))
|
||||
result.append(client.remove_node(node))
|
||||
return result
|
||||
|
||||
|
||||
@set_app.command()
|
||||
@handle_output
|
||||
@TransactionManager(
|
||||
timeout=timedelta(days=1).total_seconds(), handle_signals=True
|
||||
)
|
||||
def mode(cluster_mode: str = typer.Option(
|
||||
...,
|
||||
'--mode',
|
||||
@@ -233,7 +253,8 @@ def mode(cluster_mode: str = typer.Option(
|
||||
raise typer.BadParameter(
|
||||
'"readonly" or "readwrite" are the only acceptable modes now.'
|
||||
)
|
||||
return ClusterHandler.set_mode(cluster_mode, logger=logger)
|
||||
client.request_timeout = REQUEST_TIMEOUT
|
||||
return client.set_mode(cluster_mode)
|
||||
|
||||
|
||||
@set_app.command()
|
||||
@@ -245,12 +266,11 @@ def api_key(key: str = typer.Option(..., help='API key to set.')):
|
||||
"""
|
||||
if not key:
|
||||
raise typer.BadParameter('Empty API key not allowed.')
|
||||
|
||||
totp = pyotp.TOTP(SECRET_KEY)
|
||||
|
||||
return ClusterHandler.set_api_key(key, totp.now(), logger=logger)
|
||||
client.request_timeout = REQUEST_TIMEOUT
|
||||
return client.set_api_key(key)
|
||||
|
||||
|
||||
#TODO: remove in next releases
|
||||
@set_app.command()
|
||||
@handle_output
|
||||
def log_level(level: str = typer.Option(..., help='Logging level to set.')):
|
||||
@@ -260,5 +280,5 @@ def log_level(level: str = typer.Option(..., help='Logging level to set.')):
|
||||
"""
|
||||
if not level:
|
||||
raise typer.BadParameter('Empty log level not allowed.')
|
||||
|
||||
return ClusterHandler.set_log_level(level, logger=logger)
|
||||
client.request_timeout = REQUEST_TIMEOUT
|
||||
return client.set_log_level(level)
|
||||
|
786
cmapi/mcs_cluster_tool/mcs.1
Normal file
786
cmapi/mcs_cluster_tool/mcs.1
Normal file
@@ -0,0 +1,786 @@
|
||||
.TH \fB\fCmcs\fR
|
||||
.PP
|
||||
The MCS Command Line Interface is a unified tool to manage your MCS services
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs [OPTIONS] COMMAND [ARGS]...
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.PP
|
||||
\fBCommands\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fCbackup\fR: Backup Columnstore and/or MariDB data.
|
||||
.IP \(bu 2
|
||||
\fB\fCdbrm_backup\fR: Columnstore DBRM Backup.
|
||||
.IP \(bu 2
|
||||
\fB\fCrestore\fR: Restore Columnstore (and/or MariaDB) data.
|
||||
.IP \(bu 2
|
||||
\fB\fCdbrm_restore\fR: Restore Columnstore DBRM data.
|
||||
.IP \(bu 2
|
||||
\fB\fChelp\-all\fR: Show help for all commands in man page style.
|
||||
.IP \(bu 2
|
||||
\fB\fCstatus\fR: Get status information.
|
||||
.IP \(bu 2
|
||||
\fB\fCstop\fR: Stop the Columnstore cluster.
|
||||
.IP \(bu 2
|
||||
\fB\fCstart\fR: Start the Columnstore cluster.
|
||||
.IP \(bu 2
|
||||
\fB\fCrestart\fR: Restart the Columnstore cluster.
|
||||
.IP \(bu 2
|
||||
\fB\fCnode\fR: Cluster nodes management.
|
||||
.IP \(bu 2
|
||||
\fB\fCset\fR: Set cluster parameters.
|
||||
.IP \(bu 2
|
||||
\fB\fCcluster\fR: MariaDB Columnstore cluster management...
|
||||
.IP \(bu 2
|
||||
\fB\fCcmapi\fR: CMAPI itself related commands.
|
||||
.RE
|
||||
.SH \fB\fCmcs backup\fR
|
||||
.PP
|
||||
Backup Columnstore and/or MariDB data.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs backup [OPTIONS]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-bl, \-\-backup\-location TEXT\fR: What directory to store the backups on this machine or the target machine.
|
||||
Consider write permissions of the scp user and the user running this script.
|
||||
Mariadb\-backup will use this location as a tmp dir for S3 and remote backups temporarily.
|
||||
Example: /mnt/backups/ [default: /tmp/backups/]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-bd, \-\-backup\-destination TEXT\fR: Are the backups going to be stored on the same machine this script is running on or another server \- if Remote you need to setup scp=Options: \[dq]Local\[dq] or \[dq]Remote\[dq] [default: Local]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-scp TEXT\fR: Used only if \-\-backup\-destination=\[dq]Remote\[dq]\&.
|
||||
The user/credentials that will be used to scp the backup files
|
||||
Example: \[dq]\[la]centos@10.14.51.62\[ra]\[dq]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-bb, \-\-backup\-bucket TEXT\fR: Only used if \-\-storage=S3
|
||||
Name of the bucket to store the columnstore backups.
|
||||
Example: \[dq]s3://my\-cs\-backups\[dq]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-url, \-\-endpoint\-url TEXT\fR: Used by on premise S3 vendors.
|
||||
Example: \[dq]\[la]http://127.0.0.1:8000\[ra]\[dq]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-s, \-\-storage TEXT\fR: What storage topogoly is being used by Columnstore \- found in /etc/columnstore/storagemanager.cnf.
|
||||
Options: \[dq]LocalStorage\[dq] or \[dq]S3\[dq] [default: LocalStorage]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-i, \-\-incremental TEXT\fR: Adds columnstore deltas to an existing full backup. Backup folder to apply increment could be a value or \[dq]auto\fImost\fPrecent\[dq] \- the incremental backup applies to last full backup.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-P, \-\-parallel INTEGER\fR: Determines if columnstore data directories will have multiple rsync running at the same time for different subfolders to parallelize writes. Ignored if \[dq]\-c/\-\-compress\[dq] argument not set. [default: 4]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-ha, \-\-highavilability / \-no\-ha, \-\-no\-highavilability\fR: Hint wether shared storage is attached @ below on all nodes to see all data
|
||||
HA LocalStorage ( /var/lib/columnstore/dataX/ )
|
||||
HA S3 ( /var/lib/columnstore/storagemanager/ ) [default: no\-ha]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-f, \-\-config\-file TEXT\fR: Path to backup configuration file to load variables from \- relative or full path accepted.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-sbrm, \-\-skip\-save\-brm / \-no\-sbrm, \-\-no\-skip\-save\-brm\fR: Skip saving brm prior to running a backup \- ideal for dirty backups. [default: no\-sbrm]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-spoll, \-\-skip\-polls / \-no\-spoll, \-\-no\-skip\-polls\fR: Skip sql checks confirming no write/cpimports running. [default: no\-spoll]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-slock, \-\-skip\-locks / \-no\-slock, \-\-no\-skip\-locks\fR: Skip issuing write locks \- ideal for dirty backups. [default: no\-slock]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-smdb, \-\-skip\-mariadb\-backup / \-no\-smdb, \-\-no\-skip\-mariadb\-backup\fR: Skip running a mariadb\-backup for innodb data \- ideal for incremental dirty backups. [default: no\-smdb]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-sb, \-\-skip\-bucket\-data / \-no\-sb, \-\-no\-skip\-bucket\-data\fR: Skip taking a copy of the columnstore data in the bucket. [default: no\-sb]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-nb, \-\-name\-backup TEXT\fR: Define the name of the backup \- default: $(date +%m\-%d\-%Y) [default: 03\-20\-2025]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-c, \-\-compress TEXT\fR: Compress backup in X format \- Options: [ pigz ].
|
||||
.IP \(bu 2
|
||||
\fB\fC\-q, \-\-quiet / \-no\-q, \-\-no\-quiet\fR: Silence verbose copy command outputs. [default: no\-q]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-nv\-ssl, \-\-no\-verify\-ssl / \-v\-ssl, \-\-verify\-ssl\fR: Skips verifying ssl certs, useful for onpremise s3 storage. [default: v\-ssl]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-pi, \-\-poll\-interval INTEGER\fR: Number of seconds between poll checks for active writes & cpimports. [default: 5]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-pmw, \-\-poll\-max\-wait INTEGER\fR: Max number of minutes for polling checks for writes to wait before exiting as a failed backup attempt. [default: 60]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-r, \-\-retention\-days INTEGER\fR: Retain backups created within the last X days, default 0 == keep all backups. [default: 0]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-aro, \-\-apply\-retention\-only\fR: Only apply retention policy to existing backups, does not run a backup.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-li, \-\-list\fR: List backups.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.SH \fB\fCmcs dbrm_backup\fR
|
||||
.PP
|
||||
Columnstore DBRM Backup.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs dbrm_backup [OPTIONS]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-i, \-\-interval INTEGER\fR: Number of minutes to sleep when \-\-mode=loop. [default: 90]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-r, \-\-retention\-days INTEGER\fR: Retain dbrm backups created within the last X days, the rest are deleted [default: 7]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-bl, \-\-backup\-location TEXT\fR: Path of where to save the dbrm backups on disk. [default: /tmp/dbrm_backups]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-m, \-\-mode TEXT\fR: \[dq]loop\[dq] or \[dq]once\[dq] ; Determines if this script runs in a forever loop sleeping \-i minutes or just once. [default: once]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-nb, \-\-name\-backup TEXT\fR: Define the prefix of the backup \- default: dbrm\fIbackup+date +%Y%m%d\fP%H%M%S [default: dbrm_backup]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-ssm, \-\-skip\-storage\-manager / \-no\-ssm, \-\-no\-skip\-storage\-manager\fR: Skip backing up storagemanager directory. [default: no\-ssm]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-q, \-\-quiet / \-no\-q, \-\-no\-quiet\fR: Silence verbose copy command outputs. [default: no\-q]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-li, \-\-list\fR: List backups.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.SH \fB\fCmcs restore\fR
|
||||
.PP
|
||||
Restore Columnstore (and/or MariaDB) data.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs restore [OPTIONS]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-l, \-\-load TEXT\fR: What date folder to load from the backup_location.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-bl, \-\-backup\-location TEXT\fR: Where the backup to load is found.
|
||||
Example: /mnt/backups/ [default: /tmp/backups/]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-bd, \-\-backup_destination TEXT\fR: Is this backup on the same or remote server compared to where this script is running.
|
||||
Options: \[dq]Local\[dq] or \[dq]Remote\[dq] [default: Local]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-scp, \-\-secure\-copy\-protocol TEXT\fR: Used only if \-\-backup\-destination=RemoteThe user/credentials that will be used to scp the backup files.Example: \[dq]\[la]centos@10.14.51.62\[ra]\[dq]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-bb, \-\-backup\-bucket TEXT\fR: Only used if \-\-storage=S3
|
||||
Name of the bucket to store the columnstore backups.
|
||||
Example: \[dq]s3://my\-cs\-backups\[dq]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-url, \-\-endpoint\-url TEXT\fR: Used by on premise S3 vendors.
|
||||
Example: \[dq]\[la]http://127.0.0.1:8000\[ra]\[dq]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-s, \-\-storage TEXT\fR: What storage topogoly is being used by Columnstore \- found in /etc/columnstore/storagemanager.cnf.
|
||||
Options: \[dq]LocalStorage\[dq] or \[dq]S3\[dq] [default: LocalStorage]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-dbs, \-\-dbroots INTEGER\fR: Number of database roots in the backup. [default: 1]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-pm, \-\-nodeid TEXT\fR: Forces the handling of the restore as this node as opposed to whats detected on disk.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-nb, \-\-new\-bucket TEXT\fR: Defines the new bucket to copy the s3 data to from the backup bucket. Use \-nb if the new restored cluster should use a different bucket than the backup bucket itself.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-nr, \-\-new\-region TEXT\fR: Defines the region of the new bucket to copy the s3 data to from the backup bucket.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-nk, \-\-new\-key TEXT\fR: Defines the aws key to connect to the new_bucket.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-ns, \-\-new\-secret TEXT\fR: Defines the aws secret of the aws key to connect to the new_bucket.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-P, \-\-parallel INTEGER\fR: Determines number of decompression and mdbstream threads. Ignored if \[dq]\-c/\-\-compress\[dq] argument not set. [default: 4]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-ha, \-\-highavilability / \-no\-ha, \-\-no\-highavilability\fR: Flag for high available systems (meaning shared storage exists supporting the topology so that each node sees all data) [default: no\-ha]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-cont, \-\-continue / \-no\-cont, \-\-no\-continue\fR: This acknowledges data in your \-\-new\fIbucket is ok to delete when restoring S3. When set to true skips the enforcement that new\fPbucket should be empty prior to starting a restore. [default: no\-cont]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-f, \-\-config\-file TEXT\fR: Path to backup configuration file to load variables from \- relative or full path accepted.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-smdb, \-\-skip\-mariadb\-backup / \-no\-smdb, \-\-no\-skip\-mariadb\-backup\fR: Skip restoring mariadb server via mariadb\-backup \- ideal for only restoring columnstore. [default: no\-smdb]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-sb, \-\-skip\-bucket\-data / \-no\-sb, \-\-no\-skip\-bucket\-data\fR: Skip restoring columnstore data in the bucket \- ideal if looking to only restore mariadb server. [default: no\-sb]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-c, \-\-compress TEXT\fR: Hint that the backup is compressed in X format. Options: [ pigz ].
|
||||
.IP \(bu 2
|
||||
\fB\fC\-q, \-\-quiet / \-no\-q, \-\-no\-quiet\fR: Silence verbose copy command outputs. [default: no\-q]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-nv\-ssl, \-\-no\-verify\-ssl / \-v\-ssl, \-\-verify\-ssl\fR: Skips verifying ssl certs, useful for onpremise s3 storage. [default: v\-ssl]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-li, \-\-list\fR: List backups.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.SH \fB\fCmcs dbrm_restore\fR
|
||||
.PP
|
||||
Restore Columnstore DBRM data.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs dbrm_restore [OPTIONS]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-bl, \-\-backup\-location TEXT\fR: Path of where dbrm backups exist on disk. [default: /tmp/dbrm_backups]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-l, \-\-load TEXT\fR: Name of the directory to restore from \-bl
|
||||
.IP \(bu 2
|
||||
\fB\fC\-ns, \-\-no\-start\fR: Do not attempt columnstore startup post dbrm_restore.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-sdbk, \-\-skip\-dbrm\-backup / \-no\-sdbk, \-\-no\-skip\-dbrm\-backup\fR: Skip backing up dbrms before restoring. [default: sdbk]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-ssm, \-\-skip\-storage\-manager / \-no\-ssm, \-\-no\-skip\-storage\-manager\fR: Skip backing up storagemanager directory. [default: ssm]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-li, \-\-list\fR: List backups.
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.SH \fB\fCmcs help\-all\fR
|
||||
.PP
|
||||
Show help for all commands in man page style.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs help\-all [OPTIONS]
|
||||
.fi
|
||||
.RE
|
||||
.SH \fB\fCmcs status\fR
|
||||
.PP
|
||||
Get status information.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs status [OPTIONS]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.SH \fB\fCmcs stop\fR
|
||||
.PP
|
||||
Stop the Columnstore cluster.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs stop [OPTIONS]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-i, \-\-interactive / \-no\-i, \-\-no\-interactive\fR: Use this option on active cluster as interactive stop waits for current writes to complete in DMLProc before shutting down. Ensuring consistency, preventing data loss of active writes. [default: no\-interactive]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-t, \-\-timeout INTEGER\fR: Time in seconds to wait for DMLproc to gracefully stop.Warning: Low wait timeout values could result in data loss if the cluster is very active.In interactive mode means delay time between promts. [default: 15]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.SH \fB\fCmcs start\fR
|
||||
.PP
|
||||
Start the Columnstore cluster.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs start [OPTIONS]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.SH \fB\fCmcs restart\fR
|
||||
.PP
|
||||
Restart the Columnstore cluster.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs restart [OPTIONS]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.SH \fB\fCmcs node\fR
|
||||
.PP
|
||||
Cluster nodes management.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs node [OPTIONS] COMMAND [ARGS]...
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.PP
|
||||
\fBCommands\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fCadd\fR: Add nodes to the Columnstore cluster.
|
||||
.IP \(bu 2
|
||||
\fB\fCremove\fR: Remove nodes from the Columnstore cluster.
|
||||
.RE
|
||||
.SS \fB\fCmcs node add\fR
|
||||
.PP
|
||||
Add nodes to the Columnstore cluster.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs node add [OPTIONS]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-node TEXT\fR: node IP, name or FQDN. Can be used multiple times to add several nodes at a time. [required]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.SS \fB\fCmcs node remove\fR
|
||||
.PP
|
||||
Remove nodes from the Columnstore cluster.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs node remove [OPTIONS]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-node TEXT\fR: node IP, name or FQDN. Can be used multiple times to remove several nodes at a time. [required]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.SH \fB\fCmcs set\fR
|
||||
.PP
|
||||
Set cluster parameters.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs set [OPTIONS] COMMAND [ARGS]...
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.PP
|
||||
\fBCommands\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fCmode\fR: Set Columnstore cluster mode.
|
||||
.IP \(bu 2
|
||||
\fB\fCapi\-key\fR: Set API key for communication with cluster...
|
||||
.IP \(bu 2
|
||||
\fB\fClog\-level\fR: Set logging level on all cluster nodes for...
|
||||
.RE
|
||||
.SS \fB\fCmcs set mode\fR
|
||||
.PP
|
||||
Set Columnstore cluster mode.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs set mode [OPTIONS]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-mode TEXT\fR: cluster mode to set. \[dq]readonly\[dq] or \[dq]readwrite\[dq] are the only acceptable values. [required]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.SS \fB\fCmcs set api\-key\fR
|
||||
.PP
|
||||
Set API key for communication with cluster nodes via API.
|
||||
.PP
|
||||
WARNING: this command will affect API key value on all cluster nodes.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs set api\-key [OPTIONS]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-key TEXT\fR: API key to set. [required]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.SS \fB\fCmcs set log\-level\fR
|
||||
.PP
|
||||
Set logging level on all cluster nodes for develop purposes.
|
||||
.PP
|
||||
WARNING: this could dramatically affect the number of log lines.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs set log\-level [OPTIONS]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-level TEXT\fR: Logging level to set. [required]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.SH \fB\fCmcs cluster\fR
|
||||
.PP
|
||||
MariaDB Columnstore cluster management command line tool.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs cluster [OPTIONS] COMMAND [ARGS]...
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.PP
|
||||
\fBCommands\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fCstatus\fR: Get status information.
|
||||
.IP \(bu 2
|
||||
\fB\fCstop\fR: Stop the Columnstore cluster.
|
||||
.IP \(bu 2
|
||||
\fB\fCstart\fR: Start the Columnstore cluster.
|
||||
.IP \(bu 2
|
||||
\fB\fCrestart\fR: Restart the Columnstore cluster.
|
||||
.IP \(bu 2
|
||||
\fB\fCnode\fR: Cluster nodes management.
|
||||
.IP \(bu 2
|
||||
\fB\fCset\fR: Set cluster parameters.
|
||||
.RE
|
||||
.SS \fB\fCmcs cluster status\fR
|
||||
.PP
|
||||
Get status information.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs cluster status [OPTIONS]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.SS \fB\fCmcs cluster stop\fR
|
||||
.PP
|
||||
Stop the Columnstore cluster.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs cluster stop [OPTIONS]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-i, \-\-interactive / \-no\-i, \-\-no\-interactive\fR: Use this option on active cluster as interactive stop waits for current writes to complete in DMLProc before shutting down. Ensuring consistency, preventing data loss of active writes. [default: no\-interactive]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-t, \-\-timeout INTEGER\fR: Time in seconds to wait for DMLproc to gracefully stop.Warning: Low wait timeout values could result in data loss if the cluster is very active.In interactive mode means delay time between promts. [default: 15]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.SS \fB\fCmcs cluster start\fR
|
||||
.PP
|
||||
Start the Columnstore cluster.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs cluster start [OPTIONS]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.SS \fB\fCmcs cluster restart\fR
|
||||
.PP
|
||||
Restart the Columnstore cluster.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs cluster restart [OPTIONS]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.SS \fB\fCmcs cluster node\fR
|
||||
.PP
|
||||
Cluster nodes management.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs cluster node [OPTIONS] COMMAND [ARGS]...
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.PP
|
||||
\fBCommands\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fCadd\fR: Add nodes to the Columnstore cluster.
|
||||
.IP \(bu 2
|
||||
\fB\fCremove\fR: Remove nodes from the Columnstore cluster.
|
||||
.RE
|
||||
.SS \fB\fCmcs cluster node add\fR
|
||||
.PP
|
||||
Add nodes to the Columnstore cluster.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs cluster node add [OPTIONS]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-node TEXT\fR: node IP, name or FQDN. Can be used multiple times to add several nodes at a time. [required]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.SS \fB\fCmcs cluster node remove\fR
|
||||
.PP
|
||||
Remove nodes from the Columnstore cluster.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs cluster node remove [OPTIONS]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-node TEXT\fR: node IP, name or FQDN. Can be used multiple times to remove several nodes at a time. [required]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.SS \fB\fCmcs cluster set\fR
|
||||
.PP
|
||||
Set cluster parameters.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs cluster set [OPTIONS] COMMAND [ARGS]...
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.PP
|
||||
\fBCommands\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fCmode\fR: Set Columnstore cluster mode.
|
||||
.IP \(bu 2
|
||||
\fB\fCapi\-key\fR: Set API key for communication with cluster...
|
||||
.IP \(bu 2
|
||||
\fB\fClog\-level\fR: Set logging level on all cluster nodes for...
|
||||
.RE
|
||||
.SS \fB\fCmcs cluster set mode\fR
|
||||
.PP
|
||||
Set Columnstore cluster mode.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs cluster set mode [OPTIONS]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-mode TEXT\fR: cluster mode to set. \[dq]readonly\[dq] or \[dq]readwrite\[dq] are the only acceptable values. [required]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.SS \fB\fCmcs cluster set api\-key\fR
|
||||
.PP
|
||||
Set API key for communication with cluster nodes via API.
|
||||
.PP
|
||||
WARNING: this command will affect API key value on all cluster nodes.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs cluster set api\-key [OPTIONS]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-key TEXT\fR: API key to set. [required]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.SS \fB\fCmcs cluster set log\-level\fR
|
||||
.PP
|
||||
Set logging level on all cluster nodes for develop purposes.
|
||||
.PP
|
||||
WARNING: this could dramatically affect the number of log lines.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs cluster set log\-level [OPTIONS]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-level TEXT\fR: Logging level to set. [required]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.SH \fB\fCmcs cmapi\fR
|
||||
.PP
|
||||
CMAPI itself related commands.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs cmapi [OPTIONS] COMMAND [ARGS]...
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
||||
.PP
|
||||
\fBCommands\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fCis\-ready\fR: Check CMAPI is ready to handle requests.
|
||||
.RE
|
||||
.SS \fB\fCmcs cmapi is\-ready\fR
|
||||
.PP
|
||||
Check CMAPI is ready to handle requests.
|
||||
.PP
|
||||
\fBUsage\fP:
|
||||
.PP
|
||||
.RS
|
||||
.nf
|
||||
$ mcs cmapi is\-ready [OPTIONS]
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
\fBOptions\fP:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-node TEXT\fR: Which node to check the CMAPI is ready to handle requests. [default: 127.0.0.1]
|
||||
.IP \(bu 2
|
||||
\fB\fC\-\-help\fR: Show this message and exit.
|
||||
.RE
|
@@ -144,6 +144,16 @@ def restore(
|
||||
)
|
||||
)
|
||||
] = '',
|
||||
P: Annotated[
|
||||
int,
|
||||
typer.Option(
|
||||
'-P', '--parallel',
|
||||
help=(
|
||||
'Determines number of decompression and mdbstream threads. '
|
||||
'Ignored if "-c/--compress" argument not set.'
|
||||
)
|
||||
)
|
||||
] = 4,
|
||||
ha: Annotated[
|
||||
bool,
|
||||
typer.Option(
|
||||
@@ -170,7 +180,10 @@ def restore(
|
||||
str,
|
||||
typer.Option(
|
||||
'-f', '--config-file',
|
||||
help='Path to backup configuration file to load variables from.',
|
||||
help=(
|
||||
'Path to backup configuration file to load variables from - '
|
||||
'relative or full path accepted.'
|
||||
),
|
||||
show_default=False
|
||||
)
|
||||
] = '',
|
||||
@@ -218,16 +231,6 @@ def restore(
|
||||
show_default=False
|
||||
)
|
||||
] = '',
|
||||
P: Annotated[
|
||||
int,
|
||||
typer.Option(
|
||||
'-P', '--parallel',
|
||||
help=(
|
||||
'Determines number of decompression and mdbstream threads. '
|
||||
'Ignored if "-c/--compress" argument not set.'
|
||||
)
|
||||
)
|
||||
] = 4,
|
||||
q: Annotated[
|
||||
bool,
|
||||
typer.Option(
|
||||
@@ -242,6 +245,13 @@ def restore(
|
||||
help='Skips verifying ssl certs, useful for onpremise s3 storage.'
|
||||
)
|
||||
] = False,
|
||||
list: Annotated[
|
||||
bool,
|
||||
typer.Option(
|
||||
'-li', '--list',
|
||||
help='List backups.'
|
||||
)
|
||||
] = False
|
||||
):
|
||||
"""Restore Columnstore (and/or MariaDB) data."""
|
||||
|
||||
@@ -266,18 +276,18 @@ def restore(
|
||||
|
||||
@handle_output
|
||||
def dbrm_restore(
|
||||
p: Annotated[
|
||||
bl: Annotated[
|
||||
str,
|
||||
typer.Option(
|
||||
'-p', '--path',
|
||||
help='Path of where dbrm backups stored on disk.'
|
||||
'-bl', '--backup-location',
|
||||
help='Path of where dbrm backups exist on disk.'
|
||||
)
|
||||
] = '/tmp/dbrm_backups',
|
||||
d: Annotated[
|
||||
l: Annotated[
|
||||
str,
|
||||
typer.Option(
|
||||
'-d', '--directory',
|
||||
help='Date or directory chose to restore from.'
|
||||
'-l', '--load',
|
||||
help='Name of the directory to restore from -bl'
|
||||
)
|
||||
] = '',
|
||||
ns: Annotated[
|
||||
@@ -305,14 +315,21 @@ def dbrm_restore(
|
||||
help='Skip backing up storagemanager directory.'
|
||||
)
|
||||
] = True,
|
||||
list: Annotated[
|
||||
bool,
|
||||
typer.Option(
|
||||
'-li', '--list',
|
||||
help='List backups.'
|
||||
)
|
||||
] = False
|
||||
):
|
||||
"""Restore Columnstore DBRM data."""
|
||||
|
||||
# Default: ./$0 dbrm_restore --path /tmp/dbrm_backups
|
||||
# Default: ./$0 dbrm_restore --backup-location /tmp/dbrm_backups
|
||||
|
||||
# Examples:
|
||||
# ./$0 dbrm_restore --path /tmp/dbrm_backups --directory dbrm_backup_20240318_172842
|
||||
# ./$0 dbrm_restore --path /tmp/dbrm_backups --directory dbrm_backup_20240318_172842 --no-start
|
||||
# ./$0 dbrm_restore --backup-location /tmp/dbrm_backups --load dbrm_backup_20240318_172842
|
||||
# ./$0 dbrm_restore --backup-location /tmp/dbrm_backups --load dbrm_backup_20240318_172842 --no-startdbrm_restore --path /tmp/dbrm_backups --directory dbrm_backup_20240318_172842 --no-start
|
||||
arguments = []
|
||||
for arg_name, value in locals().items():
|
||||
sh_arg = cook_sh_arg(arg_name, value)
|
||||
|
@@ -7,7 +7,8 @@ lxml==4.7.1
|
||||
psutil==5.9.1
|
||||
pyotp==2.6.0
|
||||
requests==2.27.1
|
||||
typer==0.9.0
|
||||
typer==0.15.1
|
||||
|
||||
|
||||
# indirect dependencies
|
||||
aiohttp==3.8.1
|
||||
@@ -24,7 +25,7 @@ certifi==2021.10.8
|
||||
cffi==1.15.0
|
||||
charset-normalizer==2.0.12
|
||||
cheroot==8.6.0
|
||||
click==8.1.7
|
||||
click==8.1.8
|
||||
colorama==0.4.4
|
||||
crcmod==1.7
|
||||
docutils==0.16
|
||||
@@ -44,6 +45,8 @@ jaraco.context==4.1.1
|
||||
jaraco.functools==3.5.0
|
||||
jaraco.text==3.7.0
|
||||
jmespath==1.0.1
|
||||
markdown-it-py==3.0.0
|
||||
mdurl==0.1.2
|
||||
monotonic==1.6
|
||||
more-itertools==8.12.0
|
||||
multidict==6.0.2
|
||||
@@ -53,20 +56,23 @@ portend==3.1.0
|
||||
pyasn1-modules==0.2.8
|
||||
pyasn1==0.4.8
|
||||
pycparser==2.21
|
||||
Pygments==2.19.1
|
||||
pyOpenSSL==22.0.0
|
||||
pyparsing==3.0.9
|
||||
python-dateutil==2.8.2
|
||||
pytz==2021.3
|
||||
pyu2f==0.1.5
|
||||
PyYAML==5.4.1
|
||||
rich==13.9.4
|
||||
repoze.lru==0.7
|
||||
retry-decorator==1.1.1
|
||||
Routes==2.5.1
|
||||
rsa==4.7.2
|
||||
s3transfer==0.6.0
|
||||
shellingham==1.5.4
|
||||
six==1.16.0
|
||||
tempora==5.0.1
|
||||
typing-extensions==4.8.0
|
||||
typing_extensions==4.12.2
|
||||
urllib3==1.26.8
|
||||
yarl==1.8.1
|
||||
zc.lockfile==2.0
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -20,7 +20,7 @@ wget https://dlm.mariadb.com/enterprise-release-helpers/mariadb_es_repo_setup -O
|
||||
chmod +x mariadb_es_repo_setup
|
||||
bash -c "./mariadb_es_repo_setup --token=${UPGRADE_TOKEN} --apply --mariadb-server-version=${VERSION} --skip-maxscale --skip-tools"
|
||||
apt update --yes
|
||||
apt install --yes mariadb-server mariadb-client mariadb-plugin-columnstore
|
||||
apt install --yes -oDebug::RunScripts=1 mariadb-server mariadb-client mariadb-plugin-columnstore
|
||||
systemctl start mariadb
|
||||
systemctl start mariadb-columnstore
|
||||
|
||||
@@ -49,7 +49,7 @@ bash -c "./setup-repo.sh"
|
||||
|
||||
# the -o options are used to make choise of keep your currently-installed version without interactive prompt
|
||||
|
||||
apt-get --yes --with-new-pkgs -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
|
||||
apt-get --yes --with-new-pkgs -oDebug::RunScripts=1 -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
|
||||
|
||||
UPGRADED_VERSION=$(mariadb -e "select @@version;")
|
||||
|
||||
|
@@ -58,7 +58,7 @@ class DataCondition
|
||||
return mError;
|
||||
}
|
||||
|
||||
// Adjust a sigened integer of any size to the range [-absMaxVal , +absMaxVal]
|
||||
// Adjust a signed integer of any size to the range [-absMaxVal , +absMaxVal]
|
||||
template <typename T>
|
||||
void adjustSIntXRange(T& val, T absMaxVal)
|
||||
{
|
||||
|
@@ -125,7 +125,7 @@ struct WidthToSIntegralType<16> : _WidthToSIntegralType<16, int128_t>
|
||||
{
|
||||
};
|
||||
|
||||
void decimalPrecisionAndScale(const utils::NullString& value, int &precision, int &scale);
|
||||
void decimalPrecisionAndScale(const utils::NullString& value, int& precision, int& scale);
|
||||
|
||||
// XXX: It is assumed here that ALL TYPES have width, scale and precision.
|
||||
// XXX: And then some of them have the type tag itself.
|
||||
@@ -147,8 +147,8 @@ class TypeAttributesStd
|
||||
/**
|
||||
@brief Convenience method to get int128 from a std::string.
|
||||
*/
|
||||
int128_t decimal128FromString(const std::string& value, bool* saturate = 0) const;
|
||||
int128_t decimal128FromString(const utils::NullString& value, bool* saturate = 0) const;
|
||||
int128_t decimal128FromString(const std::string& value, bool* saturate = nullptr) const;
|
||||
int128_t decimal128FromString(const utils::NullString& value, bool* saturate = nullptr) const;
|
||||
|
||||
/**
|
||||
@brief The method sets the legacy scale and precision of a wide decimal
|
||||
@@ -507,7 +507,7 @@ class SessionParam
|
||||
long m_timeZone;
|
||||
|
||||
public:
|
||||
SessionParam(long timeZone) : m_timeZone(timeZone)
|
||||
explicit SessionParam(long timeZone) : m_timeZone(timeZone)
|
||||
{
|
||||
}
|
||||
long timeZone() const
|
||||
@@ -576,7 +576,7 @@ class SimpleValue
|
||||
class SimpleValueSInt64 : public SimpleValue
|
||||
{
|
||||
public:
|
||||
SimpleValueSInt64(int64_t value) : SimpleValue(value, 0, 0)
|
||||
explicit SimpleValueSInt64(int64_t value) : SimpleValue(value, 0, 0)
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -584,7 +584,7 @@ class SimpleValueSInt64 : public SimpleValue
|
||||
class SimpleValueUInt64 : public SimpleValue
|
||||
{
|
||||
public:
|
||||
SimpleValueUInt64(uint64_t value) : SimpleValue(static_cast<int64_t>(value), 0, 0)
|
||||
explicit SimpleValueUInt64(uint64_t value) : SimpleValue(static_cast<int64_t>(value), 0, 0)
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -592,7 +592,7 @@ class SimpleValueUInt64 : public SimpleValue
|
||||
class SimpleValueSInt128 : public SimpleValue
|
||||
{
|
||||
public:
|
||||
SimpleValueSInt128(int128_t value) : SimpleValue(0, value, 0)
|
||||
explicit SimpleValueSInt128(int128_t value) : SimpleValue(0, value, 0)
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -740,7 +740,7 @@ class MinMaxPartitionInfo : public MinMaxInfo
|
||||
|
||||
public:
|
||||
MinMaxPartitionInfo() : m_status(0){};
|
||||
MinMaxPartitionInfo(const BRM::EMEntry& entry);
|
||||
explicit MinMaxPartitionInfo(const BRM::EMEntry& entry);
|
||||
void set_invalid()
|
||||
{
|
||||
m_status |= CPINVALID;
|
||||
@@ -859,8 +859,8 @@ class DatabaseQualifiedColumnName
|
||||
std::string m_column;
|
||||
|
||||
public:
|
||||
DatabaseQualifiedColumnName(const std::string& db, const std::string& table, const std::string& column)
|
||||
: m_db(db), m_table(table), m_column(column)
|
||||
DatabaseQualifiedColumnName(std::string db, std::string table, std::string column)
|
||||
: m_db(std::move(db)), m_table(std::move(table)), m_column(std::move(column))
|
||||
{
|
||||
}
|
||||
const std::string& db() const
|
||||
@@ -880,9 +880,8 @@ class DatabaseQualifiedColumnName
|
||||
class StoreField
|
||||
{
|
||||
public:
|
||||
virtual ~StoreField()
|
||||
{
|
||||
}
|
||||
virtual ~StoreField() = default;
|
||||
|
||||
virtual int32_t colWidth() const = 0;
|
||||
virtual int32_t precision() const = 0;
|
||||
virtual int32_t scale() const = 0;
|
||||
@@ -910,9 +909,8 @@ class StoreField
|
||||
class WriteBatchField
|
||||
{
|
||||
public:
|
||||
virtual ~WriteBatchField()
|
||||
{
|
||||
}
|
||||
virtual ~WriteBatchField() = default;
|
||||
|
||||
virtual size_t ColWriteBatchDate(const unsigned char* buf, bool nullVal, ColBatchWriter& ci) = 0;
|
||||
virtual size_t ColWriteBatchDatetime(const unsigned char* buf, bool nullVal, ColBatchWriter& ci) = 0;
|
||||
virtual size_t ColWriteBatchTime(const unsigned char* buf, bool nullVal, ColBatchWriter& ci) = 0;
|
||||
@@ -957,9 +955,8 @@ class TypeHandler
|
||||
public:
|
||||
static const TypeHandler* find(SystemCatalog::ColDataType typeCode, const TypeAttributesStd& attr);
|
||||
static const TypeHandler* find_by_ddltype(const ddlpackage::ColumnType& ct);
|
||||
virtual ~TypeHandler()
|
||||
{
|
||||
}
|
||||
virtual ~TypeHandler() = default;
|
||||
|
||||
virtual const string& name() const = 0;
|
||||
virtual const string print(const TypeAttributesStd& attr) const
|
||||
{
|
||||
@@ -985,11 +982,11 @@ class TypeHandler
|
||||
const SimpleColumnParam& prm) const = 0;
|
||||
virtual SimpleValue getMinValueSimple() const
|
||||
{
|
||||
return SimpleValue(std::numeric_limits<int64_t>::min(), std::numeric_limits<int64_t>::min(), 0);
|
||||
return {std::numeric_limits<int64_t>::min(), std::numeric_limits<int64_t>::min(), 0};
|
||||
}
|
||||
virtual SimpleValue getMaxValueSimple() const
|
||||
{
|
||||
return SimpleValue(std::numeric_limits<int64_t>::max(), std::numeric_limits<int64_t>::max(), 0);
|
||||
return {std::numeric_limits<int64_t>::max(), std::numeric_limits<int64_t>::max(), 0};
|
||||
}
|
||||
virtual SimpleValue toSimpleValue(const SessionParam& sp, const TypeAttributesStd& attr, const char* str,
|
||||
round_style_t& rf) const = 0;
|
||||
@@ -1052,18 +1049,18 @@ class TypeHandlerBit : public TypeHandler
|
||||
const SimpleColumnParam& prm) const override
|
||||
{
|
||||
idbassert(0);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
SimpleValue toSimpleValue(const SessionParam& sp, const TypeAttributesStd& attr, const char* str,
|
||||
round_style_t& rf) const override
|
||||
{
|
||||
idbassert(0);
|
||||
return SimpleValue();
|
||||
return {};
|
||||
}
|
||||
boost::any getNullValueForType(const TypeAttributesStd& attr) const override
|
||||
{
|
||||
// TODO: How to communicate with write engine?
|
||||
return boost::any();
|
||||
return {};
|
||||
}
|
||||
boost::any convertFromString(const TypeAttributesStd& colType, const ConvertFromStringParam& prm,
|
||||
const std::string& str, bool& pushWarning) const override;
|
||||
@@ -1808,11 +1805,11 @@ class TypeHandlerSDecimal128 : public TypeHandlerXDecimal
|
||||
}
|
||||
SimpleValue getMinValueSimple() const override
|
||||
{
|
||||
return SimpleValue(std::numeric_limits<int64_t>::min(), datatypes::minInt128, 0);
|
||||
return {std::numeric_limits<int64_t>::min(), datatypes::minInt128, 0};
|
||||
}
|
||||
SimpleValue getMaxValueSimple() const override
|
||||
{
|
||||
return SimpleValue(std::numeric_limits<int64_t>::max(), datatypes::maxInt128, 0);
|
||||
return {std::numeric_limits<int64_t>::max(), datatypes::maxInt128, 0};
|
||||
}
|
||||
MinMaxInfo widenMinMaxInfo(const TypeAttributesStd& attr, const MinMaxInfo& a,
|
||||
const MinMaxInfo& b) const override
|
||||
@@ -1914,7 +1911,7 @@ class TypeHandlerReal : public TypeHandler
|
||||
SimpleValue toSimpleValue(const SessionParam& sp, const TypeAttributesStd& attr, const char* str,
|
||||
round_style_t& rf) const override
|
||||
{
|
||||
return SimpleValue(); // QQ: real types were not handled in IDB_format()
|
||||
return {}; // QQ: real types were not handled in IDB_format()
|
||||
}
|
||||
std::string format(const SimpleValue& v, const TypeAttributesStd& attr) const override
|
||||
{
|
||||
@@ -2047,13 +2044,13 @@ class TypeHandlerSLongDouble : public TypeHandlerReal
|
||||
boost::any getNullValueForType(const TypeAttributesStd& attr) const override
|
||||
{
|
||||
// QQ: DDLPackageProcessor::getNullValueForType() did not handle LONGDOUBLE
|
||||
return boost::any();
|
||||
return {};
|
||||
}
|
||||
boost::any convertFromString(const TypeAttributesStd& colType, const ConvertFromStringParam& prm,
|
||||
const std::string& str, bool& pushWarning) const override
|
||||
{
|
||||
throw logging::QueryDataExcept("convertColumnData: unknown column data type.", logging::dataTypeErr);
|
||||
return boost::any();
|
||||
return {};
|
||||
}
|
||||
const uint8_t* getEmptyValueForType(const TypeAttributesStd& attr) const override
|
||||
{
|
||||
@@ -2255,7 +2252,7 @@ class TypeHandlerClob : public TypeHandlerStr
|
||||
}
|
||||
boost::any getNullValueForType(const TypeAttributesStd& attr) const override
|
||||
{
|
||||
return boost::any(); // QQ
|
||||
return {}; // QQ
|
||||
}
|
||||
boost::any convertFromString(const TypeAttributesStd& colType, const ConvertFromStringParam& prm,
|
||||
const std::string& str, bool& pushWarning) const override;
|
||||
|
@@ -300,9 +300,9 @@ struct lldiv_t_128
|
||||
inline lldiv_t_128 lldiv128(const int128_t& dividend, const int128_t& divisor)
|
||||
{
|
||||
if (UNLIKELY(divisor == 0) || UNLIKELY(dividend == 0))
|
||||
return lldiv_t_128();
|
||||
return {};
|
||||
|
||||
return lldiv_t_128(dividend / divisor, dividend % divisor);
|
||||
return {dividend / divisor, dividend % divisor};
|
||||
}
|
||||
|
||||
// TODO: derive it from TSInt64 eventually
|
||||
@@ -381,9 +381,8 @@ class TDecimal128 : public TSInt128
|
||||
}
|
||||
|
||||
public:
|
||||
TDecimal128()
|
||||
{
|
||||
}
|
||||
TDecimal128() = default;
|
||||
|
||||
explicit TDecimal128(const int128_t val) : TSInt128(val)
|
||||
{
|
||||
}
|
||||
@@ -541,11 +540,6 @@ class Decimal : public TDecimal128, public TDecimal64
|
||||
return TSInt128(s128Value);
|
||||
}
|
||||
|
||||
inline TFloat128 toTFloat128() const
|
||||
{
|
||||
return TFloat128(s128Value);
|
||||
}
|
||||
|
||||
inline double toDouble() const
|
||||
{
|
||||
int128_t scaleDivisor;
|
||||
@@ -554,7 +548,7 @@ class Decimal : public TDecimal128, public TDecimal64
|
||||
return static_cast<double>(tmpval);
|
||||
}
|
||||
|
||||
inline operator double() const
|
||||
inline explicit operator double() const
|
||||
{
|
||||
return toDouble();
|
||||
}
|
||||
@@ -567,7 +561,7 @@ class Decimal : public TDecimal128, public TDecimal64
|
||||
return static_cast<float>(tmpval);
|
||||
}
|
||||
|
||||
inline operator float() const
|
||||
inline explicit operator float() const
|
||||
{
|
||||
return toFloat();
|
||||
}
|
||||
@@ -580,7 +574,7 @@ class Decimal : public TDecimal128, public TDecimal64
|
||||
return static_cast<long double>(tmpval);
|
||||
}
|
||||
|
||||
inline operator long double() const
|
||||
inline explicit operator long double() const
|
||||
{
|
||||
return toLongDouble();
|
||||
}
|
||||
@@ -1016,7 +1010,6 @@ struct NoOverflowCheck
|
||||
{
|
||||
void operator()(const int128_t& x, const int128_t& y)
|
||||
{
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -32,6 +32,7 @@ ADD_LIBRARY(ddlpackage SHARED
|
||||
markpartition.cpp
|
||||
restorepartition.cpp
|
||||
droppartition.cpp
|
||||
debugstatement.cpp
|
||||
${BISON_ddl_gram_OUTPUTS}
|
||||
${FLEX_ddl_scan_OUTPUTS}
|
||||
)
|
||||
|
@@ -34,7 +34,7 @@ int ddldebug = 0;
|
||||
int lineno = 1;
|
||||
void ddlerror(struct pass_to_bison* x, char const *s);
|
||||
|
||||
static char* scanner_copy(char *str, yyscan_t yyscanner, copy_action_t action = NOOP );
|
||||
static char* scanner_copy(const char *str, yyscan_t yyscanner, copy_action_t action = NOOP );
|
||||
|
||||
%}
|
||||
|
||||
@@ -115,9 +115,9 @@ CONSTRAINT {return CONSTRAINT;}
|
||||
CONSTRAINTS {return CONSTRAINTS;}
|
||||
CREATE {return CREATE;}
|
||||
CURRENT_USER {return CURRENT_USER;}
|
||||
DATE {ddlget_lval(yyscanner)->str=strdup("date"); return DATE;}
|
||||
DATE {ddlget_lval(yyscanner)->str = scanner_copy("date", yyscanner); return DATE;}
|
||||
DATETIME {return DATETIME;}
|
||||
TIME {ddlget_lval(yyscanner)->str=strdup("time"); return TIME;}
|
||||
TIME {ddlget_lval(yyscanner)->str = scanner_copy("time", yyscanner); return TIME;}
|
||||
TIMESTAMP {return TIMESTAMP;}
|
||||
DECIMAL {return DECIMAL;}
|
||||
DEC {return DECIMAL;}
|
||||
@@ -276,7 +276,7 @@ void scanner_finish(yyscan_t yyscanner)
|
||||
pScanData->valbuf.clear();
|
||||
}
|
||||
|
||||
char* scanner_copy (char *str, yyscan_t yyscanner, copy_action_t action)
|
||||
char* scanner_copy (const char *str, yyscan_t yyscanner, copy_action_t action)
|
||||
{
|
||||
char* result;
|
||||
char* nv = strdup(str);
|
||||
|
@@ -105,7 +105,6 @@ void fix_column_length_and_charset(SchemaObject* elem, const CHARSET_INFO* def_c
|
||||
column->fType->fLength = 16777215;
|
||||
}
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
%expect 17
|
||||
@@ -255,6 +254,24 @@ ZEROFILL
|
||||
%type <str> opt_quoted_literal
|
||||
%type <str> opt_column_charset
|
||||
%type <str> opt_column_collate
|
||||
|
||||
// for pointers to vectors of pointers:
|
||||
%destructor { if ($$) { for (auto p : *($$)) { delete p; } }; delete $$; } table_element_list
|
||||
|
||||
// for objects allocated during parse:.
|
||||
%destructor { delete $$; } qualified_name ident table_element column_def exact_numeric_type
|
||||
%destructor { delete $$; } table_options opt_table_options table_name
|
||||
%destructor { delete $$; } column_name_list data_type column_constraint
|
||||
%destructor { delete $$; } column_constraint_def column_qualifier_list
|
||||
%destructor { delete $$; } opt_referential_triggered_action referential_triggered_action
|
||||
%destructor { delete $$; } table_option character_string_type binary_string_type blob_type
|
||||
%destructor { delete $$; } text_type numeric_type table_constraint table_constraint_def
|
||||
|
||||
// NOTE: if you have a leak in this code and do not know which one leaks
|
||||
// add %destructor { printf("pop yykind %d\n"; fflush(stdout); } <*>
|
||||
// this will print tags in residual stack after syntax error and you'll see
|
||||
// what is not delete'd.
|
||||
|
||||
%%
|
||||
stmtblock: stmtmulti { x->fParseTree = $1; }
|
||||
;
|
||||
|
@@ -332,7 +332,8 @@ enum DDL_SERIAL_TYPE
|
||||
DDL_TRUNC_TABLE_STATEMENT,
|
||||
DDL_MARK_PARTITION_STATEMENT,
|
||||
DDL_RESTORE_PARTITION_STATEMENT,
|
||||
DDL_DROP_PARTITION_STATEMENT
|
||||
DDL_DROP_PARTITION_STATEMENT,
|
||||
DDL_DEBUG_STATEMENT
|
||||
};
|
||||
|
||||
/** @brief An abstract base for TableDef, ColumnDef, ...
|
||||
@@ -348,11 +349,9 @@ enum DDL_SERIAL_TYPE
|
||||
*/
|
||||
struct SchemaObject
|
||||
{
|
||||
virtual ~SchemaObject()
|
||||
{
|
||||
}
|
||||
virtual ~SchemaObject() = default;
|
||||
|
||||
SchemaObject(std::string name) : fName(name)
|
||||
explicit SchemaObject(std::string name) : fName(name)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -417,9 +416,7 @@ struct SqlStatement
|
||||
*/
|
||||
struct SqlStatementList
|
||||
{
|
||||
SqlStatementList()
|
||||
{
|
||||
}
|
||||
SqlStatementList() = default;
|
||||
|
||||
SqlStatement* operator[](int i) const
|
||||
{
|
||||
@@ -451,17 +448,13 @@ struct QualifiedName
|
||||
/** @brief Serialize to ByteStream */
|
||||
EXPORT virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
|
||||
QualifiedName()
|
||||
{
|
||||
}
|
||||
QualifiedName() = default;
|
||||
|
||||
EXPORT QualifiedName(const char* name);
|
||||
EXPORT explicit QualifiedName(const char* name);
|
||||
EXPORT QualifiedName(const char* name, const char* schema);
|
||||
EXPORT QualifiedName(const char* name, const char* schema, const char* catalog);
|
||||
|
||||
virtual ~QualifiedName()
|
||||
{
|
||||
}
|
||||
virtual ~QualifiedName() = default;
|
||||
|
||||
std::string fCatalog;
|
||||
std::string fName;
|
||||
@@ -478,7 +471,7 @@ struct TableDef : public SchemaObject
|
||||
/** @brief Serialize to ByteStream */
|
||||
EXPORT virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
|
||||
TableDef() : fQualifiedName(0)
|
||||
TableDef() : fQualifiedName(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -494,7 +487,7 @@ struct TableDef : public SchemaObject
|
||||
{
|
||||
}
|
||||
|
||||
EXPORT virtual ~TableDef();
|
||||
EXPORT ~TableDef() override;
|
||||
|
||||
QualifiedName* fQualifiedName;
|
||||
|
||||
@@ -511,22 +504,22 @@ struct TableDef : public SchemaObject
|
||||
struct CreateTableStatement : public SqlStatement
|
||||
{
|
||||
/** @brief Deserialize from ByteStream */
|
||||
EXPORT virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
EXPORT int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
EXPORT virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
EXPORT int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Ctor for deserialization */
|
||||
EXPORT CreateTableStatement();
|
||||
|
||||
/** @brief You can't have a CreateTableStatement without a
|
||||
table defintion */
|
||||
EXPORT CreateTableStatement(TableDef* tableDef);
|
||||
EXPORT explicit CreateTableStatement(TableDef* tableDef);
|
||||
|
||||
EXPORT virtual ~CreateTableStatement();
|
||||
EXPORT ~CreateTableStatement() override;
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
EXPORT virtual std::ostream& put(std::ostream& os) const;
|
||||
EXPORT std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
std::string schemaName() const
|
||||
{
|
||||
@@ -560,13 +553,9 @@ struct AlterTableAction
|
||||
EXPORT virtual int serialize(messageqcpp::ByteStream& bs) = 0;
|
||||
|
||||
/** @brief Ctor for deserialization */
|
||||
AlterTableAction()
|
||||
{
|
||||
}
|
||||
AlterTableAction() = default;
|
||||
|
||||
virtual ~AlterTableAction()
|
||||
{
|
||||
}
|
||||
virtual ~AlterTableAction() = default;
|
||||
|
||||
/** @brief QualifiedName of the focal table for this
|
||||
statement. */
|
||||
@@ -581,24 +570,24 @@ struct AlterTableAction
|
||||
struct AtaAddColumn : public AlterTableAction
|
||||
{
|
||||
/** @brief Deserialize from ByteStream */
|
||||
virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Ctor for deserialization */
|
||||
AtaAddColumn() : fColumnDef(0)
|
||||
AtaAddColumn() : fColumnDef(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
/** @brief You can't add a column without specifying a column
|
||||
definition. */
|
||||
AtaAddColumn(ColumnDef* columnDef);
|
||||
explicit AtaAddColumn(ColumnDef* columnDef);
|
||||
|
||||
virtual ~AtaAddColumn();
|
||||
~AtaAddColumn() override;
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
virtual std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
/** @brief The focal column definition. */
|
||||
ColumnDef* fColumnDef;
|
||||
@@ -610,22 +599,20 @@ struct AtaAddColumn : public AlterTableAction
|
||||
struct AtaAddColumns : public AlterTableAction
|
||||
{
|
||||
/** @brief Deserialize from ByteStream */
|
||||
virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Ctor for deserialization */
|
||||
AtaAddColumns()
|
||||
{
|
||||
}
|
||||
AtaAddColumns() = default;
|
||||
|
||||
AtaAddColumns(TableElementList* tableElements);
|
||||
explicit AtaAddColumns(TableElementList* tableElements);
|
||||
|
||||
virtual ~AtaAddColumns();
|
||||
~AtaAddColumns() override;
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
virtual std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
ColumnDefList fColumns;
|
||||
};
|
||||
@@ -636,22 +623,20 @@ struct AtaAddColumns : public AlterTableAction
|
||||
struct AtaDropColumns : public AlterTableAction
|
||||
{
|
||||
/** @brief Deserialize from ByteStream */
|
||||
EXPORT virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
EXPORT int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
EXPORT virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
EXPORT int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Ctor for deserialization */
|
||||
AtaDropColumns()
|
||||
{
|
||||
}
|
||||
AtaDropColumns() = default;
|
||||
|
||||
EXPORT AtaDropColumns(ColumnNameList* tableElements);
|
||||
EXPORT explicit AtaDropColumns(ColumnNameList* tableElements);
|
||||
|
||||
EXPORT virtual ~AtaDropColumns();
|
||||
EXPORT ~AtaDropColumns() override;
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
EXPORT virtual std::ostream& put(std::ostream& os) const;
|
||||
EXPORT std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
ColumnNameList fColumns;
|
||||
};
|
||||
@@ -661,22 +646,22 @@ struct AtaDropColumns : public AlterTableAction
|
||||
struct AtaAddTableConstraint : public AlterTableAction
|
||||
{
|
||||
/** @brief Deserialize from ByteStream */
|
||||
virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Ctor for deserialization */
|
||||
AtaAddTableConstraint() : fTableConstraint(0)
|
||||
AtaAddTableConstraint() : fTableConstraint(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
AtaAddTableConstraint(TableConstraintDef* tableConstraint);
|
||||
explicit AtaAddTableConstraint(TableConstraintDef* tableConstraint);
|
||||
|
||||
virtual ~AtaAddTableConstraint();
|
||||
~AtaAddTableConstraint() override;
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
virtual std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
TableConstraintDef* fTableConstraint;
|
||||
};
|
||||
@@ -686,25 +671,21 @@ struct AtaAddTableConstraint : public AlterTableAction
|
||||
struct AtaDropColumn : public AlterTableAction
|
||||
{
|
||||
/** @brief Deserialize from ByteStream */
|
||||
EXPORT virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
EXPORT int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
EXPORT virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
EXPORT int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Ctor for deserialization */
|
||||
AtaDropColumn()
|
||||
{
|
||||
}
|
||||
AtaDropColumn() = default;
|
||||
|
||||
/** @brief Ctor for parser construction */
|
||||
EXPORT AtaDropColumn(std::string columnName, DDL_REFERENTIAL_ACTION dropBehavior);
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
EXPORT virtual std::ostream& put(std::ostream& os) const;
|
||||
EXPORT std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
virtual ~AtaDropColumn()
|
||||
{
|
||||
}
|
||||
~AtaDropColumn() override = default;
|
||||
std::string fColumnName;
|
||||
DDL_REFERENTIAL_ACTION fDropBehavior;
|
||||
};
|
||||
@@ -714,19 +695,19 @@ struct AtaDropColumn : public AlterTableAction
|
||||
struct AtaSetColumnDefault : AlterTableAction
|
||||
{
|
||||
/** @brief Deserialize from ByteStream */
|
||||
virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
AtaSetColumnDefault() : fDefaultValue(0)
|
||||
AtaSetColumnDefault() : fDefaultValue(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
virtual std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
virtual ~AtaSetColumnDefault();
|
||||
~AtaSetColumnDefault() override;
|
||||
|
||||
AtaSetColumnDefault(const char* colName, ColumnDefaultValue* defaultValue);
|
||||
|
||||
@@ -738,25 +719,21 @@ struct AtaSetColumnDefault : AlterTableAction
|
||||
struct AtaDropColumnDefault : AlterTableAction
|
||||
{
|
||||
/** @brief Deserialize from ByteStream */
|
||||
virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Ctor for deserialization */
|
||||
AtaDropColumnDefault()
|
||||
{
|
||||
}
|
||||
AtaDropColumnDefault() = default;
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
virtual std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
virtual ~AtaDropColumnDefault()
|
||||
{
|
||||
}
|
||||
~AtaDropColumnDefault() override = default;
|
||||
|
||||
/** @brief Ctor for parser construction */
|
||||
AtaDropColumnDefault(const char* colName);
|
||||
explicit AtaDropColumnDefault(const char* colName);
|
||||
|
||||
std::string fColumnName;
|
||||
};
|
||||
@@ -765,22 +742,18 @@ struct AtaDropColumnDefault : AlterTableAction
|
||||
struct AtaDropTableConstraint : AlterTableAction
|
||||
{
|
||||
/** @brief Deserialize from ByteStream */
|
||||
virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Ctor for deserialization */
|
||||
AtaDropTableConstraint()
|
||||
{
|
||||
}
|
||||
AtaDropTableConstraint() = default;
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
virtual std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
virtual ~AtaDropTableConstraint()
|
||||
{
|
||||
}
|
||||
~AtaDropTableConstraint() override = default;
|
||||
|
||||
AtaDropTableConstraint(const char* constraintName, DDL_REFERENTIAL_ACTION dropBehavior);
|
||||
|
||||
@@ -792,21 +765,21 @@ struct AtaDropTableConstraint : AlterTableAction
|
||||
struct AtaRenameTable : public AlterTableAction
|
||||
{
|
||||
/** @brief Deserialize from ByteStream */
|
||||
virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Ctor for deserialization */
|
||||
AtaRenameTable() : fQualifiedName(0)
|
||||
AtaRenameTable() : fQualifiedName(nullptr)
|
||||
{
|
||||
}
|
||||
AtaRenameTable(QualifiedName* qualifiedName);
|
||||
explicit AtaRenameTable(QualifiedName* qualifiedName);
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
virtual ~AtaRenameTable();
|
||||
~AtaRenameTable() override;
|
||||
|
||||
QualifiedName* fQualifiedName;
|
||||
};
|
||||
@@ -815,21 +788,21 @@ struct AtaRenameTable : public AlterTableAction
|
||||
struct AtaTableComment : public AlterTableAction
|
||||
{
|
||||
/** @brief Deserialize from ByteStream */
|
||||
virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Ctor for deserialization */
|
||||
AtaTableComment() : fTableComment("")
|
||||
{
|
||||
}
|
||||
AtaTableComment(const char* tableComment);
|
||||
explicit AtaTableComment(const char* tableComment);
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
virtual ~AtaTableComment();
|
||||
~AtaTableComment() override;
|
||||
|
||||
std::string fTableComment;
|
||||
};
|
||||
@@ -838,13 +811,13 @@ struct AtaTableComment : public AlterTableAction
|
||||
struct AtaModifyColumnType : public AlterTableAction
|
||||
{
|
||||
/** @brief Deserialize from ByteStream */
|
||||
virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Ctor for deserialization */
|
||||
AtaModifyColumnType() : fColumnType(0)
|
||||
AtaModifyColumnType() : fColumnType(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -853,12 +826,12 @@ struct AtaModifyColumnType : public AlterTableAction
|
||||
{
|
||||
}
|
||||
|
||||
AtaModifyColumnType(QualifiedName* qualifiedName);
|
||||
explicit AtaModifyColumnType(QualifiedName* qualifiedName);
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
virtual ~AtaModifyColumnType();
|
||||
~AtaModifyColumnType() override;
|
||||
|
||||
ColumnType* fColumnType;
|
||||
|
||||
@@ -869,28 +842,28 @@ struct AtaModifyColumnType : public AlterTableAction
|
||||
struct AtaRenameColumn : public AlterTableAction
|
||||
{
|
||||
/** @brief Deserialize from ByteStream */
|
||||
virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Ctor for deserialization */
|
||||
AtaRenameColumn() : fNewType(0), fDefaultValue(0)
|
||||
AtaRenameColumn() : fNewType(nullptr), fDefaultValue(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
AtaRenameColumn(const char* name, const char* newName, ColumnType* newType, const char* comment = NULL)
|
||||
AtaRenameColumn(const char* name, const char* newName, ColumnType* newType, const char* comment = nullptr)
|
||||
: fName(name), fNewName(newName), fNewType(newType)
|
||||
{
|
||||
if (comment)
|
||||
fComment = comment;
|
||||
|
||||
fDefaultValue = 0;
|
||||
fDefaultValue = nullptr;
|
||||
}
|
||||
|
||||
AtaRenameColumn(const char* name, const char* newName, ColumnType* newType,
|
||||
ColumnConstraintList* constraint_list, ColumnDefaultValue* defaultValue,
|
||||
const char* comment = NULL)
|
||||
const char* comment = nullptr)
|
||||
: fName(name), fNewName(newName), fNewType(newType), fDefaultValue(defaultValue)
|
||||
{
|
||||
if (constraint_list)
|
||||
@@ -905,12 +878,12 @@ struct AtaRenameColumn : public AlterTableAction
|
||||
fComment = comment;
|
||||
}
|
||||
|
||||
AtaRenameColumn(QualifiedName* qualifiedName);
|
||||
explicit AtaRenameColumn(QualifiedName* qualifiedName);
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
virtual ~AtaRenameColumn();
|
||||
~AtaRenameColumn() override;
|
||||
|
||||
std::string fName; ///< current column name
|
||||
std::string fNewName; ///< new column name
|
||||
@@ -934,7 +907,7 @@ struct ColumnType
|
||||
EXPORT int serialize(messageqcpp::ByteStream& bs);
|
||||
|
||||
/** @brief For deserialization. */
|
||||
ColumnType() : fCharset(NULL), fCollate(NULL), fCharsetNum(0), fExplicitLength(false)
|
||||
ColumnType() : fCharset(nullptr), fCollate(nullptr), fCharsetNum(0), fExplicitLength(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -950,9 +923,7 @@ struct ColumnType
|
||||
|
||||
EXPORT ColumnType(int type);
|
||||
|
||||
virtual ~ColumnType()
|
||||
{
|
||||
}
|
||||
virtual ~ColumnType() = default;
|
||||
|
||||
/** @brief Type code from DDL_DATATYPES */
|
||||
int fType;
|
||||
@@ -1002,19 +973,15 @@ struct ColumnConstraintDef : public SchemaObject
|
||||
/** @brief Serialize to ByteStream */
|
||||
EXPORT virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
|
||||
ColumnConstraintDef()
|
||||
{
|
||||
}
|
||||
ColumnConstraintDef() = default;
|
||||
|
||||
/** @brief Constructs as check constraint. */
|
||||
EXPORT ColumnConstraintDef(const char* check);
|
||||
EXPORT explicit ColumnConstraintDef(const char* check);
|
||||
|
||||
/** @brief Constructs as other constraint. */
|
||||
EXPORT ColumnConstraintDef(DDL_CONSTRAINTS type);
|
||||
EXPORT explicit ColumnConstraintDef(DDL_CONSTRAINTS type);
|
||||
|
||||
virtual ~ColumnConstraintDef()
|
||||
{
|
||||
}
|
||||
~ColumnConstraintDef() override = default;
|
||||
|
||||
/** @brief Whether deferrable. */
|
||||
bool fDeferrable;
|
||||
@@ -1038,15 +1005,11 @@ struct ColumnDefaultValue
|
||||
/** @brief Serialize to ByteStream */
|
||||
virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
|
||||
ColumnDefaultValue()
|
||||
{
|
||||
}
|
||||
ColumnDefaultValue() = default;
|
||||
|
||||
ColumnDefaultValue(const char* value);
|
||||
explicit ColumnDefaultValue(const char* value);
|
||||
|
||||
virtual ~ColumnDefaultValue()
|
||||
{
|
||||
}
|
||||
virtual ~ColumnDefaultValue() = default;
|
||||
|
||||
/** @brief Is NULL the default value? */
|
||||
bool fNull;
|
||||
@@ -1066,20 +1029,20 @@ struct ColumnDef : public SchemaObject
|
||||
EXPORT virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
|
||||
/** @brief For deserialization. */
|
||||
ColumnDef() : fType(0)
|
||||
ColumnDef() : fType(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
EXPORT virtual ~ColumnDef();
|
||||
EXPORT ~ColumnDef() override;
|
||||
|
||||
/** @brief Parser ctor. */
|
||||
EXPORT ColumnDef(const char* name, ColumnType* type, ColumnConstraintList* constraint_list,
|
||||
ColumnDefaultValue* defaultValue, const char* comment = NULL);
|
||||
ColumnDefaultValue* defaultValue, const char* comment = nullptr);
|
||||
|
||||
/** @brief ColumnDef ctor.
|
||||
* ctor */
|
||||
ColumnDef(const char* name, ColumnType* type, ColumnConstraintList constraints,
|
||||
ColumnDefaultValue* defaultValue = NULL, const char* comment = NULL)
|
||||
ColumnDefaultValue* defaultValue = nullptr, const char* comment = nullptr)
|
||||
: SchemaObject(name), fType(type), fConstraints(constraints), fDefaultValue(defaultValue)
|
||||
{
|
||||
}
|
||||
@@ -1113,14 +1076,12 @@ struct TableConstraintDef : public SchemaObject
|
||||
|
||||
TableConstraintDef();
|
||||
|
||||
TableConstraintDef(DDL_CONSTRAINTS cType);
|
||||
explicit TableConstraintDef(DDL_CONSTRAINTS cType);
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
virtual std::ostream& put(std::ostream& os) const;
|
||||
|
||||
virtual ~TableConstraintDef()
|
||||
{
|
||||
}
|
||||
~TableConstraintDef() override = default;
|
||||
// std::string fName;
|
||||
DDL_CONSTRAINTS fConstraintType;
|
||||
};
|
||||
@@ -1130,28 +1091,26 @@ struct TableConstraintDef : public SchemaObject
|
||||
struct TableUniqueConstraintDef : public TableConstraintDef
|
||||
{
|
||||
/** @brief Return DDL_SERIAL code */
|
||||
virtual DDL_SERIAL_TYPE getSerialType()
|
||||
DDL_SERIAL_TYPE getSerialType() override
|
||||
{
|
||||
return DDL_TABLE_UNIQUE_CONSTRAINT_DEF;
|
||||
}
|
||||
|
||||
/** @brief Deserialize from ByteStream */
|
||||
virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
TableUniqueConstraintDef() : TableConstraintDef(DDL_UNIQUE)
|
||||
{
|
||||
}
|
||||
|
||||
TableUniqueConstraintDef(ColumnNameList* columns);
|
||||
virtual ~TableUniqueConstraintDef()
|
||||
{
|
||||
}
|
||||
explicit TableUniqueConstraintDef(ColumnNameList* columns);
|
||||
~TableUniqueConstraintDef() override = default;
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
virtual std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
ColumnNameList fColumnNameList;
|
||||
};
|
||||
@@ -1161,29 +1120,27 @@ struct TableUniqueConstraintDef : public TableConstraintDef
|
||||
struct TablePrimaryKeyConstraintDef : public TableConstraintDef
|
||||
{
|
||||
/** @brief Return DDL_SERIAL code */
|
||||
virtual DDL_SERIAL_TYPE getSerialType()
|
||||
DDL_SERIAL_TYPE getSerialType() override
|
||||
{
|
||||
return DDL_TABLE_PRIMARY_CONSTRAINT_DEF;
|
||||
}
|
||||
|
||||
/** @brief Deserialize from ByteStream */
|
||||
EXPORT virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
EXPORT int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
EXPORT virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
EXPORT int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
TablePrimaryKeyConstraintDef() : TableConstraintDef(DDL_PRIMARY_KEY)
|
||||
{
|
||||
}
|
||||
|
||||
EXPORT TablePrimaryKeyConstraintDef(ColumnNameList* columns);
|
||||
EXPORT explicit TablePrimaryKeyConstraintDef(ColumnNameList* columns);
|
||||
|
||||
virtual ~TablePrimaryKeyConstraintDef()
|
||||
{
|
||||
}
|
||||
~TablePrimaryKeyConstraintDef() override = default;
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
EXPORT virtual std::ostream& put(std::ostream& os) const;
|
||||
EXPORT std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
ColumnNameList fColumnNameList;
|
||||
};
|
||||
@@ -1193,9 +1150,7 @@ struct TablePrimaryKeyConstraintDef : public TableConstraintDef
|
||||
*/
|
||||
struct ReferentialAction
|
||||
{
|
||||
virtual ~ReferentialAction()
|
||||
{
|
||||
}
|
||||
virtual ~ReferentialAction() = default;
|
||||
|
||||
/** @brief Deserialize from ByteStream */
|
||||
virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
@@ -1212,18 +1167,19 @@ struct ReferentialAction
|
||||
struct TableReferencesConstraintDef : public TableConstraintDef
|
||||
{
|
||||
/** @brief Return DDL_SERIAL code */
|
||||
virtual DDL_SERIAL_TYPE getSerialType()
|
||||
DDL_SERIAL_TYPE getSerialType() override
|
||||
{
|
||||
return DDL_TABLE_REFERENCES_CONSTRAINT_DEF;
|
||||
}
|
||||
|
||||
/** @brief Deserialize from ByteStream */
|
||||
virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
TableReferencesConstraintDef() : TableConstraintDef(DDL_REFERENCES), fTableName(0), fRefAction(0)
|
||||
TableReferencesConstraintDef()
|
||||
: TableConstraintDef(DDL_REFERENCES), fTableName(nullptr), fRefAction(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1231,10 +1187,10 @@ struct TableReferencesConstraintDef : public TableConstraintDef
|
||||
ColumnNameList* foreignColumns, DDL_MATCH_TYPE matchType,
|
||||
ReferentialAction* refAction);
|
||||
|
||||
virtual ~TableReferencesConstraintDef();
|
||||
~TableReferencesConstraintDef() override;
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
virtual std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
ColumnNameList fColumns;
|
||||
QualifiedName* fTableName;
|
||||
@@ -1248,29 +1204,27 @@ struct TableReferencesConstraintDef : public TableConstraintDef
|
||||
struct TableCheckConstraintDef : public TableConstraintDef
|
||||
{
|
||||
/** @brief Return DDL_SERIAL code */
|
||||
virtual DDL_SERIAL_TYPE getSerialType()
|
||||
DDL_SERIAL_TYPE getSerialType() override
|
||||
{
|
||||
return DDL_TABLE_CHECK_CONSTRAINT_DEF;
|
||||
}
|
||||
|
||||
/** @brief Deserialize from ByteStream */
|
||||
virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
TableCheckConstraintDef() : TableConstraintDef(DDL_CHECK)
|
||||
{
|
||||
}
|
||||
|
||||
TableCheckConstraintDef(const char* check);
|
||||
explicit TableCheckConstraintDef(const char* check);
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
virtual std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
virtual ~TableCheckConstraintDef()
|
||||
{
|
||||
}
|
||||
~TableCheckConstraintDef() override = default;
|
||||
std::string fCheck;
|
||||
};
|
||||
|
||||
@@ -1283,22 +1237,22 @@ struct TableCheckConstraintDef : public TableConstraintDef
|
||||
struct AlterTableStatement : public SqlStatement
|
||||
{
|
||||
/** @brief Deserialize from ByteStream */
|
||||
EXPORT virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
EXPORT int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
EXPORT virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
EXPORT int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
AlterTableStatement() : fTableName(0)
|
||||
AlterTableStatement() : fTableName(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
EXPORT AlterTableStatement(QualifiedName* qName, AlterTableActionList* ataList);
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
EXPORT virtual std::ostream& put(std::ostream& os) const;
|
||||
EXPORT std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
/** @brief Delete members. */
|
||||
EXPORT virtual ~AlterTableStatement();
|
||||
EXPORT ~AlterTableStatement() override;
|
||||
|
||||
std::string schemaName() const
|
||||
{
|
||||
@@ -1319,8 +1273,10 @@ struct AlterTableStatement : public SqlStatement
|
||||
|
||||
QualifiedName* fTableName;
|
||||
AlterTableActionList fActions;
|
||||
|
||||
private:
|
||||
long fTimeZone;
|
||||
|
||||
public:
|
||||
};
|
||||
|
||||
@@ -1338,18 +1294,14 @@ struct ConstraintAttributes
|
||||
/** @brief Serialize to ByteStream */
|
||||
virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
|
||||
ConstraintAttributes()
|
||||
{
|
||||
}
|
||||
ConstraintAttributes() = default;
|
||||
|
||||
ConstraintAttributes(DDL_CONSTRAINT_ATTRIBUTES checkTime, bool deferrable)
|
||||
: fCheckTime(checkTime), fDeferrable(deferrable)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~ConstraintAttributes()
|
||||
{
|
||||
}
|
||||
virtual ~ConstraintAttributes() = default;
|
||||
|
||||
DDL_CONSTRAINT_ATTRIBUTES fCheckTime;
|
||||
bool fDeferrable;
|
||||
@@ -1363,19 +1315,19 @@ struct ConstraintAttributes
|
||||
struct CreateIndexStatement : public SqlStatement
|
||||
{
|
||||
/** @brief Deserialize from ByteStream */
|
||||
virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
CreateIndexStatement();
|
||||
CreateIndexStatement(QualifiedName* qualifiedName1, QualifiedName* qualifiedName2,
|
||||
ColumnNameList* columnNames, bool unique);
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
virtual ~CreateIndexStatement();
|
||||
~CreateIndexStatement() override;
|
||||
|
||||
QualifiedName* fIndexName;
|
||||
QualifiedName* fTableName;
|
||||
@@ -1388,20 +1340,20 @@ struct CreateIndexStatement : public SqlStatement
|
||||
struct DropIndexStatement : public SqlStatement
|
||||
{
|
||||
/** @brief Deserialize from ByteStream */
|
||||
virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
DropIndexStatement() : fIndexName(0)
|
||||
DropIndexStatement() : fIndexName(nullptr)
|
||||
{
|
||||
}
|
||||
DropIndexStatement(QualifiedName* qualifiedName);
|
||||
explicit DropIndexStatement(QualifiedName* qualifiedName);
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
virtual ~DropIndexStatement();
|
||||
~DropIndexStatement() override;
|
||||
|
||||
QualifiedName* fIndexName;
|
||||
};
|
||||
@@ -1411,20 +1363,20 @@ struct DropIndexStatement : public SqlStatement
|
||||
struct DropTableStatement : public SqlStatement
|
||||
{
|
||||
/** @brief Deserialize from ByteStream */
|
||||
EXPORT virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
EXPORT int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
EXPORT virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
EXPORT int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
DropTableStatement() : fTableName(0)
|
||||
DropTableStatement() : fTableName(nullptr)
|
||||
{
|
||||
}
|
||||
EXPORT DropTableStatement(QualifiedName* qualifiedName, bool cascade);
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
EXPORT std::ostream& put(std::ostream& os) const;
|
||||
EXPORT std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
virtual ~DropTableStatement()
|
||||
~DropTableStatement() override
|
||||
{
|
||||
delete fTableName;
|
||||
}
|
||||
@@ -1441,9 +1393,9 @@ struct DropTableStatement : public SqlStatement
|
||||
bool fCascade;
|
||||
};
|
||||
|
||||
/** @brief TruncTableStatement represents the drop table operation
|
||||
/** @brief DebugStatement
|
||||
*/
|
||||
struct TruncTableStatement : public SqlStatement
|
||||
struct DebugDDLStatement : public SqlStatement
|
||||
{
|
||||
/** @brief Deserialize from ByteStream */
|
||||
EXPORT virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
@@ -1451,15 +1403,39 @@ struct TruncTableStatement : public SqlStatement
|
||||
/** @brief Serialize to ByteStream */
|
||||
EXPORT virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
|
||||
TruncTableStatement() : fTableName(0)
|
||||
{
|
||||
}
|
||||
EXPORT TruncTableStatement(QualifiedName* qualifiedName);
|
||||
DebugDDLStatement(uint32_t debugLevel);
|
||||
|
||||
EXPORT DebugDDLStatement();
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
EXPORT std::ostream& put(std::ostream& os) const;
|
||||
|
||||
virtual ~TruncTableStatement()
|
||||
virtual ~DebugDDLStatement()
|
||||
{
|
||||
}
|
||||
|
||||
uint32_t fDebugLevel;
|
||||
};
|
||||
|
||||
/** @brief TruncTableStatement represents the drop table operation
|
||||
*/
|
||||
struct TruncTableStatement : public SqlStatement
|
||||
{
|
||||
/** @brief Deserialize from ByteStream */
|
||||
EXPORT int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
EXPORT int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
TruncTableStatement() : fTableName(nullptr)
|
||||
{
|
||||
}
|
||||
EXPORT explicit TruncTableStatement(QualifiedName* qualifiedName);
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
EXPORT std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
~TruncTableStatement() override
|
||||
{
|
||||
delete fTableName;
|
||||
}
|
||||
@@ -1481,23 +1457,23 @@ struct TruncTableStatement : public SqlStatement
|
||||
struct MarkPartitionStatement : public SqlStatement
|
||||
{
|
||||
/** @brief Deserialize from ByteStream */
|
||||
EXPORT virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
EXPORT int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
EXPORT virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
EXPORT int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Ctor for deserialization */
|
||||
MarkPartitionStatement() : fTableName(0)
|
||||
MarkPartitionStatement() : fTableName(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
/** @brief You can't have a CreateTableStatement without a table defintion */
|
||||
EXPORT MarkPartitionStatement(QualifiedName* qualifiedName);
|
||||
EXPORT explicit MarkPartitionStatement(QualifiedName* qualifiedName);
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
EXPORT virtual std::ostream& put(std::ostream& os) const;
|
||||
EXPORT std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
virtual ~MarkPartitionStatement()
|
||||
~MarkPartitionStatement() override
|
||||
{
|
||||
delete fTableName;
|
||||
}
|
||||
@@ -1512,22 +1488,22 @@ struct MarkPartitionStatement : public SqlStatement
|
||||
struct RestorePartitionStatement : public SqlStatement
|
||||
{
|
||||
/** @brief Deserialize from ByteStream */
|
||||
EXPORT virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
EXPORT int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
EXPORT virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
EXPORT int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Ctor for deserialization */
|
||||
RestorePartitionStatement() : fTableName(0)
|
||||
RestorePartitionStatement() : fTableName(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
EXPORT RestorePartitionStatement(QualifiedName* qualifiedName);
|
||||
EXPORT explicit RestorePartitionStatement(QualifiedName* qualifiedName);
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
EXPORT virtual std::ostream& put(std::ostream& os) const;
|
||||
EXPORT std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
virtual ~RestorePartitionStatement()
|
||||
~RestorePartitionStatement() override
|
||||
{
|
||||
delete fTableName;
|
||||
}
|
||||
@@ -1542,22 +1518,22 @@ struct RestorePartitionStatement : public SqlStatement
|
||||
struct DropPartitionStatement : public SqlStatement
|
||||
{
|
||||
/** @brief Deserialize from ByteStream */
|
||||
EXPORT virtual int unserialize(messageqcpp::ByteStream& bs);
|
||||
EXPORT int unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
EXPORT virtual int serialize(messageqcpp::ByteStream& bs);
|
||||
EXPORT int serialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
/** @brief Ctor for deserialization */
|
||||
DropPartitionStatement() : fTableName(0)
|
||||
DropPartitionStatement() : fTableName(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
EXPORT DropPartitionStatement(QualifiedName* qualifiedName);
|
||||
EXPORT explicit DropPartitionStatement(QualifiedName* qualifiedName);
|
||||
|
||||
/** @brief Dump to stdout. */
|
||||
EXPORT virtual std::ostream& put(std::ostream& os) const;
|
||||
EXPORT std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
virtual ~DropPartitionStatement()
|
||||
~DropPartitionStatement() override
|
||||
{
|
||||
delete fTableName;
|
||||
}
|
||||
|
40
dbcon/ddlpackage/debugstatement.cpp
Normal file
40
dbcon/ddlpackage/debugstatement.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
/* Copyright (C) 2024 MariaDB Corporation
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; version 2 of
|
||||
the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
#define DDLPKG_DLLEXPORT
|
||||
#include "ddlpkg.h"
|
||||
#undef DDLPKG_DLLEXPORT
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace ddlpackage
|
||||
{
|
||||
DebugDDLStatement::DebugDDLStatement(uint32_t debugLevel)
|
||||
: fDebugLevel(debugLevel)
|
||||
{
|
||||
}
|
||||
|
||||
DebugDDLStatement::DebugDDLStatement()
|
||||
: fDebugLevel(0)
|
||||
{
|
||||
}
|
||||
|
||||
ostream& DebugDDLStatement::put(ostream& os) const
|
||||
{
|
||||
os << "DDL debug level: " << fDebugLevel << endl;
|
||||
return os;
|
||||
}
|
||||
} // namespace ddlpackage
|
@@ -429,6 +429,21 @@ int DropTableStatement::serialize(ByteStream& bytestream)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/** @brief Construct from Bytestream */
|
||||
int DebugDDLStatement::unserialize(ByteStream& bytestream)
|
||||
{
|
||||
bytestream >> fDebugLevel;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** @brief Serialize to ByteStream */
|
||||
int DebugDDLStatement::serialize(ByteStream& bytestream)
|
||||
{
|
||||
bytestream << (quadbyte)DDL_DEBUG_STATEMENT;
|
||||
bytestream << fDebugLevel;
|
||||
return 1;
|
||||
}
|
||||
|
||||
///////////////////////////////////////
|
||||
/// TruncTableStatement Serialization
|
||||
///////////////////////////////////////
|
||||
|
@@ -86,12 +86,8 @@ struct pass_to_bison
|
||||
const CHARSET_INFO* default_table_charset;
|
||||
myf utf8_flag;
|
||||
|
||||
pass_to_bison(ParseTree* pt) :
|
||||
fParseTree(pt)
|
||||
, scanner(NULL)
|
||||
, default_table_charset(NULL)
|
||||
, utf8_flag(MYF(0))
|
||||
{};
|
||||
pass_to_bison(ParseTree* pt)
|
||||
: fParseTree(pt), scanner(nullptr), default_table_charset(nullptr), utf8_flag(MYF(0)){};
|
||||
};
|
||||
|
||||
class SqlParser
|
||||
|
@@ -49,7 +49,7 @@ class CreateTableProcessor : public DDLPackageProcessor
|
||||
*
|
||||
* @param createTableStmt the CreateTableStatement
|
||||
*/
|
||||
DDLResult processPackageInternal(ddlpackage::SqlStatement* sqlTableStmt);
|
||||
DDLResult processPackageInternal(ddlpackage::SqlStatement* sqlTableStmt) override;
|
||||
};
|
||||
|
||||
} // namespace ddlpackageprocessor
|
||||
|
@@ -22,7 +22,7 @@
|
||||
***********************************************************************/
|
||||
/** @file */
|
||||
|
||||
#ifndef DDLINDEXPOPULATOR_H
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
@@ -303,4 +303,3 @@ class DDLIndexPopulator
|
||||
};
|
||||
|
||||
} // namespace ddlpackageprocessor
|
||||
#endif // DDLPINDEXPOPULATOR_H
|
||||
|
@@ -29,7 +29,7 @@
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
#include <boost/any.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
#define EXPORT
|
||||
|
||||
//#define IDB_DDL_DEBUG
|
||||
// #define IDB_DDL_DEBUG
|
||||
namespace ddlpackageprocessor
|
||||
{
|
||||
#define SUMMARY_INFO(message) \
|
||||
@@ -206,8 +206,8 @@ class DDLPackageProcessor
|
||||
struct NJLSysDataList
|
||||
{
|
||||
NJLSysDataVector sysDataVec;
|
||||
EXPORT NJLSysDataList(){};
|
||||
EXPORT ~NJLSysDataList();
|
||||
EXPORT NJLSysDataList() = default;
|
||||
EXPORT ~NJLSysDataList() = default;
|
||||
NJLSysDataVector::const_iterator begin()
|
||||
{
|
||||
return sysDataVec.begin();
|
||||
@@ -863,6 +863,32 @@ bool from_string(T& t, const std::string& s, std::ios_base& (*f)(std::ios_base&)
|
||||
return !(iss >> f >> t).fail();
|
||||
}
|
||||
|
||||
class FormatStatementString
|
||||
{
|
||||
public:
|
||||
FormatStatementString() = default;
|
||||
~FormatStatementString() = default;
|
||||
|
||||
std::string formatStatementString(const std::string& cmd, const std::string& schema,
|
||||
const std::string& table,
|
||||
const std::set<BRM::LogicalPartition>& partitions)
|
||||
{
|
||||
std::ostringstream stmt;
|
||||
stmt << cmd << "(" << schema << "," << table << ",";
|
||||
|
||||
// There must be at least one partition to drop.
|
||||
for (auto& p : partitions)
|
||||
{
|
||||
stmt << p << ",";
|
||||
}
|
||||
|
||||
auto res = stmt.str();
|
||||
res.back() = ')';
|
||||
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace ddlpackageprocessor
|
||||
|
||||
#undef EXPORT
|
||||
|
@@ -38,7 +38,7 @@ class DropIndexProcessor : public DDLPackageProcessor
|
||||
*
|
||||
* @param dropIndexStmt the drop index statement
|
||||
*/
|
||||
DDLResult processPackageInternal(ddlpackage::SqlStatement& dropIndexStmt);
|
||||
DDLResult processPackageInternal(ddlpackage::SqlStatement* dropIndexStmt) override;
|
||||
|
||||
protected:
|
||||
private:
|
||||
|
@@ -119,8 +119,10 @@ DropPartitionProcessor::DDLResult DropPartitionProcessor::processPackageInternal
|
||||
return result;
|
||||
}
|
||||
|
||||
string stmt = dropPartitionStmt->fSql + "|" + dropPartitionStmt->fTableName->fSchema + "|";
|
||||
auto stmt = formatStatementString(dropPartitionStmt->fSql, dropPartitionStmt->fTableName->fSchema,
|
||||
dropPartitionStmt->fTableName->fName, dropPartitionStmt->fPartitions);
|
||||
SQLLogger logger(stmt, fDDLLoggingId, sessionID, txnID.id);
|
||||
ostringstream debugLog;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -225,6 +227,8 @@ DropPartitionProcessor::DDLResult DropPartitionProcessor::processPackageInternal
|
||||
return result;
|
||||
}
|
||||
}
|
||||
debugLog << "DropPartitionProcessor: got table lock (id) " << uniqueID << " for table (OID)"
|
||||
<< roPair.objnum << endl;
|
||||
|
||||
// 1. Get the OIDs for the columns
|
||||
// 2. Get the OIDs for the dictionaries
|
||||
@@ -240,9 +244,18 @@ DropPartitionProcessor::DDLResult DropPartitionProcessor::processPackageInternal
|
||||
|
||||
tableColRidList = systemCatalogPtr->columnRIDs(userTableName);
|
||||
tableAuxColOid = systemCatalogPtr->tableAUXColumnOID(userTableName);
|
||||
|
||||
dictOIDList = systemCatalogPtr->dictOIDs(userTableName);
|
||||
|
||||
debugLog << "DropPartitionProcessor:" << endl;
|
||||
debugLog << "column RIDS: ";
|
||||
for (const auto& rid : tableColRidList)
|
||||
debugLog << rid.objnum << " ";
|
||||
debugLog << endl;
|
||||
debugLog << "dict OIDS: ";
|
||||
for (const auto& dictOid : dictOIDList)
|
||||
debugLog << dictOid.dictOID << " ";
|
||||
debugLog << endl;
|
||||
|
||||
// Save qualified tablename, all column, dictionary OIDs, and transaction ID into a file in ASCII format
|
||||
for (unsigned i = 0; i < tableColRidList.size(); i++)
|
||||
{
|
||||
@@ -270,6 +283,12 @@ DropPartitionProcessor::DDLResult DropPartitionProcessor::processPackageInternal
|
||||
{
|
||||
throw std::runtime_error(emsg);
|
||||
}
|
||||
debugLog << "DropPartitionProcessor: marked partitions for deletion:" << endl;
|
||||
for (const auto& partition : dropPartitionStmt->fPartitions)
|
||||
debugLog << "dbroot: " << partition.dbroot << " physical parition: " << partition.pp
|
||||
<< " segment: " << partition.seg << endl;
|
||||
VERBOSE_INFO(debugLog.str());
|
||||
debugLog.clear();
|
||||
|
||||
set<BRM::LogicalPartition> markedPartitions;
|
||||
set<BRM::LogicalPartition> outOfServicePartitions;
|
||||
@@ -297,14 +316,16 @@ DropPartitionProcessor::DDLResult DropPartitionProcessor::processPackageInternal
|
||||
// Save the oids to a file
|
||||
createWritePartitionLogFile(roPair.objnum, markedPartitions, oidList, uniqueId);
|
||||
|
||||
VERBOSE_INFO("Removing files");
|
||||
VERBOSE_INFO("Removing parition files");
|
||||
removePartitionFiles(oidList, markedPartitions, uniqueId);
|
||||
// Flush PrimProc cache for those lbids
|
||||
VERBOSE_INFO("Flushing paritions");
|
||||
rc = cacheutils::flushPartition(oidList, markedPartitions);
|
||||
|
||||
// Remove the partition from extent map
|
||||
emsg.clear();
|
||||
rc = fDbrm->deletePartition(oidList, dropPartitionStmt->fPartitions, emsg);
|
||||
VERBOSE_INFO("DropPartitionProcessor: partitions removed");
|
||||
|
||||
if (rc != 0)
|
||||
throw std::runtime_error(emsg);
|
||||
@@ -389,6 +410,7 @@ DropPartitionProcessor::DDLResult DropPartitionProcessor::processPackageInternal
|
||||
}
|
||||
|
||||
fSessionManager.committed(txnID);
|
||||
VERBOSE_INFO("DropPartitionProcessor:: commited");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@@ -33,7 +33,7 @@ namespace ddlpackageprocessor
|
||||
* for interacting with the Write Engine to process
|
||||
* drop table ddl statements.
|
||||
*/
|
||||
class DropPartitionProcessor : public DDLPackageProcessor
|
||||
class DropPartitionProcessor : public DDLPackageProcessor, FormatStatementString
|
||||
{
|
||||
public:
|
||||
DropPartitionProcessor(BRM::DBRM* aDbrm) : DDLPackageProcessor(aDbrm)
|
||||
@@ -46,7 +46,7 @@ class DropPartitionProcessor : public DDLPackageProcessor
|
||||
*
|
||||
* @param dropTableStmt the drop table statement
|
||||
*/
|
||||
DDLResult processPackageInternal(ddlpackage::SqlStatement* dropPartitionStmt);
|
||||
DDLResult processPackageInternal(ddlpackage::SqlStatement* dropPartitionStmt) override;
|
||||
};
|
||||
} // namespace ddlpackageprocessor
|
||||
|
||||
|
@@ -46,7 +46,7 @@ class DropTableProcessor : public DDLPackageProcessor
|
||||
*
|
||||
* @param dropTableStmt the drop table statement
|
||||
*/
|
||||
DDLResult processPackageInternal(ddlpackage::SqlStatement* dropTableStmt);
|
||||
DDLResult processPackageInternal(ddlpackage::SqlStatement* dropTableStmt) override;
|
||||
};
|
||||
|
||||
/** @brief specialization of a DDLPacakageProcessor
|
||||
@@ -66,7 +66,7 @@ class TruncTableProcessor : public DDLPackageProcessor
|
||||
*
|
||||
* @param truncTableStmt the truncate table statement
|
||||
*/
|
||||
DDLResult processPackageInternal(ddlpackage::SqlStatement* truncTableStmt);
|
||||
DDLResult processPackageInternal(ddlpackage::SqlStatement* truncTableStmt) override;
|
||||
};
|
||||
|
||||
} // namespace ddlpackageprocessor
|
||||
|
@@ -81,7 +81,8 @@ MarkPartitionProcessor::DDLResult MarkPartitionProcessor::processPackageInternal
|
||||
CalpontSystemCatalog::DictOIDList dictOIDList;
|
||||
std::string processName("DDLProc");
|
||||
|
||||
string stmt = markPartitionStmt->fSql + "|" + markPartitionStmt->fTableName->fSchema + "|";
|
||||
auto stmt = formatStatementString(markPartitionStmt->fSql, markPartitionStmt->fTableName->fSchema,
|
||||
markPartitionStmt->fTableName->fName, markPartitionStmt->fPartitions);
|
||||
SQLLogger logger(stmt, fDDLLoggingId, markPartitionStmt->fSessionID, txnID.id);
|
||||
|
||||
uint32_t processID = 0;
|
||||
|
@@ -33,7 +33,7 @@ namespace ddlpackageprocessor
|
||||
* for interacting with the Write Engine
|
||||
* to process create table ddl statements.
|
||||
*/
|
||||
class MarkPartitionProcessor : public DDLPackageProcessor
|
||||
class MarkPartitionProcessor : public DDLPackageProcessor, FormatStatementString
|
||||
{
|
||||
public:
|
||||
MarkPartitionProcessor(BRM::DBRM* aDbrm) : DDLPackageProcessor(aDbrm)
|
||||
@@ -46,7 +46,7 @@ class MarkPartitionProcessor : public DDLPackageProcessor
|
||||
*
|
||||
* @param createTableStmt the CreateTableStatement
|
||||
*/
|
||||
DDLResult processPackageInternal(ddlpackage::SqlStatement* MarkPartitionStmt);
|
||||
DDLResult processPackageInternal(ddlpackage::SqlStatement* MarkPartitionStmt) override;
|
||||
};
|
||||
|
||||
} // namespace ddlpackageprocessor
|
||||
|
@@ -82,7 +82,8 @@ RestorePartitionProcessor::DDLResult RestorePartitionProcessor::processPackageIn
|
||||
CalpontSystemCatalog::DictOIDList dictOIDList;
|
||||
std::string processName("DDLProc");
|
||||
|
||||
string stmt = restorePartitionStmt->fSql + "|" + restorePartitionStmt->fTableName->fSchema + "|";
|
||||
auto stmt = formatStatementString(restorePartitionStmt->fSql, restorePartitionStmt->fTableName->fSchema,
|
||||
restorePartitionStmt->fTableName->fName, restorePartitionStmt->fPartitions);
|
||||
SQLLogger logger(stmt, fDDLLoggingId, restorePartitionStmt->fSessionID, txnID.id);
|
||||
|
||||
uint32_t processID = 0;
|
||||
|
@@ -33,7 +33,7 @@ namespace ddlpackageprocessor
|
||||
* for interacting with the Write Engine to process
|
||||
* drop table ddl statements.
|
||||
*/
|
||||
class RestorePartitionProcessor : public DDLPackageProcessor
|
||||
class RestorePartitionProcessor : public DDLPackageProcessor, FormatStatementString
|
||||
{
|
||||
public:
|
||||
RestorePartitionProcessor(BRM::DBRM* aDbrm) : DDLPackageProcessor(aDbrm)
|
||||
@@ -46,7 +46,7 @@ class RestorePartitionProcessor : public DDLPackageProcessor
|
||||
*
|
||||
* @param dropTableStmt the drop table statement
|
||||
*/
|
||||
DDLResult processPackageInternal(ddlpackage::SqlStatement* RestorePartitionStmt);
|
||||
DDLResult processPackageInternal(ddlpackage::SqlStatement* RestorePartitionStmt) override;
|
||||
};
|
||||
} // namespace ddlpackageprocessor
|
||||
|
||||
|
@@ -188,7 +188,7 @@ class CalpontDMLPackage
|
||||
{
|
||||
fTableName = tableName;
|
||||
|
||||
if (fTable != 0)
|
||||
if (fTable != nullptr)
|
||||
fTable->set_TableName(tableName);
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ class CalpontDMLPackage
|
||||
{
|
||||
fSchemaName = schemaName;
|
||||
|
||||
if (fTable != 0)
|
||||
if (fTable != nullptr)
|
||||
fTable->set_SchemaName(schemaName);
|
||||
}
|
||||
|
||||
|
@@ -47,33 +47,33 @@ class CommandDMLPackage : public CalpontDMLPackage
|
||||
|
||||
/** @brief dtor
|
||||
*/
|
||||
EXPORT virtual ~CommandDMLPackage();
|
||||
EXPORT ~CommandDMLPackage() override;
|
||||
|
||||
/** @brief write a CommandDMLPackage to a ByteStream
|
||||
*
|
||||
* @param bytestream the ByteStream to write to
|
||||
*/
|
||||
EXPORT int write(messageqcpp::ByteStream& bytestream);
|
||||
EXPORT int write(messageqcpp::ByteStream& bytestream) override;
|
||||
|
||||
/** @brief read CommandDMLPackage from bytestream
|
||||
*
|
||||
* @param bytestream the ByteStream to read from
|
||||
*/
|
||||
EXPORT int read(messageqcpp::ByteStream& bytestream);
|
||||
EXPORT int read(messageqcpp::ByteStream& bytestream) override;
|
||||
/** @brief do nothing
|
||||
*
|
||||
* @param buffer
|
||||
* @param columns the number of columns in the buffer
|
||||
* @param rows the number of rows in the buffer
|
||||
*/
|
||||
inline int buildFromBuffer(std::string& buffer, int columns = 0, int rows = 0)
|
||||
inline int buildFromBuffer(std::string& buffer, int columns = 0, int rows = 0) override
|
||||
{
|
||||
return 1;
|
||||
};
|
||||
|
||||
/** @brief build a CommandDMLPackage from a CommandSqlStatement
|
||||
*/
|
||||
EXPORT int buildFromSqlStatement(SqlStatement& sqlStatement);
|
||||
EXPORT int buildFromSqlStatement(SqlStatement& sqlStatement) override;
|
||||
|
||||
/** @brief build a InsertDMLPackage from MySQL buffer
|
||||
*
|
||||
@@ -81,7 +81,7 @@ class CommandDMLPackage : public CalpontDMLPackage
|
||||
* @param rows the number of rows in the buffer
|
||||
*/
|
||||
int buildFromMysqlBuffer(ColNameList& colNameList, TableValuesMap& tableValuesMap, int columns, int rows,
|
||||
NullValuesBitset& nullValues)
|
||||
NullValuesBitset& nullValues) override
|
||||
{
|
||||
return 1;
|
||||
};
|
||||
|
@@ -53,19 +53,19 @@ class DeleteDMLPackage : public CalpontDMLPackage
|
||||
|
||||
/** @brief dtor
|
||||
*/
|
||||
EXPORT virtual ~DeleteDMLPackage();
|
||||
EXPORT ~DeleteDMLPackage() override;
|
||||
|
||||
/** @brief write a DeleteDMLPackage to a ByteStream
|
||||
*
|
||||
* @param bytestream the ByteStream to write to
|
||||
*/
|
||||
EXPORT int write(messageqcpp::ByteStream& bytestream);
|
||||
EXPORT int write(messageqcpp::ByteStream& bytestream) override;
|
||||
|
||||
/** @brief read a DeleteDMLPackage from a ByteStream
|
||||
*
|
||||
* @param bytestream the ByteStream to read from
|
||||
*/
|
||||
EXPORT int read(messageqcpp::ByteStream& bytestream);
|
||||
EXPORT int read(messageqcpp::ByteStream& bytestream) override;
|
||||
|
||||
/** @brief build a DeleteDMLPackage from a string buffer
|
||||
*
|
||||
@@ -73,20 +73,20 @@ class DeleteDMLPackage : public CalpontDMLPackage
|
||||
* @param columns the number of columns in the buffer
|
||||
* @param rows the number of rows in the buffer
|
||||
*/
|
||||
EXPORT int buildFromBuffer(std::string& buffer, int columns, int rows);
|
||||
EXPORT int buildFromBuffer(std::string& buffer, int columns, int rows) override;
|
||||
|
||||
/** @brief build a DeleteDMLPackage from a parsed DeleteSqlStatement
|
||||
*
|
||||
* @param sqlStatement the parsed DeleteSqlStatement
|
||||
*/
|
||||
EXPORT int buildFromSqlStatement(SqlStatement& sqlStatement);
|
||||
EXPORT int buildFromSqlStatement(SqlStatement& sqlStatement) override;
|
||||
/** @brief build a InsertDMLPackage from MySQL buffer
|
||||
*
|
||||
* @param colNameList, tableValuesMap
|
||||
* @param rows the number of rows in the buffer
|
||||
*/
|
||||
EXPORT int buildFromMysqlBuffer(ColNameList& colNameList, TableValuesMap& tableValuesMap, int columns,
|
||||
int rows, NullValuesBitset& nullValues);
|
||||
int rows, NullValuesBitset& nullValues) override;
|
||||
|
||||
protected:
|
||||
private:
|
||||
|
@@ -42,7 +42,7 @@ namespace dmlpackage {
|
||||
int lineno = 1;
|
||||
|
||||
|
||||
static char* scanner_copy (char *str, yyscan_t yyscanner);
|
||||
static char* scanner_copy (const char *str, yyscan_t yyscanner);
|
||||
|
||||
|
||||
/* macro to save the text and return a token */
|
||||
@@ -256,7 +256,7 @@ void scanner_finish(yyscan_t yyscanner)
|
||||
pScanData->valbuf.clear();
|
||||
}
|
||||
|
||||
char* scanner_copy (char *str, yyscan_t yyscanner)
|
||||
char* scanner_copy (const char *str, yyscan_t yyscanner)
|
||||
{
|
||||
char* nv = strdup(str);
|
||||
if(nv)
|
||||
|
@@ -55,24 +55,24 @@ class DMLColumn : public DMLObject
|
||||
*
|
||||
*/
|
||||
|
||||
EXPORT DMLColumn(std::string name, utils::NullString& value, bool isFromCol = false,
|
||||
uint32_t funcScale = 0, bool isNULL = false);
|
||||
EXPORT DMLColumn(std::string name, utils::NullString& value, bool isFromCol = false, uint32_t funcScale = 0,
|
||||
bool isNULL = false);
|
||||
|
||||
/** @brief dtor
|
||||
*/
|
||||
EXPORT ~DMLColumn();
|
||||
EXPORT ~DMLColumn() override;
|
||||
|
||||
/** @brief read a DMLColumn from a ByteStream
|
||||
*
|
||||
* @param bytestream the ByteStream to read from
|
||||
*/
|
||||
EXPORT int read(messageqcpp::ByteStream& bytestream);
|
||||
EXPORT int read(messageqcpp::ByteStream& bytestream) override;
|
||||
|
||||
/** @brief write a DML column to a ByteStream
|
||||
*
|
||||
* @param bytestream the ByteStream to write to
|
||||
*/
|
||||
EXPORT int write(messageqcpp::ByteStream& bytestream);
|
||||
EXPORT int write(messageqcpp::ByteStream& bytestream) override;
|
||||
|
||||
/** @brief get the data for the column
|
||||
*/
|
||||
|
@@ -23,13 +23,14 @@
|
||||
/** @file */
|
||||
#pragma once
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <utility>
|
||||
#include <iostream>
|
||||
#include <bitset>
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
#include "nullstring.h"
|
||||
|
||||
namespace dmlpackage
|
||||
@@ -158,9 +159,7 @@ class SqlStatementList
|
||||
public:
|
||||
/** @brief ctor
|
||||
*/
|
||||
SqlStatementList()
|
||||
{
|
||||
}
|
||||
SqlStatementList() = default;
|
||||
|
||||
/** @brief dtor
|
||||
*/
|
||||
@@ -218,19 +217,19 @@ class InsertSqlStatement : public SqlStatement
|
||||
|
||||
/** @brief dtor
|
||||
*/
|
||||
virtual ~InsertSqlStatement();
|
||||
~InsertSqlStatement() override;
|
||||
|
||||
/** @brief dump to stdout
|
||||
*/
|
||||
virtual std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
/** @brief get a string representation of the query spec
|
||||
*/
|
||||
virtual std::string getQueryString() const;
|
||||
std::string getQueryString() const override;
|
||||
|
||||
/** @brief get the statement type - DML_INSERT
|
||||
*/
|
||||
inline virtual int getStatementType() const
|
||||
inline int getStatementType() const override
|
||||
{
|
||||
return DML_INSERT;
|
||||
}
|
||||
@@ -259,25 +258,25 @@ class UpdateSqlStatement : public SqlStatement
|
||||
* @param whereClausePtr pointer to a WhereClause object - default 0
|
||||
*/
|
||||
UpdateSqlStatement(TableName* tableNamePtr, ColumnAssignmentList* colAssignmentListPtr,
|
||||
WhereClause* whereClausePtr = 0);
|
||||
WhereClause* whereClausePtr = nullptr);
|
||||
|
||||
/** @brief dtor
|
||||
*/
|
||||
virtual ~UpdateSqlStatement();
|
||||
~UpdateSqlStatement() override;
|
||||
|
||||
/** @brief dump to stdout
|
||||
*/
|
||||
virtual std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
/** @brief get the string representation of the
|
||||
* SET assignment_commalist opt_where_clause
|
||||
* statement
|
||||
*/
|
||||
virtual std::string getQueryString() const;
|
||||
std::string getQueryString() const override;
|
||||
|
||||
/** @brief get the statement type - DML_UPDATE
|
||||
*/
|
||||
inline virtual int getStatementType() const
|
||||
inline int getStatementType() const override
|
||||
{
|
||||
return DML_UPDATE;
|
||||
}
|
||||
@@ -304,23 +303,23 @@ class DeleteSqlStatement : public SqlStatement
|
||||
* @param tableNamePtr pointer to a TableName object
|
||||
* @param whereClausePtr pointer to a WhereClause object - default = 0
|
||||
*/
|
||||
DeleteSqlStatement(TableName* tableNamePtr, WhereClause* whereClausePtr = 0);
|
||||
explicit DeleteSqlStatement(TableName* tableNamePtr, WhereClause* whereClausePtr = nullptr);
|
||||
|
||||
/** @brief dtor
|
||||
*/
|
||||
virtual ~DeleteSqlStatement();
|
||||
~DeleteSqlStatement() override;
|
||||
|
||||
/** @brief dump to stdout
|
||||
*/
|
||||
virtual std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
/** @brief get the string representation of the WHERE clause
|
||||
*/
|
||||
virtual std::string getQueryString() const;
|
||||
std::string getQueryString() const override;
|
||||
|
||||
/** @brief get the statement type - DML_DELETE
|
||||
*/
|
||||
inline virtual int getStatementType() const
|
||||
inline int getStatementType() const override
|
||||
{
|
||||
return DML_DELETE;
|
||||
}
|
||||
@@ -346,22 +345,22 @@ class CommandSqlStatement : public SqlStatement
|
||||
*
|
||||
* @param command the COMMIT or ROLLBACK string
|
||||
*/
|
||||
CommandSqlStatement(std::string command);
|
||||
explicit CommandSqlStatement(std::string command);
|
||||
|
||||
/** @brief get the statement type - DML_COMMAND
|
||||
*/
|
||||
inline virtual int getStatementType() const
|
||||
inline int getStatementType() const override
|
||||
{
|
||||
return DML_COMMAND;
|
||||
}
|
||||
|
||||
/** @brief dump to stdout
|
||||
*/
|
||||
virtual std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
/** @brief get the COMMIT or ROLLBACK string
|
||||
*/
|
||||
virtual std::string getQueryString() const;
|
||||
std::string getQueryString() const override;
|
||||
|
||||
std::string fCommandText;
|
||||
};
|
||||
@@ -380,7 +379,7 @@ class TableName
|
||||
*
|
||||
* @param name the table name
|
||||
*/
|
||||
TableName(char* name);
|
||||
explicit TableName(char* name);
|
||||
|
||||
/** @brief ctor
|
||||
*
|
||||
@@ -406,11 +405,10 @@ class TableName
|
||||
class ColumnAssignment
|
||||
{
|
||||
public:
|
||||
explicit ColumnAssignment(std::string const& column, std::string const& op = "=",
|
||||
std::string const& expr = "")
|
||||
: fColumn(column)
|
||||
, fOperator(op)
|
||||
, fScalarExpression(expr)
|
||||
explicit ColumnAssignment(std::string column, std::string op = "=", std::string expr = "")
|
||||
: fColumn(std::move(column))
|
||||
, fOperator(std::move(op))
|
||||
, fScalarExpression(std::move(expr))
|
||||
, fFromCol(false)
|
||||
, fFuncScale(0)
|
||||
, fIsNull(false){};
|
||||
@@ -449,13 +447,13 @@ class ValuesOrQuery
|
||||
*
|
||||
* @param valuesPtr pointer to a ValuesList object
|
||||
*/
|
||||
ValuesOrQuery(ValuesList* valuesPtr);
|
||||
explicit ValuesOrQuery(ValuesList* valuesPtr);
|
||||
|
||||
/** @brief ctor
|
||||
*
|
||||
* @param querySpecPtr pointer to a QuerySpec object
|
||||
*/
|
||||
ValuesOrQuery(QuerySpec* querySpecPtr);
|
||||
explicit ValuesOrQuery(QuerySpec* querySpecPtr);
|
||||
|
||||
/** @brief dtor
|
||||
*/
|
||||
@@ -491,7 +489,7 @@ class SelectFilter
|
||||
*
|
||||
* @param columnListPtr pointer to a ColumnNameList object
|
||||
*/
|
||||
SelectFilter(ColumnNameList* columnListPtr);
|
||||
explicit SelectFilter(ColumnNameList* columnListPtr);
|
||||
|
||||
/** @brief dtor
|
||||
*/
|
||||
@@ -524,7 +522,7 @@ class FromClause
|
||||
*
|
||||
* @param tableNameList pointer to a TableNameList object
|
||||
*/
|
||||
FromClause(TableNameList* tableNameList);
|
||||
explicit FromClause(TableNameList* tableNameList);
|
||||
|
||||
/** @brief dtor
|
||||
*/
|
||||
@@ -663,7 +661,7 @@ class Predicate
|
||||
*
|
||||
* @param predicateType the PREDICATE_TYPE
|
||||
*/
|
||||
Predicate(PREDICATE_TYPE predicateType);
|
||||
explicit Predicate(PREDICATE_TYPE predicateType);
|
||||
|
||||
/** @brief dtor
|
||||
*/
|
||||
@@ -696,16 +694,16 @@ class ComparisonPredicate : public Predicate
|
||||
|
||||
/** @brief dtor
|
||||
*/
|
||||
~ComparisonPredicate();
|
||||
~ComparisonPredicate() override;
|
||||
|
||||
/** @brief dump to stdout
|
||||
*/
|
||||
virtual std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
/** @brief get the string representation of the COMPARISON
|
||||
* predicate
|
||||
*/
|
||||
virtual std::string getPredicateString() const;
|
||||
std::string getPredicateString() const override;
|
||||
|
||||
std::string fLHScalarExpression;
|
||||
std::string fRHScalarExpression;
|
||||
@@ -731,16 +729,16 @@ class BetweenPredicate : public Predicate
|
||||
|
||||
/** @brief dtor
|
||||
*/
|
||||
~BetweenPredicate();
|
||||
~BetweenPredicate() override;
|
||||
|
||||
/** @brief dump to stdout
|
||||
*/
|
||||
virtual std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
/** @brief get the string representation of the BETWEEN
|
||||
* predicate
|
||||
*/
|
||||
virtual std::string getPredicateString() const;
|
||||
std::string getPredicateString() const override;
|
||||
|
||||
std::string fLHScalarExpression;
|
||||
std::string fRH1ScalarExpression;
|
||||
@@ -766,16 +764,16 @@ class LikePredicate : public Predicate
|
||||
|
||||
/** @brief dtor
|
||||
*/
|
||||
~LikePredicate();
|
||||
~LikePredicate() override;
|
||||
|
||||
/** @brief dump to stdout
|
||||
*/
|
||||
virtual std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
/** @brief get the string representation of the LIKE
|
||||
* predicate
|
||||
*/
|
||||
virtual std::string getPredicateString() const;
|
||||
std::string getPredicateString() const override;
|
||||
|
||||
std::string fLHScalarExpression;
|
||||
std::string fAtom;
|
||||
@@ -800,16 +798,16 @@ class NullTestPredicate : public Predicate
|
||||
|
||||
/** @brief dtor
|
||||
*/
|
||||
~NullTestPredicate();
|
||||
~NullTestPredicate() override;
|
||||
|
||||
/** @brief dump to stdout
|
||||
*/
|
||||
virtual std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
/** @brief get the string representation of the NULL test
|
||||
* predicate
|
||||
*/
|
||||
std::string getPredicateString() const;
|
||||
std::string getPredicateString() const override;
|
||||
|
||||
std::string fColumnRef;
|
||||
|
||||
@@ -834,16 +832,16 @@ class InPredicate : public Predicate
|
||||
|
||||
/** @brief dtor
|
||||
*/
|
||||
~InPredicate();
|
||||
~InPredicate() override;
|
||||
|
||||
/** @brief dump to stdout
|
||||
*/
|
||||
virtual std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
/** @brief get the string representation of the IN
|
||||
* predicate
|
||||
*/
|
||||
virtual std::string getPredicateString() const;
|
||||
std::string getPredicateString() const override;
|
||||
|
||||
std::string fScalarExpression;
|
||||
std::string fOperator;
|
||||
@@ -867,16 +865,16 @@ class AllOrAnyPredicate : public Predicate
|
||||
|
||||
/** @brief dtor
|
||||
*/
|
||||
~AllOrAnyPredicate();
|
||||
~AllOrAnyPredicate() override;
|
||||
|
||||
/** @brief dump to stdout
|
||||
*/
|
||||
virtual std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
/** @brief get the string representation of the
|
||||
* ALL or ANY predicate
|
||||
*/
|
||||
virtual std::string getPredicateString() const;
|
||||
std::string getPredicateString() const override;
|
||||
|
||||
std::string fScalarExpression;
|
||||
std::string fOperator;
|
||||
@@ -900,16 +898,16 @@ class ExistanceTestPredicate : public Predicate
|
||||
|
||||
/** @brief dtor
|
||||
*/
|
||||
~ExistanceTestPredicate();
|
||||
~ExistanceTestPredicate() override;
|
||||
|
||||
/** @brief dump to stdout
|
||||
*/
|
||||
virtual std::ostream& put(std::ostream& os) const;
|
||||
std::ostream& put(std::ostream& os) const override;
|
||||
|
||||
/** @brief get the string representation of the EXISTS
|
||||
* predicate
|
||||
*/
|
||||
virtual std::string getPredicateString() const;
|
||||
std::string getPredicateString() const override;
|
||||
|
||||
QuerySpec* fSubQuerySpecPtr;
|
||||
};
|
||||
|
@@ -44,7 +44,7 @@ class DMLTable : public DMLObject
|
||||
|
||||
/** @brief dtor
|
||||
*/
|
||||
~DMLTable();
|
||||
~DMLTable() override;
|
||||
|
||||
/** @brief get the schema name
|
||||
*/
|
||||
@@ -85,7 +85,7 @@ class DMLTable : public DMLObject
|
||||
*
|
||||
* @param bytestream the ByteStream to read from
|
||||
*/
|
||||
int read(messageqcpp::ByteStream& bytestream);
|
||||
int read(messageqcpp::ByteStream& bytestream) override;
|
||||
|
||||
/** @brief read a DMLTable metadata from a ByteStream
|
||||
*
|
||||
@@ -103,7 +103,7 @@ class DMLTable : public DMLObject
|
||||
*
|
||||
* @param bytestream the ByteStream to write to
|
||||
*/
|
||||
int write(messageqcpp::ByteStream& bytestream);
|
||||
int write(messageqcpp::ByteStream& bytestream) override;
|
||||
|
||||
protected:
|
||||
private:
|
||||
|
@@ -53,19 +53,19 @@ class InsertDMLPackage : public CalpontDMLPackage
|
||||
|
||||
/** @brief dtor
|
||||
*/
|
||||
EXPORT virtual ~InsertDMLPackage();
|
||||
EXPORT ~InsertDMLPackage() override;
|
||||
|
||||
/** @brief write a InsertDMLPackage to a ByteStream
|
||||
*
|
||||
* @param bytestream the ByteStream to write to
|
||||
*/
|
||||
EXPORT int write(messageqcpp::ByteStream& bytestream);
|
||||
EXPORT int write(messageqcpp::ByteStream& bytestream) override;
|
||||
|
||||
/** @brief read InsertDMLPackage from bytestream
|
||||
*
|
||||
* @param bytestream the ByteStream to read from
|
||||
*/
|
||||
EXPORT int read(messageqcpp::ByteStream& bytestream);
|
||||
EXPORT int read(messageqcpp::ByteStream& bytestream) override;
|
||||
|
||||
/** @brief read InsertDMLPackage metadata from bytestream
|
||||
*
|
||||
@@ -85,7 +85,7 @@ class InsertDMLPackage : public CalpontDMLPackage
|
||||
* @param columns the number of columns in the buffer
|
||||
* @param rows the number of rows in the buffer
|
||||
*/
|
||||
EXPORT int buildFromBuffer(std::string& buffer, int columns, int rows);
|
||||
EXPORT int buildFromBuffer(std::string& buffer, int columns, int rows) override;
|
||||
|
||||
/** @brief build a InsertDMLPackage from MySQL buffer
|
||||
*
|
||||
@@ -95,13 +95,13 @@ class InsertDMLPackage : public CalpontDMLPackage
|
||||
* @param rows number of rows to be touched
|
||||
*/
|
||||
EXPORT int buildFromMysqlBuffer(ColNameList& colNameList, TableValuesMap& tableValuesMap, int columns,
|
||||
int rows, NullValuesBitset& nullValues);
|
||||
int rows, NullValuesBitset& nullValues) override;
|
||||
|
||||
/** @brief build a InsertDMLPackage from a InsertSqlStatement
|
||||
*
|
||||
* @param sqlStmt the InsertSqlStatement
|
||||
*/
|
||||
EXPORT int buildFromSqlStatement(SqlStatement& sqlStatement);
|
||||
EXPORT int buildFromSqlStatement(SqlStatement& sqlStatement) override;
|
||||
|
||||
/** @brief Dump the InsertDMLPackage for debugging purposes
|
||||
*/
|
||||
|
@@ -45,7 +45,7 @@ class Row : public DMLObject
|
||||
|
||||
/** @brief dtor
|
||||
*/
|
||||
EXPORT ~Row();
|
||||
EXPORT ~Row() override;
|
||||
|
||||
/** @brief copy constructor
|
||||
*/
|
||||
@@ -55,13 +55,13 @@ class Row : public DMLObject
|
||||
*
|
||||
* @param bytestream the ByteStream to read from
|
||||
*/
|
||||
EXPORT int read(messageqcpp::ByteStream& bytestream);
|
||||
EXPORT int read(messageqcpp::ByteStream& bytestream) override;
|
||||
|
||||
/** @brief write a Row to a ByteStream
|
||||
*
|
||||
* @param bytestream the ByteStream to write to
|
||||
*/
|
||||
EXPORT int write(messageqcpp::ByteStream& bytestream);
|
||||
EXPORT int write(messageqcpp::ByteStream& bytestream) override;
|
||||
|
||||
/** @brief get the list of columns in the row
|
||||
*/
|
||||
|
@@ -53,19 +53,19 @@ class UpdateDMLPackage : public CalpontDMLPackage
|
||||
|
||||
/** @brief dtor
|
||||
*/
|
||||
EXPORT virtual ~UpdateDMLPackage();
|
||||
EXPORT ~UpdateDMLPackage() override;
|
||||
|
||||
/** @brief write a UpdateDMLPackage to a ByteStream
|
||||
*
|
||||
* @param bytestream the ByteStream to write to
|
||||
*/
|
||||
EXPORT int write(messageqcpp::ByteStream& bytestream);
|
||||
EXPORT int write(messageqcpp::ByteStream& bytestream) override;
|
||||
|
||||
/** @brief read a UpdateDMLPackage from a ByteStream
|
||||
*
|
||||
* @param bytestream the ByteStream to read from
|
||||
*/
|
||||
EXPORT int read(messageqcpp::ByteStream& bytestream);
|
||||
EXPORT int read(messageqcpp::ByteStream& bytestream) override;
|
||||
|
||||
/** @brief build a UpdateDMLPackage from a string buffer
|
||||
*
|
||||
@@ -73,13 +73,13 @@ class UpdateDMLPackage : public CalpontDMLPackage
|
||||
* @param columns the number of columns in the buffer
|
||||
* @param rows the number of rows in the buffer
|
||||
*/
|
||||
EXPORT int buildFromBuffer(std::string& buffer, int columns, int rows);
|
||||
EXPORT int buildFromBuffer(std::string& buffer, int columns, int rows) override;
|
||||
|
||||
/** @brief build a UpdateDMLPackage from a parsed UpdateSqlStatement
|
||||
*
|
||||
* @param sqlStatement the parsed UpdateSqlStatement
|
||||
*/
|
||||
EXPORT int buildFromSqlStatement(SqlStatement& sqlStatement);
|
||||
EXPORT int buildFromSqlStatement(SqlStatement& sqlStatement) override;
|
||||
|
||||
/** @brief build a InsertDMLPackage from MySQL buffer
|
||||
*
|
||||
@@ -87,7 +87,7 @@ class UpdateDMLPackage : public CalpontDMLPackage
|
||||
* @param rows the number of rows in the buffer
|
||||
*/
|
||||
EXPORT int buildFromMysqlBuffer(ColNameList& colNameList, TableValuesMap& tableValuesMap, int columns,
|
||||
int rows, NullValuesBitset& nullValues);
|
||||
int rows, NullValuesBitset& nullValues) override;
|
||||
void buildUpdateFromMysqlBuffer(UpdateSqlStatement& updateStmt);
|
||||
|
||||
protected:
|
||||
|
@@ -23,10 +23,11 @@
|
||||
/** @file */
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <bitset>
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
#include "dmlpkg.h"
|
||||
|
||||
#define EXPORT
|
||||
@@ -73,7 +74,7 @@ class VendorDMLStatement
|
||||
*/
|
||||
inline void set_TableName(std::string value)
|
||||
{
|
||||
fTableName = value;
|
||||
fTableName = std::move(value);
|
||||
}
|
||||
|
||||
/** @brief Get the schema name
|
||||
@@ -87,7 +88,7 @@ class VendorDMLStatement
|
||||
*/
|
||||
inline void set_SchemaName(std::string value)
|
||||
{
|
||||
fSchema = value;
|
||||
fSchema = std::move(value);
|
||||
}
|
||||
|
||||
/** @brief Get the DML statVendorDMLStatement classement type
|
||||
@@ -115,7 +116,7 @@ class VendorDMLStatement
|
||||
*/
|
||||
inline void set_DMLStatement(std::string dmlStatement)
|
||||
{
|
||||
fDMLStatement = dmlStatement;
|
||||
fDMLStatement = std::move(dmlStatement);
|
||||
}
|
||||
|
||||
/** @brief Get the number of rows
|
||||
@@ -157,7 +158,7 @@ class VendorDMLStatement
|
||||
*/
|
||||
inline void set_DataBuffer(std::string value)
|
||||
{
|
||||
fDataBuffer = value;
|
||||
fDataBuffer = std::move(value);
|
||||
}
|
||||
/** @brief Get the session ID
|
||||
*/
|
||||
|
@@ -21,7 +21,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/condition.hpp>
|
||||
@@ -48,4 +48,3 @@ class AutoincrementData
|
||||
OIDNextValue fOidNextValueMap;
|
||||
boost::mutex fOIDnextvalLock;
|
||||
};
|
||||
|
||||
|
@@ -46,6 +46,7 @@ using namespace joblist;
|
||||
|
||||
namespace execplan
|
||||
{
|
||||
|
||||
void getAggCols(execplan::ParseTree* n, void* obj)
|
||||
{
|
||||
vector<AggregateColumn*>* list = reinterpret_cast<vector<AggregateColumn*>*>(obj);
|
||||
|
@@ -94,7 +94,7 @@ class AggregateColumn : public ReturnedColumn
|
||||
/**
|
||||
* ctor
|
||||
*/
|
||||
AggregateColumn(const uint32_t sessionID);
|
||||
explicit AggregateColumn(const uint32_t sessionID);
|
||||
|
||||
/**
|
||||
* ctor
|
||||
@@ -109,9 +109,7 @@ class AggregateColumn : public ReturnedColumn
|
||||
/**
|
||||
* Destructors
|
||||
*/
|
||||
virtual ~AggregateColumn()
|
||||
{
|
||||
}
|
||||
~AggregateColumn() override = default;
|
||||
|
||||
/**
|
||||
* Accessor Methods
|
||||
@@ -167,7 +165,7 @@ class AggregateColumn : public ReturnedColumn
|
||||
*
|
||||
* deep copy of this pointer and return the copy
|
||||
*/
|
||||
inline virtual AggregateColumn* clone() const override
|
||||
inline AggregateColumn* clone() const override
|
||||
{
|
||||
return new AggregateColumn(*this);
|
||||
}
|
||||
@@ -190,14 +188,14 @@ class AggregateColumn : public ReturnedColumn
|
||||
/**
|
||||
* ASC flag
|
||||
*/
|
||||
inline virtual bool asc() const override
|
||||
inline bool asc() const override
|
||||
{
|
||||
return fAsc;
|
||||
}
|
||||
/**
|
||||
* ASC flag
|
||||
*/
|
||||
inline virtual void asc(const bool asc) override
|
||||
inline void asc(const bool asc) override
|
||||
{
|
||||
fAsc = asc;
|
||||
}
|
||||
@@ -205,7 +203,7 @@ class AggregateColumn : public ReturnedColumn
|
||||
/**
|
||||
* fData: SQL representation of this object
|
||||
*/
|
||||
virtual const std::string data() const override
|
||||
const std::string data() const override
|
||||
{
|
||||
return fData;
|
||||
}
|
||||
@@ -221,24 +219,24 @@ class AggregateColumn : public ReturnedColumn
|
||||
/**
|
||||
* Overloaded stream operator
|
||||
*/
|
||||
virtual const std::string toString() const override;
|
||||
virtual std::string toCppCode(IncludeSet& includes) const override;
|
||||
const std::string toString() const override;
|
||||
std::string toCppCode(IncludeSet& includes) const override;
|
||||
|
||||
/**
|
||||
* Serialize interface
|
||||
*/
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
/**
|
||||
* Serialize interface
|
||||
*/
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
|
||||
*/
|
||||
virtual bool operator==(const TreeNode* t) const override;
|
||||
bool operator==(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -253,7 +251,7 @@ class AggregateColumn : public ReturnedColumn
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
|
||||
*/
|
||||
virtual bool operator!=(const TreeNode* t) const override;
|
||||
bool operator!=(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -309,8 +307,8 @@ class AggregateColumn : public ReturnedColumn
|
||||
static AggOp agname2num(const std::string&);
|
||||
|
||||
using ReturnedColumn::hasAggregate;
|
||||
virtual bool hasAggregate() override;
|
||||
virtual bool hasWindowFunc() override
|
||||
bool hasAggregate() override;
|
||||
bool hasWindowFunc() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -357,7 +355,7 @@ class AggregateColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override
|
||||
const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
bool localIsNull = false;
|
||||
evaluate(row, localIsNull);
|
||||
@@ -368,7 +366,7 @@ class AggregateColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int64_t getIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
evaluate(row, isNull);
|
||||
return TreeNode::getIntVal();
|
||||
@@ -377,7 +375,7 @@ class AggregateColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override
|
||||
uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
evaluate(row, isNull);
|
||||
return TreeNode::getUintVal();
|
||||
@@ -386,7 +384,7 @@ class AggregateColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual float getFloatVal(rowgroup::Row& row, bool& isNull) override
|
||||
float getFloatVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
evaluate(row, isNull);
|
||||
return TreeNode::getFloatVal();
|
||||
@@ -395,7 +393,7 @@ class AggregateColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual double getDoubleVal(rowgroup::Row& row, bool& isNull) override
|
||||
double getDoubleVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
evaluate(row, isNull);
|
||||
return TreeNode::getDoubleVal();
|
||||
@@ -404,7 +402,7 @@ class AggregateColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override
|
||||
long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
evaluate(row, isNull);
|
||||
return TreeNode::getLongDoubleVal();
|
||||
@@ -413,7 +411,7 @@ class AggregateColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override
|
||||
IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
evaluate(row, isNull);
|
||||
return TreeNode::getDecimalVal();
|
||||
@@ -421,7 +419,7 @@ class AggregateColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
evaluate(row, isNull);
|
||||
return TreeNode::getDateIntVal();
|
||||
@@ -429,7 +427,7 @@ class AggregateColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
evaluate(row, isNull);
|
||||
return TreeNode::getTimeIntVal();
|
||||
@@ -437,7 +435,7 @@ class AggregateColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
evaluate(row, isNull);
|
||||
return TreeNode::getDatetimeIntVal();
|
||||
@@ -445,7 +443,7 @@ class AggregateColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
evaluate(row, isNull);
|
||||
return TreeNode::getTimestampIntVal();
|
||||
|
@@ -300,12 +300,12 @@ const string ArithmeticColumn::toString() const
|
||||
if (fAlias.length() > 0)
|
||||
oss << "Alias: " << fAlias << endl;
|
||||
|
||||
if (fExpression != 0)
|
||||
fExpression->walk(walkfn, oss);
|
||||
|
||||
oss << "expressionId=" << fExpressionId << endl;
|
||||
oss << "joinInfo=" << fJoinInfo << " returnAll=" << fReturnAll << " sequence#=" << fSequence << endl;
|
||||
oss << "resultType=" << colDataTypeToString(fResultType.colDataType) << "|" << fResultType.colWidth << endl;
|
||||
if (fExpression != 0)
|
||||
fExpression->walk(walkfn, oss);
|
||||
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
|
@@ -51,7 +51,7 @@ class ArithmeticColumn : public ReturnedColumn
|
||||
ArithmeticColumn();
|
||||
ArithmeticColumn(const std::string& sql, const uint32_t sessionID = 0);
|
||||
ArithmeticColumn(const ArithmeticColumn& rhs, const uint32_t sessionID = 0);
|
||||
virtual ~ArithmeticColumn();
|
||||
~ArithmeticColumn() override;
|
||||
|
||||
inline ParseTree* expression() const
|
||||
{
|
||||
@@ -102,7 +102,7 @@ class ArithmeticColumn : public ReturnedColumn
|
||||
/**
|
||||
* get SQL representation of this object
|
||||
*/
|
||||
virtual const std::string data() const override
|
||||
const std::string data() const override
|
||||
{
|
||||
return fData;
|
||||
}
|
||||
@@ -110,7 +110,7 @@ class ArithmeticColumn : public ReturnedColumn
|
||||
/**
|
||||
* set SQL representation of this object
|
||||
*/
|
||||
virtual void data(const std::string data) override
|
||||
void data(const std::string data) override
|
||||
{
|
||||
fData = data;
|
||||
}
|
||||
@@ -118,13 +118,13 @@ class ArithmeticColumn : public ReturnedColumn
|
||||
/**
|
||||
* virtual stream method
|
||||
*/
|
||||
virtual const std::string toString() const override;
|
||||
const std::string toString() const override;
|
||||
|
||||
/** return a copy of this pointer
|
||||
*
|
||||
* deep copy of this pointer and return the copy
|
||||
*/
|
||||
inline virtual ArithmeticColumn* clone() const override
|
||||
inline ArithmeticColumn* clone() const override
|
||||
{
|
||||
return new ArithmeticColumn(*this);
|
||||
}
|
||||
@@ -132,15 +132,15 @@ class ArithmeticColumn : public ReturnedColumn
|
||||
/**
|
||||
* The serialization interface
|
||||
*/
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
|
||||
*/
|
||||
virtual bool operator==(const TreeNode* t) const override;
|
||||
bool operator==(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -154,7 +154,7 @@ class ArithmeticColumn : public ReturnedColumn
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
|
||||
*/
|
||||
virtual bool operator!=(const TreeNode* t) const override;
|
||||
bool operator!=(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -164,16 +164,16 @@ class ArithmeticColumn : public ReturnedColumn
|
||||
bool operator!=(const ArithmeticColumn& t) const;
|
||||
|
||||
using ReturnedColumn::hasAggregate;
|
||||
virtual bool hasAggregate() override;
|
||||
virtual bool hasWindowFunc() override;
|
||||
bool hasAggregate() override;
|
||||
bool hasWindowFunc() override;
|
||||
|
||||
virtual void setDerivedTable() override;
|
||||
virtual void replaceRealCol(std::vector<SRCP>&) override;
|
||||
virtual const std::vector<SimpleColumn*>& simpleColumnList() const override
|
||||
void setDerivedTable() override;
|
||||
void replaceRealCol(std::vector<SRCP>&) override;
|
||||
const std::vector<SimpleColumn*>& simpleColumnList() const override
|
||||
{
|
||||
return fSimpleColumnList;
|
||||
}
|
||||
virtual void setSimpleColumnList() override;
|
||||
void setSimpleColumnList() override;
|
||||
|
||||
/**
|
||||
* Return the table that the column arguments belong to.
|
||||
@@ -181,9 +181,9 @@ class ArithmeticColumn : public ReturnedColumn
|
||||
* @return tablename, if all arguments belong to one table
|
||||
* empty string "", if multiple tables are involved in this func
|
||||
*/
|
||||
virtual bool singleTable(CalpontSystemCatalog::TableAliasName& tan) override;
|
||||
bool singleTable(CalpontSystemCatalog::TableAliasName& tan) override;
|
||||
|
||||
virtual std::string toCppCode(IncludeSet& includes) const override;
|
||||
std::string toCppCode(IncludeSet& includes) const override;
|
||||
|
||||
private:
|
||||
std::string fTableAlias; // table alias for this column
|
||||
@@ -211,62 +211,62 @@ class ArithmeticColumn : public ReturnedColumn
|
||||
* F&E framework *
|
||||
***********************************************************/
|
||||
public:
|
||||
virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override
|
||||
const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
return fExpression->getStrVal(row, isNull);
|
||||
}
|
||||
|
||||
virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int64_t getIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
return fExpression->getIntVal(row, isNull);
|
||||
}
|
||||
|
||||
virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override
|
||||
uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
return fExpression->getUintVal(row, isNull);
|
||||
}
|
||||
|
||||
virtual float getFloatVal(rowgroup::Row& row, bool& isNull) override
|
||||
float getFloatVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
return fExpression->getFloatVal(row, isNull);
|
||||
}
|
||||
|
||||
virtual double getDoubleVal(rowgroup::Row& row, bool& isNull) override
|
||||
double getDoubleVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
return fExpression->getDoubleVal(row, isNull);
|
||||
}
|
||||
|
||||
virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override
|
||||
long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
return fExpression->getLongDoubleVal(row, isNull);
|
||||
}
|
||||
|
||||
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override
|
||||
IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
return fExpression->getDecimalVal(row, isNull);
|
||||
}
|
||||
|
||||
virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
return fExpression->getDateIntVal(row, isNull);
|
||||
}
|
||||
|
||||
virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
return fExpression->getDatetimeIntVal(row, isNull);
|
||||
}
|
||||
|
||||
virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
return fExpression->getTimestampIntVal(row, isNull);
|
||||
}
|
||||
|
||||
virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
return fExpression->getTimeIntVal(row, isNull);
|
||||
}
|
||||
|
||||
virtual bool getBoolVal(rowgroup::Row& row, bool& isNull) override
|
||||
bool getBoolVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
return fExpression->getBoolVal(row, isNull);
|
||||
}
|
||||
|
@@ -46,16 +46,16 @@ class ArithmeticOperator : public Operator
|
||||
|
||||
public:
|
||||
ArithmeticOperator();
|
||||
ArithmeticOperator(const std::string& operatorName);
|
||||
explicit ArithmeticOperator(const std::string& operatorName);
|
||||
ArithmeticOperator(const ArithmeticOperator& rhs);
|
||||
|
||||
virtual ~ArithmeticOperator();
|
||||
~ArithmeticOperator() override;
|
||||
|
||||
/** return a copy of this pointer
|
||||
*
|
||||
* deep copy of this pointer and return the copy
|
||||
*/
|
||||
inline virtual ArithmeticOperator* clone() const override
|
||||
inline ArithmeticOperator* clone() const override
|
||||
{
|
||||
return new ArithmeticOperator(*this);
|
||||
}
|
||||
@@ -72,15 +72,15 @@ class ArithmeticOperator : public Operator
|
||||
/**
|
||||
* The serialization interface
|
||||
*/
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
|
||||
*/
|
||||
virtual bool operator==(const TreeNode* t) const override;
|
||||
bool operator==(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -94,7 +94,7 @@ class ArithmeticOperator : public Operator
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
|
||||
*/
|
||||
virtual bool operator!=(const TreeNode* t) const override;
|
||||
bool operator!=(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -107,10 +107,10 @@ class ArithmeticOperator : public Operator
|
||||
* F&E framework *
|
||||
***********************************************************/
|
||||
using Operator::evaluate;
|
||||
inline virtual void evaluate(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override;
|
||||
inline void evaluate(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override;
|
||||
|
||||
using Operator::getStrVal;
|
||||
virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull, ParseTree* lop,
|
||||
const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull, ParseTree* lop,
|
||||
ParseTree* rop) override
|
||||
{
|
||||
bool localIsNull = false;
|
||||
@@ -119,38 +119,37 @@ class ArithmeticOperator : public Operator
|
||||
return localIsNull ? fResult.strVal.dropString() : TreeNode::getStrVal(fTimeZone);
|
||||
}
|
||||
using Operator::getIntVal;
|
||||
virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
|
||||
int64_t getIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
|
||||
{
|
||||
evaluate(row, isNull, lop, rop);
|
||||
return TreeNode::getIntVal();
|
||||
}
|
||||
using Operator::getUintVal;
|
||||
virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
|
||||
uint64_t getUintVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
|
||||
{
|
||||
evaluate(row, isNull, lop, rop);
|
||||
return TreeNode::getUintVal();
|
||||
}
|
||||
using Operator::getFloatVal;
|
||||
virtual float getFloatVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
|
||||
float getFloatVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
|
||||
{
|
||||
evaluate(row, isNull, lop, rop);
|
||||
return TreeNode::getFloatVal();
|
||||
}
|
||||
using Operator::getDoubleVal;
|
||||
virtual double getDoubleVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
|
||||
double getDoubleVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
|
||||
{
|
||||
evaluate(row, isNull, lop, rop);
|
||||
return TreeNode::getDoubleVal();
|
||||
}
|
||||
using Operator::getLongDoubleVal;
|
||||
virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull, ParseTree* lop,
|
||||
ParseTree* rop) override
|
||||
long double getLongDoubleVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
|
||||
{
|
||||
evaluate(row, isNull, lop, rop);
|
||||
return TreeNode::getLongDoubleVal();
|
||||
}
|
||||
using Operator::getDecimalVal;
|
||||
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
|
||||
IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
|
||||
{
|
||||
evaluate(row, isNull, lop, rop);
|
||||
|
||||
@@ -169,32 +168,31 @@ class ArithmeticOperator : public Operator
|
||||
return TreeNode::getDecimalVal();
|
||||
}
|
||||
using Operator::getDateIntVal;
|
||||
virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
|
||||
int32_t getDateIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
|
||||
{
|
||||
evaluate(row, isNull, lop, rop);
|
||||
return TreeNode::getDateIntVal();
|
||||
}
|
||||
using Operator::getDatetimeIntVal;
|
||||
virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
|
||||
int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
|
||||
{
|
||||
evaluate(row, isNull, lop, rop);
|
||||
return TreeNode::getDatetimeIntVal();
|
||||
}
|
||||
using Operator::getTimestampIntVal;
|
||||
virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop,
|
||||
ParseTree* rop) override
|
||||
int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
|
||||
{
|
||||
evaluate(row, isNull, lop, rop);
|
||||
return TreeNode::getTimestampIntVal();
|
||||
}
|
||||
using Operator::getTimeIntVal;
|
||||
virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
|
||||
int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
|
||||
{
|
||||
evaluate(row, isNull, lop, rop);
|
||||
return TreeNode::getTimeIntVal();
|
||||
}
|
||||
using Operator::getBoolVal;
|
||||
virtual bool getBoolVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
|
||||
bool getBoolVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
|
||||
{
|
||||
evaluate(row, isNull, lop, rop);
|
||||
return TreeNode::getBoolVal();
|
||||
@@ -209,7 +207,7 @@ class ArithmeticOperator : public Operator
|
||||
fDecimalOverflowCheck = check;
|
||||
}
|
||||
|
||||
inline virtual std::string toCppCode(IncludeSet& includes) const override
|
||||
inline std::string toCppCode(IncludeSet& includes) const override
|
||||
{
|
||||
includes.insert("arithmeticoperator.h");
|
||||
std::stringstream ss;
|
||||
@@ -261,6 +259,10 @@ inline void ArithmeticOperator::evaluate(rowgroup::Row& row, bool& isNull, Parse
|
||||
case execplan::CalpontSystemCatalog::SMALLINT:
|
||||
case execplan::CalpontSystemCatalog::TINYINT:
|
||||
fResult.intVal = execute(lop->getIntVal(row, isNull), rop->getIntVal(row, isNull), isNull);
|
||||
if (isNull)
|
||||
{
|
||||
fResult.intVal = joblist::INTNULL;
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::UBIGINT:
|
||||
@@ -282,6 +284,10 @@ inline void ArithmeticOperator::evaluate(rowgroup::Row& row, bool& isNull, Parse
|
||||
case execplan::CalpontSystemCatalog::USMALLINT:
|
||||
case execplan::CalpontSystemCatalog::UTINYINT:
|
||||
fResult.uintVal = execute(lop->getUintVal(row, isNull), rop->getUintVal(row, isNull), isNull);
|
||||
if (isNull)
|
||||
{
|
||||
fResult.uintVal = joblist::UBIGINTNULL;
|
||||
}
|
||||
break;
|
||||
|
||||
case execplan::CalpontSystemCatalog::DOUBLE:
|
||||
@@ -313,6 +319,19 @@ inline void ArithmeticOperator::evaluate(rowgroup::Row& row, bool& isNull, Parse
|
||||
template <typename T>
|
||||
inline T ArithmeticOperator::execute(T op1, T op2, bool& isNull)
|
||||
{
|
||||
if (isNull)
|
||||
{
|
||||
// at least one operand is NULL.
|
||||
// do nothing, return 0.
|
||||
if constexpr (std::is_same<T, datatypes::TSInt128>::value)
|
||||
{
|
||||
return datatypes::TSInt128(); // returns 0
|
||||
}
|
||||
else
|
||||
{
|
||||
return T{0};
|
||||
}
|
||||
}
|
||||
switch (fOp)
|
||||
{
|
||||
case OP_ADD: return op1 + op2;
|
||||
|
@@ -23,6 +23,6 @@
|
||||
// # of bytes in a block
|
||||
const uint64_t BLOCK_SIZE = 8192;
|
||||
|
||||
// lobgical_block_rids is the # of rows 1-byter-column in a block
|
||||
// logical_block_rids is the # of rows 1-byter-column in a block
|
||||
// its value is the same as block_size, but different unit
|
||||
const uint64_t LOGICAL_BLOCK_RIDS = BLOCK_SIZE;
|
||||
|
@@ -25,13 +25,13 @@
|
||||
using namespace std;
|
||||
|
||||
#include <boost/uuid/uuid_io.hpp>
|
||||
#include <utility>
|
||||
|
||||
#include "bytestream.h"
|
||||
using namespace messageqcpp;
|
||||
|
||||
#include "calpontselectexecutionplan.h"
|
||||
#include "objectreader.h"
|
||||
#include "filter.h"
|
||||
#include "returnedcolumn.h"
|
||||
#include "simplecolumn.h"
|
||||
#include "querystats.h"
|
||||
@@ -63,10 +63,10 @@ CalpontSelectExecutionPlan::ColumnMap CalpontSelectExecutionPlan::fColMap;
|
||||
/**
|
||||
* Constructors/Destructors
|
||||
*/
|
||||
CalpontSelectExecutionPlan::CalpontSelectExecutionPlan(const int location)
|
||||
CalpontSelectExecutionPlan::CalpontSelectExecutionPlan(int location)
|
||||
: fLocalQuery(GLOBAL_QUERY)
|
||||
, fFilters(0)
|
||||
, fHaving(0)
|
||||
, fFilters(nullptr)
|
||||
, fHaving(nullptr)
|
||||
, fLocation(location)
|
||||
, fDependent(false)
|
||||
, fTxnID(-1)
|
||||
@@ -98,17 +98,18 @@ CalpontSelectExecutionPlan::CalpontSelectExecutionPlan(const int location)
|
||||
fUuid = QueryTeleClient::genUUID();
|
||||
}
|
||||
|
||||
CalpontSelectExecutionPlan::CalpontSelectExecutionPlan(
|
||||
const ReturnedColumnList& returnedCols, ParseTree* filters, const SelectList& subSelects,
|
||||
const GroupByColumnList& groupByCols, ParseTree* having, const OrderByColumnList& orderByCols,
|
||||
const string alias, const int location, const bool dependent, const bool withRollup)
|
||||
: fReturnedCols(returnedCols)
|
||||
CalpontSelectExecutionPlan::CalpontSelectExecutionPlan(ReturnedColumnList returnedCols, ParseTree* filters,
|
||||
SelectList subSelects, GroupByColumnList groupByCols,
|
||||
ParseTree* having, OrderByColumnList orderByCols,
|
||||
string alias, int location, bool dependent,
|
||||
bool withRollup)
|
||||
: fReturnedCols(std::move(returnedCols))
|
||||
, fFilters(filters)
|
||||
, fSubSelects(subSelects)
|
||||
, fGroupByCols(groupByCols)
|
||||
, fSubSelects(std::move(subSelects))
|
||||
, fGroupByCols(std::move(groupByCols))
|
||||
, fHaving(having)
|
||||
, fOrderByCols(orderByCols)
|
||||
, fTableAlias(alias)
|
||||
, fOrderByCols(std::move(orderByCols))
|
||||
, fTableAlias(std::move(alias))
|
||||
, fLocation(location)
|
||||
, fDependent(dependent)
|
||||
, fPriority(querystats::DEFAULT_USER_PRIORITY_LEVEL)
|
||||
@@ -118,23 +119,18 @@ CalpontSelectExecutionPlan::CalpontSelectExecutionPlan(
|
||||
}
|
||||
|
||||
CalpontSelectExecutionPlan::CalpontSelectExecutionPlan(string data)
|
||||
: fData(data)
|
||||
, fPriority(querystats::DEFAULT_USER_PRIORITY_LEVEL)
|
||||
, fWithRollup(false)
|
||||
: fData(std::move(data)), fPriority(querystats::DEFAULT_USER_PRIORITY_LEVEL), fWithRollup(false)
|
||||
{
|
||||
fUuid = QueryTeleClient::genUUID();
|
||||
}
|
||||
|
||||
CalpontSelectExecutionPlan::~CalpontSelectExecutionPlan()
|
||||
{
|
||||
if (fFilters != NULL)
|
||||
delete fFilters;
|
||||
|
||||
if (fHaving != NULL)
|
||||
delete fHaving;
|
||||
|
||||
fFilters = NULL;
|
||||
fHaving = NULL;
|
||||
fFilters = nullptr;
|
||||
fHaving = nullptr;
|
||||
|
||||
if (!fDynamicParseTreeVec.empty())
|
||||
{
|
||||
@@ -145,11 +141,11 @@ CalpontSelectExecutionPlan::~CalpontSelectExecutionPlan()
|
||||
// 'delete fFilters;' above has already deleted objects pointed
|
||||
// to by parseTree->left()/right()/data(), so we set the
|
||||
// pointers to NULL here before calling 'delete parseTree;'
|
||||
parseTree->left((ParseTree*)(NULL));
|
||||
parseTree->right((ParseTree*)(NULL));
|
||||
parseTree->data((TreeNode*)(NULL));
|
||||
parseTree->left((ParseTree*)(nullptr));
|
||||
parseTree->right((ParseTree*)(nullptr));
|
||||
parseTree->data((TreeNode*)(nullptr));
|
||||
delete parseTree;
|
||||
parseTree = NULL;
|
||||
parseTree = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,7 +261,7 @@ string CalpontSelectExecutionPlan::toString() const
|
||||
// Filters
|
||||
output << ">>Filters" << endl;
|
||||
|
||||
if (filters() != 0)
|
||||
if (filters() != nullptr)
|
||||
filters()->walk(ParseTree::print, output);
|
||||
else
|
||||
output << "empty filter tree" << endl;
|
||||
@@ -282,7 +278,7 @@ string CalpontSelectExecutionPlan::toString() const
|
||||
}
|
||||
|
||||
// Having
|
||||
if (having() != 0)
|
||||
if (having() != nullptr)
|
||||
{
|
||||
output << ">>Having" << endl;
|
||||
having()->walk(ParseTree::print, output);
|
||||
@@ -496,16 +492,16 @@ void CalpontSelectExecutionPlan::unserialize(messageqcpp::ByteStream& b)
|
||||
fDerivedTableList.clear();
|
||||
fSelectSubList.clear();
|
||||
|
||||
if (fFilters != 0)
|
||||
if (fFilters != nullptr)
|
||||
{
|
||||
delete fFilters;
|
||||
fFilters = 0;
|
||||
fFilters = nullptr;
|
||||
}
|
||||
|
||||
if (fHaving != 0)
|
||||
if (fHaving != nullptr)
|
||||
{
|
||||
delete fHaving;
|
||||
fHaving = 0;
|
||||
fHaving = nullptr;
|
||||
}
|
||||
|
||||
if (!fDynamicParseTreeVec.empty())
|
||||
@@ -517,11 +513,11 @@ void CalpontSelectExecutionPlan::unserialize(messageqcpp::ByteStream& b)
|
||||
// 'delete fFilters;' above has already deleted objects pointed
|
||||
// to by parseTree->left()/right()/data(), so we set the
|
||||
// pointers to NULL here before calling 'delete parseTree;'
|
||||
parseTree->left((ParseTree*)(NULL));
|
||||
parseTree->right((ParseTree*)(NULL));
|
||||
parseTree->data((TreeNode*)(NULL));
|
||||
parseTree->left((ParseTree*)(nullptr));
|
||||
parseTree->right((ParseTree*)(nullptr));
|
||||
parseTree->data((TreeNode*)(nullptr));
|
||||
delete parseTree;
|
||||
parseTree = NULL;
|
||||
parseTree = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -699,12 +695,12 @@ bool CalpontSelectExecutionPlan::operator==(const CalpontSelectExecutionPlan& t)
|
||||
return false;
|
||||
|
||||
// fFilters
|
||||
if (fFilters != NULL && t.fFilters != NULL)
|
||||
if (fFilters != nullptr && t.fFilters != nullptr)
|
||||
{
|
||||
if (*fFilters != *t.fFilters)
|
||||
return false;
|
||||
}
|
||||
else if (fFilters != NULL || t.fFilters != NULL)
|
||||
else if (fFilters != nullptr || t.fFilters != nullptr)
|
||||
return false;
|
||||
|
||||
// fSubSelects
|
||||
@@ -725,12 +721,12 @@ bool CalpontSelectExecutionPlan::operator==(const CalpontSelectExecutionPlan& t)
|
||||
return false;
|
||||
|
||||
// fHaving
|
||||
if (fHaving != NULL && t.fHaving != NULL)
|
||||
if (fHaving != nullptr && t.fHaving != nullptr)
|
||||
{
|
||||
if (*fHaving != *t.fHaving)
|
||||
return false;
|
||||
}
|
||||
else if (fHaving != NULL || t.fHaving != NULL)
|
||||
else if (fHaving != nullptr || t.fHaving != nullptr)
|
||||
return false;
|
||||
|
||||
// fOrderByCols
|
||||
@@ -795,7 +791,7 @@ bool CalpontSelectExecutionPlan::operator==(const CalpontExecutionPlan* t) const
|
||||
|
||||
ac = dynamic_cast<const CalpontSelectExecutionPlan*>(t);
|
||||
|
||||
if (ac == NULL)
|
||||
if (ac == nullptr)
|
||||
return false;
|
||||
|
||||
return *this == *ac;
|
||||
|
@@ -146,19 +146,18 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan
|
||||
/**
|
||||
* Constructors
|
||||
*/
|
||||
CalpontSelectExecutionPlan(const int location = MAIN);
|
||||
explicit CalpontSelectExecutionPlan(int location = MAIN);
|
||||
|
||||
CalpontSelectExecutionPlan(const ReturnedColumnList& returnedCols, ParseTree* filters,
|
||||
const SelectList& subSelects, const GroupByColumnList& groupByCols,
|
||||
ParseTree* having, const OrderByColumnList& orderByCols, const std::string alias,
|
||||
const int location, const bool dependent, const bool withRollup);
|
||||
CalpontSelectExecutionPlan(ReturnedColumnList returnedCols, ParseTree* filters, SelectList subSelects,
|
||||
GroupByColumnList groupByCols, ParseTree* having, OrderByColumnList orderByCols,
|
||||
std::string alias, int location, bool dependent, bool withRollup);
|
||||
|
||||
CalpontSelectExecutionPlan(const std::string data);
|
||||
explicit CalpontSelectExecutionPlan(std::string data);
|
||||
|
||||
/**
|
||||
* Destructors
|
||||
*/
|
||||
virtual ~CalpontSelectExecutionPlan();
|
||||
~CalpontSelectExecutionPlan() override;
|
||||
|
||||
/**
|
||||
* Access and mutator methods
|
||||
@@ -366,13 +365,13 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan
|
||||
/** sql representation of this select query
|
||||
*
|
||||
*/
|
||||
const std::string data() const
|
||||
const std::string& data() const
|
||||
{
|
||||
return fData;
|
||||
}
|
||||
void data(const std::string data)
|
||||
void data(std::string data)
|
||||
{
|
||||
fData = data;
|
||||
fData = std::move(data);
|
||||
}
|
||||
|
||||
/** session id
|
||||
@@ -679,7 +678,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan
|
||||
{
|
||||
fDJSSmallSideLimit = l;
|
||||
}
|
||||
uint64_t djsSmallSideLimit()
|
||||
uint64_t djsSmallSideLimit() const
|
||||
{
|
||||
return fDJSSmallSideLimit;
|
||||
}
|
||||
@@ -688,7 +687,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan
|
||||
{
|
||||
fDJSLargeSideLimit = l;
|
||||
}
|
||||
uint64_t djsLargeSideLimit()
|
||||
uint64_t djsLargeSideLimit() const
|
||||
{
|
||||
return fDJSLargeSideLimit;
|
||||
}
|
||||
@@ -697,7 +696,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan
|
||||
{
|
||||
fDJSPartitionSize = l;
|
||||
}
|
||||
uint64_t djsPartitionSize()
|
||||
uint64_t djsPartitionSize() const
|
||||
{
|
||||
return fDJSPartitionSize;
|
||||
}
|
||||
@@ -715,7 +714,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan
|
||||
{
|
||||
fDJSForceRun = b;
|
||||
}
|
||||
bool djsForceRun()
|
||||
bool djsForceRun() const
|
||||
{
|
||||
return fDJSForceRun;
|
||||
}
|
||||
@@ -724,7 +723,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan
|
||||
{
|
||||
fMaxPmJoinResultCount = value;
|
||||
}
|
||||
uint32_t maxPmJoinResultCount()
|
||||
uint32_t maxPmJoinResultCount() const
|
||||
{
|
||||
return fMaxPmJoinResultCount;
|
||||
}
|
||||
@@ -733,7 +732,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan
|
||||
{
|
||||
fUMMemLimit = l;
|
||||
}
|
||||
int64_t umMemLimit()
|
||||
int64_t umMemLimit() const
|
||||
{
|
||||
return fUMMemLimit;
|
||||
}
|
||||
@@ -742,7 +741,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan
|
||||
{
|
||||
fIsDML = b;
|
||||
}
|
||||
bool isDML()
|
||||
bool isDML() const
|
||||
{
|
||||
return fIsDML;
|
||||
}
|
||||
@@ -762,15 +761,15 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan
|
||||
/**
|
||||
* @note Serialize() assumes that none of the vectors contain NULL pointers.
|
||||
*/
|
||||
virtual void serialize(messageqcpp::ByteStream&) const;
|
||||
virtual void unserialize(messageqcpp::ByteStream&);
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
|
||||
*/
|
||||
virtual bool operator==(const CalpontExecutionPlan* t) const;
|
||||
bool operator==(const CalpontExecutionPlan* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -784,7 +783,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
|
||||
*/
|
||||
virtual bool operator!=(const CalpontExecutionPlan* t) const;
|
||||
bool operator!=(const CalpontExecutionPlan* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -863,7 +862,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan
|
||||
/**
|
||||
* A tree of Filter objects
|
||||
*/
|
||||
ParseTree* fFilters = nullptr;
|
||||
ParseTree* fFilters{nullptr};
|
||||
/**
|
||||
* A list of CalpontExecutionPlan objects
|
||||
*/
|
||||
@@ -875,7 +874,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan
|
||||
/**
|
||||
* A tree of having clause condition associated with group by clause
|
||||
*/
|
||||
ParseTree* fHaving;
|
||||
ParseTree* fHaving{nullptr};
|
||||
/**
|
||||
* A list of order by columns
|
||||
*/
|
||||
@@ -955,7 +954,7 @@ class CalpontSelectExecutionPlan : public CalpontExecutionPlan
|
||||
// Derived table involved in the query. For derived table optimization
|
||||
std::vector<SCSEP> fSubSelectList;
|
||||
|
||||
boost::uuids::uuid fUuid;
|
||||
boost::uuids::uuid fUuid{};
|
||||
|
||||
/* Disk-based join vars */
|
||||
uint64_t fDJSSmallSideLimit = 0;
|
||||
|
@@ -139,9 +139,8 @@ class CalpontSystemCatalog : public datatypes::SystemCatalog
|
||||
{
|
||||
}
|
||||
DictOID(const DictOID& rhs)
|
||||
: dictOID(rhs.dictOID), listOID(rhs.listOID), treeOID(rhs.treeOID), compressionType(rhs.compressionType)
|
||||
{
|
||||
}
|
||||
|
||||
= default;
|
||||
OID dictOID;
|
||||
OID listOID;
|
||||
OID treeOID;
|
||||
@@ -176,7 +175,7 @@ class CalpontSystemCatalog : public datatypes::SystemCatalog
|
||||
// If we used an unorderedmap<OID, ColumnResult*>, we might improve performance.
|
||||
// Maybe.
|
||||
NJLSysDataVector sysDataVec;
|
||||
NJLSysDataList(){};
|
||||
NJLSysDataList() = default;
|
||||
~NJLSysDataList();
|
||||
NJLSysDataVector::const_iterator begin() const
|
||||
{
|
||||
@@ -439,9 +438,7 @@ class CalpontSystemCatalog : public datatypes::SystemCatalog
|
||||
*/
|
||||
struct TableName
|
||||
{
|
||||
TableName()
|
||||
{
|
||||
}
|
||||
TableName() = default;
|
||||
TableName(std::string sch, std::string tb) : schema(sch), table(tb)
|
||||
{
|
||||
}
|
||||
@@ -873,7 +870,7 @@ class CalpontSystemCatalog : public datatypes::SystemCatalog
|
||||
|
||||
private:
|
||||
/** Constuctors */
|
||||
explicit CalpontSystemCatalog(const CalpontSystemCatalog& rhs);
|
||||
CalpontSystemCatalog(const CalpontSystemCatalog& rhs);
|
||||
|
||||
CalpontSystemCatalog& operator=(const CalpontSystemCatalog& rhs);
|
||||
|
||||
|
@@ -56,7 +56,7 @@ class ClientRotator
|
||||
}
|
||||
}
|
||||
|
||||
/** @brief connnect
|
||||
/** @brief connect
|
||||
*
|
||||
* Try connecting to client based on session id. If no connection,
|
||||
* try connectList.
|
||||
@@ -79,7 +79,7 @@ class ClientRotator
|
||||
{
|
||||
fClient->shutdown();
|
||||
delete fClient;
|
||||
fClient = 0;
|
||||
fClient = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ class ClientRotator
|
||||
*/
|
||||
bool exeConnect(const std::string& clientName);
|
||||
|
||||
/** @brief connnect to list
|
||||
/** @brief connect to list
|
||||
*
|
||||
* Try connecting to next client on list
|
||||
* until timeout lapses. Then throw exception.
|
||||
|
@@ -67,22 +67,23 @@ class ConstantColumn : public ReturnedColumn
|
||||
/**
|
||||
* ctor
|
||||
*/
|
||||
ConstantColumn(const std::string& sql, TYPE type = LITERAL);
|
||||
explicit ConstantColumn(const std::string& sql, TYPE type = LITERAL);
|
||||
/**
|
||||
* ctor
|
||||
*/
|
||||
ConstantColumn(const int64_t val, TYPE type = NUM); // deprecate
|
||||
explicit ConstantColumn(const int64_t val, TYPE type = NUM); // deprecate
|
||||
/**
|
||||
* ctor
|
||||
*/
|
||||
ConstantColumn(const uint64_t val, TYPE type = NUM, int8_t scale = 0, uint8_t precision = 0); // deprecate
|
||||
explicit ConstantColumn(const uint64_t val, TYPE type = NUM, int8_t scale = 0,
|
||||
uint8_t precision = 0); // deprecate
|
||||
|
||||
// There are more ctors below...
|
||||
|
||||
/**
|
||||
* dtor
|
||||
*/
|
||||
virtual ~ConstantColumn();
|
||||
~ConstantColumn() override;
|
||||
|
||||
/*
|
||||
* Accessor Methods
|
||||
@@ -144,25 +145,25 @@ class ConstantColumn : public ReturnedColumn
|
||||
/**
|
||||
* accessor
|
||||
*/
|
||||
virtual const std::string data() const override;
|
||||
const std::string data() const override;
|
||||
/**
|
||||
* accessor
|
||||
*/
|
||||
virtual void data(const std::string data) override
|
||||
void data(const std::string data) override
|
||||
{
|
||||
fData = data;
|
||||
}
|
||||
/**
|
||||
* accessor
|
||||
*/
|
||||
virtual const std::string toString() const override;
|
||||
const std::string toString() const override;
|
||||
|
||||
virtual std::string toCppCode(IncludeSet& includes) const override;
|
||||
std::string toCppCode(IncludeSet& includes) const override;
|
||||
/** return a copy of this pointer
|
||||
*
|
||||
* deep copy of this pointer and return the copy
|
||||
*/
|
||||
inline virtual ConstantColumn* clone() const override
|
||||
inline ConstantColumn* clone() const override
|
||||
{
|
||||
return new ConstantColumn(*this);
|
||||
}
|
||||
@@ -173,18 +174,18 @@ class ConstantColumn : public ReturnedColumn
|
||||
/**
|
||||
* serialize
|
||||
*/
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
/**
|
||||
* unserialize
|
||||
*/
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
|
||||
*/
|
||||
virtual bool operator==(const TreeNode* t) const override;
|
||||
bool operator==(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -198,7 +199,7 @@ class ConstantColumn : public ReturnedColumn
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
|
||||
*/
|
||||
virtual bool operator!=(const TreeNode* t) const override;
|
||||
bool operator!=(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -207,13 +208,13 @@ class ConstantColumn : public ReturnedColumn
|
||||
*/
|
||||
bool operator!=(const ConstantColumn& t) const;
|
||||
|
||||
virtual bool hasWindowFunc() override
|
||||
bool hasWindowFunc() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Constant column on the filte can always be moved into derived table */
|
||||
virtual void setDerivedTable() override
|
||||
void setDerivedTable() override
|
||||
{
|
||||
fDerivedTable = std::string("*");
|
||||
}
|
||||
@@ -267,7 +268,7 @@ class ConstantColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual bool getBoolVal(rowgroup::Row& row, bool& isNull) override
|
||||
bool getBoolVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
isNull = isNull || (fType == NULLDATA);
|
||||
return TreeNode::getBoolVal();
|
||||
@@ -275,7 +276,7 @@ class ConstantColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override
|
||||
const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
isNull = isNull || (fType == NULLDATA);
|
||||
return fResult.strVal;
|
||||
@@ -283,7 +284,7 @@ class ConstantColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int64_t getIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
isNull = isNull || (fType == NULLDATA);
|
||||
return fResult.intVal;
|
||||
@@ -291,7 +292,7 @@ class ConstantColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override
|
||||
uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
isNull = isNull || (fType == NULLDATA);
|
||||
return fResult.uintVal;
|
||||
@@ -299,7 +300,7 @@ class ConstantColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual float getFloatVal(rowgroup::Row& row, bool& isNull) override
|
||||
float getFloatVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
isNull = isNull || (fType == NULLDATA);
|
||||
return fResult.floatVal;
|
||||
@@ -307,7 +308,7 @@ class ConstantColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual double getDoubleVal(rowgroup::Row& row, bool& isNull) override
|
||||
double getDoubleVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
isNull = isNull || (fType == NULLDATA);
|
||||
return fResult.doubleVal;
|
||||
@@ -315,7 +316,7 @@ class ConstantColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override
|
||||
IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
isNull = isNull || (fType == NULLDATA);
|
||||
return fResult.decimalVal;
|
||||
@@ -323,7 +324,7 @@ class ConstantColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
isNull = isNull || (fType == NULLDATA);
|
||||
|
||||
@@ -338,7 +339,7 @@ class ConstantColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
isNull = isNull || (fType == NULLDATA);
|
||||
|
||||
@@ -354,7 +355,7 @@ class ConstantColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
isNull = isNull || (fType == NULLDATA);
|
||||
|
||||
@@ -370,7 +371,7 @@ class ConstantColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
isNull = isNull || (fType == NULLDATA);
|
||||
|
||||
@@ -409,7 +410,7 @@ class ConstantColumnNull : public ConstantColumn
|
||||
class ConstantColumnString : public ConstantColumn
|
||||
{
|
||||
public:
|
||||
ConstantColumnString(const std::string& str) : ConstantColumn(str, ConstantColumn::LITERAL)
|
||||
explicit ConstantColumnString(const std::string& str) : ConstantColumn(str, ConstantColumn::LITERAL)
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -471,7 +472,6 @@ std::ostream& operator<<(std::ostream& output, const ConstantColumn& rhs);
|
||||
class RollupMarkColumn : public ReturnedColumn
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* ctor
|
||||
*/
|
||||
@@ -483,7 +483,7 @@ class RollupMarkColumn : public ReturnedColumn
|
||||
/**
|
||||
* dtor
|
||||
*/
|
||||
virtual ~RollupMarkColumn();
|
||||
~RollupMarkColumn() override;
|
||||
|
||||
/**
|
||||
* accessor
|
||||
@@ -502,26 +502,26 @@ class RollupMarkColumn : public ReturnedColumn
|
||||
/**
|
||||
* accessor
|
||||
*/
|
||||
virtual const std::string data() const override
|
||||
const std::string data() const override
|
||||
{
|
||||
return "";
|
||||
}
|
||||
/**
|
||||
* accessor
|
||||
*/
|
||||
virtual void data(const std::string data) override
|
||||
void data(const std::string data) override
|
||||
{
|
||||
idbassert(0);
|
||||
}
|
||||
/**
|
||||
* accessor
|
||||
*/
|
||||
virtual const std::string toString() const override
|
||||
const std::string toString() const override
|
||||
{
|
||||
return "RollupMarkColumn";
|
||||
}
|
||||
|
||||
virtual std::string toCppCode(IncludeSet& includes) const override
|
||||
std::string toCppCode(IncludeSet& includes) const override
|
||||
{
|
||||
idbassert(0);
|
||||
}
|
||||
@@ -529,7 +529,7 @@ class RollupMarkColumn : public ReturnedColumn
|
||||
*
|
||||
* deep copy of this pointer and return the copy
|
||||
*/
|
||||
inline virtual RollupMarkColumn* clone() const override
|
||||
inline RollupMarkColumn* clone() const override
|
||||
{
|
||||
return new RollupMarkColumn();
|
||||
}
|
||||
@@ -540,18 +540,18 @@ class RollupMarkColumn : public ReturnedColumn
|
||||
/**
|
||||
* serialize
|
||||
*/
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
/**
|
||||
* unserialize
|
||||
*/
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
|
||||
*/
|
||||
virtual bool operator==(const TreeNode* t) const override
|
||||
bool operator==(const TreeNode* t) const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -571,7 +571,7 @@ class RollupMarkColumn : public ReturnedColumn
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
|
||||
*/
|
||||
virtual bool operator!=(const TreeNode* t) const override
|
||||
bool operator!=(const TreeNode* t) const override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -586,13 +586,13 @@ class RollupMarkColumn : public ReturnedColumn
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool hasWindowFunc() override
|
||||
bool hasWindowFunc() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Constant column on the filte can always be moved into derived table */
|
||||
virtual void setDerivedTable() override
|
||||
void setDerivedTable() override
|
||||
{
|
||||
fDerivedTable = std::string("*");
|
||||
}
|
||||
@@ -617,18 +617,18 @@ class RollupMarkColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual bool getBoolVal(rowgroup::Row& row, bool& isNull) override
|
||||
bool getBoolVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override;
|
||||
const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override;
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int64_t getIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
isNull = false;
|
||||
return 0x12340000UL;
|
||||
@@ -636,28 +636,28 @@ class RollupMarkColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override
|
||||
uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
return getIntVal(row, isNull);
|
||||
}
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual float getFloatVal(rowgroup::Row& row, bool& isNull) override
|
||||
float getFloatVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
return getIntVal(row, isNull);
|
||||
}
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual double getDoubleVal(rowgroup::Row& row, bool& isNull) override
|
||||
double getDoubleVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
return getIntVal(row, isNull);
|
||||
}
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override
|
||||
IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
isNull = false;
|
||||
return fResult.decimalVal;
|
||||
@@ -665,7 +665,7 @@ class RollupMarkColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
isNull = false;
|
||||
|
||||
@@ -680,7 +680,7 @@ class RollupMarkColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
isNull = false;
|
||||
|
||||
@@ -696,7 +696,7 @@ class RollupMarkColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
isNull = false;
|
||||
|
||||
@@ -712,7 +712,7 @@ class RollupMarkColumn : public ReturnedColumn
|
||||
/**
|
||||
* F&E
|
||||
*/
|
||||
virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
isNull = false;
|
||||
|
||||
|
@@ -62,16 +62,14 @@ ConstantFilter::ConstantFilter(const SOP& op, ReturnedColumn* lhs, ReturnedColum
|
||||
{
|
||||
SSFP ssfp(new SimpleFilter(op, lhs, rhs));
|
||||
fFilterList.push_back(ssfp);
|
||||
SimpleColumn* sc = dynamic_cast<SimpleColumn*>(lhs);
|
||||
fCol.reset(sc->clone());
|
||||
fCol.reset(lhs->clone());
|
||||
}
|
||||
|
||||
ConstantFilter::ConstantFilter(SimpleFilter* sf)
|
||||
{
|
||||
SSFP ssfp(sf);
|
||||
fFilterList.push_back(ssfp);
|
||||
const SimpleColumn* sc = dynamic_cast<const SimpleColumn*>(sf->lhs());
|
||||
fCol.reset(sc->clone());
|
||||
fCol.reset(sf->lhs()->clone());
|
||||
}
|
||||
|
||||
ConstantFilter::ConstantFilter(const ConstantFilter& rhs) : Filter(rhs), fOp(rhs.fOp), fCol(rhs.fCol)
|
||||
|
@@ -64,7 +64,7 @@ class ConstantFilter : public Filter
|
||||
*/
|
||||
ConstantFilter();
|
||||
ConstantFilter(const SOP& op, ReturnedColumn* lhs, ReturnedColumn* rhs);
|
||||
ConstantFilter(SimpleFilter* sf);
|
||||
explicit ConstantFilter(SimpleFilter* sf);
|
||||
// for code generation purposes only
|
||||
ConstantFilter(const SOP& op, const FilterList& filterList, const SRCP& col,
|
||||
const std::string& functionName, const std::string& data);
|
||||
@@ -75,7 +75,7 @@ class ConstantFilter : public Filter
|
||||
/**
|
||||
* Destructors
|
||||
*/
|
||||
virtual ~ConstantFilter();
|
||||
~ConstantFilter() override;
|
||||
|
||||
/**
|
||||
* Accessor Methods
|
||||
@@ -114,20 +114,20 @@ class ConstantFilter : public Filter
|
||||
}
|
||||
|
||||
// virtual const std::string data() const;
|
||||
virtual const std::string toString() const override;
|
||||
virtual std::string toCppCode(IncludeSet& includes) const override;
|
||||
const std::string toString() const override;
|
||||
std::string toCppCode(IncludeSet& includes) const override;
|
||||
/**
|
||||
* The serialization interface
|
||||
*/
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
|
||||
*/
|
||||
virtual bool operator==(const TreeNode* t) const override;
|
||||
bool operator==(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -141,7 +141,7 @@ class ConstantFilter : public Filter
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
|
||||
*/
|
||||
virtual bool operator!=(const TreeNode* t) const override;
|
||||
bool operator!=(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -193,12 +193,12 @@ class ConstantFilter : public Filter
|
||||
***********************************************************/
|
||||
public:
|
||||
ConstantFilter(const ConstantFilter& rhs);
|
||||
inline virtual ConstantFilter* clone() const override
|
||||
inline ConstantFilter* clone() const override
|
||||
{
|
||||
return new ConstantFilter(*this);
|
||||
}
|
||||
|
||||
inline virtual bool getBoolVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline bool getBoolVal(rowgroup::Row& row, bool& isNull) override;
|
||||
|
||||
// get all simple columns involved in this column
|
||||
const std::vector<SimpleColumn*>& simpleColumnList();
|
||||
|
@@ -49,9 +49,9 @@ class ExistsFilter : public Filter
|
||||
* Constructors
|
||||
*/
|
||||
ExistsFilter();
|
||||
ExistsFilter(const SCSEP& sub, const bool existsFlag = false, const bool correlated = false);
|
||||
explicit ExistsFilter(const SCSEP& sub, const bool existsFlag = false, const bool correlated = false);
|
||||
ExistsFilter(const ExistsFilter& rhs);
|
||||
virtual ~ExistsFilter();
|
||||
~ExistsFilter() override;
|
||||
|
||||
/**
|
||||
* Accessor Methods
|
||||
@@ -87,19 +87,19 @@ class ExistsFilter : public Filter
|
||||
* Overloaded stream operator
|
||||
*/
|
||||
// virtual std::ostream& operator<< (std::ostream& output);
|
||||
virtual const std::string toString() const override;
|
||||
virtual std::string toCppCode(IncludeSet& includes) const override;
|
||||
const std::string toString() const override;
|
||||
std::string toCppCode(IncludeSet& includes) const override;
|
||||
/**
|
||||
* The serialization interface
|
||||
*/
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
|
||||
/** return a copy of this pointer
|
||||
*
|
||||
* deep copy of this pointer and return the copy
|
||||
*/
|
||||
inline virtual ExistsFilter* clone() const override
|
||||
inline ExistsFilter* clone() const override
|
||||
{
|
||||
return new ExistsFilter(*this);
|
||||
}
|
||||
@@ -109,7 +109,7 @@ class ExistsFilter : public Filter
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
|
||||
*/
|
||||
virtual bool operator==(const TreeNode* t) const override;
|
||||
bool operator==(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -123,7 +123,7 @@ class ExistsFilter : public Filter
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
|
||||
*/
|
||||
virtual bool operator!=(const TreeNode* t) const override;
|
||||
bool operator!=(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
|
@@ -53,12 +53,12 @@ struct Token
|
||||
TreeNode* value;
|
||||
bool is_operator() const
|
||||
{
|
||||
if (value == 0)
|
||||
if (value == nullptr)
|
||||
return false;
|
||||
|
||||
return (typeid(*value) == typeid(Operator));
|
||||
}
|
||||
Token() : value(0)
|
||||
Token() : value(nullptr)
|
||||
{
|
||||
}
|
||||
Token(TreeNode* v) : value(v)
|
||||
|
@@ -60,14 +60,14 @@ class Filter : public TreeNode
|
||||
* Constructors
|
||||
*/
|
||||
Filter();
|
||||
Filter(const std::string& sql);
|
||||
explicit Filter(const std::string& sql);
|
||||
// not needed yet
|
||||
// Filter(const Filter& rhs);
|
||||
|
||||
/**
|
||||
* Destructors
|
||||
*/
|
||||
virtual ~Filter();
|
||||
~Filter() override;
|
||||
/**
|
||||
* Accessor Methods
|
||||
*/
|
||||
@@ -75,15 +75,15 @@ class Filter : public TreeNode
|
||||
/**
|
||||
* Operations
|
||||
*/
|
||||
virtual const std::string toString() const override;
|
||||
const std::string toString() const override;
|
||||
|
||||
virtual std::string toCppCode(IncludeSet& includes) const override;
|
||||
std::string toCppCode(IncludeSet& includes) const override;
|
||||
|
||||
virtual const std::string data() const override
|
||||
const std::string data() const override
|
||||
{
|
||||
return fData;
|
||||
}
|
||||
virtual void data(const std::string data) override
|
||||
void data(const std::string data) override
|
||||
{
|
||||
fData = data;
|
||||
}
|
||||
@@ -92,7 +92,7 @@ class Filter : public TreeNode
|
||||
*
|
||||
* deep copy of this pointer and return the copy
|
||||
*/
|
||||
inline virtual Filter* clone() const override
|
||||
inline Filter* clone() const override
|
||||
{
|
||||
return new Filter(*this);
|
||||
}
|
||||
@@ -100,15 +100,15 @@ class Filter : public TreeNode
|
||||
/**
|
||||
* The serialization interface
|
||||
*/
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
|
||||
*/
|
||||
virtual bool operator==(const TreeNode* t) const override;
|
||||
bool operator==(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -122,7 +122,7 @@ class Filter : public TreeNode
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
|
||||
*/
|
||||
virtual bool operator!=(const TreeNode* t) const override;
|
||||
bool operator!=(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -133,9 +133,9 @@ class Filter : public TreeNode
|
||||
|
||||
/** @brief test if this filter can be combined with the argument filter
|
||||
* This is for operation combine optimization
|
||||
* @param f the filter that this fiter tries to combine with
|
||||
* @param f the filter that this filter tries to combine with
|
||||
* @param op the operator that connects the two filters. if one or both of the
|
||||
* two filters is constantFilter, need to make sure operator is consistant.
|
||||
* two filters is constantFilter, need to make sure operator is consistent.
|
||||
* @return a filter(constantfilter) if successfully combined. otherwise
|
||||
* return NULL
|
||||
* For Oracle front end. Deprecated now.
|
||||
|
@@ -51,11 +51,11 @@ class FunctionColumn : public ReturnedColumn
|
||||
{
|
||||
public:
|
||||
FunctionColumn();
|
||||
FunctionColumn(std::string& funcName);
|
||||
explicit FunctionColumn(std::string& funcName);
|
||||
FunctionColumn(const std::string& functionName, const std::string& funcParmsInString,
|
||||
const uint32_t sessionID = 0);
|
||||
FunctionColumn(const FunctionColumn& rhs, const uint32_t sessionID = 0);
|
||||
virtual ~FunctionColumn();
|
||||
~FunctionColumn() override;
|
||||
|
||||
/** get function name
|
||||
*
|
||||
@@ -131,19 +131,19 @@ class FunctionColumn : public ReturnedColumn
|
||||
fTimeZone = timeZone;
|
||||
}
|
||||
|
||||
virtual const std::string data() const override;
|
||||
virtual void data(const std::string data) override
|
||||
const std::string data() const override;
|
||||
void data(const std::string data) override
|
||||
{
|
||||
fData = data;
|
||||
}
|
||||
|
||||
virtual const std::string toString() const override;
|
||||
const std::string toString() const override;
|
||||
|
||||
/** return a copy of this pointer
|
||||
*
|
||||
* deep copy of this pointer and return the copy
|
||||
*/
|
||||
inline virtual FunctionColumn* clone() const override
|
||||
inline FunctionColumn* clone() const override
|
||||
{
|
||||
return new FunctionColumn(*this);
|
||||
}
|
||||
@@ -151,20 +151,20 @@ class FunctionColumn : public ReturnedColumn
|
||||
/**
|
||||
* The serialization interface
|
||||
*/
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
|
||||
using ReturnedColumn::hasAggregate;
|
||||
virtual bool hasAggregate() override;
|
||||
virtual bool hasWindowFunc() override;
|
||||
virtual void setDerivedTable() override;
|
||||
virtual void replaceRealCol(std::vector<SRCP>&) override;
|
||||
bool hasAggregate() override;
|
||||
bool hasWindowFunc() override;
|
||||
void setDerivedTable() override;
|
||||
void replaceRealCol(std::vector<SRCP>&) override;
|
||||
virtual const std::vector<SimpleColumn*>& simpleColumnList() const override
|
||||
{
|
||||
return fSimpleColumnList;
|
||||
}
|
||||
|
||||
virtual void setSimpleColumnList() override;
|
||||
void setSimpleColumnList() override;
|
||||
/**
|
||||
* Return the tableAlias name of the table that the column arguments belong to.
|
||||
*
|
||||
@@ -172,9 +172,9 @@ class FunctionColumn : public ReturnedColumn
|
||||
* @return true, if all arguments belong to one table
|
||||
* false, if multiple tables are involved in the function
|
||||
*/
|
||||
virtual bool singleTable(CalpontSystemCatalog::TableAliasName& tan) override;
|
||||
bool singleTable(CalpontSystemCatalog::TableAliasName& tan) override;
|
||||
|
||||
virtual std::string toCppCode(IncludeSet& includes) const override;
|
||||
std::string toCppCode(IncludeSet& includes) const override;
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -190,7 +190,7 @@ class FunctionColumn : public ReturnedColumn
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
|
||||
*/
|
||||
virtual bool operator==(const TreeNode* t) const override;
|
||||
bool operator==(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -204,7 +204,7 @@ class FunctionColumn : public ReturnedColumn
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
|
||||
*/
|
||||
virtual bool operator!=(const TreeNode* t) const override;
|
||||
bool operator!=(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -217,7 +217,7 @@ class FunctionColumn : public ReturnedColumn
|
||||
* F&E framework *
|
||||
***********************************************************/
|
||||
public:
|
||||
virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override
|
||||
const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
fOperationType.setTimeZone(fTimeZone);
|
||||
fResult.strVal.dropString();
|
||||
@@ -228,32 +228,32 @@ class FunctionColumn : public ReturnedColumn
|
||||
}
|
||||
return fResult.strVal;
|
||||
}
|
||||
virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int64_t getIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
fOperationType.setTimeZone(fTimeZone);
|
||||
return fFunctor->getIntVal(row, fFunctionParms, isNull, fOperationType);
|
||||
}
|
||||
virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override
|
||||
uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
fOperationType.setTimeZone(fTimeZone);
|
||||
return fFunctor->getUintVal(row, fFunctionParms, isNull, fOperationType);
|
||||
}
|
||||
virtual float getFloatVal(rowgroup::Row& row, bool& isNull) override
|
||||
float getFloatVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
fOperationType.setTimeZone(fTimeZone);
|
||||
return fFunctor->getFloatVal(row, fFunctionParms, isNull, fOperationType);
|
||||
}
|
||||
virtual double getDoubleVal(rowgroup::Row& row, bool& isNull) override
|
||||
double getDoubleVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
fOperationType.setTimeZone(fTimeZone);
|
||||
return fFunctor->getDoubleVal(row, fFunctionParms, isNull, fOperationType);
|
||||
}
|
||||
virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override
|
||||
long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
fOperationType.setTimeZone(fTimeZone);
|
||||
return fFunctor->getLongDoubleVal(row, fFunctionParms, isNull, fOperationType);
|
||||
}
|
||||
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override
|
||||
IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
fOperationType.setTimeZone(fTimeZone);
|
||||
IDB_Decimal decimal = fFunctor->getDecimalVal(row, fFunctionParms, isNull, fOperationType);
|
||||
@@ -290,8 +290,9 @@ class FunctionColumn : public ReturnedColumn
|
||||
if (fResultType.scale > decimal.scale)
|
||||
decimal.value *= IDB_pow[fResultType.scale - decimal.scale];
|
||||
else
|
||||
decimal.value = (int64_t)(
|
||||
decimal.value > 0 ? (double)decimal.value / IDB_pow[decimal.scale - fResultType.scale] + 0.5
|
||||
decimal.value =
|
||||
(int64_t)(decimal.value > 0
|
||||
? (double)decimal.value / IDB_pow[decimal.scale - fResultType.scale] + 0.5
|
||||
: (double)decimal.value / IDB_pow[decimal.scale - fResultType.scale] - 0.5);
|
||||
}
|
||||
|
||||
@@ -299,27 +300,27 @@ class FunctionColumn : public ReturnedColumn
|
||||
decimal.precision = std::max(fResultType.precision, static_cast<int32_t>(decimal.precision));
|
||||
return decimal;
|
||||
}
|
||||
virtual bool getBoolVal(rowgroup::Row& row, bool& isNull) override
|
||||
bool getBoolVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
fOperationType.setTimeZone(fTimeZone);
|
||||
return fFunctor->getBoolVal(row, fFunctionParms, isNull, fOperationType);
|
||||
}
|
||||
virtual int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int32_t getDateIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
fOperationType.setTimeZone(fTimeZone);
|
||||
return fFunctor->getDateIntVal(row, fFunctionParms, isNull, fOperationType);
|
||||
}
|
||||
virtual int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int64_t getDatetimeIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
fOperationType.setTimeZone(fTimeZone);
|
||||
return fFunctor->getDatetimeIntVal(row, fFunctionParms, isNull, fOperationType);
|
||||
}
|
||||
virtual int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int64_t getTimestampIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
fOperationType.setTimeZone(fTimeZone);
|
||||
return fFunctor->getTimestampIntVal(row, fFunctionParms, isNull, fOperationType);
|
||||
}
|
||||
virtual int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int64_t getTimeIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
fOperationType.setTimeZone(fTimeZone);
|
||||
return fFunctor->getTimeIntVal(row, fFunctionParms, isNull, fOperationType);
|
||||
@@ -333,7 +334,7 @@ class FunctionColumn : public ReturnedColumn
|
||||
private:
|
||||
funcexp::FunctionParm fFunctionParms;
|
||||
funcexp::Func* fFunctor; /// functor to execute this function
|
||||
funcexp::Func* fDynamicFunctor = NULL; // for rand encode decode
|
||||
funcexp::Func* fDynamicFunctor = nullptr; // for rand encode decode
|
||||
bool fFixed = false;
|
||||
};
|
||||
|
||||
|
@@ -52,25 +52,25 @@ class GroupConcatColumn : public AggregateColumn
|
||||
*/
|
||||
GroupConcatColumn();
|
||||
|
||||
GroupConcatColumn(const uint32_t sessionID);
|
||||
explicit GroupConcatColumn(const uint32_t sessionID);
|
||||
|
||||
GroupConcatColumn(const GroupConcatColumn& rhs, const uint32_t sessionID = 0);
|
||||
|
||||
/**
|
||||
* Destructors
|
||||
*/
|
||||
virtual ~GroupConcatColumn();
|
||||
~GroupConcatColumn() override;
|
||||
|
||||
/**
|
||||
* Overloaded stream operator
|
||||
*/
|
||||
virtual const std::string toString() const override;
|
||||
const std::string toString() const override;
|
||||
|
||||
/** return a copy of this pointer
|
||||
*
|
||||
* deep copy of this pointer and return the copy
|
||||
*/
|
||||
virtual GroupConcatColumn* clone() const override
|
||||
GroupConcatColumn* clone() const override
|
||||
{
|
||||
return new GroupConcatColumn(*this);
|
||||
}
|
||||
@@ -98,8 +98,8 @@ class GroupConcatColumn : public AggregateColumn
|
||||
/**
|
||||
* Serialize interface
|
||||
*/
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -107,7 +107,7 @@ class GroupConcatColumn : public AggregateColumn
|
||||
* @return true iff every member of t is a duplicate copy of every member of this;
|
||||
* false otherwise
|
||||
*/
|
||||
virtual bool operator==(const TreeNode* t) const override;
|
||||
bool operator==(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -124,7 +124,7 @@ class GroupConcatColumn : public AggregateColumn
|
||||
* @return false iff every member of t is a duplicate copy of every member of this;
|
||||
* true otherwise
|
||||
*/
|
||||
virtual bool operator!=(const TreeNode* t) const override;
|
||||
bool operator!=(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -135,7 +135,7 @@ class GroupConcatColumn : public AggregateColumn
|
||||
using AggregateColumn::operator!=;
|
||||
virtual bool operator!=(const GroupConcatColumn& t) const;
|
||||
|
||||
virtual string toCppCode(IncludeSet& includes) const override;
|
||||
string toCppCode(IncludeSet& includes) const override;
|
||||
|
||||
private:
|
||||
std::vector<SRCP> fOrderCols;
|
||||
|
@@ -79,9 +79,7 @@ class IntervalColumn : public ReturnedColumn
|
||||
IntervalColumn();
|
||||
IntervalColumn(SRCP&, int);
|
||||
IntervalColumn(const IntervalColumn& rhs, const uint32_t sessionID = 0);
|
||||
virtual ~IntervalColumn()
|
||||
{
|
||||
}
|
||||
~IntervalColumn() override = default;
|
||||
const SRCP& val() const
|
||||
{
|
||||
return fVal;
|
||||
@@ -99,22 +97,22 @@ class IntervalColumn : public ReturnedColumn
|
||||
fIntervalType = intervalType;
|
||||
}
|
||||
const std::string toString() const override;
|
||||
inline virtual IntervalColumn* clone() const override
|
||||
inline IntervalColumn* clone() const override
|
||||
{
|
||||
return new IntervalColumn(*this);
|
||||
}
|
||||
|
||||
using ReturnedColumn::hasAggregate;
|
||||
virtual bool hasAggregate() override
|
||||
bool hasAggregate() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual bool hasWindowFunc() override
|
||||
bool hasWindowFunc() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual std::string toCppCode(IncludeSet& includes) const override;
|
||||
std::string toCppCode(IncludeSet& includes) const override;
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -124,12 +122,12 @@ class IntervalColumn : public ReturnedColumn
|
||||
int fIntervalType;
|
||||
|
||||
// okay to be private for now.
|
||||
virtual bool operator==(const TreeNode* t) const override
|
||||
bool operator==(const TreeNode* t) const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool operator==(const IntervalColumn& t) const;
|
||||
virtual bool operator!=(const TreeNode* t) const override
|
||||
bool operator!=(const TreeNode* t) const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@@ -47,25 +47,25 @@ class JsonArrayAggColumn : public AggregateColumn
|
||||
*/
|
||||
JsonArrayAggColumn();
|
||||
|
||||
JsonArrayAggColumn(const uint32_t sessionID);
|
||||
explicit JsonArrayAggColumn(const uint32_t sessionID);
|
||||
|
||||
JsonArrayAggColumn(const JsonArrayAggColumn& rhs, const uint32_t sessionID = 0);
|
||||
|
||||
/**
|
||||
* Destructors
|
||||
*/
|
||||
virtual ~JsonArrayAggColumn();
|
||||
~JsonArrayAggColumn() override;
|
||||
|
||||
/**
|
||||
* Overloaded stream operator
|
||||
*/
|
||||
virtual const std::string toString() const override;
|
||||
const std::string toString() const override;
|
||||
|
||||
/** return a copy of this pointer
|
||||
*
|
||||
* deep copy of this pointer and return the copy
|
||||
*/
|
||||
virtual JsonArrayAggColumn* clone() const override
|
||||
JsonArrayAggColumn* clone() const override
|
||||
{
|
||||
return new JsonArrayAggColumn(*this);
|
||||
}
|
||||
@@ -93,8 +93,8 @@ class JsonArrayAggColumn : public AggregateColumn
|
||||
/**
|
||||
* Serialize interface
|
||||
*/
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -102,7 +102,7 @@ class JsonArrayAggColumn : public AggregateColumn
|
||||
* @return true iff every member of t is a duplicate copy of every member of this;
|
||||
* false otherwise
|
||||
*/
|
||||
virtual bool operator==(const TreeNode* t) const override;
|
||||
bool operator==(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -119,7 +119,7 @@ class JsonArrayAggColumn : public AggregateColumn
|
||||
* @return false iff every member of t is a duplicate copy of every member of this;
|
||||
* true otherwise
|
||||
*/
|
||||
virtual bool operator!=(const TreeNode* t) const override;
|
||||
bool operator!=(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -130,7 +130,7 @@ class JsonArrayAggColumn : public AggregateColumn
|
||||
using AggregateColumn::operator!=;
|
||||
virtual bool operator!=(const JsonArrayAggColumn& t) const;
|
||||
|
||||
virtual std::string toCppCode(IncludeSet& includes) const override;
|
||||
std::string toCppCode(IncludeSet& includes) const override;
|
||||
|
||||
private:
|
||||
std::vector<SRCP> fOrderCols;
|
||||
|
@@ -27,7 +27,7 @@
|
||||
#include <iosfwd>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
//#include "expressionparser.h"
|
||||
// #include "expressionparser.h"
|
||||
#include "operator.h"
|
||||
#include "parsetree.h"
|
||||
|
||||
@@ -64,13 +64,13 @@ class LogicOperator : public Operator
|
||||
* Constructors
|
||||
*/
|
||||
LogicOperator();
|
||||
LogicOperator(const std::string& operatorName);
|
||||
explicit LogicOperator(const std::string& operatorName);
|
||||
LogicOperator(const LogicOperator& rhs);
|
||||
|
||||
/**
|
||||
* Destructors
|
||||
*/
|
||||
virtual ~LogicOperator();
|
||||
~LogicOperator() override;
|
||||
|
||||
/**
|
||||
* Accessor Methods
|
||||
@@ -80,7 +80,7 @@ class LogicOperator : public Operator
|
||||
*
|
||||
* deep copy of this pointer and return the copy
|
||||
*/
|
||||
inline virtual LogicOperator* clone() const override
|
||||
inline LogicOperator* clone() const override
|
||||
{
|
||||
return new LogicOperator(*this);
|
||||
}
|
||||
@@ -88,15 +88,15 @@ class LogicOperator : public Operator
|
||||
/**
|
||||
* The serialization interface
|
||||
*/
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
|
||||
*/
|
||||
virtual bool operator==(const TreeNode* t) const override;
|
||||
bool operator==(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -110,7 +110,7 @@ class LogicOperator : public Operator
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
|
||||
*/
|
||||
virtual bool operator!=(const TreeNode* t) const override;
|
||||
bool operator!=(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -123,7 +123,7 @@ class LogicOperator : public Operator
|
||||
|
||||
// F&E framework
|
||||
using Operator::getBoolVal;
|
||||
inline virtual bool getBoolVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
|
||||
inline bool getBoolVal(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
|
||||
{
|
||||
switch (fOp)
|
||||
{
|
||||
@@ -165,12 +165,12 @@ class LogicOperator : public Operator
|
||||
}
|
||||
|
||||
using TreeNode::evaluate;
|
||||
inline virtual void evaluate(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
|
||||
inline void evaluate(rowgroup::Row& row, bool& isNull, ParseTree* lop, ParseTree* rop) override
|
||||
{
|
||||
fResult.boolVal = getBoolVal(row, isNull, lop, rop);
|
||||
}
|
||||
|
||||
inline virtual std::string toCppCode(IncludeSet& includes) const override
|
||||
inline std::string toCppCode(IncludeSet& includes) const override
|
||||
{
|
||||
includes.insert("logicoperator.h");
|
||||
std::stringstream ss;
|
||||
|
@@ -54,7 +54,7 @@ class MCSAnalyzeTableExecutionPlan : public CalpontExecutionPlan
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~MCSAnalyzeTableExecutionPlan() = default;
|
||||
~MCSAnalyzeTableExecutionPlan() override = default;
|
||||
|
||||
const ReturnedColumnList& returnedCols() const
|
||||
{
|
||||
@@ -232,16 +232,16 @@ class MCSAnalyzeTableExecutionPlan : public CalpontExecutionPlan
|
||||
return ((fSessionID & 0x80000000) != 0);
|
||||
}
|
||||
|
||||
virtual void serialize(messageqcpp::ByteStream& bs) const;
|
||||
void serialize(messageqcpp::ByteStream& bs) const override;
|
||||
|
||||
virtual void unserialize(messageqcpp::ByteStream& bs);
|
||||
void unserialize(messageqcpp::ByteStream& bs) override;
|
||||
|
||||
// TODO: Why do we need this?
|
||||
virtual bool operator==(const CalpontExecutionPlan* t) const
|
||||
bool operator==(const CalpontExecutionPlan* t) const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual bool operator!=(const CalpontExecutionPlan* t) const
|
||||
bool operator!=(const CalpontExecutionPlan* t) const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
namespace messageqcpp
|
||||
{
|
||||
@@ -53,9 +53,9 @@ class ObjectReader
|
||||
class UnserializeException : public std::exception
|
||||
{
|
||||
public:
|
||||
UnserializeException(std::string) throw();
|
||||
virtual ~UnserializeException() throw();
|
||||
virtual const char* what() const throw();
|
||||
explicit UnserializeException(std::string) noexcept;
|
||||
~UnserializeException() noexcept override;
|
||||
const char* what() const noexcept override;
|
||||
|
||||
private:
|
||||
std::string fWhat;
|
||||
|
@@ -70,23 +70,23 @@ class Operator : public TreeNode
|
||||
{
|
||||
public:
|
||||
Operator();
|
||||
Operator(const std::string& operatorName);
|
||||
explicit Operator(const std::string& operatorName);
|
||||
Operator(const Operator& rhs);
|
||||
|
||||
virtual ~Operator();
|
||||
~Operator() override;
|
||||
|
||||
virtual const std::string toString() const override;
|
||||
virtual const std::string data() const override
|
||||
const std::string toString() const override;
|
||||
const std::string data() const override
|
||||
{
|
||||
return fData;
|
||||
}
|
||||
virtual void data(const std::string data) override;
|
||||
void data(const std::string data) override;
|
||||
|
||||
/** return a copy of this pointer
|
||||
*
|
||||
* deep copy of this pointer and return the copy
|
||||
*/
|
||||
inline virtual Operator* clone() const override
|
||||
inline Operator* clone() const override
|
||||
{
|
||||
return new Operator(*this);
|
||||
}
|
||||
@@ -101,15 +101,15 @@ class Operator : public TreeNode
|
||||
/**
|
||||
* The serialization interface
|
||||
*/
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
|
||||
*/
|
||||
virtual bool operator==(const TreeNode* t) const override;
|
||||
bool operator==(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -123,7 +123,7 @@ class Operator : public TreeNode
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
|
||||
*/
|
||||
virtual bool operator!=(const TreeNode* t) const override;
|
||||
bool operator!=(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -139,7 +139,7 @@ class Operator : public TreeNode
|
||||
*/
|
||||
virtual void reverseOp();
|
||||
|
||||
virtual std::string toCppCode(IncludeSet& includes) const override;
|
||||
std::string toCppCode(IncludeSet& includes) const override;
|
||||
|
||||
protected:
|
||||
std::string fData;
|
||||
@@ -231,11 +231,11 @@ class Operator : public TreeNode
|
||||
virtual void setOpType(Type& l, Type& r)
|
||||
{
|
||||
}
|
||||
virtual void operationType(const Type& ot) override
|
||||
void operationType(const Type& ot) override
|
||||
{
|
||||
fOperationType = ot;
|
||||
}
|
||||
virtual const Type& operationType() const override
|
||||
const Type& operationType() const override
|
||||
{
|
||||
return fOperationType;
|
||||
}
|
||||
|
@@ -49,9 +49,9 @@ class OuterJoinOnFilter : public Filter
|
||||
* Constructors
|
||||
*/
|
||||
OuterJoinOnFilter();
|
||||
OuterJoinOnFilter(const SPTP& pt);
|
||||
explicit OuterJoinOnFilter(const SPTP& pt);
|
||||
OuterJoinOnFilter(const OuterJoinOnFilter& rhs);
|
||||
virtual ~OuterJoinOnFilter();
|
||||
~OuterJoinOnFilter() override;
|
||||
|
||||
/**
|
||||
* Accessor Methods
|
||||
@@ -69,19 +69,19 @@ class OuterJoinOnFilter : public Filter
|
||||
* Overloaded stream operator
|
||||
*/
|
||||
// virtual std::ostream& operator<< (std::ostream& output);
|
||||
virtual const std::string toString() const override;
|
||||
const std::string toString() const override;
|
||||
|
||||
/**
|
||||
* The serialization interface
|
||||
*/
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
|
||||
/** return a copy of this pointer
|
||||
*
|
||||
* deep copy of this pointer and return the copy
|
||||
*/
|
||||
inline virtual OuterJoinOnFilter* clone() const override
|
||||
inline OuterJoinOnFilter* clone() const override
|
||||
{
|
||||
return new OuterJoinOnFilter(*this);
|
||||
}
|
||||
@@ -91,7 +91,7 @@ class OuterJoinOnFilter : public Filter
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
|
||||
*/
|
||||
virtual bool operator==(const TreeNode* t) const override;
|
||||
bool operator==(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -105,7 +105,7 @@ class OuterJoinOnFilter : public Filter
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
|
||||
*/
|
||||
virtual bool operator!=(const TreeNode* t) const override;
|
||||
bool operator!=(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -113,7 +113,8 @@ class OuterJoinOnFilter : public Filter
|
||||
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
|
||||
*/
|
||||
bool operator!=(const OuterJoinOnFilter& t) const;
|
||||
virtual std::string toCppCode(IncludeSet& includes) const override;
|
||||
std::string toCppCode(IncludeSet& includes) const override;
|
||||
|
||||
private:
|
||||
// default okay?
|
||||
// OuterJoinOnFilter& operator=(const OuterJoinOnFilter& rhs);
|
||||
|
@@ -59,7 +59,7 @@ class ParseTree
|
||||
* Constructor / Destructor
|
||||
*/
|
||||
inline ParseTree();
|
||||
inline ParseTree(TreeNode* data);
|
||||
inline explicit ParseTree(TreeNode* data);
|
||||
inline ParseTree(TreeNode* data, ParseTree* left, ParseTree* right);
|
||||
inline ParseTree(const ParseTree& rhs);
|
||||
inline virtual ~ParseTree();
|
||||
@@ -210,9 +210,9 @@ class ParseTree
|
||||
inline static void deleter(ParseTree*& n)
|
||||
{
|
||||
delete n->fData;
|
||||
n->fData = 0;
|
||||
n->fData = nullptr;
|
||||
delete n;
|
||||
n = 0;
|
||||
n = nullptr;
|
||||
}
|
||||
|
||||
inline void derivedTable(const std::string& derivedTable)
|
||||
@@ -238,7 +238,7 @@ class ParseTree
|
||||
{
|
||||
ParseTree* node;
|
||||
GoTo direction;
|
||||
StackFrame(ParseTree* node_, GoTo direction_ = GoTo::Left) : node(node_), direction(direction_)
|
||||
explicit StackFrame(ParseTree* node_, GoTo direction_ = GoTo::Left) : node(node_), direction(direction_)
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -370,11 +370,11 @@ namespace execplan
|
||||
/**
|
||||
* Class Definition
|
||||
*/
|
||||
inline ParseTree::ParseTree() : fData(0), fLeft(0), fRight(0), fDerivedTable("")
|
||||
inline ParseTree::ParseTree() : fData(nullptr), fLeft(nullptr), fRight(nullptr), fDerivedTable("")
|
||||
{
|
||||
}
|
||||
|
||||
inline ParseTree::ParseTree(TreeNode* data) : fData(data), fLeft(0), fRight(0)
|
||||
inline ParseTree::ParseTree(TreeNode* data) : fData(data), fLeft(nullptr), fRight(nullptr)
|
||||
{
|
||||
// bug5984. Need to validate data to be not null
|
||||
if (data)
|
||||
@@ -389,7 +389,7 @@ inline ParseTree::ParseTree(TreeNode* data, ParseTree* left, ParseTree* right)
|
||||
}
|
||||
|
||||
inline ParseTree::ParseTree(const ParseTree& rhs)
|
||||
: fData(0), fLeft(0), fRight(0), fDerivedTable(rhs.fDerivedTable)
|
||||
: fData(nullptr), fLeft(nullptr), fRight(nullptr), fDerivedTable(rhs.fDerivedTable)
|
||||
{
|
||||
copyTree(rhs);
|
||||
}
|
||||
@@ -613,22 +613,22 @@ inline ParseTree& ParseTree::operator=(const ParseTree& rhs)
|
||||
|
||||
inline void ParseTree::copyTree(const ParseTree& src)
|
||||
{
|
||||
if (fLeft != NULL)
|
||||
if (fLeft != nullptr)
|
||||
delete fLeft;
|
||||
|
||||
if (fRight != NULL)
|
||||
if (fRight != nullptr)
|
||||
delete fRight;
|
||||
|
||||
fLeft = NULL;
|
||||
fRight = NULL;
|
||||
fLeft = nullptr;
|
||||
fRight = nullptr;
|
||||
|
||||
if (src.left() != NULL)
|
||||
if (src.left() != nullptr)
|
||||
{
|
||||
fLeft = new ParseTree();
|
||||
fLeft->copyTree(*(src.left()));
|
||||
}
|
||||
|
||||
if (src.right() != NULL)
|
||||
if (src.right() != nullptr)
|
||||
{
|
||||
fRight = new ParseTree();
|
||||
fRight->copyTree(*(src.right()));
|
||||
@@ -636,29 +636,29 @@ inline void ParseTree::copyTree(const ParseTree& src)
|
||||
|
||||
delete fData;
|
||||
|
||||
if (src.data() == NULL)
|
||||
fData = NULL;
|
||||
if (src.data() == nullptr)
|
||||
fData = nullptr;
|
||||
else
|
||||
fData = src.data()->clone();
|
||||
}
|
||||
|
||||
inline void ParseTree::destroyTree(ParseTree* root)
|
||||
{
|
||||
if (root == NULL)
|
||||
if (root == nullptr)
|
||||
return;
|
||||
|
||||
if (root->left() != NULL)
|
||||
if (root->left() != nullptr)
|
||||
{
|
||||
destroyTree(root->fLeft);
|
||||
}
|
||||
|
||||
if (root->right() != NULL)
|
||||
if (root->right() != nullptr)
|
||||
{
|
||||
destroyTree(root->fRight);
|
||||
}
|
||||
|
||||
delete root;
|
||||
root = 0;
|
||||
root = nullptr;
|
||||
}
|
||||
|
||||
inline void ParseTree::draw(const ParseTree* n, std::ostream& dotFile)
|
||||
@@ -668,13 +668,11 @@ inline void ParseTree::draw(const ParseTree* n, std::ostream& dotFile)
|
||||
l = n->left();
|
||||
r = n->right();
|
||||
|
||||
if (l != 0)
|
||||
dotFile << "n" << (void*)n << " -> "
|
||||
<< "n" << (void*)l << std::endl;
|
||||
if (l != nullptr)
|
||||
dotFile << "n" << (void*)n << " -> " << "n" << (void*)l << std::endl;
|
||||
|
||||
if (r != 0)
|
||||
dotFile << "n" << (void*)n << " -> "
|
||||
<< "n" << (void*)r << std::endl;
|
||||
if (r != nullptr)
|
||||
dotFile << "n" << (void*)n << " -> " << "n" << (void*)r << std::endl;
|
||||
|
||||
auto& node = *(n->data());
|
||||
dotFile << "n" << (void*)n << " [label=\"" << n->data()->data() << " (" << n << ") "
|
||||
|
@@ -412,7 +412,7 @@ bool PredicateOperator::getBoolVal(rowgroup::Row& row, bool& isNull, ReturnedCol
|
||||
|
||||
int64_t val2 = rop->getIntVal(row, isNull);
|
||||
|
||||
return numericCompare(val1, val2) && !isNull;
|
||||
return !isNull && numericCompare(val1, val2);
|
||||
}
|
||||
|
||||
case execplan::CalpontSystemCatalog::UBIGINT:
|
||||
|
@@ -52,15 +52,15 @@ class PredicateOperator : public Operator
|
||||
{
|
||||
public:
|
||||
PredicateOperator();
|
||||
PredicateOperator(const std::string& operatorName);
|
||||
explicit PredicateOperator(const std::string& operatorName);
|
||||
PredicateOperator(const PredicateOperator& rhs);
|
||||
virtual ~PredicateOperator();
|
||||
~PredicateOperator() override;
|
||||
|
||||
/** return a copy of this pointer
|
||||
*
|
||||
* deep copy of this pointer and return the copy
|
||||
*/
|
||||
inline virtual PredicateOperator* clone() const override
|
||||
inline PredicateOperator* clone() const override
|
||||
{
|
||||
return new PredicateOperator(*this);
|
||||
}
|
||||
@@ -68,15 +68,15 @@ class PredicateOperator : public Operator
|
||||
/**
|
||||
* The serialization interface
|
||||
*/
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
|
||||
*/
|
||||
virtual bool operator==(const TreeNode* t) const override;
|
||||
bool operator==(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -90,7 +90,7 @@ class PredicateOperator : public Operator
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
|
||||
*/
|
||||
virtual bool operator!=(const TreeNode* t) const override;
|
||||
bool operator!=(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -107,10 +107,10 @@ class PredicateOperator : public Operator
|
||||
* F&E framework *
|
||||
***********************************************************/
|
||||
using Operator::getBoolVal;
|
||||
virtual bool getBoolVal(rowgroup::Row& row, bool& isNull, ReturnedColumn* lop, ReturnedColumn* rop) override;
|
||||
bool getBoolVal(rowgroup::Row& row, bool& isNull, ReturnedColumn* lop, ReturnedColumn* rop) override;
|
||||
void setOpType(Type& l, Type& r) override;
|
||||
|
||||
inline virtual std::string toCppCode(IncludeSet& includes) const override
|
||||
inline std::string toCppCode(IncludeSet& includes) const override
|
||||
{
|
||||
includes.insert("predicateoperator.h");
|
||||
std::stringstream ss;
|
||||
|
@@ -62,7 +62,7 @@ class PseudoColumn : public SimpleColumn
|
||||
* Constructors
|
||||
*/
|
||||
PseudoColumn();
|
||||
PseudoColumn(const uint32_t pseudoType);
|
||||
explicit PseudoColumn(const uint32_t pseudoType);
|
||||
PseudoColumn(const std::string& token, const uint32_t pseudoType, const uint32_t sessionID = 0);
|
||||
PseudoColumn(const std::string& schema, const std::string& table, const std::string& col,
|
||||
const uint32_t pseudoType, const uint32_t sessionID = 0);
|
||||
@@ -74,13 +74,13 @@ class PseudoColumn : public SimpleColumn
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~PseudoColumn();
|
||||
~PseudoColumn() override;
|
||||
|
||||
/** return a copy of this pointer
|
||||
*
|
||||
* deep copy of this pointer and return the copy
|
||||
*/
|
||||
inline virtual PseudoColumn* clone() const override
|
||||
inline PseudoColumn* clone() const override
|
||||
{
|
||||
return new PseudoColumn(*this);
|
||||
}
|
||||
@@ -106,17 +106,17 @@ class PseudoColumn : public SimpleColumn
|
||||
/**
|
||||
* The serialize interface
|
||||
*/
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
|
||||
virtual const std::string toString() const override;
|
||||
const std::string toString() const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
|
||||
*/
|
||||
virtual bool operator==(const TreeNode* t) const override;
|
||||
bool operator==(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -130,7 +130,7 @@ class PseudoColumn : public SimpleColumn
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
|
||||
*/
|
||||
virtual bool operator!=(const TreeNode* t) const override;
|
||||
bool operator!=(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -141,7 +141,7 @@ class PseudoColumn : public SimpleColumn
|
||||
|
||||
static uint32_t pseudoNameToType(std::string& name);
|
||||
|
||||
virtual std::string toCppCode(IncludeSet& includes) const override;
|
||||
std::string toCppCode(IncludeSet& includes) const override;
|
||||
|
||||
private:
|
||||
/**
|
||||
|
@@ -83,20 +83,20 @@ class ReturnedColumn : public TreeNode
|
||||
* Constructors
|
||||
*/
|
||||
ReturnedColumn();
|
||||
ReturnedColumn(const std::string& sql);
|
||||
ReturnedColumn(const uint32_t sessionID, const bool returnAll = false);
|
||||
explicit ReturnedColumn(const std::string& sql);
|
||||
explicit ReturnedColumn(const uint32_t sessionID, const bool returnAll = false);
|
||||
ReturnedColumn(const ReturnedColumn& rhs, const uint32_t sessionID = 0);
|
||||
|
||||
/**
|
||||
* Destructors
|
||||
*/
|
||||
virtual ~ReturnedColumn();
|
||||
~ReturnedColumn() override;
|
||||
|
||||
/**
|
||||
* Accessor Methods
|
||||
*/
|
||||
virtual const std::string data() const override;
|
||||
virtual void data(const std::string data) override
|
||||
const std::string data() const override;
|
||||
void data(const std::string data) override
|
||||
{
|
||||
fData = data;
|
||||
}
|
||||
@@ -231,22 +231,22 @@ class ReturnedColumn : public TreeNode
|
||||
/**
|
||||
* Operations
|
||||
*/
|
||||
virtual ReturnedColumn* clone() const override = 0;
|
||||
ReturnedColumn* clone() const override = 0;
|
||||
|
||||
/**
|
||||
* The serialize interface
|
||||
*/
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
|
||||
virtual const std::string toString() const override;
|
||||
virtual std::string toCppCode(IncludeSet& includes) const override;
|
||||
const std::string toString() const override;
|
||||
std::string toCppCode(IncludeSet& includes) const override;
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
|
||||
*/
|
||||
virtual bool operator==(const TreeNode* t) const override;
|
||||
bool operator==(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -261,7 +261,7 @@ class ReturnedColumn : public TreeNode
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
|
||||
*/
|
||||
virtual bool operator!=(const TreeNode* t) const override;
|
||||
bool operator!=(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
|
@@ -56,13 +56,13 @@ class RowColumn : public ReturnedColumn
|
||||
/**
|
||||
* Constructors
|
||||
*/
|
||||
RowColumn(const uint32_t sessionID = 0);
|
||||
explicit RowColumn(const uint32_t sessionID = 0);
|
||||
RowColumn(const RowColumn& rhs, const uint32_t sessionID = 0);
|
||||
RowColumn(const std::vector<SRCP>& columnVec, const uint32_t sessionID = 0);
|
||||
explicit RowColumn(const std::vector<SRCP>& columnVec, const uint32_t sessionID = 0);
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~RowColumn();
|
||||
~RowColumn() override;
|
||||
|
||||
/**
|
||||
* Accessor Methods
|
||||
@@ -80,7 +80,7 @@ class RowColumn : public ReturnedColumn
|
||||
*
|
||||
* deep copy of this pointer and return the copy
|
||||
*/
|
||||
inline virtual RowColumn* clone() const override
|
||||
inline RowColumn* clone() const override
|
||||
{
|
||||
return new RowColumn(*this);
|
||||
}
|
||||
@@ -95,20 +95,20 @@ class RowColumn : public ReturnedColumn
|
||||
// virtual void serialize(messageqcpp::ByteStream&) const;
|
||||
// virtual void unserialize(messageqcpp::ByteStream&);
|
||||
|
||||
virtual const std::string toString() const override;
|
||||
const std::string toString() const override;
|
||||
|
||||
/**
|
||||
* Serialization interface
|
||||
*/
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
|
||||
*/
|
||||
virtual bool operator==(const TreeNode* t) const override;
|
||||
bool operator==(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -122,7 +122,7 @@ class RowColumn : public ReturnedColumn
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
|
||||
*/
|
||||
virtual bool operator!=(const TreeNode* t) const override;
|
||||
bool operator!=(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -131,16 +131,16 @@ class RowColumn : public ReturnedColumn
|
||||
*/
|
||||
bool operator!=(const RowColumn& t) const;
|
||||
using ReturnedColumn::hasAggregate;
|
||||
virtual bool hasAggregate() override
|
||||
bool hasAggregate() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual bool hasWindowFunc() override
|
||||
bool hasWindowFunc() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual std::string toCppCode(IncludeSet& includes) const override;
|
||||
std::string toCppCode(IncludeSet& includes) const override;
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -156,23 +156,21 @@ class SubSelect : public ReturnedColumn
|
||||
SubSelect() : ReturnedColumn()
|
||||
{
|
||||
}
|
||||
~SubSelect()
|
||||
{
|
||||
}
|
||||
~SubSelect() override = default;
|
||||
SubSelect* clone() const override
|
||||
{
|
||||
return new SubSelect();
|
||||
}
|
||||
using ReturnedColumn::hasAggregate;
|
||||
virtual bool hasAggregate() override
|
||||
bool hasAggregate() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual bool hasWindowFunc() override
|
||||
bool hasWindowFunc() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual const std::string toString() const override;
|
||||
const std::string toString() const override;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -63,7 +63,7 @@ class SelectFilter : public Filter
|
||||
/**
|
||||
* Destructors
|
||||
*/
|
||||
virtual ~SelectFilter();
|
||||
~SelectFilter() override;
|
||||
|
||||
/**
|
||||
* Accessor Methods
|
||||
@@ -107,13 +107,13 @@ class SelectFilter : public Filter
|
||||
fCorrelated = correlated;
|
||||
}
|
||||
|
||||
virtual const std::string toString() const override;
|
||||
virtual std::string toCppCode(IncludeSet& includes) const override;
|
||||
virtual inline const std::string data() const override
|
||||
const std::string toString() const override;
|
||||
std::string toCppCode(IncludeSet& includes) const override;
|
||||
inline const std::string data() const override
|
||||
{
|
||||
return fData;
|
||||
}
|
||||
virtual inline void data(const std::string data) override
|
||||
inline void data(const std::string data) override
|
||||
{
|
||||
fData = data;
|
||||
}
|
||||
@@ -130,14 +130,14 @@ class SelectFilter : public Filter
|
||||
/**
|
||||
* The serialization interface
|
||||
*/
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
|
||||
/** return a copy of this pointer
|
||||
*
|
||||
* deep copy of this pointer and return the copy
|
||||
*/
|
||||
inline virtual SelectFilter* clone() const override
|
||||
inline SelectFilter* clone() const override
|
||||
{
|
||||
return new SelectFilter(*this);
|
||||
}
|
||||
@@ -147,7 +147,7 @@ class SelectFilter : public Filter
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
|
||||
*/
|
||||
virtual bool operator==(const TreeNode* t) const override;
|
||||
bool operator==(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -161,7 +161,7 @@ class SelectFilter : public Filter
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
|
||||
*/
|
||||
virtual bool operator!=(const TreeNode* t) const override;
|
||||
bool operator!=(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
|
@@ -67,7 +67,7 @@ namespace execplan
|
||||
* immediately, causing all subsequent references to fail. This only affects
|
||||
* 'leakcheck'.
|
||||
*/
|
||||
//#define DESTROYSHMSEG
|
||||
// #define DESTROYSHMSEG
|
||||
|
||||
class SessionManager
|
||||
{
|
||||
@@ -94,7 +94,7 @@ class SessionManager
|
||||
* and no operation other than reset() should be performed on a
|
||||
* SessionManager instantiated with this.
|
||||
*/
|
||||
SessionManager(bool nolock);
|
||||
explicit SessionManager(bool nolock);
|
||||
|
||||
/** @brief Destructor
|
||||
*
|
||||
@@ -211,4 +211,3 @@ class SessionManager
|
||||
};
|
||||
|
||||
} // namespace execplan
|
||||
|
||||
|
@@ -36,7 +36,7 @@
|
||||
#include "shmkeys.h"
|
||||
#include "brmtypes.h"
|
||||
|
||||
//#define SM_DEBUG
|
||||
// #define SM_DEBUG
|
||||
|
||||
namespace execplan
|
||||
{
|
||||
@@ -132,7 +132,7 @@ class SessionMonitor
|
||||
{
|
||||
txnCount = 0;
|
||||
verID = 0;
|
||||
activeTxns = NULL;
|
||||
activeTxns = nullptr;
|
||||
};
|
||||
};
|
||||
typedef struct SessionMonitorData_struct SessionMonitorData_t;
|
||||
|
@@ -208,6 +208,13 @@ SimpleColumn::SimpleColumn(const SimpleColumn& rhs, const uint32_t sessionID)
|
||||
{
|
||||
}
|
||||
|
||||
SimpleColumn::SimpleColumn(const ReturnedColumn& rhs, const uint32_t sessionID)
|
||||
: ReturnedColumn(rhs, sessionID)
|
||||
, fData(rhs.data())
|
||||
, fisColumnStore(true)
|
||||
{
|
||||
}
|
||||
|
||||
SimpleColumn::~SimpleColumn()
|
||||
{
|
||||
}
|
||||
@@ -270,7 +277,9 @@ const string SimpleColumn::toString() const
|
||||
<< returnAll() << delim << sequence() << delim << cardinality() << delim << joinInfo() << delim
|
||||
<< colSource() << delim << (isColumnStore() ? "ColumnStore" : "ForeignEngine") << delim
|
||||
<< colPosition() << delim << cs.getCharset().cs_name.str << delim << cs.getCharset().coll_name.str
|
||||
<< delim << endl;
|
||||
<< " inputindex/outputindex: " << fInputIndex << delim << fOutputIndex
|
||||
<< " eid " << fExpressionId
|
||||
<< endl;
|
||||
|
||||
return output.str();
|
||||
}
|
||||
|
@@ -57,24 +57,27 @@ class SimpleColumn : public ReturnedColumn
|
||||
/**
|
||||
* Constructors
|
||||
*/
|
||||
class ForTestPurposeWithoutOID{};
|
||||
class ForTestPurposeWithoutOID
|
||||
{
|
||||
};
|
||||
|
||||
SimpleColumn();
|
||||
|
||||
SimpleColumn(const std::string& token, ForTestPurposeWithoutOID);
|
||||
|
||||
SimpleColumn(const std::string& token, const uint32_t sessionID = 0);
|
||||
explicit SimpleColumn(const std::string& token, const uint32_t sessionID = 0);
|
||||
|
||||
SimpleColumn(const std::string& schema, const std::string& table, const std::string& col,
|
||||
const uint32_t sessionID = 0, const int lower_case_table_names = 0);
|
||||
SimpleColumn(const std::string& schema, const std::string& table, const std::string& col,
|
||||
const bool isColumnStore, const uint32_t sessionID = 0, const int lower_case_table_names = 0);
|
||||
SimpleColumn(const SimpleColumn& rhs, const uint32_t sessionID = 0);
|
||||
SimpleColumn(const ReturnedColumn& rhs, const uint32_t sessionID = 0);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~SimpleColumn();
|
||||
~SimpleColumn() override;
|
||||
|
||||
/**
|
||||
* Accessor Methods
|
||||
@@ -123,8 +126,8 @@ class SimpleColumn : public ReturnedColumn
|
||||
fOid = oid;
|
||||
}
|
||||
|
||||
virtual const std::string data() const override;
|
||||
virtual void data(const std::string data) override
|
||||
const std::string data() const override;
|
||||
void data(const std::string data) override
|
||||
{
|
||||
fData = data;
|
||||
}
|
||||
@@ -178,7 +181,7 @@ class SimpleColumn : public ReturnedColumn
|
||||
*
|
||||
* deep copy of this pointer and return the copy
|
||||
*/
|
||||
inline virtual SimpleColumn* clone() const override
|
||||
inline SimpleColumn* clone() const override
|
||||
{
|
||||
return new SimpleColumn(*this);
|
||||
}
|
||||
@@ -190,17 +193,17 @@ class SimpleColumn : public ReturnedColumn
|
||||
/**
|
||||
* The serialize interface
|
||||
*/
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
|
||||
virtual const std::string toString() const override;
|
||||
virtual std::string toCppCode(IncludeSet& includes) const override;
|
||||
const std::string toString() const override;
|
||||
std::string toCppCode(IncludeSet& includes) const override;
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
|
||||
*/
|
||||
virtual bool operator==(const TreeNode* t) const override;
|
||||
bool operator==(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -216,7 +219,7 @@ class SimpleColumn : public ReturnedColumn
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
|
||||
*/
|
||||
virtual bool operator!=(const TreeNode* t) const override;
|
||||
bool operator!=(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -226,7 +229,7 @@ class SimpleColumn : public ReturnedColumn
|
||||
bool operator!=(const SimpleColumn& t) const;
|
||||
|
||||
/** @brief check if this column is the same as the argument */
|
||||
virtual bool sameColumn(const ReturnedColumn* rc) const override;
|
||||
bool sameColumn(const ReturnedColumn* rc) const override;
|
||||
|
||||
/** @brief return column type of this column (could be of any engine type) */
|
||||
const CalpontSystemCatalog::ColType& colType() const
|
||||
@@ -237,7 +240,7 @@ class SimpleColumn : public ReturnedColumn
|
||||
/** @brief set the column's OID from the syscat */
|
||||
void setOID();
|
||||
|
||||
virtual bool hasWindowFunc() override
|
||||
bool hasWindowFunc() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -251,7 +254,7 @@ class SimpleColumn : public ReturnedColumn
|
||||
* @return true, if all arguments belong to one table
|
||||
* false, if multiple tables are involved in the function
|
||||
*/
|
||||
virtual bool singleTable(CalpontSystemCatalog::TableAliasName& tan) override;
|
||||
bool singleTable(CalpontSystemCatalog::TableAliasName& tan) override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
@@ -281,13 +284,13 @@ class SimpleColumn : public ReturnedColumn
|
||||
* F&E framework *
|
||||
***********************************************************/
|
||||
public:
|
||||
virtual void evaluate(rowgroup::Row& row, bool& isNull) override;
|
||||
virtual bool getBoolVal(rowgroup::Row& row, bool& isNull) override
|
||||
void evaluate(rowgroup::Row& row, bool& isNull) override;
|
||||
bool getBoolVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
evaluate(row, isNull);
|
||||
return TreeNode::getBoolVal();
|
||||
}
|
||||
virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override
|
||||
const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
bool localIsNull = false;
|
||||
evaluate(row, localIsNull);
|
||||
@@ -300,37 +303,37 @@ class SimpleColumn : public ReturnedColumn
|
||||
return TreeNode::getStrVal(fTimeZone);
|
||||
}
|
||||
|
||||
virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
int64_t getIntVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
evaluate(row, isNull);
|
||||
return TreeNode::getIntVal();
|
||||
}
|
||||
|
||||
virtual uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override
|
||||
uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
evaluate(row, isNull);
|
||||
return TreeNode::getUintVal();
|
||||
}
|
||||
|
||||
virtual float getFloatVal(rowgroup::Row& row, bool& isNull) override
|
||||
float getFloatVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
evaluate(row, isNull);
|
||||
return TreeNode::getFloatVal();
|
||||
}
|
||||
|
||||
virtual double getDoubleVal(rowgroup::Row& row, bool& isNull) override
|
||||
double getDoubleVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
evaluate(row, isNull);
|
||||
return TreeNode::getDoubleVal();
|
||||
}
|
||||
|
||||
virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override
|
||||
long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
evaluate(row, isNull);
|
||||
return TreeNode::getLongDoubleVal();
|
||||
}
|
||||
|
||||
virtual IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override
|
||||
IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override
|
||||
{
|
||||
evaluate(row, isNull);
|
||||
|
||||
|
@@ -54,35 +54,33 @@ class SimpleColumn_Decimal : public SimpleColumn
|
||||
public:
|
||||
/** Constructors */
|
||||
SimpleColumn_Decimal();
|
||||
SimpleColumn_Decimal(const std::string& token, const uint32_t sessionID = 0);
|
||||
explicit SimpleColumn_Decimal(const std::string& token, const uint32_t sessionID = 0);
|
||||
SimpleColumn_Decimal(const std::string& schema, const std::string& table, const std::string& col,
|
||||
const bool isColumnStore, const uint32_t sessionID = 0);
|
||||
SimpleColumn_Decimal(const SimpleColumn& rhs, const uint32_t sessionID = 0);
|
||||
explicit SimpleColumn_Decimal(const SimpleColumn& rhs, const uint32_t sessionID = 0);
|
||||
|
||||
/** Destructor */
|
||||
virtual ~SimpleColumn_Decimal()
|
||||
{
|
||||
}
|
||||
~SimpleColumn_Decimal() override = default;
|
||||
|
||||
inline virtual SimpleColumn_Decimal* clone() const override
|
||||
inline SimpleColumn_Decimal* clone() const override
|
||||
{
|
||||
return new SimpleColumn_Decimal<len>(*this);
|
||||
}
|
||||
|
||||
/** Evaluate methods */
|
||||
virtual inline const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override;
|
||||
virtual inline int64_t getIntVal(rowgroup::Row& row, bool& isNull) override;
|
||||
virtual inline float getFloatVal(rowgroup::Row& row, bool& isNull) override;
|
||||
virtual inline double getDoubleVal(rowgroup::Row& row, bool& isNull) override;
|
||||
virtual inline long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override;
|
||||
virtual inline IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline int64_t getIntVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline float getFloatVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline double getDoubleVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override;
|
||||
|
||||
/** The serialize interface */
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
uint64_t fNullVal;
|
||||
|
||||
virtual std::string toCppCode(IncludeSet& includes) const override;
|
||||
std::string toCppCode(IncludeSet& includes) const override;
|
||||
|
||||
private:
|
||||
void setNullVal();
|
||||
|
@@ -53,36 +53,34 @@ class SimpleColumn_INT : public SimpleColumn
|
||||
public:
|
||||
/** Constructors */
|
||||
SimpleColumn_INT();
|
||||
SimpleColumn_INT(const std::string& token, const uint32_t sessionID = 0);
|
||||
explicit SimpleColumn_INT(const std::string& token, const uint32_t sessionID = 0);
|
||||
SimpleColumn_INT(const std::string& schema, const std::string& table, const std::string& col,
|
||||
const bool isColumnStore, const uint32_t sessionID = 0);
|
||||
SimpleColumn_INT(const SimpleColumn& rhs, const uint32_t sessionID = 0);
|
||||
explicit SimpleColumn_INT(const SimpleColumn& rhs, const uint32_t sessionID = 0);
|
||||
|
||||
/** Destructor */
|
||||
virtual ~SimpleColumn_INT()
|
||||
{
|
||||
}
|
||||
~SimpleColumn_INT() override = default;
|
||||
|
||||
inline virtual SimpleColumn_INT* clone() const override
|
||||
inline SimpleColumn_INT* clone() const override
|
||||
{
|
||||
return new SimpleColumn_INT<len>(*this);
|
||||
}
|
||||
|
||||
/** Evaluate methods */
|
||||
virtual inline const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override;
|
||||
virtual inline int64_t getIntVal(rowgroup::Row& row, bool& isNull) override;
|
||||
virtual inline uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override;
|
||||
virtual inline float getFloatVal(rowgroup::Row& row, bool& isNull) override;
|
||||
virtual inline double getDoubleVal(rowgroup::Row& row, bool& isNull) override;
|
||||
virtual inline long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override;
|
||||
virtual inline IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline int64_t getIntVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline float getFloatVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline double getDoubleVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override;
|
||||
|
||||
/** The serialize interface */
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
uint64_t fNullVal;
|
||||
|
||||
virtual std::string toCppCode(IncludeSet& includes) const override;
|
||||
std::string toCppCode(IncludeSet& includes) const override;
|
||||
|
||||
private:
|
||||
void setNullVal();
|
||||
@@ -93,8 +91,8 @@ std::string SimpleColumn_INT<len>::toCppCode(IncludeSet& includes) const
|
||||
{
|
||||
includes.insert("simplecolumn_int.h");
|
||||
std::stringstream ss;
|
||||
ss << "SimpleColumn_INT<" << len << ">(" << std::quoted(fSchemaName) << ", " << std::quoted(fTableName) << ", " <<
|
||||
std::quoted(fColumnName) << ", " << fisColumnStore << ", " << sessionID() << ")";
|
||||
ss << "SimpleColumn_INT<" << len << ">(" << std::quoted(fSchemaName) << ", " << std::quoted(fTableName)
|
||||
<< ", " << std::quoted(fColumnName) << ", " << fisColumnStore << ", " << sessionID() << ")";
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
@@ -146,7 +144,7 @@ void SimpleColumn_INT<len>::setNullVal()
|
||||
}
|
||||
|
||||
template <int len>
|
||||
inline const utils::NullString & SimpleColumn_INT<len>::getStrVal(rowgroup::Row& row, bool& isNull)
|
||||
inline const utils::NullString& SimpleColumn_INT<len>::getStrVal(rowgroup::Row& row, bool& isNull)
|
||||
{
|
||||
if (row.equals<len>(fNullVal, fInputIndex))
|
||||
{
|
||||
|
@@ -53,36 +53,34 @@ class SimpleColumn_UINT : public SimpleColumn
|
||||
public:
|
||||
/** Constructors */
|
||||
SimpleColumn_UINT();
|
||||
SimpleColumn_UINT(const std::string& token, const uint32_t sessionID = 0);
|
||||
explicit SimpleColumn_UINT(const std::string& token, const uint32_t sessionID = 0);
|
||||
SimpleColumn_UINT(const std::string& schema, const std::string& table, const std::string& col,
|
||||
const bool isColumnStore, const uint32_t sessionID = 0);
|
||||
SimpleColumn_UINT(const SimpleColumn& rhs, const uint32_t sessionID = 0);
|
||||
explicit SimpleColumn_UINT(const SimpleColumn& rhs, const uint32_t sessionID = 0);
|
||||
|
||||
/** Destructor */
|
||||
virtual ~SimpleColumn_UINT()
|
||||
{
|
||||
}
|
||||
~SimpleColumn_UINT() override = default;
|
||||
|
||||
inline virtual SimpleColumn_UINT* clone() const override
|
||||
inline SimpleColumn_UINT* clone() const override
|
||||
{
|
||||
return new SimpleColumn_UINT<len>(*this);
|
||||
}
|
||||
|
||||
/** Evaluate methods */
|
||||
virtual inline const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override;
|
||||
virtual inline int64_t getIntVal(rowgroup::Row& row, bool& isNull) override;
|
||||
virtual inline uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override;
|
||||
virtual inline float getFloatVal(rowgroup::Row& row, bool& isNull) override;
|
||||
virtual inline double getDoubleVal(rowgroup::Row& row, bool& isNull) override;
|
||||
virtual inline long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override;
|
||||
virtual inline IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline int64_t getIntVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline uint64_t getUintVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline float getFloatVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline double getDoubleVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline IDB_Decimal getDecimalVal(rowgroup::Row& row, bool& isNull) override;
|
||||
|
||||
/** The serialize interface */
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
uint64_t fNullVal;
|
||||
|
||||
virtual std::string toCppCode(IncludeSet& includes) const override;
|
||||
std::string toCppCode(IncludeSet& includes) const override;
|
||||
|
||||
private:
|
||||
void setNullVal();
|
||||
|
@@ -65,17 +65,19 @@ class SimpleFilter : public Filter
|
||||
SEMI
|
||||
};
|
||||
|
||||
struct ForTestPurposesWithoutColumnsOIDS{};
|
||||
struct ForTestPurposesWithoutColumnsOIDS
|
||||
{
|
||||
};
|
||||
|
||||
SimpleFilter();
|
||||
SimpleFilter(const std::string& sql);
|
||||
explicit SimpleFilter(const std::string& sql);
|
||||
SimpleFilter(const std::string& sql, ForTestPurposesWithoutColumnsOIDS);
|
||||
SimpleFilter(const SOP& op, ReturnedColumn* lhs, ReturnedColumn* rhs, const long timeZone = 0);
|
||||
SimpleFilter(const SimpleFilter& rhs);
|
||||
|
||||
virtual ~SimpleFilter();
|
||||
~SimpleFilter() override;
|
||||
|
||||
inline virtual SimpleFilter* clone() const override
|
||||
inline SimpleFilter* clone() const override
|
||||
{
|
||||
return new SimpleFilter(*this);
|
||||
}
|
||||
@@ -106,7 +108,7 @@ class SimpleFilter : public Filter
|
||||
}
|
||||
|
||||
using Filter::data;
|
||||
virtual const std::string data() const override;
|
||||
const std::string data() const override;
|
||||
|
||||
/** assign fLhs
|
||||
*
|
||||
@@ -129,20 +131,20 @@ class SimpleFilter : public Filter
|
||||
*/
|
||||
void rhs(ReturnedColumn* rhs);
|
||||
|
||||
virtual const std::string toString() const override;
|
||||
const std::string toString() const override;
|
||||
|
||||
/**
|
||||
* The serialization interface
|
||||
*/
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return true if every member of t is a duplicate copy of every member of this; false otherwise
|
||||
*/
|
||||
virtual bool operator==(const TreeNode* t) const override;
|
||||
bool operator==(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -160,7 +162,6 @@ class SimpleFilter : public Filter
|
||||
|
||||
bool operator<(const SimpleFilter& t) const;
|
||||
|
||||
|
||||
bool semanticEq(const SimpleFilter& t) const;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
@@ -168,7 +169,7 @@ class SimpleFilter : public Filter
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return false if every member of t is a duplicate copy of every member of this; true otherwise
|
||||
*/
|
||||
virtual bool operator!=(const TreeNode* t) const override;
|
||||
bool operator!=(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -221,7 +222,7 @@ class SimpleFilter : public Filter
|
||||
|
||||
static std::string escapeString(const std::string& input);
|
||||
|
||||
virtual string toCppCode(IncludeSet& includes) const override;
|
||||
string toCppCode(IncludeSet& includes) const override;
|
||||
|
||||
private:
|
||||
SOP fOp; /// operator
|
||||
@@ -237,10 +238,10 @@ class SimpleFilter : public Filter
|
||||
* F&E framework *
|
||||
***********************************************************/
|
||||
public:
|
||||
inline virtual bool getBoolVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline virtual double getDoubleVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline virtual long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline bool getBoolVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline int64_t getIntVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline double getDoubleVal(rowgroup::Row& row, bool& isNull) override;
|
||||
inline long double getLongDoubleVal(rowgroup::Row& row, bool& isNull) override;
|
||||
|
||||
// get all simple columns involved in this column
|
||||
const std::vector<SimpleColumn*>& simpleColumnList();
|
||||
|
@@ -65,7 +65,7 @@ class SimpleScalarFilter : public Filter
|
||||
/**
|
||||
* Destructors
|
||||
*/
|
||||
virtual ~SimpleScalarFilter();
|
||||
~SimpleScalarFilter() override;
|
||||
|
||||
/**
|
||||
* Accessor Methods
|
||||
@@ -100,13 +100,13 @@ class SimpleScalarFilter : public Filter
|
||||
fSub = sub;
|
||||
}
|
||||
|
||||
virtual const std::string toString() const override;
|
||||
const std::string toString() const override;
|
||||
|
||||
virtual inline const std::string data() const override
|
||||
inline const std::string data() const override
|
||||
{
|
||||
return fData;
|
||||
}
|
||||
virtual inline void data(const std::string data) override
|
||||
inline void data(const std::string data) override
|
||||
{
|
||||
fData = data;
|
||||
}
|
||||
@@ -114,14 +114,14 @@ class SimpleScalarFilter : public Filter
|
||||
/**
|
||||
* The serialization interface
|
||||
*/
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
|
||||
/** return a copy of this pointer
|
||||
*
|
||||
* deep copy of this pointer and return the copy
|
||||
*/
|
||||
inline virtual SimpleScalarFilter* clone() const override
|
||||
inline SimpleScalarFilter* clone() const override
|
||||
{
|
||||
return new SimpleScalarFilter(*this);
|
||||
}
|
||||
@@ -131,7 +131,7 @@ class SimpleScalarFilter : public Filter
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
|
||||
*/
|
||||
virtual bool operator==(const TreeNode* t) const override;
|
||||
bool operator==(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -145,7 +145,7 @@ class SimpleScalarFilter : public Filter
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
|
||||
*/
|
||||
virtual bool operator!=(const TreeNode* t) const override;
|
||||
bool operator!=(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -154,7 +154,7 @@ class SimpleScalarFilter : public Filter
|
||||
*/
|
||||
bool operator!=(const SimpleScalarFilter& t) const;
|
||||
|
||||
virtual string toCppCode(IncludeSet& includes) const override;
|
||||
string toCppCode(IncludeSet& includes) const override;
|
||||
|
||||
private:
|
||||
// default okay?
|
||||
|
@@ -269,7 +269,9 @@ class TreeNode
|
||||
***********************************************************************/
|
||||
virtual const utils::NullString& getStrVal(rowgroup::Row& row, bool& isNull)
|
||||
{
|
||||
isNull = isNull || fResult.strVal.isNull(); // XXX: NullString returns isNull, we should remove that parameter altogether.
|
||||
isNull = isNull ||
|
||||
fResult.strVal
|
||||
.isNull(); // XXX: NullString returns isNull, we should remove that parameter altogether.
|
||||
return fResult.strVal;
|
||||
}
|
||||
virtual int64_t getIntVal(rowgroup::Row& row, bool& isNull)
|
||||
@@ -475,19 +477,20 @@ inline const utils::NullString& TreeNode::getStrVal(const long timeZone)
|
||||
case CalpontSystemCatalog::VARCHAR:
|
||||
if (fResultType.colWidth <= 7)
|
||||
{
|
||||
const char *intAsChar = (const char*) (&fResult.origIntVal);
|
||||
const char* intAsChar = (const char*)(&fResult.origIntVal);
|
||||
fResult.strVal.assign((const uint8_t*)intAsChar, strlen(intAsChar));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case CalpontSystemCatalog::CHAR:
|
||||
case CalpontSystemCatalog::VARBINARY: // XXX: TODO: we don't have varbinary support now, but it may be handled just like varchar.
|
||||
case CalpontSystemCatalog::VARBINARY: // XXX: TODO: we don't have varbinary support now, but it may be
|
||||
// handled just like varchar.
|
||||
case CalpontSystemCatalog::BLOB:
|
||||
case CalpontSystemCatalog::TEXT:
|
||||
if (fResultType.colWidth <= 8)
|
||||
{
|
||||
const char *intAsChar = (const char*) (&fResult.origIntVal);
|
||||
const char* intAsChar = (const char*)(&fResult.origIntVal);
|
||||
fResult.strVal.assign((const uint8_t*)intAsChar, strlen(intAsChar));
|
||||
}
|
||||
|
||||
@@ -865,27 +868,27 @@ inline double TreeNode::getDoubleVal()
|
||||
{
|
||||
case CalpontSystemCatalog::CHAR:
|
||||
if (fResultType.colWidth <= 8)
|
||||
return strtod((char*)(&fResult.origIntVal), NULL);
|
||||
return strtod((char*)(&fResult.origIntVal), nullptr);
|
||||
|
||||
idbassert(fResult.strVal.str());
|
||||
return strtod(fResult.strVal.str(), NULL);
|
||||
return strtod(fResult.strVal.str(), nullptr);
|
||||
|
||||
case CalpontSystemCatalog::VARCHAR:
|
||||
if (fResultType.colWidth <= 7)
|
||||
return strtod((char*)(&fResult.origIntVal), NULL);
|
||||
return strtod((char*)(&fResult.origIntVal), nullptr);
|
||||
|
||||
idbassert(fResult.strVal.str());
|
||||
return strtod(fResult.strVal.str(), NULL);
|
||||
return strtod(fResult.strVal.str(), nullptr);
|
||||
|
||||
// FIXME: ???
|
||||
case CalpontSystemCatalog::VARBINARY:
|
||||
case CalpontSystemCatalog::BLOB:
|
||||
case CalpontSystemCatalog::TEXT:
|
||||
if (fResultType.colWidth <= 7)
|
||||
return strtod((char*)(&fResult.origIntVal), NULL);
|
||||
return strtod((char*)(&fResult.origIntVal), nullptr);
|
||||
|
||||
//idbassert(fResult.strVal.str());
|
||||
return strtod(fResult.strVal.safeString("").c_str(), NULL);
|
||||
// idbassert(fResult.strVal.str());
|
||||
return strtod(fResult.strVal.safeString("").c_str(), nullptr);
|
||||
|
||||
case CalpontSystemCatalog::BIGINT:
|
||||
case CalpontSystemCatalog::TINYINT:
|
||||
@@ -936,27 +939,27 @@ inline long double TreeNode::getLongDoubleVal()
|
||||
{
|
||||
case CalpontSystemCatalog::CHAR:
|
||||
if (fResultType.colWidth <= 8)
|
||||
return strtold((char*)(&fResult.origIntVal), NULL);
|
||||
return strtold((char*)(&fResult.origIntVal), nullptr);
|
||||
|
||||
idbassert(fResult.strVal.str());
|
||||
return strtold(fResult.strVal.str(), NULL);
|
||||
return strtold(fResult.strVal.str(), nullptr);
|
||||
|
||||
case CalpontSystemCatalog::VARCHAR:
|
||||
if (fResultType.colWidth <= 7)
|
||||
return strtold((char*)(&fResult.origIntVal), NULL);
|
||||
return strtold((char*)(&fResult.origIntVal), nullptr);
|
||||
|
||||
idbassert(fResult.strVal.str());
|
||||
return strtold(fResult.strVal.str(), NULL);
|
||||
return strtold(fResult.strVal.str(), nullptr);
|
||||
|
||||
// FIXME: ???
|
||||
case CalpontSystemCatalog::VARBINARY:
|
||||
case CalpontSystemCatalog::BLOB:
|
||||
case CalpontSystemCatalog::TEXT:
|
||||
if (fResultType.colWidth <= 7)
|
||||
return strtold((char*)(&fResult.origIntVal), NULL);
|
||||
return strtold((char*)(&fResult.origIntVal), nullptr);
|
||||
|
||||
idbassert(fResult.strVal.str());
|
||||
return strtold(fResult.strVal.str(), NULL);
|
||||
return strtold(fResult.strVal.str(), nullptr);
|
||||
|
||||
case CalpontSystemCatalog::BIGINT:
|
||||
case CalpontSystemCatalog::TINYINT:
|
||||
|
@@ -50,14 +50,14 @@ class TreeNodeImpl : public TreeNode
|
||||
* Constructors
|
||||
*/
|
||||
TreeNodeImpl();
|
||||
TreeNodeImpl(const std::string& sql);
|
||||
explicit TreeNodeImpl(const std::string& sql);
|
||||
// not needed yet
|
||||
// TreeNodeImpl(const TreeNodeImpl& rhs);
|
||||
|
||||
/**
|
||||
* Destructors
|
||||
*/
|
||||
virtual ~TreeNodeImpl();
|
||||
~TreeNodeImpl() override;
|
||||
/**
|
||||
* Accessor Methods
|
||||
*/
|
||||
@@ -65,13 +65,13 @@ class TreeNodeImpl : public TreeNode
|
||||
/**
|
||||
* Operations
|
||||
*/
|
||||
virtual const std::string toString() const override;
|
||||
const std::string toString() const override;
|
||||
|
||||
virtual const std::string data() const override
|
||||
const std::string data() const override
|
||||
{
|
||||
return fData;
|
||||
}
|
||||
virtual void data(const std::string data) override
|
||||
void data(const std::string data) override
|
||||
{
|
||||
fData = data;
|
||||
}
|
||||
@@ -80,7 +80,7 @@ class TreeNodeImpl : public TreeNode
|
||||
*
|
||||
* deep copy of this pointer and return the copy
|
||||
*/
|
||||
inline virtual TreeNodeImpl* clone() const override
|
||||
inline TreeNodeImpl* clone() const override
|
||||
{
|
||||
return new TreeNodeImpl(*this);
|
||||
}
|
||||
@@ -88,15 +88,15 @@ class TreeNodeImpl : public TreeNode
|
||||
/**
|
||||
* The serialization interface
|
||||
*/
|
||||
virtual void serialize(messageqcpp::ByteStream&) const override;
|
||||
virtual void unserialize(messageqcpp::ByteStream&) override;
|
||||
void serialize(messageqcpp::ByteStream&) const override;
|
||||
void unserialize(messageqcpp::ByteStream&) override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return true iff every member of t is a duplicate copy of every member of this; false otherwise
|
||||
*/
|
||||
virtual bool operator==(const TreeNode* t) const override;
|
||||
bool operator==(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -110,7 +110,7 @@ class TreeNodeImpl : public TreeNode
|
||||
* Do a deep, strict (as opposed to semantic) equivalence test.
|
||||
* @return false iff every member of t is a duplicate copy of every member of this; true otherwise
|
||||
*/
|
||||
virtual bool operator!=(const TreeNode* t) const override;
|
||||
bool operator!=(const TreeNode* t) const override;
|
||||
|
||||
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
|
||||
*
|
||||
@@ -119,7 +119,8 @@ class TreeNodeImpl : public TreeNode
|
||||
*/
|
||||
bool operator!=(const TreeNodeImpl& t) const;
|
||||
|
||||
virtual std::string toCppCode(IncludeSet& includes) const override;
|
||||
std::string toCppCode(IncludeSet& includes) const override;
|
||||
|
||||
private:
|
||||
// default okay
|
||||
// TreeNodeImpl& operator=(const TreeNodeImpl& rhs);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user