1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-02 17:22:27 +03:00

Fixes of bugs from ASAN warnings, part one (#2796)

This commit is contained in:
Leonid Fedorov
2023-03-30 18:29:04 +03:00
committed by GitHub
parent a1d20d82d5
commit 2f153184c3
71 changed files with 591 additions and 2038 deletions

View File

@ -205,7 +205,7 @@ IF (NOT INSTALL_LAYOUT)
ENDIF() ENDIF()
OPTION(SECURITY_HARDENED "Use security-enhancing compiler features (stack protector, relro, etc)" ${security_default}) OPTION(SECURITY_HARDENED "Use security-enhancing compiler features (stack protector, relro, etc)" ${security_default})
OPTION(SECURITY_HARDENED_NEW "Use new security-enhancing compilier features" OFF) OPTION(SECURITY_HARDENED_NEW "Use new security-enhancing compilier features" OFF)
IF(SECURITY_HARDENED) IF(SECURITY_HARDENED AND NOT WITH_ASAN AND NOT WITH_UBSAN AND NOT WITH_TSAN AND NOT WITH_GPROF)
# security-enhancing flags # security-enhancing flags
MY_CHECK_AND_SET_COMPILER_FLAG("-pie -fPIC") MY_CHECK_AND_SET_COMPILER_FLAG("-pie -fPIC")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wl,-z,relro,-z,now") MY_CHECK_AND_SET_COMPILER_FLAG("-Wl,-z,relro,-z,now")
@ -237,10 +237,15 @@ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-register") MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-register")
endif() endif()
IF (WITH_COLUMNSTORE_ASAN)
MY_CHECK_AND_SET_COMPILER_FLAG("-U_FORTIFY_SOURCE" DEBUG RELWITHDEBINFO)
MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=address -fsanitize-address-use-after-scope -fPIC")
ENDIF()
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-deprecated-copy" DEBUG RELEASE RELWITHDEBINFO MINSIZEREL) MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-deprecated-copy" DEBUG RELEASE RELWITHDEBINFO MINSIZEREL)
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-deprecated-declarations" DEBUG RELEASE RELWITHDEBINFO MINSIZEREL) MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-deprecated-declarations" DEBUG RELEASE RELWITHDEBINFO MINSIZEREL)
MY_CHECK_AND_SET_COMPILER_FLAG("-Werror -Wall") MY_CHECK_AND_SET_COMPILER_FLAG("-Werror -Wall -Wextra")
SET (ENGINE_LDFLAGS "-Wl,--no-as-needed -Wl,--add-needed") SET (ENGINE_LDFLAGS "-Wl,--no-as-needed -Wl,--add-needed")
SET (ENGINE_DT_LIB datatypes) SET (ENGINE_DT_LIB datatypes)
SET (ENGINE_COMMON_LIBS messageqcpp loggingcpp configcpp idbboot boost_thread xml2 pthread rt ${ENGINE_DT_LIB}) SET (ENGINE_COMMON_LIBS messageqcpp loggingcpp configcpp idbboot boost_thread xml2 pthread rt ${ENGINE_DT_LIB})

View File

@ -18,17 +18,25 @@ message "Building Mariadb Server from $color_yellow$MDB_SOURCE_PATH$color_normal
BUILD_TYPE_OPTIONS=("Debug" "RelWithDebInfo") BUILD_TYPE_OPTIONS=("Debug" "RelWithDebInfo")
DISTRO_OPTIONS=("Ubuntu" "CentOS" "Debian" "Rocky") DISTRO_OPTIONS=("Ubuntu" "CentOS" "Debian" "Rocky")
cd $SCRIPT_LOCATION
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
BRANCHES=($(git branch --list --no-color| grep "[^* ]+" -Eo)) BRANCHES=($(git branch --list --no-color| grep "[^* ]+" -Eo))
cd -
optparse.define short=t long=build-type desc="Build Type: ${BUILD_TYPE_OPTIONS[*]}" variable=MCS_BUILD_TYPE optparse.define short=t long=build-type desc="Build Type: ${BUILD_TYPE_OPTIONS[*]}" variable=MCS_BUILD_TYPE
optparse.define short=d long=distro desc="Choouse your OS: ${DISTRO_OPTIONS[*]}" variable=OS optparse.define short=d long=distro desc="Choouse your OS: ${DISTRO_OPTIONS[*]}" variable=OS
optparse.define short=s long=skip-deps desc="Skip install dependences" variable=SKIP_DEPS default=false value=true optparse.define short=D long=install-deps desc="Install dependences" variable=INSTALL_DEPS default=false value=true
optparse.define short=C long=force-cmake-reconfig desc="Force cmake reconfigure" variable=FORCE_CMAKE_CONFIG default=false value=true optparse.define short=C long=force-cmake-reconfig desc="Force cmake reconfigure" variable=FORCE_CMAKE_CONFIG default=false value=true
optparse.define short=S long=skip-columnstore-submodules desc="Skip columnstore submodules initialization" variable=SKIP_SUBMODULES default=false value=true optparse.define short=S long=skip-columnstore-submodules desc="Skip columnstore submodules initialization" variable=SKIP_SUBMODULES default=false value=true
optparse.define short=u long=skip-unit-tests desc="Skip UnitTests" variable=SKIP_UNIT_TESTS default=false value=true optparse.define short=u long=skip-unit-tests desc="Skip UnitTests" variable=SKIP_UNIT_TESTS default=false value=true
optparse.define short=B long=run-microbench="Compile and run microbenchmarks " variable=RUN_BENCHMARKS default=false value=true optparse.define short=B long=run-microbench="Compile and run microbenchmarks " variable=RUN_BENCHMARKS default=false value=true
optparse.define short=b long=branch desc="Choouse git branch ('none' for menu)" variable=BRANCH optparse.define short=b long=branch desc="Choose git branch. For menu use -b \"\"" variable=BRANCH default=$CURRENT_BRANCH
optparse.define short=D long=without-core-dumps desc="Do not produce core dumps" variable=WITHOUT_COREDUMPS default=false value=true optparse.define short=D long=without-core-dumps desc="Do not produce core dumps" variable=WITHOUT_COREDUMPS default=false value=true
optparse.define short=A long=asan desc="Build with ASAN" variable=ASAN default=false value=true
optparse.define short=v long=verbose desc="Verbose makefile commands" variable=MAKEFILE_VERBOSE default=false value=true
optparse.define short=P long=report-path desc="Path for storing reports and profiles" variable=REPORT_PATH default="/core"
source $( optparse.build ) source $( optparse.build )
@ -45,18 +53,27 @@ INSTALL_PREFIX="/usr/"
DATA_DIR="/var/lib/mysql/data" DATA_DIR="/var/lib/mysql/data"
CMAKE_BIN_NAME=cmake CMAKE_BIN_NAME=cmake
CTEST_BIN_NAME=ctest CTEST_BIN_NAME=ctest
CONFIG_DIR="/etc/my.cnf.d"
if [[ $OS = 'Ubuntu' || $OS = 'Debian' ]]; then
CONFIG_DIR="/etc/mysql/mariadb.conf.d"
fi
select_branch() select_branch()
{ {
cd $SCRIPT_LOCATION
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [[ ! " ${BRANCHES[*]} " =~ " ${BRANCH} " ]]; then if [[ ! " ${BRANCHES[*]} " =~ " ${BRANCH} " ]]; then
if [[ $BRANCH = 'none' ]]; then if [[ $BRANCH = "" ]]; then
getChoice -q "Select your branch" -o BRANCHES getChoice -q "Select your branch" -o BRANCHES
BRANCH=$selectedChoice BRANCH=$selectedChoice
fi fi
cd $SCRIPT_LOCATION if [[ $BRANCH != $CURRENT_BRANCH ]]; then
message "Selecting $BRANCH branch for Columnstore" message "Selecting $BRANCH branch for Columnstore"
git checkout $BRANCH git checkout $BRANCH
cd - fi
message "Turning off Columnstore submodule auto update via gitconfig" message "Turning off Columnstore submodule auto update via gitconfig"
cd $MDB_SOURCE_PATH cd $MDB_SOURCE_PATH
@ -64,8 +81,6 @@ select_branch()
cd - cd -
fi fi
cd $SCRIPT_LOCATION
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
cd - cd -
message "Columnstore will be built from $color_yellow$CURRENT_BRANCH$color_normal branch" message "Columnstore will be built from $color_yellow$CURRENT_BRANCH$color_normal branch"
} }
@ -136,7 +151,9 @@ clean_old_installation()
rm -rf /var/lib/columnstore/local/ rm -rf /var/lib/columnstore/local/
rm -f /var/lib/columnstore/storagemanager/storagemanager-lock rm -f /var/lib/columnstore/storagemanager/storagemanager-lock
rm -f /var/lib/columnstore/storagemanager/cs-initialized rm -f /var/lib/columnstore/storagemanager/cs-initialized
rm -rf /var/log/mariadb/columnstore/*
rm -rf /tmp/* rm -rf /tmp/*
rm -rf $REPORT_PATH
rm -rf /var/lib/mysql rm -rf /var/lib/mysql
rm -rf /var/run/mysqld rm -rf /var/run/mysqld
rm -rf $DATA_DIR rm -rf $DATA_DIR
@ -161,7 +178,8 @@ build()
-DWITH_WSREP=OFF -DWITH_WSREP=OFF
-DWITH_SSL=system -DWITH_SSL=system
-DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX -DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX
-DCMAKE_EXPORT_COMPILE_COMMANDS=1" -DCMAKE_EXPORT_COMPILE_COMMANDS=1
"
if [[ $SKIP_UNIT_TESTS = true ]] ; then if [[ $SKIP_UNIT_TESTS = true ]] ; then
@ -172,11 +190,21 @@ build()
message "Buiding with unittests" message "Buiding with unittests"
fi fi
if [[ $ASAN = true ]] ; then
warn "Building with ASAN"
MDB_CMAKE_FLAGS="${MDB_CMAKE_FLAGS} -DWITH_ASAN=ON -DWITH_COLUMNSTORE_ASAN=ON -DWITH_COLUMNSTORE_REPORT_PATH=${REPORT_PATH}"
fi
if [[ $WITHOUT_COREDUMPS = true ]] ; then if [[ $WITHOUT_COREDUMPS = true ]] ; then
warn "Cores are not dumped" warn "Cores are not dumped"
else else
MDB_CMAKE_FLAGS="${MDB_CMAKE_FLAGS} -DWITH_COREDUMPS=ON" MDB_CMAKE_FLAGS="${MDB_CMAKE_FLAGS} -DWITH_COREDUMPS=ON"
echo "${REPORT_PATH}/core_%e.%p" | sudo tee /proc/sys/kernel/core_pattern
fi
if [[ $MAKEFILE_VERBOSE = true ]] ; then
warn "Verbosing Makefile Commands"
MDB_CMAKE_FLAGS="${MDB_CMAKE_FLAGS} -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"
fi fi
if [[ $RUN_BENCHMARKS = true ]] ; then if [[ $RUN_BENCHMARKS = true ]] ; then
@ -197,7 +225,6 @@ build()
message "Buiding without microbenchmarks" message "Buiding without microbenchmarks"
fi fi
cd $MDB_SOURCE_PATH cd $MDB_SOURCE_PATH
if [[ $SKIP_SUBMODULES = true ]] ; then if [[ $SKIP_SUBMODULES = true ]] ; then
@ -228,11 +255,13 @@ build()
message "building with flags $MDB_CMAKE_FLAGS" message "building with flags $MDB_CMAKE_FLAGS"
local CPUS=$(getconf _NPROCESSORS_ONLN) local CPUS=$(getconf _NPROCESSORS_ONLN)
${CMAKE_BIN_NAME} . -DCMAKE_BUILD_TYPE=$MCS_BUILD_TYPE $MDB_CMAKE_FLAGS && \ ${CMAKE_BIN_NAME} -DCMAKE_BUILD_TYPE=$MCS_BUILD_TYPE $MDB_CMAKE_FLAGS && \ |
make -j $CPUS install make -j $CPUS
message "Installing silently"
make -j $CPUS install > /dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
error "!!!! BUILD FAILED" error "!!!! BUILD FAILED !!!!"
exit 1 exit 1
fi fi
cd - cd -
@ -259,7 +288,7 @@ run_unit_tests()
else else
message "Running unittests" message "Running unittests"
cd $MDB_SOURCE_PATH cd $MDB_SOURCE_PATH
${CTEST_BIN_NAME} . -R columnstore: -j $(nproc) ${CTEST_BIN_NAME} . -R columnstore: -j $(nproc) --progress
cd - cd -
fi fi
} }
@ -271,14 +300,56 @@ run_microbenchmarks_tests()
else else
message "Runnning microbenchmarks" message "Runnning microbenchmarks"
cd $MDB_SOURCE_PATH cd $MDB_SOURCE_PATH
${CTEST_BIN_NAME} . -V -R columnstore_microbenchmarks: -j $(nproc) ${CTEST_BIN_NAME} . -V -R columnstore_microbenchmarks: -j $(nproc) --progress
cd - cd -
fi fi
} }
disable_plugins_for_bootstrap()
{
find /etc -type f -exec sed -i 's/plugin-load-add=auth_gssapi.so//g' {} +
find /etc -type f -exec sed -i 's/plugin-load-add=ha_columnstore.so//g' {} +
}
enable_columnstore_back()
{
echo plugin-load-add=ha_columnstore.so >> $CONFIG_DIR/columnstore.cnf
}
fix_config_files()
{
message Fixing config files
THREAD_STACK_SIZE="20M"
SYSTEMD_SERVICE_DIR="/usr/lib/systemd/system"
if [[ $ASAN = true ]] ; then
COLUMNSTORE_CONFIG=$CONFIG_DIR/columnstore.cnf
if grep -q thread_stack $COLUMNSTORE_CONFIG; then
warn "MDB Server has thread_stack settings on $COLUMNSTORE_CONFIG check it's compatibility with ASAN"
else
echo "thread_stack = ${THREAD_STACK_SIZE}" >> $COLUMNSTORE_CONFIG
message "thread_stack was set to ${THREAD_STACK_SIZE} in $COLUMNSTORE_CONFIG"
fi
MDB_SERVICE_FILE=$SYSTEMD_SERVICE_DIR/mariadb.service
if grep -q ASAN $MDB_SERVICE_FILE; then
warn "MDB Server has ASAN options in $MDB_SERVICE_FILE, check it's compatibility"
else
echo Environment="'ASAN_OPTIONS=abort_on_error=1:disable_coredump=0,print_stats=false,detect_odr_violation=0,check_initialization_order=1,detect_stack_use_after_return=1,atexit=false,log_path=${ASAN_PATH}'" >> $MDB_SERVICE_FILE
message "ASAN options were added to $MDB_SERVICE_FILE"
fi
fi
systemctl daemon-reload
}
install() install()
{ {
message "Installing MariaDB" message "Installing MariaDB"
disable_plugins_for_bootstrap
mkdir -p $REPORT_PATH
chmod 777 $REPORT_PATH
check_user_and_group check_user_and_group
@ -288,10 +359,15 @@ install()
socket=/run/mysqld/mysqld.sock" > /etc/my.cnf.d/socket.cnf' socket=/run/mysqld/mysqld.sock" > /etc/my.cnf.d/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 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
mkdir -p /var/lib/mysql
chown mysql:mysql /var/lib/mysql
message "Running mysql_install_db" message "Running mysql_install_db"
mysql_install_db --rpm --user=mysql sudo -u mysql mysql_install_db --rpm --user=mysql > /dev/null
mv /tmp/ha_columnstore_1.so $INSTALL_PREFIX/lib/mysql/plugin/ha_columnstore.so || mv /tmp/ha_columnstore_2.so $INSTALL_PREFIX/lib64/mysql/plugin/ha_columnstore.so mv /tmp/ha_columnstore_1.so $INSTALL_PREFIX/lib/mysql/plugin/ha_columnstore.so || mv /tmp/ha_columnstore_2.so $INSTALL_PREFIX/lib64/mysql/plugin/ha_columnstore.so
enable_columnstore_back
mkdir -p /etc/columnstore mkdir -p /etc/columnstore
cp $MDB_SOURCE_PATH/storage/columnstore/columnstore/oam/etc/Columnstore.xml /etc/columnstore/Columnstore.xml cp $MDB_SOURCE_PATH/storage/columnstore/columnstore/oam/etc/Columnstore.xml /etc/columnstore/Columnstore.xml
@ -308,7 +384,7 @@ socket=/run/mysqld/mysqld.sock" > /etc/my.cnf.d/socket.cnf'
> /etc/mysql/debian.cnf > /etc/mysql/debian.cnf
fi fi
systemctl daemon-reload fix_config_files
if [ -d "/etc/mysql/mariadb.conf.d/" ]; then if [ -d "/etc/mysql/mariadb.conf.d/" ]; then
message "Copying configs from /etc/mysql/mariadb.conf.d/ to /etc/my.cnf.d" message "Copying configs from /etc/mysql/mariadb.conf.d/ to /etc/my.cnf.d"
@ -345,9 +421,23 @@ socket=/run/mysqld/mysqld.sock" > /etc/my.cnf.d/socket.cnf'
chmod 777 /var/log/mariadb/columnstore chmod 777 /var/log/mariadb/columnstore
} }
smoke()
{
message "Creating test database"
mariadb -e "create database if not exists test;"
message "Selecting magic numbers"
MAGIC=`mysql -N test < $MDB_SOURCE_PATH/storage/columnstore/columnstore/tests/scripts/smoke.sql`
if [[ $MAGIC == '42' ]] ; then
message "Great answer correct"
else
warn "Smoke failed, answer is '$MAGIC'"
fi
}
select_branch select_branch
if [[ $SKIP_DEPS = false ]] ; then if [[ $INSTALL_DEPS = true ]] ; then
install_deps install_deps
fi fi
@ -358,4 +448,6 @@ run_unit_tests
run_microbenchmarks_tests run_microbenchmarks_tests
install install
start_service start_service
smoke
message "$color_green FINISHED $color_normal" message "$color_green FINISHED $color_normal"

View File

@ -164,6 +164,27 @@ const int128_t mcs_pow_10_128[20] = {
100000000000000000000000000000000000000_xxl, 100000000000000000000000000000000000000_xxl,
}; };
const long long columnstore_precision[19] = {0,
9,
99,
999,
9999,
99999,
999999,
9999999,
99999999,
999999999,
9999999999LL,
99999999999LL,
999999999999LL,
9999999999999LL,
99999999999999LL,
999999999999999LL,
9999999999999999LL,
99999999999999999LL,
999999999999999999LL};
const int128_t ConversionRangeMaxValue[20] = {9999999999999999999_xxl, const int128_t ConversionRangeMaxValue[20] = {9999999999999999999_xxl,
99999999999999999999_xxl, 99999999999999999999_xxl,
999999999999999999999_xxl, 999999999999999999999_xxl,

View File

@ -1,102 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,6,0,0
PRODUCTVERSION 4,6,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "InfiniDB, Inc."
VALUE "FileDescription", "InfiniDB DDL API"
VALUE "FileVersion", "4.6.0-0"
VALUE "InternalName", "libddlpackageproc"
VALUE "LegalCopyright", "Copyright (C) 2014"
VALUE "OriginalFilename", "libddlpackageproc.dll"
VALUE "ProductName", "InfiniDB"
VALUE "ProductVersion", "4.6.0.0 Beta"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -1,102 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,6,0,0
PRODUCTVERSION 4,6,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "InfiniDB, Inc."
VALUE "FileDescription", "InfiniDB DML API"
VALUE "FileVersion", "4.6.0-0"
VALUE "InternalName", "libdmlpackageproc"
VALUE "LegalCopyright", "Copyright (C) 2014"
VALUE "OriginalFilename", "libdmlpackageproc.dll"
VALUE "ProductName", "InfiniDB"
VALUE "ProductVersion", "4.6.0.0 Beta"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -1,102 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,6,0,0
PRODUCTVERSION 4,6,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "InfiniDB, Inc."
VALUE "FileDescription", "InfiniDB Job List API"
VALUE "FileVersion", "4.6.0-0"
VALUE "InternalName", "libjoblist.dll"
VALUE "LegalCopyright", "Copyright (C) 2014"
VALUE "OriginalFilename", "libjoblist.dll"
VALUE "ProductName", "InfiniDB"
VALUE "ProductVersion", "4.6.0.0 Beta"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -29,6 +29,7 @@
#include "blocksize.h" #include "blocksize.h"
#include "calpontsystemcatalog.h" #include "calpontsystemcatalog.h"
#include "joblisttypes.h" #include "joblisttypes.h"
#include <columnwidth.h>
#include <vector> #include <vector>
@ -701,7 +702,7 @@ const uint8_t ROUND_POS = 0x01; // actual value larger/longer than the stored v
const uint8_t ROUND_NEG = 0x80; // actual value less than the stored value const uint8_t ROUND_NEG = 0x80; // actual value less than the stored value
// Tied to ColByScanRequestHeader and ColByScanRangeRequestHeader. Check other headers if modifying. // Tied to ColByScanRequestHeader and ColByScanRangeRequestHeader. Check other headers if modifying.
struct NewColRequestHeader struct /*alignas(utils::MAXCOLUMNWIDTH)*/ NewColRequestHeader
{ {
ISMPacketHeader ism; ISMPacketHeader ism;
PrimitiveHeader hdr; PrimitiveHeader hdr;

View File

@ -298,7 +298,6 @@ void TupleAnnexStep::join()
uint32_t TupleAnnexStep::nextBand(messageqcpp::ByteStream& bs) uint32_t TupleAnnexStep::nextBand(messageqcpp::ByteStream& bs)
{ {
RGData rgDataOut;
bool more = false; bool more = false;
uint32_t rowCount = 0; uint32_t rowCount = 0;
@ -306,18 +305,18 @@ uint32_t TupleAnnexStep::nextBand(messageqcpp::ByteStream& bs)
{ {
bs.restart(); bs.restart();
more = fOutputDL->next(fOutputIterator, &rgDataOut); more = fOutputDL->next(fOutputIterator, &fRgDataOut);
if (more && !cancelled()) if (more && !cancelled())
{ {
fRowGroupDeliver.setData(&rgDataOut); fRowGroupDeliver.setData(&fRgDataOut);
fRowGroupDeliver.serializeRGData(bs); fRowGroupDeliver.serializeRGData(bs);
rowCount = fRowGroupDeliver.getRowCount(); rowCount = fRowGroupDeliver.getRowCount();
} }
else else
{ {
while (more) while (more)
more = fOutputDL->next(fOutputIterator, &rgDataOut); more = fOutputDL->next(fOutputIterator, &fRgDataOut);
fEndOfResult = true; fEndOfResult = true;
} }
@ -327,7 +326,7 @@ uint32_t TupleAnnexStep::nextBand(messageqcpp::ByteStream& bs)
handleException(std::current_exception(), logging::ERR_IN_DELIVERY, logging::ERR_ALWAYS_CRITICAL, handleException(std::current_exception(), logging::ERR_IN_DELIVERY, logging::ERR_ALWAYS_CRITICAL,
"TupleAnnexStep::nextBand()"); "TupleAnnexStep::nextBand()");
while (more) while (more)
more = fOutputDL->next(fOutputIterator, &rgDataOut); more = fOutputDL->next(fOutputIterator, &fRgDataOut);
fEndOfResult = true; fEndOfResult = true;
} }
@ -335,8 +334,8 @@ uint32_t TupleAnnexStep::nextBand(messageqcpp::ByteStream& bs)
if (fEndOfResult) if (fEndOfResult)
{ {
// send an empty / error band // send an empty / error band
rgDataOut.reinit(fRowGroupDeliver, 0); fRgDataOut.reinit(fRowGroupDeliver, 0);
fRowGroupDeliver.setData(&rgDataOut); fRowGroupDeliver.setData(&fRgDataOut);
fRowGroupDeliver.resetRowGroup(0); fRowGroupDeliver.resetRowGroup(0);
fRowGroupDeliver.setStatus(status()); fRowGroupDeliver.setStatus(status());
fRowGroupDeliver.serializeRGData(bs); fRowGroupDeliver.serializeRGData(bs);

View File

@ -118,6 +118,7 @@ class TupleAnnexStep : public JobStep, public TupleDeliveryStep
rowgroup::RowGroup fRowGroupIn; rowgroup::RowGroup fRowGroupIn;
rowgroup::RowGroup fRowGroupOut; rowgroup::RowGroup fRowGroupOut;
rowgroup::RowGroup fRowGroupDeliver; rowgroup::RowGroup fRowGroupDeliver;
rowgroup::RGData fRgDataOut;
rowgroup::Row fRowIn; rowgroup::Row fRowIn;
rowgroup::Row fRowOut; rowgroup::Row fRowOut;

View File

@ -1054,7 +1054,7 @@ void WindowFunctionStep::doPostProcessForSelect()
for (int64_t i = begin; i < end; i++) for (int64_t i = begin; i < end; i++)
{ {
if (rgData.rowData.get() == NULL) if (!rgData.hasRowData())
{ {
rgCapacity = ((rowsLeft > 8192) ? 8192 : rowsLeft); rgCapacity = ((rowsLeft > 8192) ? 8192 : rowsLeft);
rowsLeft -= rgCapacity; rowsLeft -= rgCapacity;

View File

@ -1941,7 +1941,7 @@ int ha_mcs_cache::flush_insert_cache()
int error, error2; int error, error2;
ha_maria* from = cache_handler; ha_maria* from = cache_handler;
uchar* record = table->record[0]; uchar* record = table->record[0];
ulonglong copied_rows = 0; [[maybe_unused]] ulonglong copied_rows = 0;
DBUG_ENTER("flush_insert_cache"); DBUG_ENTER("flush_insert_cache");
DBUG_ASSERT(from->file->state->records == share->cached_rows); DBUG_ASSERT(from->file->state->records == share->cached_rows);

View File

@ -2963,7 +2963,7 @@ SimpleColumn* getSmallestColumn(boost::shared_ptr<CalpontSystemCatalog> csc,
CalpontSelectExecutionPlan::ReturnedColumnList::const_iterator iter; CalpontSelectExecutionPlan::ReturnedColumnList::const_iterator iter;
ReturnedColumn* rc; ReturnedColumn* rc = nullptr;
for (iter = cols.begin(); iter != cols.end(); iter++) for (iter = cols.begin(); iter != cols.end(); iter++)
{ {

View File

@ -569,7 +569,7 @@ extern "C"
void calshowpartitions_deinit(UDF_INIT* initid) void calshowpartitions_deinit(UDF_INIT* initid)
{ {
delete initid->ptr; delete[] initid->ptr;
} }
const char* calshowpartitions(UDF_INIT* initid, UDF_ARGS* args, char* result, unsigned long* length, const char* calshowpartitions(UDF_INIT* initid, UDF_ARGS* args, char* result, unsigned long* length,
@ -1164,7 +1164,7 @@ extern "C"
void calshowpartitionsbyvalue_deinit(UDF_INIT* initid) void calshowpartitionsbyvalue_deinit(UDF_INIT* initid)
{ {
delete initid->ptr; delete[] initid->ptr;
} }
const char* calshowpartitionsbyvalue(UDF_INIT* initid, UDF_ARGS* args, char* result, const char* calshowpartitionsbyvalue(UDF_INIT* initid, UDF_ARGS* args, char* result,

View File

@ -1,102 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,6,0,0
PRODUCTVERSION 4,6,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "InfiniDB, Inc."
VALUE "FileDescription", "InfiniDB DDL Processor"
VALUE "FileVersion", "4.6.0-0"
VALUE "InternalName", "DDLProc"
VALUE "LegalCopyright", "Copyright (C) 2014"
VALUE "OriginalFilename", "DDLProc.exe"
VALUE "ProductName", "InfiniDB"
VALUE "ProductVersion", "4.6.0.0 Beta"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -1,102 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,6,0,0
PRODUCTVERSION 4,6,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "InfiniDB, Inc."
VALUE "FileDescription", "InfiniDB DML Processor"
VALUE "FileVersion", "4.6.0-0"
VALUE "InternalName", "DMLProc"
VALUE "LegalCopyright", "Copyright (C) 2014"
VALUE "OriginalFilename", "DMLProc.exe"
VALUE "ProductName", "InfiniDB"
VALUE "ProductVersion", "4.6.0.0 Beta"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -8,6 +8,34 @@ if (WITH_COREDUMPS)
endif (WITH_COREDUMPS) endif (WITH_COREDUMPS)
SET(LD_PRELOAD_STRING "LD_PRELOAD=$(ldconfig -p | grep -m1 libjemalloc | awk '{print $1}')")
SET(ALLOC_CONFIG "MALLOC_CONF=''")
SET(PRIMPROC_ALLOC_CONFIG ${ALLOC_CONFIG})
SET(DMLPROC_ALLOC_CONFIG ${ALLOC_CONFIG})
SET(DDLPROC_ALLOC_CONFIG ${ALLOC_CONFIG})
SET(WRITEENGINE_ALLOC_CONFIG ${ALLOC_CONFIG})
SET(CONTROLLERNODE_ALLOC_CONFIG ${ALLOC_CONFIG})
SET(WORKERNODE_ALLOC_CONFIG ${ALLOC_CONFIG})
SET(STORAGEMANAGER_ALLOC_CONFIG ${ALLOC_CONFIG})
if (WITH_COLUMNSTORE_ASAN)
SET(ASAN_PATH "/tmp/asan")
if (WITH_COLUMNSTORE_REPORT_PATH)
SET(ASAN_PATH "${WITH_COLUMNSTORE_REPORT_PATH}/asan")
endif (WITH_COLUMNSTORE_REPORT_PATH)
SET(LD_PRELOAD_STRING "")
SET(ALLOC_CONFIG "ASAN_OPTIONS=abort_on_error=1:disable_coredump=0,print_stats=false,detect_odr_violation=0,check_initialization_order=1,detect_stack_use_after_return=1,atexit=false,log_path=${ASAN_PATH}")
SET(PRIMPROC_ALLOC_CONFIG ${ALLOC_CONFIG})
SET(DMLPROC_ALLOC_CONFIG ${ALLOC_CONFIG})
SET(DDLPROC_ALLOC_CONFIG ${ALLOC_CONFIG})
SET(WRITEENGINE_ALLOC_CONFIG ${ALLOC_CONFIG})
SET(CONTROLLERNODE_ALLOC_CONFIG ${ALLOC_CONFIG})
SET(WORKERNODE_ALLOC_CONFIG ${ALLOC_CONFIG})
SET(STORAGEMANAGER_ALLOC_CONFIG ${ALLOC_CONFIG})
endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/columnstoreSyslogSetup.sh.in" "${CMAKE_CURRENT_SOURCE_DIR}/columnstoreSyslogSetup.sh" @ONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/columnstoreSyslogSetup.sh.in" "${CMAKE_CURRENT_SOURCE_DIR}/columnstoreSyslogSetup.sh" @ONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/columnstore-post-install.in" "${CMAKE_CURRENT_SOURCE_DIR}/columnstore-post-install" @ONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/columnstore-post-install.in" "${CMAKE_CURRENT_SOURCE_DIR}/columnstore-post-install" @ONLY)

View File

@ -13,7 +13,7 @@ Group=@DEFAULT_GROUP@
LimitNOFILE=65536 LimitNOFILE=65536
LimitNPROC=65536 LimitNPROC=65536
LimitCORE=@CORE_DUMPS@ LimitCORE=@CORE_DUMPS@
Environment="@CONTROLLERNODE_ALLOC_CONFIG@"
ExecStart=@ENGINE_BINDIR@/controllernode ExecStart=@ENGINE_BINDIR@/controllernode
ExecStop=@ENGINE_BINDIR@/mcs-stop-controllernode.sh $MAINPID ExecStop=@ENGINE_BINDIR@/mcs-stop-controllernode.sh $MAINPID

View File

@ -14,6 +14,7 @@ LimitNOFILE=65536
LimitNPROC=65536 LimitNPROC=65536
LimitCORE=@CORE_DUMPS@ LimitCORE=@CORE_DUMPS@
Environment="@DDLPROC_ALLOC_CONFIG@"
ExecStart=@ENGINE_BINDIR@/DDLProc ExecStart=@ENGINE_BINDIR@/DDLProc
Restart=on-failure Restart=on-failure

View File

@ -14,6 +14,7 @@ LimitNOFILE=65536
LimitNPROC=65536 LimitNPROC=65536
LimitCORE=@CORE_DUMPS@ LimitCORE=@CORE_DUMPS@
Environment="@DMLPROC_ALLOC_CONFIG@"
ExecStart=@ENGINE_BINDIR@/DMLProc ExecStart=@ENGINE_BINDIR@/DMLProc
Restart=on-failure Restart=on-failure

View File

@ -16,7 +16,7 @@ LimitNPROC=65536
LimitCORE=@CORE_DUMPS@ LimitCORE=@CORE_DUMPS@
ExecStartPre=/usr/bin/env bash -c "ldconfig -p | grep -m1 libjemalloc > /dev/null || echo 'Please install jemalloc to avoid ColumnStore performance degradation and unexpected service interruptions.'" ExecStartPre=/usr/bin/env bash -c "ldconfig -p | grep -m1 libjemalloc > /dev/null || echo 'Please install jemalloc to avoid ColumnStore performance degradation and unexpected service interruptions.'"
ExecStart=/usr/bin/env bash -c "LD_PRELOAD=$(ldconfig -p | grep -m1 libjemalloc | awk '{print $1}') exec @ENGINE_BINDIR@/PrimProc" ExecStart=/usr/bin/env bash -c "@PRIMPROC_ALLOC_CONFIG@ @LD_PRELOAD_STRING@ exec @ENGINE_BINDIR@/PrimProc"
Restart=on-failure Restart=on-failure
TimeoutStopSec=2 TimeoutStopSec=2

View File

@ -10,5 +10,5 @@ LimitNOFILE=65536
LimitNPROC=65536 LimitNPROC=65536
LimitCORE=@CORE_DUMPS@ LimitCORE=@CORE_DUMPS@
ExecStart=/usr/bin/env bash -c "LD_PRELOAD=$(ldconfig -p | grep -m1 libjemalloc | awk '{print $1}') exec @ENGINE_BINDIR@/StorageManager" ExecStart=/usr/bin/env bash -c "@STORAGEMANAGER_ALLOC_CONFIG@ @LD_PRELOAD_STRING@ exec @ENGINE_BINDIR@/StorageManager"
SuccessExitStatus=255 SuccessExitStatus=255

View File

@ -11,6 +11,7 @@ LimitNOFILE=65536
LimitNPROC=65536 LimitNPROC=65536
LimitCORE=@CORE_DUMPS@ LimitCORE=@CORE_DUMPS@
Environment="@WORKERNODE_ALLOC_CONFIG@"
ExecStart=@ENGINE_BINDIR@/workernode DBRM_Worker%i ExecStart=@ENGINE_BINDIR@/workernode DBRM_Worker%i
ExecStopPost=@ENGINE_BINDIR@/mcs-savebrm.py ExecStopPost=@ENGINE_BINDIR@/mcs-savebrm.py
ExecStopPost=/usr/bin/env bash -c "clearShm > /dev/null 2>&1" ExecStopPost=/usr/bin/env bash -c "clearShm > /dev/null 2>&1"

View File

@ -14,7 +14,7 @@ LimitNOFILE=65536
LimitNPROC=65536 LimitNPROC=65536
LimitCORE=@CORE_DUMPS@ LimitCORE=@CORE_DUMPS@
ExecStart=/usr/bin/env bash -c "LD_PRELOAD=$(ldconfig -p | grep -m1 libjemalloc | awk '{print $1}') exec @ENGINE_BINDIR@/WriteEngineServer" ExecStart=/usr/bin/env bash -c "@WRITEENGINE_ALLOC_CONFIG@ @LD_PRELOAD_STRING@ exec @ENGINE_BINDIR@/WriteEngineServer"
Restart=on-failure Restart=on-failure
TimeoutStopSec=20 TimeoutStopSec=20

View File

@ -1,102 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,6,0,0
PRODUCTVERSION 4,6,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "InfiniDB, Inc."
VALUE "FileDescription", "InfiniDB OAM API"
VALUE "FileVersion", "4.6.0-0"
VALUE "InternalName", "liboamcpp"
VALUE "LegalCopyright", "Copyright (C) 2014"
VALUE "OriginalFilename", "liboamcpp.dll"
VALUE "ProductName", "InfiniDB"
VALUE "ProductVersion", "4.6.0.0 Beta"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -1,102 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,6,0,0
PRODUCTVERSION 4,6,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "InfiniDB, Inc."
VALUE "FileDescription", "InfiniDB Primitive Processor"
VALUE "FileVersion", "4.6.0-0"
VALUE "InternalName", "PrimProc"
VALUE "LegalCopyright", "Copyright (C) 2014"
VALUE "OriginalFilename", "PrimProc.exe"
VALUE "ProductName", "InfiniDB"
VALUE "ProductVersion", "4.6.0.0 Beta"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -931,7 +931,7 @@ void BatchPrimitiveProcessor::initProcessor()
strValues.reset(new string[LOGICAL_BLOCK_RIDS]); strValues.reset(new string[LOGICAL_BLOCK_RIDS]);
outMsgSize = defaultBufferSize; outMsgSize = defaultBufferSize;
outputMsg.reset(reinterpret_cast<uint8_t*>(aligned_alloc(utils::MAXCOLUMNWIDTH, outMsgSize))); outputMsg.reset(new(std::align_val_t(MAXCOLUMNWIDTH)) uint8_t[outMsgSize]);
if (ot == ROW_GROUP) if (ot == ROW_GROUP)
{ {

View File

@ -232,7 +232,7 @@ class BatchPrimitiveProcessor
/* Common space for primitive data */ /* Common space for primitive data */
alignas(utils::MAXCOLUMNWIDTH) uint8_t blockData[BLOCK_SIZE * utils::MAXCOLUMNWIDTH]; alignas(utils::MAXCOLUMNWIDTH) uint8_t blockData[BLOCK_SIZE * utils::MAXCOLUMNWIDTH];
uint8_t blockDataAux[BLOCK_SIZE * execplan::AUX_COL_WIDTH]; uint8_t blockDataAux[BLOCK_SIZE * execplan::AUX_COL_WIDTH];
boost::scoped_array<uint8_t> outputMsg; std::unique_ptr<uint8_t[], utils::AlignedDeleter> outputMsg;
uint32_t outMsgSize; uint32_t outMsgSize;
std::vector<SCommand> filterSteps; std::vector<SCommand> filterSteps;

View File

@ -631,7 +631,8 @@ void ColumnCommand::fillInPrimitiveMessageHeader(const int8_t outputType, const
size_t inputMsgBufSize = baseMsgLength + (LOGICAL_BLOCK_RIDS * sizeof(primitives::RIDType)); size_t inputMsgBufSize = baseMsgLength + (LOGICAL_BLOCK_RIDS * sizeof(primitives::RIDType));
if (!inputMsg) if (!inputMsg)
inputMsg.reset(reinterpret_cast<uint8_t*>(aligned_alloc(utils::MAXCOLUMNWIDTH, inputMsgBufSize))); inputMsg.reset(new(std::align_val_t(utils::MAXCOLUMNWIDTH)) uint8_t[inputMsgBufSize]);
primMsg = (NewColRequestHeader*)inputMsg.get(); primMsg = (NewColRequestHeader*)inputMsg.get();
outMsg = (ColResultHeader*)bpp->outputMsg.get(); outMsg = (ColResultHeader*)bpp->outputMsg.get();

View File

@ -30,6 +30,8 @@
#pragma once #pragma once
#include <memory>
#include "columnwidth.h"
#include "command.h" #include "command.h"
#include "calpontsystemcatalog.h" #include "calpontsystemcatalog.h"
@ -164,7 +166,7 @@ class ColumnCommand : public Command
bool _isScan; bool _isScan;
boost::scoped_array<uint8_t> inputMsg; std::unique_ptr<uint8_t[], utils::AlignedDeleter> inputMsg;
NewColRequestHeader* primMsg; NewColRequestHeader* primMsg;
ColResultHeader* outMsg; ColResultHeader* outMsg;

View File

@ -370,9 +370,9 @@ namespace exemgr
// shared by multiple threads per session. // shared by multiple threads per session.
ThreadCntPerSessionMap_t threadCntPerSessionMap_; ThreadCntPerSessionMap_t threadCntPerSessionMap_;
std::mutex threadCntPerSessionMapMutex_; std::mutex threadCntPerSessionMapMutex_;
ActiveStatementCounter* statementsRunningCount_; ActiveStatementCounter* statementsRunningCount_ = nullptr;
joblist::DistributedEngineComm* dec_; joblist::DistributedEngineComm* dec_ = nullptr;
joblist::ResourceManager* rm_; joblist::ResourceManager* rm_ = nullptr;
// Its attributes are set in Child() // Its attributes are set in Child()
querytele::QueryTeleServerParms teleServerParms_; querytele::QueryTeleServerParms teleServerParms_;
std::vector<struct in_addr> localNetIfaceSins_; std::vector<struct in_addr> localNetIfaceSins_;

View File

@ -248,7 +248,7 @@ void SQLFrontSessionThread::analyzeTableExecute(messageqcpp::ByteStream& bs, job
auto rowCount = jl->projectTable(dummyTableOid, bs); auto rowCount = jl->projectTable(dummyTableOid, bs);
while (rowCount) while (rowCount)
{ {
auto outRG = (static_cast<joblist::TupleJobList*>(jl.get()))->getOutputRowGroup(); auto const& outRG = (static_cast<joblist::TupleJobList*>(jl.get()))->getOutputRowGroup();
statisticsManager->collectSample(outRG); statisticsManager->collectSample(outRG);
rowCount = jl->projectTable(dummyTableOid, bs); rowCount = jl->projectTable(dummyTableOid, bs);
} }
@ -894,7 +894,7 @@ void SQLFrontSessionThread::operator()()
std::unique_lock<std::mutex> scoped(jlMutex); std::unique_lock<std::mutex> scoped(jlMutex);
destructing++; destructing++;
std::thread bgdtor( std::thread bgdtor(
[jl, &jlMutex, &jlCleanupDone, stmtID, &li, &destructing, &msgLog] [jl, &jlMutex, &jlCleanupDone, stmtID, li, &destructing, &msgLog]
{ {
std::unique_lock<std::mutex> scoped(jlMutex); std::unique_lock<std::mutex> scoped(jlMutex);
const_cast<joblist::SJLP&>(jl).reset(); // this happens second; does real destruction const_cast<joblist::SJLP&>(jl).reset(); // this happens second; does real destruction

View File

@ -17,7 +17,17 @@
#pragma once #pragma once
#ifndef __clang__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
#include <boost/property_tree/ptree.hpp> #include <boost/property_tree/ptree.hpp>
#ifndef __clang__
#pragma GCC diagnostic pop
#endif
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include <sys/types.h> #include <sys/types.h>
#include <functional> #include <functional>

View File

@ -22,7 +22,16 @@
#include <set> #include <set>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#define BOOST_SPIRIT_THREADSAFE #define BOOST_SPIRIT_THREADSAFE
#ifndef __clang__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
#include <boost/property_tree/ptree.hpp> #include <boost/property_tree/ptree.hpp>
#ifndef __clang__
#pragma GCC diagnostic pop
#endif
#include <boost/property_tree/json_parser.hpp> #include <boost/property_tree/json_parser.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/uuid/uuid.hpp> #include <boost/uuid/uuid.hpp>

View File

@ -27,7 +27,16 @@
#include <boost/uuid/uuid_io.hpp> #include <boost/uuid/uuid_io.hpp>
#include <boost/uuid/random_generator.hpp> #include <boost/uuid/random_generator.hpp>
#define BOOST_SPIRIT_THREADSAFE #define BOOST_SPIRIT_THREADSAFE
#ifndef __clang__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
#include <boost/property_tree/ptree.hpp> #include <boost/property_tree/ptree.hpp>
#ifndef __clang__
#pragma GCC diagnostic pop
#endif
#include <boost/property_tree/json_parser.hpp> #include <boost/property_tree/json_parser.hpp>
#include "Utilities.h" #include "Utilities.h"

View File

@ -3,14 +3,14 @@ mysql -e "create database if not exists test;"
SOCKET=`mysql -e "show variables like 'socket';" | grep socket | cut -f2` SOCKET=`mysql -e "show variables like 'socket';" | grep socket | cut -f2`
cd /usr/share/mysql/mysql-test cd /usr/share/mysql/mysql-test
./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/setup
./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/basic | tee $CURRENT_DIR/mtr.basic.log 2>&1 ./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/basic | tee $CURRENT_DIR/mtr.basic.log 2>&1
./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/setup | tee $CURRENT_DIR/mtr.setup.log 2>&1
./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/bugfixes | tee $CURRENT_DIR/mtr.bugfixes.log 2>&1 ./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/bugfixes | tee $CURRENT_DIR/mtr.bugfixes.log 2>&1
./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/devregression | tee $CURRENT_DIR/mtr.devregression.log 2>&1 ./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/devregression | tee $CURRENT_DIR/mtr.devregression.log 2>&1
./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/autopilot | tee $CURRENT_DIR/mtr.autopilot.log 2>&1 ./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/autopilot | tee $CURRENT_DIR/mtr.autopilot.log 2>&1
./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/extended | tee $CURRENT_DIR/mtr.extended.log 2>&1 ./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/extended | tee $CURRENT_DIR/mtr.extended.log 2>&1
./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/multinode | tee $CURRENT_DIR/mtr.multinode.log 2>&1 ./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/multinode | tee $CURRENT_DIR/mtr.multinode.log 2>&1
./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/oracle | tee $CURRENT_DIR/mtr.multinode.log 2>&1 ./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/oracle | tee $CURRENT_DIR/mtr.oracle.log 2>&1
./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/1pmonly | tee $CURRENT_DIR/mtr.1pmonly.log 2>&1 ./mtr --force --max-test-fail=0 --testcase-timeout=60 --extern socket=$SOCKET --suite=columnstore/1pmonly | tee $CURRENT_DIR/mtr.1pmonly.log 2>&1
cd - cd -

5
tests/scripts/smoke.sql Normal file
View File

@ -0,0 +1,5 @@
DROP TABLE IF EXISTS smoke_table;
CREATE TABLE smoke_table(a int) ENGINE COLUMNSTORE;
INSERT INTO smoke_table VALUES(42);
SELECT * FROM smoke_table;
DROP TABLE smoke_table;

View File

@ -1,102 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,6,0,0
PRODUCTVERSION 4,6,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "InfiniDB, Inc."
VALUE "FileDescription", "InfiniDB Bulk Load Utility"
VALUE "FileVersion", "4.6.0-0"
VALUE "InternalName", "colxml"
VALUE "LegalCopyright", "Copyright (C) 2014"
VALUE "OriginalFilename", "colxml.exe"
VALUE "ProductName", "InfiniDB"
VALUE "ProductVersion", "4.6.0.0 Beta"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -21,8 +21,16 @@
namespace utils namespace utils
{ {
const uint8_t MAXLEGACYWIDTH = 8ULL; constexpr uint8_t MAXLEGACYWIDTH = 8ULL;
const uint8_t MAXCOLUMNWIDTH = 16ULL; constexpr uint8_t MAXCOLUMNWIDTH = 16ULL;
struct AlignedDeleter
{
void operator()(uint8_t* ptr)
{
operator delete[](ptr, std::align_val_t(utils::MAXCOLUMNWIDTH));
};
};
inline bool isWide(uint8_t width) inline bool isWide(uint8_t width)
{ {

View File

@ -69,15 +69,17 @@ const fs::path defaultConfigFilePath(configDefaultFileName);
namespace config namespace config
{ {
Config* globConfigInstancePtr = nullptr;
Config::configMap_t Config::fInstanceMap;
boost::mutex Config::fInstanceMapMutex; boost::mutex Config::fInstanceMapMutex;
Config::configMap_t Config::fInstanceMap;
// duplicate to that in the Config class // duplicate to that in the Config class
boost::mutex Config::fXmlLock; boost::mutex Config::fXmlLock;
// duplicate to that in the Config class // duplicate to that in the Config class
boost::mutex Config::fWriteXmlLock; boost::mutex Config::fWriteXmlLock;
std::atomic_bool globHasConfig; std::atomic_bool globHasConfig;
ConfigUniqPtr globConfigInstancePtr;
void Config::checkAndReloadConfig() void Config::checkAndReloadConfig()
{ {
struct stat statbuf; struct stat statbuf;
@ -105,20 +107,20 @@ Config* Config::makeConfig(const string& cf)
if (globConfigInstancePtr) if (globConfigInstancePtr)
{ {
globConfigInstancePtr->checkAndReloadConfig(); globConfigInstancePtr->checkAndReloadConfig();
return globConfigInstancePtr; return globConfigInstancePtr.get();
} }
// Make this configurable at least at compile-time. // Make this configurable at least at compile-time.
std::string configFilePath = std::string configFilePath =
std::string(MCSSYSCONFDIR) + std::string("/columnstore/") + configDefaultFileName; std::string(MCSSYSCONFDIR) + std::string("/columnstore/") + configDefaultFileName;
globConfigInstancePtr = new Config(configFilePath); globConfigInstancePtr.reset(new Config(configFilePath));
globHasConfig.store(true, std::memory_order_relaxed); globHasConfig.store(true, std::memory_order_relaxed);
return globConfigInstancePtr; return globConfigInstancePtr.get();
} }
boost::mutex::scoped_lock lk(fInstanceMapMutex); boost::mutex::scoped_lock lk(fInstanceMapMutex);
globConfigInstancePtr->checkAndReloadConfig(); globConfigInstancePtr->checkAndReloadConfig();
return globConfigInstancePtr; return globConfigInstancePtr.get();
} }
boost::mutex::scoped_lock lk(fInstanceMapMutex); boost::mutex::scoped_lock lk(fInstanceMapMutex);
@ -526,21 +528,6 @@ void Config::writeConfigFile(messageqcpp::ByteStream msg) const
/* static */ /* static */
void Config::deleteInstanceMap() void Config::deleteInstanceMap()
{ {
boost::mutex::scoped_lock lk(fInstanceMapMutex);
for (Config::configMap_t::iterator iter = fInstanceMap.begin(); iter != fInstanceMap.end(); ++iter)
{
Config* instance = iter->second;
delete instance;
}
fInstanceMap.clear();
if (globConfigInstancePtr)
{
delete globConfigInstancePtr;
globConfigInstancePtr = nullptr;
}
} }
/* static */ /* static */
@ -643,4 +630,18 @@ std::string Config::getTempFileDir(Config::TempDirPurpose what)
return {}; return {};
} }
void Config::ConfigDeleter::operator()(Config* config)
{
boost::mutex::scoped_lock lk(fInstanceMapMutex);
for (Config::configMap_t::iterator iter = fInstanceMap.begin(); iter != fInstanceMap.end(); ++iter)
{
Config* instance = iter->second;
delete instance;
}
fInstanceMap.clear();
delete config;
}
} // namespace config } // namespace config

View File

@ -56,6 +56,11 @@ namespace config
class Config class Config
{ {
public: public:
struct ConfigDeleter
{
void operator()(Config* config);
};
/** @brief Config factory method /** @brief Config factory method
* *
* Creates a singleton Config object * Creates a singleton Config object
@ -249,8 +254,14 @@ class Config
* *
*/ */
void checkAndReloadConfig(); void checkAndReloadConfig();
}; };
using ConfigUniqPtr = std::unique_ptr<Config, Config::ConfigDeleter>;
} // namespace config } // namespace config
#undef EXPORT #undef EXPORT

View File

@ -1,102 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,6,0,0
PRODUCTVERSION 4,6,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "InfiniDB, Inc."
VALUE "FileDescription", "InfiniDB Config API"
VALUE "FileVersion", "4.6.0-0"
VALUE "InternalName", "libconfigcpp"
VALUE "LegalCopyright", "Copyright (C) 2014"
VALUE "OriginalFilename", "libconfigcpp.dll"
VALUE "ProductName", "InfiniDB"
VALUE "ProductVersion", "4.6.0.0 Beta"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -150,6 +150,7 @@ void XMLParser::setConfig(xmlDocPtr doc, const string& section, const string& na
{ {
xmlAddChild(cur2, xmlNewText((const xmlChar*)"\t")); xmlAddChild(cur2, xmlNewText((const xmlChar*)"\t"));
cur3 = cur2->xmlChildrenNode; cur3 = cur2->xmlChildrenNode;
xmlFree(cur3->content);
} }
else else
{ {

View File

@ -48,26 +48,6 @@ using namespace logging;
namespace namespace
{ {
const int64_t columnstore_precision[19] = {0,
9,
99,
999,
9999,
99999,
999999,
9999999,
99999999,
999999999,
9999999999LL,
99999999999LL,
999999999999LL,
9999999999999LL,
99999999999999LL,
999999999999999LL,
9999999999999999LL,
99999999999999999LL,
999999999999999999LL};
template <class T> template <class T>
bool from_string(T& t, const std::string& s, std::ios_base& (*f)(std::ios_base&)) bool from_string(T& t, const std::string& s, std::ios_base& (*f)(std::ios_base&))
{ {
@ -474,14 +454,6 @@ void number_int_value(const string& data, cscDataType typeCode,
// @ bug 3285 make sure the value is in precision range for decimal data type // @ bug 3285 make sure the value is in precision range for decimal data type
if ((typeCode == datatypes::SystemCatalog::DECIMAL) || (typeCode == datatypes::SystemCatalog::UDECIMAL) || if ((typeCode == datatypes::SystemCatalog::DECIMAL) || (typeCode == datatypes::SystemCatalog::UDECIMAL) ||
(ct.scale > 0)) (ct.scale > 0))
{
T rangeUp, rangeLow;
if (ct.precision < 19)
{
rangeUp = (T)columnstore_precision[ct.precision];
}
else
{ {
auto precision = auto precision =
ct.precision == rowgroup::MagicPrecisionForCountAgg ? datatypes::INT128MAXPRECISION : ct.precision; ct.precision == rowgroup::MagicPrecisionForCountAgg ? datatypes::INT128MAXPRECISION : ct.precision;
@ -490,10 +462,9 @@ void number_int_value(const string& data, cscDataType typeCode,
throw QueryDataExcept("Unsupported precision " + std::to_string(precision) + " converting DECIMAL ", throw QueryDataExcept("Unsupported precision " + std::to_string(precision) + " converting DECIMAL ",
dataTypeErr); dataTypeErr);
} }
rangeUp = datatypes::ConversionRangeMaxValue[ct.precision - 19];
}
rangeLow = -rangeUp; T rangeUp = dataconvert::decimalRangeUp<T>(precision);
T rangeLow = -rangeUp;
if (intVal > rangeUp) if (intVal > rangeUp)
{ {
@ -2802,7 +2773,8 @@ int64_t DataConvert::stringToTime(const string& data)
{ {
if (!hasDate) if (!hasDate)
{ {
day = strtol(data.substr(0, pos).c_str(), &end, 10); std::string tmpDataSegment = data.substr(0, pos);
day = strtol(tmpDataSegment.c_str(), &end, 10);
if (*end != '\0') if (*end != '\0')
return -1; return -1;

View File

@ -102,6 +102,7 @@ const int64_t IDB_pow[19] = {1,
100000000000000000LL, 100000000000000000LL,
1000000000000000000LL}; 1000000000000000000LL};
const int32_t SECS_PER_MIN = 60; const int32_t SECS_PER_MIN = 60;
const int32_t MINS_PER_HOUR = 60; const int32_t MINS_PER_HOUR = 60;
const int32_t HOURS_PER_DAY = 24; const int32_t HOURS_PER_DAY = 24;
@ -1545,6 +1546,20 @@ inline int128_t strtoll128(const char* data, bool& saturate, char** ep)
return res; return res;
} }
template <class T>
T decimalRangeUp(int32_t precision)
{
if (precision < 19)
{
return (T)datatypes::columnstore_precision[precision];
}
else
{
return datatypes::ConversionRangeMaxValue[precision - 19];
}
}
template <> template <>
inline int128_t string_to_ll<int128_t>(const std::string& data, bool& bSaturate) inline int128_t string_to_ll<int128_t>(const std::string& data, bool& bSaturate)
{ {

View File

@ -1072,7 +1072,6 @@ IDB_Decimal Func_cast_decimal::getDecimalVal(Row& row, FunctionParm& parm, bool&
if (decimal.isTSInt128ByPrecision()) if (decimal.isTSInt128ByPrecision())
{ {
int128_t max_number_decimal = datatypes::ConversionRangeMaxValue[max_length - 19]; int128_t max_number_decimal = datatypes::ConversionRangeMaxValue[max_length - 19];
uint128_t uval = parm[0]->data()->getUintVal(row, isNull); uint128_t uval = parm[0]->data()->getUintVal(row, isNull);
if (uval > (uint128_t)datatypes::Decimal::maxInt128) if (uval > (uint128_t)datatypes::Decimal::maxInt128)

View File

@ -591,6 +591,12 @@ uint64_t dateAdd(uint64_t time, const string& expr, IntervalColumn::interval_typ
if (-day < month_length[monthSave]) if (-day < month_length[monthSave])
{ {
if (monthSave == 0)
{
monthSave = 12;
tmpYear--;
}
month--; month--;
monthSave--; monthSave--;
@ -613,6 +619,12 @@ uint64_t dateAdd(uint64_t time, const string& expr, IntervalColumn::interval_typ
// BUG 5448 - changed from '==' to '<=' // BUG 5448 - changed from '==' to '<='
if (day <= 0) if (day <= 0)
{ {
if (monthSave == 0)
{
monthSave = 12;
tmpYear--;
}
month--; month--;
monthSave--; monthSave--;
@ -635,6 +647,17 @@ uint64_t dateAdd(uint64_t time, const string& expr, IntervalColumn::interval_typ
break; break;
} }
if (monthSave == 0)
{
monthSave = 12;
tmpYear--;
if (isLeapYear(tmpYear))
month_length[2] = 29;
else
month_length[2] = 28;
}
month--; month--;
monthSave--; monthSave--;

View File

@ -37,7 +37,7 @@ std::string Func_json_unquote::getStrVal(rowgroup::Row& row, FunctionParm& fp, b
if (unlikely(jsEg.s.error) || jsEg.value_type != JSON_VALUE_STRING) if (unlikely(jsEg.s.error) || jsEg.value_type != JSON_VALUE_STRING)
return js.data(); return js.data();
char* buf = (char*)alloca(jsEg.value_len); char* buf = (char*)alloca(jsEg.value_len + 1);
if ((strLen = json_unescape(cs, jsEg.value, jsEg.value + jsEg.value_len, &my_charset_utf8mb3_general_ci, if ((strLen = json_unescape(cs, jsEg.value, jsEg.value + jsEg.value_len, &my_charset_utf8mb3_general_ci,
(uchar*)buf, (uchar*)(buf + jsEg.value_len))) >= 0) (uchar*)buf, (uchar*)(buf + jsEg.value_len))) >= 0)
{ {

View File

@ -47,15 +47,10 @@ bool IDBFactory::installDefaultPlugins()
// protect these methods since we are changing our static data structure // protect these methods since we are changing our static data structure
boost::mutex::scoped_lock lock(fac_guard); boost::mutex::scoped_lock lock(fac_guard);
s_plugins[IDBDataFile::BUFFERED] = s_plugins.emplace(IDBDataFile::BUFFERED, FileFactoryEnt(IDBDataFile::BUFFERED, "buffered", new BufferedFileFactory(),
FileFactoryEnt(IDBDataFile::BUFFERED, "buffered", new BufferedFileFactory(), new PosixFileSystem()); new PosixFileSystem()));
s_plugins[IDBDataFile::UNBUFFERED] = FileFactoryEnt(IDBDataFile::UNBUFFERED, "unbuffered", s_plugins.emplace(IDBDataFile::UNBUFFERED, FileFactoryEnt(IDBDataFile::UNBUFFERED, "unbuffered",
new UnbufferedFileFactory(), new PosixFileSystem()); new UnbufferedFileFactory(), new PosixFileSystem()));
// TODO: use the installPlugin fcn below instead of declaring this statically, then remove the dependency
// IDBDatafile -> cloudio
// s_plugins[IDBDataFile::CLOUD] = FileFactoryEnt(IDBDataFile::CLOUD, "cloud", new SMFileFactory(), new
// SMFileSystem());
return false; return false;
} }
@ -86,7 +81,7 @@ bool IDBFactory::installPlugin(const std::string& plugin)
} }
FileFactoryEnt ent = (*(FileFactoryEntryFunc)functor)(); FileFactoryEnt ent = (*(FileFactoryEntryFunc)functor)();
s_plugins[ent.type] = ent; s_plugins.emplace(ent.type, std::move(ent));
std::ostringstream oss; std::ostringstream oss;
oss << "IDBFactory::installPlugin: installed filesystem plugin " << plugin; oss << "IDBFactory::installPlugin: installed filesystem plugin " << plugin;
@ -112,7 +107,7 @@ IDBDataFile* IDBFactory::open(IDBDataFile::Types type, const char* fname, const
throw std::runtime_error(oss.str()); throw std::runtime_error(oss.str());
} }
return s_plugins[type].factory->open(fname, mode, opts, colWidth); return s_plugins.at(type).factory->open(fname, mode, opts, colWidth);
} }
IDBFileSystem& IDBFactory::getFs(IDBDataFile::Types type) IDBFileSystem& IDBFactory::getFs(IDBDataFile::Types type)
@ -124,7 +119,14 @@ IDBFileSystem& IDBFactory::getFs(IDBDataFile::Types type)
throw std::runtime_error(oss.str()); throw std::runtime_error(oss.str());
} }
return *(s_plugins[type].filesystem); return *(s_plugins.at(type).filesystem);
} }
FileFactoryEnt::~FileFactoryEnt()
{
delete filesystem;
delete factory;
}
} // namespace idbdatafile } // namespace idbdatafile

View File

@ -31,21 +31,31 @@ class IDBFileSystem;
struct FileFactoryEnt struct FileFactoryEnt
{ {
FileFactoryEnt() : type(IDBDataFile::UNKNOWN), name("unknown"), factory(0), filesystem(0)
{
;
}
FileFactoryEnt(IDBDataFile::Types t, const std::string& n, FileFactoryBase* f, IDBFileSystem* fs) FileFactoryEnt(IDBDataFile::Types t, const std::string& n, FileFactoryBase* f, IDBFileSystem* fs)
: type(t), name(n), factory(f), filesystem(fs) : type(t), name(n), factory(f), filesystem(fs)
{ {
; ;
} }
IDBDataFile::Types type; FileFactoryEnt(const FileFactoryEnt&) = delete;
std::string name; FileFactoryEnt& operator=(const FileFactoryEnt&) = delete;
FileFactoryBase* factory; FileFactoryEnt& operator=(FileFactoryEnt&&) = delete;
IDBFileSystem* filesystem; FileFactoryEnt(FileFactoryEnt&& temporary)
: factory(temporary.factory)
, filesystem(temporary.filesystem)
{
temporary.factory = nullptr;
temporary.filesystem = nullptr;
}
~FileFactoryEnt();
IDBDataFile::Types type = IDBDataFile::UNKNOWN;
std::string name = "unknown";
FileFactoryBase* factory = nullptr;
IDBFileSystem* filesystem = nullptr;
}; };
typedef FileFactoryEnt (*FileFactoryEntryFunc)(); typedef FileFactoryEnt (*FileFactoryEntryFunc)();
@ -101,8 +111,8 @@ class IDBFactory
static FactoryMap s_plugins; static FactoryMap s_plugins;
IDBFactory(); IDBFactory() = delete;
virtual ~IDBFactory(); ~IDBFactory() = delete;
}; };
inline const std::string& IDBFactory::name(IDBDataFile::Types type) inline const std::string& IDBFactory::name(IDBDataFile::Types type)
@ -112,7 +122,7 @@ inline const std::string& IDBFactory::name(IDBDataFile::Types type)
throw std::runtime_error("unknown plugin type in IDBFactory::name"); throw std::runtime_error("unknown plugin type in IDBFactory::name");
} }
return s_plugins[type].name; return s_plugins.at(type).name;
} }
} // namespace idbdatafile } // namespace idbdatafile

View File

@ -15,18 +15,25 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */ MA 02110-1301, USA. */
#include <memory>
#include <sstream> #include <sstream>
#include <map> #include <map>
#include <boost/thread/mutex.hpp>
#include <time.h> #include <time.h>
#include <mutex>
#include "messagequeuepool.h" #include "messagequeuepool.h"
#include "messagequeue.h" #include "messagequeue.h"
namespace messageqcpp namespace messageqcpp
{ {
boost::mutex queueMutex;
std::mutex& getQueueMutex()
{
static std::mutex queueMutex;
return queueMutex;
}
// Make linker happy // Make linker happy
std::multimap<std::string, ClientObject*> MessageQueueClientPool::clientMap; MessageQueueClientPool::ClientMapType MessageQueueClientPool::clientMap;
// 300 seconds idle until cleanup // 300 seconds idle until cleanup
#define MAX_IDLE_TIME 300 #define MAX_IDLE_TIME 300
@ -38,7 +45,7 @@ static uint64_t TimeSpecToSeconds(struct timespec* ts)
MessageQueueClient* MessageQueueClientPool::getInstance(const std::string& dnOrIp, uint64_t port) MessageQueueClient* MessageQueueClientPool::getInstance(const std::string& dnOrIp, uint64_t port)
{ {
boost::mutex::scoped_lock lock(queueMutex); std::scoped_lock lock(getQueueMutex());
std::ostringstream oss; std::ostringstream oss;
oss << dnOrIp << "_" << port; oss << dnOrIp << "_" << port;
@ -58,16 +65,16 @@ MessageQueueClient* MessageQueueClientPool::getInstance(const std::string& dnOrI
clock_gettime(CLOCK_MONOTONIC, &now); clock_gettime(CLOCK_MONOTONIC, &now);
uint64_t nowSeconds = TimeSpecToSeconds(&now); uint64_t nowSeconds = TimeSpecToSeconds(&now);
newClientObject->client = new MessageQueueClient(dnOrIp, port); newClientObject->client.reset(new MessageQueueClient(dnOrIp, port));
newClientObject->inUse = true; newClientObject->inUse = true;
newClientObject->lastUsed = nowSeconds; newClientObject->lastUsed = nowSeconds;
clientMap.insert(std::pair<std::string, ClientObject*>(searchString, newClientObject)); clientMap.emplace(std::move(searchString), std::move(newClientObject));
return newClientObject->client; return newClientObject->client.get();
} }
MessageQueueClient* MessageQueueClientPool::getInstance(const std::string& module) MessageQueueClient* MessageQueueClientPool::getInstance(const std::string& module)
{ {
boost::mutex::scoped_lock lock(queueMutex); std::scoped_lock lock(getQueueMutex());
MessageQueueClient* returnClient = MessageQueueClientPool::findInPool(module); MessageQueueClient* returnClient = MessageQueueClientPool::findInPool(module);
@ -78,16 +85,19 @@ MessageQueueClient* MessageQueueClientPool::getInstance(const std::string& modul
} }
// We didn't find one, create new one // We didn't find one, create new one
ClientObject* newClientObject = new ClientObject(); auto newClientObject = std::make_unique<ClientObject>();
struct timespec now; struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now); clock_gettime(CLOCK_MONOTONIC, &now);
uint64_t nowSeconds = TimeSpecToSeconds(&now); uint64_t nowSeconds = TimeSpecToSeconds(&now);
newClientObject->client = new MessageQueueClient(module);
newClientObject->client.reset(new MessageQueueClient(module));
newClientObject->inUse = true; newClientObject->inUse = true;
newClientObject->lastUsed = nowSeconds; newClientObject->lastUsed = nowSeconds;
clientMap.insert(std::pair<std::string, ClientObject*>(module, newClientObject)); auto result = newClientObject->client.get();
return newClientObject->client; clientMap.emplace(std::move(module), std::move(newClientObject));
return result;
} }
MessageQueueClient* MessageQueueClientPool::findInPool(const std::string& search) MessageQueueClient* MessageQueueClientPool::findInPool(const std::string& search)
@ -97,22 +107,21 @@ MessageQueueClient* MessageQueueClientPool::findInPool(const std::string& search
uint64_t nowSeconds = TimeSpecToSeconds(&now); uint64_t nowSeconds = TimeSpecToSeconds(&now);
MessageQueueClient* returnClient = NULL; MessageQueueClient* returnClient = NULL;
std::multimap<std::string, ClientObject*>::iterator it = clientMap.begin(); auto it = clientMap.begin();
// Scan pool // Scan pool
while (it != clientMap.end()) while (it != clientMap.end())
{ {
ClientObject* clientObject = it->second; ClientObject* clientObject = it->second.get();
uint64_t elapsedTime = nowSeconds - clientObject->lastUsed; uint64_t elapsedTime = nowSeconds - clientObject->lastUsed;
// If connection hasn't been used for MAX_IDLE_TIME we probably don't need it so drop it // If connection hasn't been used for MAX_IDLE_TIME we probably don't need it so drop it
// Don't drop in use connections that have been in use a long time // Don't drop in use connections that have been in use a long time
if ((elapsedTime >= MAX_IDLE_TIME) && (!clientObject->inUse)) if ((elapsedTime >= MAX_IDLE_TIME) && (!clientObject->inUse))
{ {
delete clientObject->client;
delete clientObject;
// Do this so we don't invalidate current interator // Do this so we don't invalidate current interator
std::multimap<std::string, ClientObject*>::iterator toDelete = it; auto toDelete = it;
it++; it++;
clientMap.erase(toDelete); clientMap.erase(toDelete);
continue; continue;
@ -120,15 +129,13 @@ MessageQueueClient* MessageQueueClientPool::findInPool(const std::string& search
if (!clientObject->inUse) if (!clientObject->inUse)
{ {
MessageQueueClient* client = clientObject->client; MessageQueueClient* client = clientObject->client.get();
// If the unused socket isn't connected or has data pending read, destroy it // If the unused socket isn't connected or has data pending read, destroy it
if (!client->isConnected() || client->hasData()) if (!client->isConnected() || client->hasData())
{ {
delete client;
delete clientObject;
// Do this so we don't invalidate current interator // Do this so we don't invalidate current interator
std::multimap<std::string, ClientObject*>::iterator toDelete = it; auto toDelete = it;
it++; it++;
clientMap.erase(toDelete); clientMap.erase(toDelete);
continue; continue;
@ -140,7 +147,7 @@ MessageQueueClient* MessageQueueClientPool::findInPool(const std::string& search
{ {
if ((returnClient == NULL) && (!clientObject->inUse)) if ((returnClient == NULL) && (!clientObject->inUse))
{ {
returnClient = clientObject->client; returnClient = clientObject->client.get();
clientObject->inUse = true; clientObject->inUse = true;
return returnClient; return returnClient;
} }
@ -160,12 +167,13 @@ void MessageQueueClientPool::releaseInstance(MessageQueueClient* client)
if (client == NULL) if (client == NULL)
return; return;
boost::mutex::scoped_lock lock(queueMutex);
std::multimap<std::string, ClientObject*>::iterator it = clientMap.begin(); std::scoped_lock lock(getQueueMutex());
auto it = clientMap.begin();
while (it != clientMap.end()) while (it != clientMap.end())
{ {
if (it->second->client == client) if (it->second->client.get() == client)
{ {
struct timespec now; struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now); clock_gettime(CLOCK_MONOTONIC, &now);
@ -188,15 +196,14 @@ void MessageQueueClientPool::deleteInstance(MessageQueueClient* client)
if (client == NULL) if (client == NULL)
return; return;
boost::mutex::scoped_lock lock(queueMutex);
std::multimap<std::string, ClientObject*>::iterator it = clientMap.begin(); std::scoped_lock lock(getQueueMutex());
auto it = clientMap.begin();
while (it != clientMap.end()) while (it != clientMap.end())
{ {
if (it->second->client == client) if (it->second->client.get() == client)
{ {
delete it->second->client;
delete it->second;
clientMap.erase(it); clientMap.erase(it);
return; return;
} }

View File

@ -19,22 +19,20 @@
#include <map> #include <map>
#include "messagequeue.h" #include "messagequeue.h"
#include <memory>
namespace messageqcpp namespace messageqcpp
{ {
struct ClientObject struct ClientObject
{ {
MessageQueueClient* client; std::unique_ptr<MessageQueueClient> client;
uint64_t lastUsed; uint64_t lastUsed = 0;
bool inUse; bool inUse = false;
ClientObject() : client(NULL), lastUsed(0), inUse(false)
{
}
}; };
class MessageQueueClientPool class MessageQueueClientPool
{ {
using ClientMapType = std::multimap<std::string, std::unique_ptr<ClientObject>>;
public: public:
static MessageQueueClient* getInstance(const std::string& module); static MessageQueueClient* getInstance(const std::string& module);
static MessageQueueClient* getInstance(const std::string& dnOrIp, uint64_t port); static MessageQueueClient* getInstance(const std::string& dnOrIp, uint64_t port);
@ -46,7 +44,7 @@ class MessageQueueClientPool
MessageQueueClientPool(){}; MessageQueueClientPool(){};
~MessageQueueClientPool(){}; ~MessageQueueClientPool(){};
static std::multimap<std::string, ClientObject*> clientMap; static ClientMapType clientMap;
}; };
} // namespace messageqcpp } // namespace messageqcpp

View File

@ -50,19 +50,7 @@ namespace rowgroup
{ {
using cscType = execplan::CalpontSystemCatalog::ColDataType; using cscType = execplan::CalpontSystemCatalog::ColDataType;
StringStore::StringStore() : empty(true), fUseStoreStringMutex(false)
{
}
StringStore::StringStore(const StringStore&)
{
throw logic_error("Don't call StringStore copy ctor");
}
StringStore& StringStore::operator=(const StringStore&)
{
throw logic_error("Don't call StringStore operator=");
}
StringStore::~StringStore() StringStore::~StringStore()
{ {
@ -86,10 +74,10 @@ StringStore::~StringStore()
uint64_t StringStore::storeString(const uint8_t* data, uint32_t len) uint64_t StringStore::storeString(const uint8_t* data, uint32_t len)
{ {
MemChunk* lastMC = NULL; MemChunk* lastMC = nullptr;
uint64_t ret = 0; uint64_t ret = 0;
empty = false; // At least a NULL is being stored. empty = false; // At least a nullptr is being stored.
// Sometimes the caller actually wants "" to be returned....... argggghhhh...... // Sometimes the caller actually wants "" to be returned....... argggghhhh......
// if (len == 0) // if (len == 0)
@ -121,7 +109,7 @@ uint64_t StringStore::storeString(const uint8_t* data, uint32_t len)
} }
else else
{ {
if ((lastMC == NULL) || (lastMC->capacity - lastMC->currentSize < (len + 4))) if ((lastMC == nullptr) || (lastMC->capacity - lastMC->currentSize < (len + 4)))
{ {
// mem usage debugging // mem usage debugging
// if (lastMC) // if (lastMC)
@ -215,20 +203,12 @@ void StringStore::clear()
empty = true; empty = true;
} }
UserDataStore::UserDataStore() : fUseUserDataMutex(false)
{
}
UserDataStore::~UserDataStore()
{
}
uint32_t UserDataStore::storeUserData(mcsv1sdk::mcsv1Context& context, uint32_t UserDataStore::storeUserData(mcsv1sdk::mcsv1Context& context,
boost::shared_ptr<mcsv1sdk::UserData> data, uint32_t len) boost::shared_ptr<mcsv1sdk::UserData> data, uint32_t len)
{ {
uint32_t ret = 0; uint32_t ret = 0;
if (len == 0 || data == NULL) if (len == 0 || data == nullptr)
{ {
return numeric_limits<uint32_t>::max(); return numeric_limits<uint32_t>::max();
} }
@ -305,7 +285,7 @@ void UserDataStore::deserialize(ByteStream& bs)
} }
mcsv1sdk::mcsv1_UDAF::ReturnCode rc; mcsv1sdk::mcsv1_UDAF::ReturnCode rc;
mcsv1sdk::UserData* userData = NULL; mcsv1sdk::UserData* userData = nullptr;
rc = funcIter->second->createUserData(userData, vStoreData[i].length); rc = funcIter->second->createUserData(userData, vStoreData[i].length);
if (rc != mcsv1sdk::mcsv1_UDAF::SUCCESS) if (rc != mcsv1sdk::mcsv1_UDAF::SUCCESS)
@ -323,10 +303,6 @@ void UserDataStore::deserialize(ByteStream& bs)
return; return;
} }
RGData::RGData()
{
// cout << "rgdata++ = " << __sync_add_and_fetch(&rgDataCount, 1) << endl;
}
RGData::RGData(const RowGroup& rg, uint32_t rowCount) RGData::RGData(const RowGroup& rg, uint32_t rowCount)
{ {
@ -336,6 +312,9 @@ RGData::RGData(const RowGroup& rg, uint32_t rowCount)
if (rg.usesStringTable() && rowCount > 0) if (rg.usesStringTable() && rowCount > 0)
strings.reset(new StringStore()); strings.reset(new StringStore());
userDataStore.reset();
#ifdef VALGRIND #ifdef VALGRIND
/* In a PM-join, we can serialize entire tables; not every value has been /* In a PM-join, we can serialize entire tables; not every value has been
* filled in yet. Need to look into that. Valgrind complains that * filled in yet. Need to look into that. Valgrind complains that
@ -354,6 +333,8 @@ RGData::RGData(const RowGroup& rg)
if (rg.usesStringTable()) if (rg.usesStringTable())
strings.reset(new StringStore()); strings.reset(new StringStore());
userDataStore.reset();
#ifdef VALGRIND #ifdef VALGRIND
/* In a PM-join, we can serialize entire tables; not every value has been /* In a PM-join, we can serialize entire tables; not every value has been
* filled in yet. Need to look into that. Valgrind complains that * filled in yet. Need to look into that. Valgrind complains that
@ -366,6 +347,7 @@ RGData::RGData(const RowGroup& rg)
void RGData::reinit(const RowGroup& rg, uint32_t rowCount) void RGData::reinit(const RowGroup& rg, uint32_t rowCount)
{ {
rowData.reset(new uint8_t[rg.getDataSize(rowCount)]); rowData.reset(new uint8_t[rg.getDataSize(rowCount)]);
userDataStore.reset();
if (rg.usesStringTable()) if (rg.usesStringTable())
strings.reset(new StringStore()); strings.reset(new StringStore());
@ -386,16 +368,6 @@ void RGData::reinit(const RowGroup& rg)
reinit(rg, 8192); reinit(rg, 8192);
} }
RGData::RGData(const RGData& r) : rowData(r.rowData), strings(r.strings), userDataStore(r.userDataStore)
{
// cout << "rgdata++ = " << __sync_add_and_fetch(&rgDataCount, 1) << endl;
}
RGData::~RGData()
{
// cout << "rgdata-- = " << __sync_sub_and_fetch(&rgDataCount, 1) << endl;
}
void RGData::serialize(ByteStream& bs, uint32_t amount) const void RGData::serialize(ByteStream& bs, uint32_t amount) const
{ {
// cout << "serializing!\n"; // cout << "serializing!\n";
@ -465,6 +437,7 @@ void RGData::clear()
{ {
rowData.reset(); rowData.reset();
strings.reset(); strings.reset();
userDataStore.reset();
} }
// UserDataStore is only used for UDAF. // UserDataStore is only used for UDAF.
@ -479,10 +452,6 @@ UserDataStore* RGData::getUserDataStore()
return userDataStore.get(); return userDataStore.get();
} }
Row::Row() : data(NULL), strings(NULL), userDataStore(NULL)
{
}
Row::Row(const Row& r) Row::Row(const Row& r)
: columnCount(r.columnCount) : columnCount(r.columnCount)
, baseRid(r.baseRid) , baseRid(r.baseRid)
@ -502,11 +471,7 @@ Row::Row(const Row& r)
, hasLongStringField(r.hasLongStringField) , hasLongStringField(r.hasLongStringField)
, sTableThreshold(r.sTableThreshold) , sTableThreshold(r.sTableThreshold)
, forceInline(r.forceInline) , forceInline(r.forceInline)
, userDataStore(NULL) , userDataStore(nullptr)
{
}
Row::~Row()
{ {
} }
@ -1037,7 +1002,7 @@ bool Row::equals(const Row& r2, uint32_t lastCol) const
const CHARSET_INFO* Row::getCharset(uint32_t col) const const CHARSET_INFO* Row::getCharset(uint32_t col) const
{ {
if (charsets[col] == NULL) if (charsets[col] == nullptr)
{ {
const_cast<CHARSET_INFO**>(charsets)[col] = &datatypes::Charset(charsetNumbers[col]).getCharset(); const_cast<CHARSET_INFO**>(charsets)[col] = &datatypes::Charset(charsetNumbers[col]).getCharset();
} }
@ -1045,14 +1010,6 @@ const CHARSET_INFO* Row::getCharset(uint32_t col) const
} }
RowGroup::RowGroup() RowGroup::RowGroup()
: columnCount(0)
, data(NULL)
, rgData(NULL)
, strings(NULL)
, useStringTable(true)
, hasCollation(false)
, hasLongStringField(false)
, sTableThreshold(20)
{ {
// 1024 is too generous to waste. // 1024 is too generous to waste.
oldOffsets.reserve(10); oldOffsets.reserve(10);
@ -1071,7 +1028,7 @@ RowGroup::RowGroup(uint32_t colCount, const vector<uint32_t>& positions, const v
const vector<uint32_t>& cprecision, uint32_t stringTableThreshold, bool stringTable, const vector<uint32_t>& cprecision, uint32_t stringTableThreshold, bool stringTable,
const vector<bool>& forceInlineData) const vector<bool>& forceInlineData)
: columnCount(colCount) : columnCount(colCount)
, data(NULL) , data(nullptr)
, oldOffsets(positions) , oldOffsets(positions)
, oids(roids) , oids(roids)
, keys(tkeys) , keys(tkeys)
@ -1079,8 +1036,8 @@ RowGroup::RowGroup(uint32_t colCount, const vector<uint32_t>& positions, const v
, charsetNumbers(csNumbers) , charsetNumbers(csNumbers)
, scale(cscale) , scale(cscale)
, precision(cprecision) , precision(cprecision)
, rgData(NULL) , rgData(nullptr)
, strings(NULL) , strings(nullptr)
, sTableThreshold(stringTableThreshold) , sTableThreshold(stringTableThreshold)
{ {
uint32_t i; uint32_t i;
@ -1121,8 +1078,8 @@ RowGroup::RowGroup(uint32_t colCount, const vector<uint32_t>& positions, const v
useStringTable = (stringTable && hasLongStringField); useStringTable = (stringTable && hasLongStringField);
offsets = (useStringTable ? &stOffsets[0] : &oldOffsets[0]); offsets = (useStringTable ? &stOffsets[0] : &oldOffsets[0]);
// Set all the charsets to NULL for jit initialization. // Set all the charsets to nullptr for jit initialization.
charsets.insert(charsets.begin(), charsetNumbers.size(), NULL); charsets.insert(charsets.begin(), charsetNumbers.size(), nullptr);
} }
RowGroup::RowGroup(const RowGroup& r) RowGroup::RowGroup(const RowGroup& r)
@ -1189,14 +1146,6 @@ RowGroup& RowGroup::operator=(const RowGroup& r)
} }
RowGroup::RowGroup(ByteStream& bs) RowGroup::RowGroup(ByteStream& bs)
: columnCount(0)
, data(nullptr)
, rgData(nullptr)
, strings(nullptr)
, useStringTable(true)
, hasCollation(false)
, hasLongStringField(false)
, sTableThreshold(20)
{ {
this->deserialize(bs); this->deserialize(bs);
} }
@ -1267,22 +1216,13 @@ void RowGroup::deserialize(ByteStream& bs)
else if (!useStringTable && !oldOffsets.empty()) else if (!useStringTable && !oldOffsets.empty())
offsets = &oldOffsets[0]; offsets = &oldOffsets[0];
// Set all the charsets to NULL for jit initialization. // Set all the charsets to nullptr for jit initialization.
charsets.insert(charsets.begin(), charsetNumbers.size(), NULL); charsets.insert(charsets.begin(), charsetNumbers.size(), nullptr);
} }
void RowGroup::serializeRGData(ByteStream& bs) const void RowGroup::serializeRGData(ByteStream& bs) const
{ {
// cout << "****** serializing\n" << toString() << en
// if (useStringTable || !hasLongStringField)
rgData->serialize(bs, getDataSize()); rgData->serialize(bs, getDataSize());
// else {
// uint64_t size;
// RGData *compressed = convertToStringTable(&size);
// compressed->serialize(bs, size);
// if (compressed != rgData)
// delete compressed;
// }
} }
uint32_t RowGroup::getDataSize() const uint32_t RowGroup::getDataSize() const
@ -1367,7 +1307,7 @@ string RowGroup::toString(const std::vector<uint64_t>& used) const
// os << "strings = " << hex << (int64_t) strings << "\n"; // os << "strings = " << hex << (int64_t) strings << "\n";
// os << "data = " << (int64_t) data << "\n" << dec; // os << "data = " << (int64_t) data << "\n" << dec;
if (data != NULL) if (data != nullptr)
{ {
Row r; Row r;
initRow(&r); initRow(&r);
@ -1589,7 +1529,7 @@ void RowGroup::addToSysDataList(execplan::CalpontSystemCatalog::NJLSysDataList&
const CHARSET_INFO* RowGroup::getCharset(uint32_t col) const CHARSET_INFO* RowGroup::getCharset(uint32_t col)
{ {
if (charsets[col] == NULL) if (charsets[col] == nullptr)
{ {
charsets[col] = &datatypes::Charset(charsetNumbers[col]).getCharset(); charsets[col] = &datatypes::Charset(charsetNumbers[col]).getCharset();
} }

View File

@ -129,7 +129,11 @@ inline T derefFromTwoVectorPtrs(const std::vector<T>* outer, const std::vector<T
class StringStore class StringStore
{ {
public: public:
StringStore(); StringStore() = default;
StringStore(const StringStore&) = delete;
StringStore(StringStore&&) = delete;
StringStore& operator=(const StringStore&) = delete;
StringStore& operator=(StringStore&&) = delete;
virtual ~StringStore(); virtual ~StringStore();
inline std::string getString(uint64_t offset) const; inline std::string getString(uint64_t offset) const;
@ -171,17 +175,14 @@ class StringStore
private: private:
std::string empty_str; std::string empty_str;
StringStore(const StringStore&);
StringStore& operator=(const StringStore&);
static constexpr const uint32_t CHUNK_SIZE = 64 * 1024; // allocators like powers of 2 static constexpr const uint32_t CHUNK_SIZE = 64 * 1024; // allocators like powers of 2
std::vector<boost::shared_array<uint8_t>> mem; std::vector<boost::shared_array<uint8_t>> mem;
// To store strings > 64KB (BLOB/TEXT) // To store strings > 64KB (BLOB/TEXT)
std::vector<boost::shared_array<uint8_t>> longStrings; std::vector<boost::shared_array<uint8_t>> longStrings;
bool empty; bool empty = true;
bool fUseStoreStringMutex; //@bug6065, make StringStore::storeString() thread safe bool fUseStoreStringMutex = false; //@bug6065, make StringStore::storeString() thread safe
boost::mutex fMutex; boost::mutex fMutex;
}; };
@ -208,8 +209,13 @@ class UserDataStore
}; };
public: public:
UserDataStore(); UserDataStore() = default;
virtual ~UserDataStore(); virtual ~UserDataStore() = default;
UserDataStore(const UserDataStore&) = delete;
UserDataStore(UserDataStore&&) = delete;
UserDataStore& operator=(const UserDataStore&) = delete;
UserDataStore& operator=(UserDataStore&&) = delete;
void serialize(messageqcpp::ByteStream&) const; void serialize(messageqcpp::ByteStream&) const;
void deserialize(messageqcpp::ByteStream&); void deserialize(messageqcpp::ByteStream&);
@ -231,12 +237,10 @@ class UserDataStore
boost::shared_ptr<mcsv1sdk::UserData> getUserData(uint32_t offset) const; boost::shared_ptr<mcsv1sdk::UserData> getUserData(uint32_t offset) const;
private: private:
UserDataStore(const UserDataStore&);
UserDataStore& operator=(const UserDataStore&);
std::vector<StoreData> vStoreData; std::vector<StoreData> vStoreData;
bool fUseUserDataMutex; bool fUseUserDataMutex = false;
boost::mutex fMutex; boost::mutex fMutex;
}; };
@ -248,13 +252,16 @@ class Row;
class RGData class RGData
{ {
public: public:
RGData(); // useless unless followed by an = or a deserialize operation RGData() = default; // useless unless followed by an = or a deserialize operation
RGData(const RowGroup& rg, uint32_t rowCount); // allocates memory for rowData RGData(const RowGroup& rg, uint32_t rowCount); // allocates memory for rowData
explicit RGData(const RowGroup& rg); explicit RGData(const RowGroup& rg);
RGData(const RGData&); RGData& operator=(const RGData&) = default;
virtual ~RGData(); RGData& operator=(RGData&&) = default;
RGData(const RGData&) = default;
RGData(RGData&&) = default;
virtual ~RGData() = default;
inline RGData& operator=(const RGData&);
// amount should be the # returned by RowGroup::getDataSize() // amount should be the # returned by RowGroup::getDataSize()
void serialize(messageqcpp::ByteStream&, uint32_t amount) const; void serialize(messageqcpp::ByteStream&, uint32_t amount) const;
@ -268,7 +275,7 @@ class RGData
void clear(); void clear();
void reinit(const RowGroup& rg); void reinit(const RowGroup& rg);
void reinit(const RowGroup& rg, uint32_t rowCount); void reinit(const RowGroup& rg, uint32_t rowCount);
inline void setStringStore(boost::shared_ptr<StringStore>& ss) inline void setStringStore(std::shared_ptr<StringStore>& ss)
{ {
strings = ss; strings = ss;
} }
@ -301,18 +308,21 @@ class RGData
return (userDataStore ? (userDataStore->useUserDataMutex()) : false); return (userDataStore ? (userDataStore->useUserDataMutex()) : false);
} }
boost::shared_array<uint8_t> rowData; bool hasRowData() const
boost::shared_ptr<StringStore> strings; {
boost::shared_ptr<UserDataStore> userDataStore; return !!rowData;
}
private: private:
// boost::shared_array<uint8_t> rowData; std::shared_ptr<uint8_t[]> rowData;
// boost::shared_ptr<StringStore> strings; std::shared_ptr<StringStore> strings;
std::shared_ptr<UserDataStore> userDataStore;
// Need sig to support backward compat. RGData can deserialize both forms. // Need sig to support backward compat. RGData can deserialize both forms.
static const uint32_t RGDATA_SIG = 0xffffffff; // won't happen for 'old' Rowgroup data static const uint32_t RGDATA_SIG = 0xffffffff; // won't happen for 'old' Rowgroup data
friend class RowGroup; friend class RowGroup;
friend class RowGroupStorage;
}; };
class Row class Row
@ -320,28 +330,26 @@ class Row
public: public:
struct Pointer struct Pointer
{ {
inline Pointer() : data(NULL), strings(NULL), userDataStore(NULL) inline Pointer() = default;
{
}
// Pointer(uint8_t*) implicitly makes old code compatible with the string table impl; // Pointer(uint8_t*) implicitly makes old code compatible with the string table impl;
inline Pointer(uint8_t* d) : data(d), strings(NULL), userDataStore(NULL) inline Pointer(uint8_t* d) : data(d)
{ {
} }
inline Pointer(uint8_t* d, StringStore* s) : data(d), strings(s), userDataStore(NULL) inline Pointer(uint8_t* d, StringStore* s) : data(d), strings(s)
{ {
} }
inline Pointer(uint8_t* d, StringStore* s, UserDataStore* u) : data(d), strings(s), userDataStore(u) inline Pointer(uint8_t* d, StringStore* s, UserDataStore* u) : data(d), strings(s), userDataStore(u)
{ {
} }
uint8_t* data; uint8_t* data = nullptr;
StringStore* strings; StringStore* strings = nullptr;
UserDataStore* userDataStore; UserDataStore* userDataStore = nullptr;
}; };
Row(); Row() = default;
Row(const Row&); Row(const Row&);
~Row(); ~Row() = default;
Row& operator=(const Row&); Row& operator=(const Row&);
bool operator==(const Row&) const; bool operator==(const Row&) const;
@ -491,7 +499,7 @@ class Row
template <typename T> template <typename T>
inline void setBinaryField_offset(const T* value, uint32_t width, uint32_t colIndex); inline void setBinaryField_offset(const T* value, uint32_t width, uint32_t colIndex);
// support VARBINARY // support VARBINARY
// Add 2-byte length at the CHARSET_INFO*beginning of the field. NULL and zero length field are // Add 2-byte length at the CHARSET_INFO*beginning of the field. nullptr and zero length field are
// treated the same, could use one of the length bit to distinguish these two cases. // treated the same, could use one of the length bit to distinguish these two cases.
inline std::string getVarBinaryStringField(uint32_t colIndex) const; inline std::string getVarBinaryStringField(uint32_t colIndex) const;
inline void setVarBinaryField(const std::string& val, uint32_t colIndex); inline void setVarBinaryField(const std::string& val, uint32_t colIndex);
@ -580,30 +588,31 @@ class Row
const CHARSET_INFO* getCharset(uint32_t col) const; const CHARSET_INFO* getCharset(uint32_t col) const;
private: private:
uint32_t columnCount;
uint64_t baseRid;
// Note, the mem behind these pointer fields is owned by RowGroup not Row
uint32_t* oldOffsets;
uint32_t* stOffsets;
uint32_t* offsets;
uint32_t* colWidths;
execplan::CalpontSystemCatalog::ColDataType* types;
uint32_t* charsetNumbers;
CHARSET_INFO** charsets;
uint8_t* data;
uint32_t* scale;
uint32_t* precision;
StringStore* strings;
bool useStringTable;
bool hasCollation;
bool hasLongStringField;
uint32_t sTableThreshold;
boost::shared_array<bool> forceInline;
inline bool inStringTable(uint32_t col) const; inline bool inStringTable(uint32_t col) const;
UserDataStore* userDataStore; // For UDAF private:
uint32_t columnCount = 0;
uint64_t baseRid = 0;
// Note, the mem behind these pointer fields is owned by RowGroup not Row
uint32_t* oldOffsets = nullptr;
uint32_t* stOffsets = nullptr;
uint32_t* offsets = nullptr;
uint32_t* colWidths = nullptr;
execplan::CalpontSystemCatalog::ColDataType* types = nullptr;
uint32_t* charsetNumbers = nullptr;
CHARSET_INFO** charsets = nullptr;
uint8_t* data = nullptr;
uint32_t* scale = nullptr;
uint32_t* precision = nullptr;
StringStore* strings = nullptr;
bool useStringTable = true;
bool hasCollation = false;
bool hasLongStringField = false;
uint32_t sTableThreshold = 20;
boost::shared_array<bool> forceInline;
UserDataStore* userDataStore = nullptr; // For UDAF
friend class RowGroup; friend class RowGroup;
}; };
@ -1478,9 +1487,6 @@ class RowGroup : public messageqcpp::Serializeable
inline bool usesStringTable() const; inline bool usesStringTable() const;
inline void setUseStringTable(bool); inline void setUseStringTable(bool);
// RGData *convertToInlineData(uint64_t *size = NULL) const; // caller manages the memory returned by
// this void convertToInlineDataInPlace(); RGData *convertToStringTable(uint64_t *size = NULL)
// const; void convertToStringTableInPlace();
void serializeRGData(messageqcpp::ByteStream&) const; void serializeRGData(messageqcpp::ByteStream&) const;
inline uint32_t getStringTableThreshold() const; inline uint32_t getStringTableThreshold() const;
@ -1516,17 +1522,17 @@ class RowGroup : public messageqcpp::Serializeable
const uint16_t& blockNum); const uint16_t& blockNum);
inline void getLocation(uint32_t* partNum, uint16_t* segNum, uint8_t* extentNum, uint16_t* blockNum); inline void getLocation(uint32_t* partNum, uint16_t* segNum, uint8_t* extentNum, uint16_t* blockNum);
inline void setStringStore(boost::shared_ptr<StringStore>); inline void setStringStore(std::shared_ptr<StringStore>);
const CHARSET_INFO* getCharset(uint32_t col); const CHARSET_INFO* getCharset(uint32_t col);
private: private:
uint32_t columnCount; uint32_t columnCount = 0;
uint8_t* data; uint8_t* data = nullptr;
std::vector<uint32_t> oldOffsets; // inline data offsets std::vector<uint32_t> oldOffsets; // inline data offsets
std::vector<uint32_t> stOffsets; // string table offsets std::vector<uint32_t> stOffsets; // string table offsets
uint32_t* offsets; // offsets either points to oldOffsets or stOffsets uint32_t* offsets = nullptr; // offsets either points to oldOffsets or stOffsets
std::vector<uint32_t> colWidths; std::vector<uint32_t> colWidths;
// oids: the real oid of the column, may have duplicates with alias. // oids: the real oid of the column, may have duplicates with alias.
// This oid is necessary for front-end to decide the real column width. // This oid is necessary for front-end to decide the real column width.
@ -1544,12 +1550,12 @@ class RowGroup : public messageqcpp::Serializeable
std::vector<uint32_t> precision; std::vector<uint32_t> precision;
// string table impl // string table impl
RGData* rgData; RGData* rgData = nullptr;
StringStore* strings; // note, strings and data belong to rgData StringStore* strings = nullptr; // note, strings and data belong to rgData
bool useStringTable; bool useStringTable = true;
bool hasCollation; bool hasCollation = false;
bool hasLongStringField; bool hasLongStringField = false;
uint32_t sTableThreshold; uint32_t sTableThreshold = 20;
boost::shared_array<bool> forceInline; boost::shared_array<bool> forceInline;
static const uint32_t headerSize = 18; static const uint32_t headerSize = 18;
@ -1586,7 +1592,7 @@ every row, they're a measurable performance penalty */
inline uint32_t RowGroup::getRowCount() const inline uint32_t RowGroup::getRowCount() const
{ {
// idbassert(data); // idbassert(data);
// if (!data) throw std::logic_error("RowGroup::getRowCount(): data is NULL!"); // if (!data) throw std::logic_error("RowGroup::getRowCount(): data is nullptr!");
return *((uint32_t*)&data[rowCountOffset]); return *((uint32_t*)&data[rowCountOffset]);
} }
@ -1617,8 +1623,8 @@ inline void RowGroup::getRow(uint32_t rowNum, Row* r) const
inline void RowGroup::setData(uint8_t* d) inline void RowGroup::setData(uint8_t* d)
{ {
data = d; data = d;
strings = NULL; strings = nullptr;
rgData = NULL; rgData = nullptr;
setUseStringTable(false); setUseStringTable(false);
} }
@ -1652,7 +1658,7 @@ inline void RowGroup::setUseStringTable(bool b)
offsets = &oldOffsets[0]; offsets = &oldOffsets[0];
if (!useStringTable) if (!useStringTable)
strings = NULL; strings = nullptr;
} }
inline uint64_t RowGroup::getBaseRid() const inline uint64_t RowGroup::getBaseRid() const
@ -1712,7 +1718,7 @@ inline uint32_t RowGroup::getRowSizeWithStrings() const
inline uint64_t RowGroup::getSizeWithStrings(uint64_t n) const inline uint64_t RowGroup::getSizeWithStrings(uint64_t n) const
{ {
if (strings == NULL) if (strings == nullptr)
return getDataSize(n); return getDataSize(n);
else else
return getDataSize(n) + strings->getSize(); return getDataSize(n) + strings->getSize();
@ -1836,7 +1842,7 @@ inline uint32_t RowGroup::getStringTableThreshold() const
return sTableThreshold; return sTableThreshold;
} }
inline void RowGroup::setStringStore(boost::shared_ptr<StringStore> ss) inline void RowGroup::setStringStore(std::shared_ptr<StringStore> ss)
{ {
if (useStringTable) if (useStringTable)
{ {
@ -2031,7 +2037,7 @@ inline bool StringStore::isNullValue(uint64_t off) const
if (off == std::numeric_limits<uint64_t>::max()) if (off == std::numeric_limits<uint64_t>::max())
return true; return true;
// Long strings won't be NULL // Long strings won't be nullptr
if (off & 0x8000000000000000) if (off & 0x8000000000000000)
return false; return false;
@ -2054,7 +2060,7 @@ inline bool StringStore::isNullValue(uint64_t off) const
if ((offset + length) > mc->currentSize) if ((offset + length) > mc->currentSize)
return true; return true;
if (mc->data[offset + 4] == 0) // "" = NULL string for some reason... if (mc->data[offset + 4] == 0) // "" = nullptr string for some reason...
return true; return true;
return (memcmp(&mc->data[offset + 4], joblist::CPNULLSTRMARK.c_str(), 8) == 0); return (memcmp(&mc->data[offset + 4], joblist::CPNULLSTRMARK.c_str(), 8) == 0);
} }
@ -2121,14 +2127,6 @@ inline uint64_t StringStore::getSize() const
return ret; return ret;
} }
inline RGData& RGData::operator=(const RGData& r)
{
rowData = r.rowData;
strings = r.strings;
userDataStore = r.userDataStore;
return *this;
}
inline void RGData::getRow(uint32_t num, Row* row) inline void RGData::getRow(uint32_t num, Row* row)
{ {
uint32_t size = row->getSize(); uint32_t size = row->getSize();

View File

@ -1,102 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,6,0,0
PRODUCTVERSION 4,6,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "InfiniDB, Inc."
VALUE "FileDescription", "InfiniDB UDF API"
VALUE "FileVersion", "4.6.0-0"
VALUE "InternalName", "libudfsdk"
VALUE "LegalCopyright", "Copyright (C) 2014"
VALUE "OriginalFilename", "libudfsdk.dll"
VALUE "ProductName", "InfiniDB"
VALUE "ProductVersion", "4.6.0.0 Beta"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -1,102 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,6,0,0
PRODUCTVERSION 4,6,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "InfiniDB, Inc."
VALUE "FileDescription", "InfiniDB UDF API"
VALUE "FileVersion", "4.6.0-0"
VALUE "InternalName", "libudfsdk"
VALUE "LegalCopyright", "Copyright (C) 2014"
VALUE "OriginalFilename", "libudfsdk.dll"
VALUE "ProductName", "InfiniDB"
VALUE "ProductVersion", "4.6.0.0 Beta"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -27,6 +27,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <cstdio> #include <cstdio>
#include <ctime> #include <ctime>
#include <memory>
#include "messagequeue.h" #include "messagequeue.h"
#include "bytestream.h" #include "bytestream.h"
@ -57,21 +58,18 @@ void timespec_sub(const struct timespec& tv1, const struct timespec& tv2, double
namespace BRM namespace BRM
{ {
SlaveComm::SlaveComm(string hostname, SlaveDBRMNode* s) SlaveComm::SlaveComm(string hostname)
: slave(s)
, currentSaveFile(NULL)
, journalh(NULL)
{ {
config::Config* config = config::Config::makeConfig(); config::Config* config = config::Config::makeConfig();
string tmp; string tmp;
slave = std::make_unique<SlaveDBRMNode>();
bool tellUser = true; bool tellUser = true;
for (;;) for (;;)
{ {
try try
{ {
server = new MessageQueueServer(hostname); server = std::make_unique<MessageQueueServer>(hostname);
break; break;
} }
catch (runtime_error& re) catch (runtime_error& re)
@ -133,8 +131,8 @@ SlaveComm::SlaveComm(string hostname, SlaveDBRMNode* s)
journalName = savefile + "_journal"; journalName = savefile + "_journal";
const char* filename = journalName.c_str(); const char* filename = journalName.c_str();
journalh = IDBDataFile::open(IDBPolicy::getType(filename, IDBPolicy::WRITEENG), filename, "a", 0); journalh.reset(IDBDataFile::open(IDBPolicy::getType(filename, IDBPolicy::WRITEENG), filename, "a", 0));
if (journalh == NULL) if (journalh == nullptr)
throw runtime_error("Could not open the BRM journal for writing!"); throw runtime_error("Could not open the BRM journal for writing!");
} }
else else
@ -162,8 +160,6 @@ SlaveComm::SlaveComm(string hostname, SlaveDBRMNode* s)
} }
SlaveComm::SlaveComm() SlaveComm::SlaveComm()
: currentSaveFile(NULL)
, journalh(NULL)
{ {
config::Config* config = config::Config::makeConfig(); config::Config* config = config::Config::makeConfig();
@ -192,23 +188,9 @@ SlaveComm::SlaveComm()
server = NULL; server = NULL;
standalone = true; standalone = true;
printOnly = false; printOnly = false;
slave = new SlaveDBRMNode(); slave = std::make_unique<SlaveDBRMNode>();
} }
SlaveComm::~SlaveComm()
{
delete server;
server = NULL;
if (firstSlave)
{
delete currentSaveFile;
currentSaveFile = NULL;
}
delete journalh;
journalh = NULL;
}
void SlaveComm::stop() void SlaveComm::stop()
{ {
@ -1946,8 +1928,7 @@ void SlaveComm::do_confirm()
{ {
if (!currentSaveFile) if (!currentSaveFile)
{ {
currentSaveFile = currentSaveFile.reset(IDBDataFile::open(IDBPolicy::getType(tmp.c_str(), IDBPolicy::WRITEENG), tmp.c_str(), "wb", 0));
IDBDataFile::open(IDBPolicy::getType(tmp.c_str(), IDBPolicy::WRITEENG), tmp.c_str(), "wb", 0);
} }
if (currentSaveFile == NULL) if (currentSaveFile == NULL)
@ -1970,7 +1951,7 @@ void SlaveComm::do_confirm()
if (err < (int)relative.length()) if (err < (int)relative.length())
{ {
ostringstream os; ostringstream os;
os << "WorkerComm: currentfile write() returned " << err << " file pointer is " << currentSaveFile; os << "WorkerComm: currentfile write() returned " << err << " file pointer is " << currentSaveFile.get();
if (err < 0) if (err < 0)
os << " errno: " << strerror(errno); os << " errno: " << strerror(errno);
@ -1979,13 +1960,13 @@ void SlaveComm::do_confirm()
} }
currentSaveFile->flush(); currentSaveFile->flush();
delete currentSaveFile;
currentSaveFile = NULL; currentSaveFile = nullptr;
saveFileToggle = !saveFileToggle; saveFileToggle = !saveFileToggle;
delete journalh; ;
journalh = IDBDataFile::open(IDBPolicy::getType(journalName.c_str(), IDBPolicy::WRITEENG), journalh.reset(IDBDataFile::open(IDBPolicy::getType(journalName.c_str(), IDBPolicy::WRITEENG),
journalName.c_str(), "w+b", 0); journalName.c_str(), "w+b", 0));
if (!journalh) if (!journalh)
throw runtime_error("Could not open the BRM journal for writing!"); throw runtime_error("Could not open the BRM journal for writing!");
@ -2245,7 +2226,6 @@ void SlaveComm::do_ownerCheck(ByteStream& msg)
master.write(reply); master.write(reply);
} }
// FIXME: needs to be refactored along with SessionManagerServer::lookupProcessStatus()
bool SlaveComm::processExists(const uint32_t pid, const string& pname) bool SlaveComm::processExists(const uint32_t pid, const string& pname)
{ {
string stat; string stat;
@ -2278,7 +2258,6 @@ bool SlaveComm::processExists(const uint32_t pid, const string& pname)
return true; return true;
} }
void SlaveComm::do_dmlLockLBIDRanges(ByteStream& msg) void SlaveComm::do_dmlLockLBIDRanges(ByteStream& msg)
{ {
ByteStream reply; ByteStream reply;

View File

@ -54,8 +54,10 @@ class SlaveComm
EXPORT SlaveComm(); EXPORT SlaveComm();
/** Use this ctor to have it connected to the rest of the DBRM system */ /** Use this ctor to have it connected to the rest of the DBRM system */
EXPORT SlaveComm(std::string hostname, SlaveDBRMNode* s); // hostname = 'DBRM_WorkerN' EXPORT SlaveComm(std::string hostname); // hostname = 'DBRM_WorkerN'
EXPORT ~SlaveComm(); EXPORT ~SlaveComm() {};
SlaveDBRMNode& getSlaveNode() { return *slave; }
EXPORT void run(); EXPORT void run();
EXPORT void stop(); EXPORT void stop();
@ -112,15 +114,15 @@ class SlaveComm
void saveDelta(); void saveDelta();
bool processExists(const uint32_t pid, const std::string& pname); bool processExists(const uint32_t pid, const std::string& pname);
messageqcpp::MessageQueueServer* server; std::unique_ptr<messageqcpp::MessageQueueServer> server;
messageqcpp::IOSocket master; messageqcpp::IOSocket master;
SlaveDBRMNode* slave; std::unique_ptr<SlaveDBRMNode> slave;
std::string savefile; std::string savefile;
bool release, die, firstSlave, saveFileToggle, takeSnapshot, doSaveDelta, standalone, printOnly; bool release, die, firstSlave, saveFileToggle, takeSnapshot, doSaveDelta, standalone, printOnly;
messageqcpp::ByteStream delta; messageqcpp::ByteStream delta;
idbdatafile::IDBDataFile* currentSaveFile; std::unique_ptr<idbdatafile::IDBDataFile> currentSaveFile;
std::string journalName; std::string journalName;
idbdatafile::IDBDataFile* journalh; std::unique_ptr<idbdatafile::IDBDataFile> journalh;
int64_t snapshotInterval, journalCount; int64_t snapshotInterval, journalCount;
struct timespec MSG_TIMEOUT; struct timespec MSG_TIMEOUT;
}; };

View File

@ -22,6 +22,7 @@
#include <iostream> #include <iostream>
#include <signal.h> #include <signal.h>
#include <memory>
#include <string> #include <string>
#include <clocale> #include <clocale>
#include "slavedbrmnode.h" #include "slavedbrmnode.h"
@ -39,7 +40,7 @@
using namespace BRM; using namespace BRM;
using namespace std; using namespace std;
SlaveComm* comm; std::unique_ptr<SlaveComm> comm;
bool die = false; bool die = false;
boost::thread_group monitorThreads; boost::thread_group monitorThreads;
@ -120,12 +121,11 @@ int ServiceWorkerNode::Child()
{ {
setupChildSignalHandlers(); setupChildSignalHandlers();
SlaveDBRMNode slave;
ShmKeys keys; ShmKeys keys;
try try
{ {
comm = new SlaveComm(std::string(m_nodename), &slave); comm = std::make_unique<SlaveComm>(std::string(m_nodename));
NotifyServiceStarted(); NotifyServiceStarted();
} }
catch (exception& e) catch (exception& e)
@ -139,12 +139,12 @@ int ServiceWorkerNode::Child()
} }
/* Start 4 threads to monitor write lock state */ /* Start 4 threads to monitor write lock state */
monitorThreads.create_thread(RWLockMonitor(&die, slave.getEMFLLockStatus(), keys.KEYRANGE_EMFREELIST_BASE)); monitorThreads.create_thread(RWLockMonitor(&die, comm->getSlaveNode().getEMFLLockStatus(), keys.KEYRANGE_EMFREELIST_BASE));
monitorThreads.create_thread(RWLockMonitor(&die, slave.getEMLockStatus(), keys.KEYRANGE_EXTENTMAP_BASE)); monitorThreads.create_thread(RWLockMonitor(&die, comm->getSlaveNode().getEMLockStatus(), keys.KEYRANGE_EXTENTMAP_BASE));
monitorThreads.create_thread(RWLockMonitor(&die, slave.getVBBMLockStatus(), keys.KEYRANGE_VBBM_BASE)); monitorThreads.create_thread(RWLockMonitor(&die, comm->getSlaveNode().getVBBMLockStatus(), keys.KEYRANGE_VBBM_BASE));
monitorThreads.create_thread(RWLockMonitor(&die, slave.getVSSLockStatus(), keys.KEYRANGE_VSS_BASE)); monitorThreads.create_thread(RWLockMonitor(&die, comm->getSlaveNode().getVSSLockStatus(), keys.KEYRANGE_VSS_BASE));
monitorThreads.create_thread( monitorThreads.create_thread(
RWLockMonitor(&die, slave.getEMIndexLockStatus(), keys.KEYRANGE_EXTENTMAP_INDEX_BASE)); RWLockMonitor(&die, comm->getSlaveNode().getEMIndexLockStatus(), keys.KEYRANGE_EXTENTMAP_INDEX_BASE));
try try
{ {

View File

@ -1,2 +0,0 @@
nohup controlernode &
nohup workernode DBRM_Worker1 &

View File

@ -1,48 +0,0 @@
IPCS_CLEANUP=$(EXPORT_ROOT)/bin/dbrm stop; ipcs-pat -d > /dev/null; sleep 2; $(EXPORT_ROOT)/bin/dbrm start;
CPPFLAGS=-I. -I$(EXPORT_ROOT)/include -I/usr/include/libxml2
CXXFLAGS+=$(DEBUG_FLAGS) -D_FILE_OFFSET_BITS=64 -Wall -fpic
LLIBS=-L. -L$(EXPORT_ROOT)/lib -lxml2 -lrwlock -lconfigcpp -lmessageqcpp -lbrm -lboost_thread \
-lloggingcpp -lboost_date_time -lboost_filesystem
TLIBS=$(LLIBS) -lcppunit -ldl
GLIBS=$(TLIBS:-lcppunit=)
LIBDIR=../obj
LOBJS_SHARED= \
$(LIBDIR)/we_blockop.o \
$(LIBDIR)/we_brm.o \
$(LIBDIR)/we_bulkrollbackmgr.o \
$(LIBDIR)/we_bulkrollbackfile.o \
$(LIBDIR)/we_bulkrollbackfilecompressed.o \
$(LIBDIR)/we_bulkrollbackfilecompressedhdfs.o \
$(LIBDIR)/we_cache.o \
$(LIBDIR)/we_chunkmanager.o \
$(LIBDIR)/we_config.o \
$(LIBDIR)/we_confirmhdfsdbfile.o \
$(LIBDIR)/we_convertor.o \
$(LIBDIR)/we_dbfileop.o \
$(LIBDIR)/we_dbrootextenttracker.o \
$(LIBDIR)/we_define.o \
$(LIBDIR)/we_fileop.o \
$(LIBDIR)/we_log.o \
$(LIBDIR)/we_rbmetawriter.o \
$(LIBDIR)/we_simplesyslog.o \
$(LIBDIR)/we_stats.o
LOBJS_INDEX= \
$(LIBDIR)/we_freemgr.o \
$(LIBDIR)/we_indexlist.o \
$(LIBDIR)/we_indexlist_common.o \
$(LIBDIR)/we_indexlist_find_delete.o \
$(LIBDIR)/we_indexlist_multiple_narray.o \
$(LIBDIR)/we_indexlist_narray.o \
$(LIBDIR)/we_indexlist_update_hdr_sub.o \
$(LIBDIR)/we_indextree.o
LOBJS_DCTNRY= $(LIBDIR)/we_dctnry.o
LOBJS_XML= $(LIBDIR)/we_xmlop.o \
$(LIBDIR)/we_xmljob.o \
$(LIBDIR)/we_xmlgendata.o \
$(LIBDIR)/we_xmlgenproc.o

View File

@ -1,100 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,6,0,0
PRODUCTVERSION 4,6,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "InfiniDB"
VALUE "FileDescription", "InfiniDB Bulk Loader"
VALUE "FileVersion", "4.6.0-0"
VALUE "InternalName", "cpimport"
VALUE "LegalCopyright", "Copyright (C) 2014"
VALUE "OriginalFilename", "cpimport.exe"
VALUE "ProductName", "InfiniDB"
VALUE "ProductVersion", "4.6.0.0 Beta"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -2415,12 +2415,10 @@ void BulkLoadBuffer::tokenize(const boost::ptr_vector<ColumnInfo>& columnsInfo,
//------------------------------------------------------------------ //------------------------------------------------------------------
case FLD_PARSE_ENCLOSED_STATE: case FLD_PARSE_ENCLOSED_STATE:
{ {
char next = *(p + 1);
if ((p + 1 < pEndOfData) && if ((p + 1 < pEndOfData) &&
(((c == ESCAPE_CHAR) && ((next == STRING_ENCLOSED_CHAR) || (next == ESCAPE_CHAR) || (((c == ESCAPE_CHAR) && ((*(p + 1) == STRING_ENCLOSED_CHAR) || (*(p + 1) == ESCAPE_CHAR) ||
(next == LINE_FEED) || (next == CARRIAGE_RETURN))) || (*(p + 1) == LINE_FEED) || (*(p + 1) == CARRIAGE_RETURN))) ||
((c == STRING_ENCLOSED_CHAR) && (next == STRING_ENCLOSED_CHAR)))) ((c == STRING_ENCLOSED_CHAR) && (*(p + 1) == STRING_ENCLOSED_CHAR))))
{ {
// Create/save original data before stripping out bytes // Create/save original data before stripping out bytes
if (rawDataRowLength == 0) if (rawDataRowLength == 0)
@ -2515,7 +2513,7 @@ void BulkLoadBuffer::tokenize(const boost::ptr_vector<ColumnInfo>& columnsInfo,
// cout << "triming ... " << endl; // cout << "triming ... " << endl;
char* tmp = p; char* tmp = p;
while (*(--tmp) == ' ') while (tmp != lastRowHead && *(--tmp) == ' ')
{ {
// cout << "offset is " << offset <<endl; // cout << "offset is " << offset <<endl;
offset--; offset--;

View File

@ -1,102 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,6,0,0
PRODUCTVERSION 4,6,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "InfiniDB, Inc."
VALUE "FileDescription", "InfiniDB Write Engine API"
VALUE "FileVersion", "4.6.0-0"
VALUE "InternalName", "libwriteengine"
VALUE "LegalCopyright", "Copyright (C) 2014"
VALUE "OriginalFilename", "libwriteengine.dll"
VALUE "ProductName", "InfiniDB"
VALUE "ProductVersion", "4.6.0.0 Beta"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -1,102 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,6,0,0
PRODUCTVERSION 4,6,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "InfiniDB, Inc."
VALUE "FileDescription", "InfiniDB Write Engine Server"
VALUE "FileVersion", "4.6.0-0"
VALUE "InternalName", "WriteEngineServer"
VALUE "LegalCopyright", "Copyright (C) 2014"
VALUE "OriginalFilename", "WriteEngineServer.exe"
VALUE "ProductName", "InfiniDB"
VALUE "ProductVersion", "4.6.0.0 Beta"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -60,7 +60,7 @@ namespace WriteEngine
{ {
/*static*/ boost::mutex FileOp::m_createDbRootMutexes; /*static*/ boost::mutex FileOp::m_createDbRootMutexes;
/*static*/ boost::mutex FileOp::m_mkdirMutex; /*static*/ boost::mutex FileOp::m_mkdirMutex;
/*static*/ std::map<int, boost::mutex*> FileOp::m_DbRootAddExtentMutexes; /*static*/ std::map<int, boost::mutex> FileOp::m_DbRootAddExtentMutexes;
// in 1 call to fwrite(), during initialization // in 1 call to fwrite(), during initialization
// StopWatch timer; // StopWatch timer;
@ -993,7 +993,7 @@ int FileOp::initColumnExtent(IDBDataFile* pFile, uint16_t dbRoot, int nBlocks, c
Stats::startParseEvent(WE_STATS_WAIT_TO_CREATE_COL_EXTENT); Stats::startParseEvent(WE_STATS_WAIT_TO_CREATE_COL_EXTENT);
#endif #endif
boost::mutex::scoped_lock lk(*m_DbRootAddExtentMutexes[dbRoot]); boost::mutex::scoped_lock lk(m_DbRootAddExtentMutexes[dbRoot]);
#ifdef PROFILE #ifdef PROFILE
if (bExpandExtent) if (bExpandExtent)
@ -1714,7 +1714,7 @@ int FileOp::initDctnryExtent(IDBDataFile* pFile, uint16_t dbRoot, int nBlocks, u
Stats::startParseEvent(WE_STATS_WAIT_TO_CREATE_DCT_EXTENT); Stats::startParseEvent(WE_STATS_WAIT_TO_CREATE_DCT_EXTENT);
#endif #endif
boost::mutex::scoped_lock lk(*m_DbRootAddExtentMutexes[dbRoot]); boost::mutex::scoped_lock lk(m_DbRootAddExtentMutexes[dbRoot]);
#ifdef PROFILE #ifdef PROFILE
if (bExpandExtent) if (bExpandExtent)
@ -1809,33 +1809,13 @@ void FileOp::initDbRootExtentMutexes()
for (size_t i = 0; i < rootIds.size(); i++) for (size_t i = 0; i < rootIds.size(); i++)
{ {
boost::mutex* pM = new boost::mutex; m_DbRootAddExtentMutexes.emplace(std::piecewise_construct,
m_DbRootAddExtentMutexes[rootIds[i]] = pM; std::forward_as_tuple(rootIds[i]),
std::forward_as_tuple());
} }
} }
} }
/***********************************************************
* DESCRIPTION:
* Cleans up memory allocated to the DBRoot extent mutexes. Calling
* this function is not necessary, but it is provided for completeness,
* to complement initDbRootExtentMutexes(), and to provide a way to
* free up memory at the end of program execution.
***********************************************************/
/* static */
void FileOp::removeDbRootExtentMutexes()
{
boost::mutex::scoped_lock lk(m_createDbRootMutexes);
std::map<int, boost::mutex*>::iterator k = m_DbRootAddExtentMutexes.begin();
while (k != m_DbRootAddExtentMutexes.end())
{
delete k->second;
++k;
}
}
/*********************************************************** /***********************************************************
* DESCRIPTION: * DESCRIPTION:
* Write out (reinitialize) a partial extent in a column file. * Write out (reinitialize) a partial extent in a column file.

View File

@ -443,7 +443,6 @@ class FileOp : public BlockOp, public WeUIDGID
execplan::CalpontSystemCatalog::ColDataType colDataType); execplan::CalpontSystemCatalog::ColDataType colDataType);
static void initDbRootExtentMutexes(); static void initDbRootExtentMutexes();
static void removeDbRootExtentMutexes();
int writeInitialCompColumnChunk(IDBDataFile* pFile, int nBlocksAllocated, int nRows, int writeInitialCompColumnChunk(IDBDataFile* pFile, int nBlocksAllocated, int nRows,
const uint8_t* emptyVal, int width, BRM::LBID_t lbid, const uint8_t* emptyVal, int width, BRM::LBID_t lbid,
@ -457,7 +456,7 @@ class FileOp : public BlockOp, public WeUIDGID
static boost::mutex m_createDbRootMutexes; static boost::mutex m_createDbRootMutexes;
// Mutexes used to serialize extent creation within each DBRoot // Mutexes used to serialize extent creation within each DBRoot
static std::map<int, boost::mutex*> m_DbRootAddExtentMutexes; static std::map<int, boost::mutex> m_DbRootAddExtentMutexes;
// protect race condition in creating directories // protect race condition in creating directories
static boost::mutex m_mkdirMutex; static boost::mutex m_mkdirMutex;

View File

@ -399,8 +399,8 @@ struct JobColumn /** @brief Job Column Structure */
int compressionType; /** @brief compression type */ int compressionType; /** @brief compression type */
bool autoIncFlag; /** @brief auto increment flag */ bool autoIncFlag; /** @brief auto increment flag */
DctnryStruct dctnry; /** @brief dictionary structure */ DctnryStruct dctnry; /** @brief dictionary structure */
int64_t fMinIntSat; /** @brief For integer type, the min saturation value */ int128_t fMinIntSat; /** @brief For integer type, the min saturation value */
uint64_t fMaxIntSat; /** @brief For integer type, the max saturation value */ uint128_t fMaxIntSat; /** @brief For integer type, the max saturation value */
double fMinDblSat; /** @brief for float/double, the min saturation value */ double fMinDblSat; /** @brief for float/double, the min saturation value */
double fMaxDblSat; /** @brief for float/double, the max saturation value */ double fMaxDblSat; /** @brief for float/double, the max saturation value */
bool fWithDefault; /** @brief With default */ bool fWithDefault; /** @brief With default */

View File

@ -1,101 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,6,0,0
PRODUCTVERSION 4,6,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "InfiniDB Bulk Loader"
VALUE "FileVersion", "4.6.0-0"
VALUE "InternalName", "splitter"
VALUE "LegalCopyright", "Copyright (C) 2014"
VALUE "OriginalFilename", "cpimport.exe"
VALUE "ProductName", "InfiniDB"
VALUE "ProductVersion", "4.6.0.0 Beta"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -464,7 +464,7 @@ bool WECmdArgs::str2PmList(std::string& PmList, VecInts& V)
if (aLen > 0) if (aLen > 0)
{ {
strncpy(aBuff, PmList.c_str(), BUFLEN); strncpy(aBuff, PmList.c_str(), BUFLEN - 1);
aBuff[BUFLEN - 1] = 0; aBuff[BUFLEN - 1] = 0;
} }
else else

View File

@ -65,6 +65,7 @@ using namespace idbdatafile;
#include "dataconvert.h" #include "dataconvert.h"
#include "string_prefixes.h" #include "string_prefixes.h"
#include "mcs_decimal.h"
namespace WriteEngine namespace WriteEngine
//#define PROFILE 1 //#define PROFILE 1
@ -917,7 +918,7 @@ int WriteEngineWrapper::fillColumn(const TxnID& txnid, const OID& dataOid,
Column refCol; Column refCol;
ColType newColType; ColType newColType;
ColType refColType; ColType refColType;
boost::scoped_array<char> defVal(new char[MAX_COLUMN_BOUNDARY]); boost::scoped_array<char> defVal(new char[datatypes::MAXDECIMALWIDTH]);
ColumnOp* colOpNewCol = m_colOp[op(compressionType)]; ColumnOp* colOpNewCol = m_colOp[op(compressionType)];
ColumnOp* refColOp = m_colOp[op(refCompressionType)]; ColumnOp* refColOp = m_colOp[op(refCompressionType)];
Dctnry* dctnry = m_dctnry[op(compressionType)]; Dctnry* dctnry = m_dctnry[op(compressionType)];
@ -992,6 +993,29 @@ int WriteEngineWrapper::fillColumn(const TxnID& txnid, const OID& dataOid,
return rc; return rc;
} }
// TODO: Get rid of this
void emptyValueToAny(boost::any* any, const uint8_t* emptyValue, int colWidth)
{
switch (colWidth)
{
case 16:
*any = *(uint128_t*)emptyValue;
break;
case 8:
*any = *(uint64_t*)emptyValue;
break;
case 4:
*any = *(uint32_t*)emptyValue;
break;
case 2:
*any = *(uint16_t*)emptyValue;
break;
default:
*any = *emptyValue;
}
}
int WriteEngineWrapper::deleteRow(const TxnID& txnid, const vector<CSCTypesList>& colExtentsColType, int WriteEngineWrapper::deleteRow(const TxnID& txnid, const vector<CSCTypesList>& colExtentsColType,
vector<ColStructList>& colExtentsStruct, vector<void*>& colOldValueList, vector<ColStructList>& colExtentsStruct, vector<void*>& colOldValueList,
vector<RIDList>& ridLists, const int32_t tableOid, bool hasAUXCol) vector<RIDList>& ridLists, const int32_t tableOid, bool hasAUXCol)
@ -1032,10 +1056,7 @@ int WriteEngineWrapper::deleteRow(const TxnID& txnid, const vector<CSCTypesList>
const uint8_t* emptyVal = m_colOp[op(curColStruct.fCompressionType)]->getEmptyRowValue( const uint8_t* emptyVal = m_colOp[op(curColStruct.fCompressionType)]->getEmptyRowValue(
curColStruct.colDataType, curColStruct.colWidth); curColStruct.colDataType, curColStruct.colWidth);
if (curColStruct.colWidth == datatypes::MAXDECIMALWIDTH) emptyValueToAny(&curTuple.data, emptyVal, curColStruct.colWidth);
curTuple.data = *(int128_t*)emptyVal;
else
curTuple.data = *(int64_t*)emptyVal;
curTupleList.push_back(curTuple); curTupleList.push_back(curTuple);
colValueList.push_back(curTupleList); colValueList.push_back(curTupleList);

View File

@ -21,6 +21,7 @@
*******************************************************************************/ *******************************************************************************/
/** @file */ /** @file */
#include "mcs_basic_types.h"
#define WRITEENGINEXMLJOB_DLLEXPORT #define WRITEENGINEXMLJOB_DLLEXPORT
#include "we_xmljob.h" #include "we_xmljob.h"
#undef WRITEENGINEXMLJOB_DLLEXPORT #undef WRITEENGINEXMLJOB_DLLEXPORT
@ -46,28 +47,6 @@ using namespace execplan;
namespace WriteEngine namespace WriteEngine
{ {
// Maximum saturation value for DECIMAL types based on precision
// TODO MCOL-641 add support here. see dataconvert.cpp
const long long columnstore_precision[19] = {0,
9,
99,
999,
9999,
99999,
999999,
9999999,
99999999,
999999999,
9999999999LL,
99999999999LL,
999999999999LL,
9999999999999LL,
99999999999999LL,
999999999999999LL,
9999999999999999LL,
99999999999999999LL,
999999999999999999LL};
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Constructor // Constructor
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -695,13 +674,14 @@ void XMLJob::initSatLimits(JobColumn& curColumn) const
} }
else if (curColumn.typeName == ColDataTypeStr[CalpontSystemCatalog::DECIMAL]) else if (curColumn.typeName == ColDataTypeStr[CalpontSystemCatalog::DECIMAL])
{ {
curColumn.fMinIntSat = -columnstore_precision[curColumn.precision]; curColumn.fMaxIntSat = dataconvert::decimalRangeUp<int128_t>(curColumn.precision);
curColumn.fMaxIntSat = columnstore_precision[curColumn.precision]; curColumn.fMinIntSat = -curColumn.fMaxIntSat;
} }
else if (curColumn.typeName == ColDataTypeStr[CalpontSystemCatalog::UDECIMAL]) else if (curColumn.typeName == ColDataTypeStr[CalpontSystemCatalog::UDECIMAL])
{ {
curColumn.fMinIntSat = 0; curColumn.fMinIntSat = 0;
curColumn.fMaxIntSat = columnstore_precision[curColumn.precision]; curColumn.fMaxIntSat = dataconvert::decimalRangeUp<int128_t>(curColumn.precision);
} }
else if (curColumn.typeName == ColDataTypeStr[CalpontSystemCatalog::FLOAT]) else if (curColumn.typeName == ColDataTypeStr[CalpontSystemCatalog::FLOAT])
{ {