You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-07 03:22:57 +03:00
chore(codemanagement, ci): better coredumps handling, deps fixed
This commit is contained in:
@@ -88,8 +88,3 @@ set(COMPONENTS
|
||||
foreach(component ${COMPONENTS})
|
||||
add_subdirectory(${component})
|
||||
endforeach()
|
||||
|
||||
add_dependencies(udf_mysql GenError)
|
||||
add_dependencies(funcexp GenError)
|
||||
add_dependencies(oamcpp GenError)
|
||||
add_dependencies(regr_mysql GenError)
|
||||
|
658
build/bootstrap_mcs.py
Normal file
658
build/bootstrap_mcs.py
Normal file
@@ -0,0 +1,658 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
# Color output (simple, for now)
|
||||
def message(text):
|
||||
print(f"\033[1;32m{text}\033[0m")
|
||||
|
||||
def warn(text):
|
||||
print(f"\033[1;33m{text}\033[0m")
|
||||
|
||||
def error(text):
|
||||
print(f"\033[1;31m{text}\033[0m", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
def message_split():
|
||||
print("\n" + "-" * 60 + "\n")
|
||||
|
||||
def message_splitted(text):
|
||||
message_split()
|
||||
message(text)
|
||||
message_split()
|
||||
|
||||
# Paths and env vars
|
||||
SCRIPT_LOCATION = Path(__file__).parent.resolve()
|
||||
MDB_SOURCE_PATH = (SCRIPT_LOCATION / '../../../..').resolve()
|
||||
COLUMSNTORE_SOURCE_PATH = (SCRIPT_LOCATION / '../').resolve()
|
||||
DEFAULT_MARIA_BUILD_PATH = (MDB_SOURCE_PATH.parent / f"BuildOf_{MDB_SOURCE_PATH.name}").resolve()
|
||||
|
||||
# Default values
|
||||
INSTALL_PREFIX = "/usr/"
|
||||
DATA_DIR = "/var/lib/mysql/data"
|
||||
RPM_CONFIG_DIR = "/etc/my.cnf.d"
|
||||
DEB_CONFIG_DIR = "/etc/mysql/mariadb.conf.d"
|
||||
CONFIG_DIR = RPM_CONFIG_DIR
|
||||
GCC_VERSION = "11"
|
||||
DISTRO_OPTIONS = ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04", "debian:11", "debian:12", "rockylinux:8", "rockylinux:9"]
|
||||
|
||||
# Argument parsing
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description="Compile/install MCS from scratch.")
|
||||
parser.add_argument('-A', '--asan', action='store_true', help='Build with ASAN')
|
||||
parser.add_argument('-a', '--build-path', default=str(DEFAULT_MARIA_BUILD_PATH), help='Path for build output')
|
||||
parser.add_argument('-B', '--run-microbench', action='store_true', help='Compile and run microbenchmarks')
|
||||
parser.add_argument('-c', '--cloud', action='store_true', help='Enable cloud storage')
|
||||
parser.add_argument('-C', '--force-cmake-reconfig', action='store_true', help='Force cmake reconfigure')
|
||||
parser.add_argument('-d', '--distro', choices=DISTRO_OPTIONS, help='Choose your OS')
|
||||
parser.add_argument('-D', '--install-deps', action='store_true', help='Install dependencies')
|
||||
parser.add_argument('-F', '--custom-cmake-flags', help='Add custom cmake flags')
|
||||
parser.add_argument('-f', '--do-not-freeze-revision', action='store_true', help="Disable revision freezing")
|
||||
parser.add_argument('-g', '--alien', action='store_true', help='Turn off maintainer mode (ex. -Werror)')
|
||||
parser.add_argument('-G', '--draw-deps', action='store_true', help='Draw dependencies graph')
|
||||
parser.add_argument('-j', '--parallel', type=int, default=os.cpu_count(), help='Number of parallels for build')
|
||||
parser.add_argument('-M', '--skip-smoke', action='store_true', help='Skip final smoke test')
|
||||
parser.add_argument('-N', '--ninja', action='store_true', help='Build with ninja')
|
||||
parser.add_argument('-n', '--no-clean-install', action='store_true', help='Do not perform a clean install')
|
||||
return parser.parse_args()
|
||||
|
||||
def run(cmd, check=True, **kwargs):
|
||||
message(f"Running: {cmd}")
|
||||
result = subprocess.run(cmd, shell=True, check=check, **kwargs)
|
||||
return result
|
||||
|
||||
def retry_eval(retries, cmd):
|
||||
# Simple retry logic for commands
|
||||
for attempt in range(retries):
|
||||
try:
|
||||
run(cmd)
|
||||
return
|
||||
except subprocess.CalledProcessError as e:
|
||||
warn(f"Attempt {attempt+1} failed: {e}")
|
||||
error(f"Command failed after {retries} attempts: {cmd}")
|
||||
|
||||
def change_ubuntu_mirror(region):
|
||||
warn(f"Would change Ubuntu mirror to region: {region} (stub)")
|
||||
|
||||
def detect_distro():
|
||||
# Stub: In bash, this would detect and set OS variable
|
||||
warn("OS detection not implemented. Please specify --distro.")
|
||||
return None
|
||||
|
||||
def install_deps(OS, GCC_VERSION):
|
||||
RPM_BUILD_DEPS = (
|
||||
"dnf install -y lz4 lz4-devel systemd-devel git make libaio-devel openssl-devel boost-devel bison "
|
||||
"snappy-devel flex libcurl-devel libxml2-devel ncurses-devel automake libtool policycoreutils-devel "
|
||||
"rpm-build lsof iproute pam-devel perl-DBI cracklib-devel expect createrepo python3 checkpolicy "
|
||||
"cppunit-devel cmake3 libxcrypt-devel xz-devel zlib-devel libzstd-devel glibc-devel"
|
||||
)
|
||||
DEB_BUILD_DEPS = (
|
||||
"apt-get -y update && apt-get -y install build-essential automake libboost-all-dev "
|
||||
"bison cmake libncurses5-dev python3 libaio-dev libsystemd-dev libpcre2-dev libperl-dev libssl-dev libxml2-dev "
|
||||
"libkrb5-dev flex libpam-dev git libsnappy-dev libcurl4-openssl-dev libgtest-dev libcppunit-dev googletest "
|
||||
"libjemalloc-dev liblz-dev liblzo2-dev liblzma-dev liblz4-dev libbz2-dev libbenchmark-dev libdistro-info-perl "
|
||||
"graphviz devscripts ccache equivs eatmydata curl"
|
||||
)
|
||||
if "rockylinux:8" in OS or "rocky:8" in OS:
|
||||
command = (
|
||||
f"dnf install -y curl 'dnf-command(config-manager)' && dnf config-manager --set-enabled powertools && "
|
||||
f"dnf install -y gcc-toolset-{GCC_VERSION} libarchive cmake && . /opt/rh/gcc-toolset-{GCC_VERSION}/enable && "
|
||||
f"{RPM_BUILD_DEPS}"
|
||||
)
|
||||
elif "rockylinux:9" in OS or "rocky:9" in OS:
|
||||
command = (
|
||||
"dnf install -y 'dnf-command(config-manager)' && dnf config-manager --set-enabled crb && "
|
||||
"dnf install -y pcre2-devel gcc gcc-c++ curl-minimal && "
|
||||
f"{RPM_BUILD_DEPS}"
|
||||
)
|
||||
elif OS.startswith("debian:11") or OS.startswith("debian:12") \
|
||||
or OS.startswith("ubuntu:20.04") or OS.startswith("ubuntu:22.04") or OS.startswith("ubuntu:24.04"):
|
||||
command = DEB_BUILD_DEPS
|
||||
else:
|
||||
error(f"Unsupported OS: {OS}")
|
||||
if OS in ['ubuntu:22.04', 'ubuntu:24.04']:
|
||||
if os.path.exists('/.dockerenv'):
|
||||
change_ubuntu_mirror('us')
|
||||
command += " lto-disabled-list"
|
||||
message(f"Installing dependencies for {OS}")
|
||||
retry_eval(5, command)
|
||||
|
||||
def construct_cmake_flags(args, env_vars):
|
||||
MDB_CMAKE_FLAGS = [
|
||||
'-DBUILD_CONFIG=mysql_release',
|
||||
f'-DCMAKE_BUILD_TYPE={env_vars["MCS_BUILD_TYPE"]}',
|
||||
'-DCMAKE_EXPORT_COMPILE_COMMANDS=1',
|
||||
f'-DCMAKE_INSTALL_PREFIX:PATH={env_vars["INSTALL_PREFIX"]}',
|
||||
'-DMYSQL_MAINTAINER_MODE=NO',
|
||||
'-DPLUGIN_COLUMNSTORE=YES',
|
||||
'-DPLUGIN_CONNECT=NO',
|
||||
'-DPLUGIN_GSSAPI=NO',
|
||||
'-DPLUGIN_MROONGA=NO',
|
||||
'-DPLUGIN_OQGRAPH=NO',
|
||||
'-DPLUGIN_ROCKSDB=NO',
|
||||
'-DPLUGIN_SPHINX=NO',
|
||||
'-DPLUGIN_SPIDER=NO',
|
||||
'-DPLUGIN_TOKUDB=NO',
|
||||
'-DWITH_EMBEDDED_SERVER=NO',
|
||||
'-DWITH_SSL=system',
|
||||
'-DWITH_SYSTEMD=yes',
|
||||
'-DWITH_WSREP=NO',
|
||||
]
|
||||
if env_vars['MAINTAINER_MODE']:
|
||||
MDB_CMAKE_FLAGS.append('-DCOLUMNSTORE_MAINTAINER=YES')
|
||||
message("Columnstore maintainer mode on")
|
||||
else:
|
||||
warn("Maintainer mode is disabled, be careful, alien")
|
||||
if env_vars.get('SKIP_UNIT_TESTS', False):
|
||||
warn("Unittests are not built")
|
||||
else:
|
||||
MDB_CMAKE_FLAGS.append('-DWITH_UNITTESTS=YES')
|
||||
message("Building with unittests")
|
||||
if env_vars['DRAW_DEPS']:
|
||||
warn("Generating dependencies graph to mariadb.dot")
|
||||
MDB_CMAKE_FLAGS.append(f'--graphviz={env_vars["DEP_GRAPH_PATH"]}')
|
||||
if env_vars['USE_NINJA']:
|
||||
warn("Using Ninja instead of Makefiles")
|
||||
MDB_CMAKE_FLAGS.append('-GNinja')
|
||||
if env_vars.get('STATIC_BUILD', False):
|
||||
warn("Building all with static linkage")
|
||||
MDB_CMAKE_FLAGS.append('-DCOLUMNSTORE_STATIC_LIBRARIES:BOOL=ON')
|
||||
if env_vars['ASAN']:
|
||||
warn("Building with Address Sanitizer ")
|
||||
MDB_CMAKE_FLAGS.extend([
|
||||
'-DWITH_ASAN=ON',
|
||||
'-DWITH_COLUMNSTORE_ASAN=ON',
|
||||
f'-DWITH_COLUMNSTORE_REPORT_PATH={env_vars.get("REPORT_PATH", "/tmp")}'
|
||||
])
|
||||
if env_vars.get('TSAN', False):
|
||||
warn("Building with Thread Sanitizer")
|
||||
MDB_CMAKE_FLAGS.extend([
|
||||
'-DWITH_TSAN=ON',
|
||||
f'-DWITH_COLUMNSTORE_REPORT_PATH={env_vars.get("REPORT_PATH", "/tmp")}'
|
||||
])
|
||||
message("Setting vm.mmap_rnd_bits=30 for TSAN support")
|
||||
run('sysctl vm.mmap_rnd_bits=30')
|
||||
if env_vars.get('UBSAN', False):
|
||||
warn("Building with UB Sanitizer")
|
||||
MDB_CMAKE_FLAGS.extend([
|
||||
'-DWITH_UBSAN=ON',
|
||||
f'-DWITH_COLUMNSTORE_REPORT_PATH={env_vars.get("REPORT_PATH", "/tmp")}'
|
||||
])
|
||||
if not env_vars.get('WITHOUT_COREDUMPS', False):
|
||||
warn("Building with CoreDumps")
|
||||
MDB_CMAKE_FLAGS.append('-DWITH_COREDUMPS=ON')
|
||||
if os.path.exists('/.dockerenv'):
|
||||
warn("Build is executed in Docker, core dumps saving path /proc/sys/kernel/core_pattern will not be configured!")
|
||||
else:
|
||||
warn(f"/proc/sys/kernel/core_pattern changed to {env_vars.get('REPORT_PATH', '/tmp')}/core_%e.%p")
|
||||
with open('/proc/sys/kernel/core_pattern', 'w') as f:
|
||||
f.write(f"{env_vars.get('REPORT_PATH', '/tmp')}/core_%e.%p\n")
|
||||
else:
|
||||
warn("Cores are not dumped")
|
||||
if env_vars.get('MAKEFILE_VERBOSE', False):
|
||||
warn("Verbosing Makefile Commands")
|
||||
MDB_CMAKE_FLAGS.append('-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON')
|
||||
if env_vars.get('SCCACHE', False):
|
||||
warn("Use sccache")
|
||||
MDB_CMAKE_FLAGS.extend([
|
||||
'-DCMAKE_C_COMPILER_LAUNCHER=sccache',
|
||||
'-DCMAKE_CXX_COMPILER_LAUNCHER=sccache'
|
||||
])
|
||||
if env_vars['RUN_BENCHMARKS']:
|
||||
if env_vars['MCS_BUILD_TYPE'] == 'Debug':
|
||||
error("Benchmarks will not be built or run in Debug build Mode")
|
||||
MDB_CMAKE_FLAGS.append('-DWITH_MICROBENCHMARKS=NO')
|
||||
env_vars['RUN_BENCHMARKS'] = False
|
||||
elif 'ubuntu' not in env_vars['OS'] and 'debian' not in env_vars['OS']:
|
||||
error("Benchmarks are now available only on Ubuntu or Debian")
|
||||
MDB_CMAKE_FLAGS.append('-DWITH_MICROBENCHMARKS=NO')
|
||||
env_vars['RUN_BENCHMARKS'] = False
|
||||
else:
|
||||
message("Compile with microbenchmarks")
|
||||
MDB_CMAKE_FLAGS.append('-DWITH_MICROBENCHMARKS=YES')
|
||||
else:
|
||||
MDB_CMAKE_FLAGS.append('-DWITH_MICROBENCHMARKS=NO')
|
||||
message("Building without microbenchmarks")
|
||||
CODENAME = None
|
||||
if 'rocky' in env_vars['OS']:
|
||||
OS_VERSION = ''.join(filter(str.isdigit, env_vars['OS']))
|
||||
MDB_CMAKE_FLAGS.append(f'-DRPM=rockylinux{OS_VERSION}')
|
||||
elif env_vars['OS'] == 'debian:11':
|
||||
CODENAME = 'bullseye'
|
||||
elif env_vars['OS'] == 'debian:12':
|
||||
CODENAME = 'bookworm'
|
||||
elif env_vars['OS'] == 'ubuntu:20.04':
|
||||
CODENAME = 'focal'
|
||||
elif env_vars['OS'] == 'ubuntu:22.04':
|
||||
CODENAME = 'jammy'
|
||||
elif env_vars['OS'] == 'ubuntu:24.04':
|
||||
CODENAME = 'noble'
|
||||
else:
|
||||
error(f"Unsupported OS: {env_vars['OS']}")
|
||||
if CODENAME:
|
||||
MDB_CMAKE_FLAGS.append(f'-DDEB={CODENAME}')
|
||||
if env_vars['CUSTOM_CMAKE_FLAGS']:
|
||||
MDB_CMAKE_FLAGS.append(env_vars['CUSTOM_CMAKE_FLAGS'])
|
||||
message("Building with flags")
|
||||
for flag in MDB_CMAKE_FLAGS:
|
||||
print(flag)
|
||||
return MDB_CMAKE_FLAGS
|
||||
|
||||
def init_submodules(SKIP_SUBMODULES, MDB_SOURCE_PATH):
|
||||
if SKIP_SUBMODULES:
|
||||
warn("Skipping initialization of columnstore submodules")
|
||||
else:
|
||||
message("Initialization of columnstore submodules")
|
||||
cwd = os.getcwd()
|
||||
try:
|
||||
os.chdir(MDB_SOURCE_PATH)
|
||||
run("git submodule update --init --recursive")
|
||||
finally:
|
||||
os.chdir(cwd)
|
||||
|
||||
def stop_service():
|
||||
message_split()
|
||||
message("Stopping MariaDB services")
|
||||
run("systemctl stop mariadb", check=False)
|
||||
run("systemctl stop mariadb-columnstore", check=False)
|
||||
run("systemctl stop mcs-storagemanager", check=False)
|
||||
|
||||
import shutil
|
||||
|
||||
def clean_old_installation(REPORT_PATH, DATA_DIR, CONFIG_DIR):
|
||||
message_split()
|
||||
message("Cleaning old installation")
|
||||
paths = [
|
||||
'/var/lib/columnstore/data1/*',
|
||||
'/var/lib/columnstore/data/',
|
||||
'/var/lib/columnstore/local/',
|
||||
'/var/lib/columnstore/storagemanager/*',
|
||||
'/var/log/mariadb/columnstore/*',
|
||||
'/tmp/*',
|
||||
REPORT_PATH,
|
||||
'/var/lib/mysql',
|
||||
'/var/run/mysqld',
|
||||
DATA_DIR,
|
||||
CONFIG_DIR
|
||||
]
|
||||
for p in paths:
|
||||
for path in [str(x) for x in Path('/').glob(p.lstrip('/'))]:
|
||||
try:
|
||||
if os.path.isdir(path):
|
||||
shutil.rmtree(path, ignore_errors=True)
|
||||
elif os.path.isfile(path):
|
||||
os.remove(path)
|
||||
except Exception as e:
|
||||
warn(f"Could not remove {path}: {e}")
|
||||
|
||||
def check_debian_install_file():
|
||||
warn("check_debian_install_file stubbed")
|
||||
|
||||
def generate_svgs():
|
||||
warn("generate_svgs stubbed")
|
||||
|
||||
def check_errorcode():
|
||||
warn("check_errorcode stubbed")
|
||||
|
||||
def build_binary(MARIA_BUILD_PATH, MDB_SOURCE_PATH, FORCE_CMAKE_CONFIG, CMAKE_BIN_NAME, MDB_CMAKE_FLAGS, CPUS):
|
||||
MARIA_BUILD_PATH = Path(MARIA_BUILD_PATH).resolve()
|
||||
message_split()
|
||||
message(f"Building sources in mode")
|
||||
message(f"Compiled artifacts will be written to {MARIA_BUILD_PATH}")
|
||||
MARIA_BUILD_PATH.mkdir(parents=True, exist_ok=True)
|
||||
os.chdir(MDB_SOURCE_PATH)
|
||||
if FORCE_CMAKE_CONFIG:
|
||||
warn("Erasing cmake cache")
|
||||
cache = MARIA_BUILD_PATH / 'CMakeCache.txt'
|
||||
files = MARIA_BUILD_PATH / 'CMakeFiles'
|
||||
if cache.exists():
|
||||
cache.unlink()
|
||||
if files.exists():
|
||||
shutil.rmtree(files, ignore_errors=True)
|
||||
message("Configuring cmake silently")
|
||||
run(f"{CMAKE_BIN_NAME} {' '.join(MDB_CMAKE_FLAGS)} -S{MDB_SOURCE_PATH} -B{MARIA_BUILD_PATH}")
|
||||
message_split()
|
||||
check_debian_install_file()
|
||||
generate_svgs()
|
||||
run(f"{CMAKE_BIN_NAME} --build {MARIA_BUILD_PATH} -j {CPUS}")
|
||||
message("Installing silently")
|
||||
run(f"{CMAKE_BIN_NAME} --install {MARIA_BUILD_PATH}")
|
||||
check_errorcode()
|
||||
message("Adding symbol link to compile_commands.json to the source root")
|
||||
src = MARIA_BUILD_PATH / 'compile_commands.json'
|
||||
dst = Path(MDB_SOURCE_PATH) / 'compile_commands.json'
|
||||
if src.exists():
|
||||
if dst.exists():
|
||||
dst.unlink()
|
||||
dst.symlink_to(src)
|
||||
|
||||
def run_unit_tests(SKIP_UNIT_TESTS, MARIA_BUILD_PATH, CTEST_BIN_NAME):
|
||||
message_split()
|
||||
if SKIP_UNIT_TESTS:
|
||||
warn("Skipping unittests")
|
||||
else:
|
||||
message("Running unittests")
|
||||
cwd = os.getcwd()
|
||||
try:
|
||||
os.chdir(MARIA_BUILD_PATH)
|
||||
run(f"{CTEST_BIN_NAME} . -R columnstore: -j {os.cpu_count()} --progress --output-on-failure")
|
||||
finally:
|
||||
os.chdir(cwd)
|
||||
|
||||
def run_microbenchmarks_tests(RUN_BENCHMARKS, MARIA_BUILD_PATH, CTEST_BIN_NAME):
|
||||
message_split()
|
||||
if not RUN_BENCHMARKS:
|
||||
warn("Skipping microbenchmarks")
|
||||
else:
|
||||
message("Runnning microbenchmarks")
|
||||
cwd = os.getcwd()
|
||||
try:
|
||||
os.chdir(MARIA_BUILD_PATH)
|
||||
run(f"{CTEST_BIN_NAME} . -V -R columnstore_microbenchmarks: -j {os.cpu_count()} --progress")
|
||||
finally:
|
||||
os.chdir(cwd)
|
||||
|
||||
def make_dir(path):
|
||||
Path(path).mkdir(parents=True, exist_ok=True)
|
||||
|
||||
import pwd
|
||||
import grp
|
||||
|
||||
def check_user_and_group(user_or_group):
|
||||
# Try user first, then group
|
||||
try:
|
||||
pwd.getpwnam(user_or_group)
|
||||
message(f"User '{user_or_group}' exists.")
|
||||
return True
|
||||
except KeyError:
|
||||
try:
|
||||
grp.getgrnam(user_or_group)
|
||||
message(f"Group '{user_or_group}' exists.")
|
||||
return True
|
||||
except KeyError:
|
||||
# Try to create as user, fallback to group
|
||||
try:
|
||||
run(f"groupadd {user_or_group}", check=True)
|
||||
message(f"Group '{user_or_group}' created.")
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
run(f"useradd -r -g {user_or_group} {user_or_group}", check=True)
|
||||
message(f"User '{user_or_group}' created.")
|
||||
except Exception as e:
|
||||
warn(f"Failed to create user/group '{user_or_group}': {e}")
|
||||
return False
|
||||
return True
|
||||
|
||||
def fix_config_files(MDB_SOURCE_PATH=None, CONFIG_DIR=None, OS=None):
|
||||
# Example: copy default config if not present
|
||||
import shutil
|
||||
default_cnf = Path(MDB_SOURCE_PATH or '.') / 'storage/columnstore/columnstore/oam/etc/Columnstore.xml'
|
||||
target_cnf = Path(CONFIG_DIR or '/etc/columnstore') / 'Columnstore.xml'
|
||||
try:
|
||||
if not target_cnf.exists() and default_cnf.exists():
|
||||
target_cnf.parent.mkdir(parents=True, exist_ok=True)
|
||||
shutil.copy(str(default_cnf), str(target_cnf))
|
||||
message(f"Copied {default_cnf} to {target_cnf}")
|
||||
else:
|
||||
message(f"Config file {target_cnf} already exists or source missing.")
|
||||
except Exception as e:
|
||||
warn(f"Failed to fix config files: {e}")
|
||||
return False
|
||||
return True
|
||||
|
||||
import psutil
|
||||
|
||||
def start_storage_manager_if_needed(MDB_SOURCE_PATH=None, CONFIG_DIR=None):
|
||||
# Check if storage manager process is running, start if not
|
||||
storage_manager_name = 'mcs-storagemanager'
|
||||
running = any(storage_manager_name in p.name() for p in psutil.process_iter(attrs=['name']))
|
||||
if running:
|
||||
message(f"Storage manager '{storage_manager_name}' already running.")
|
||||
return True
|
||||
try:
|
||||
run(f"systemctl start {storage_manager_name}", check=True)
|
||||
message(f"Started storage manager '{storage_manager_name}'.")
|
||||
return True
|
||||
except Exception as e:
|
||||
warn(f"Failed to start storage manager '{storage_manager_name}': {e}")
|
||||
return False
|
||||
|
||||
def install(RECOMPILE_ONLY, EUID, REPORT_PATH, CONFIG_DIR, MDB_SOURCE_PATH, OS, DEBCONFIG_DIR, INSTALL_PREFIX, DATA_DIR):
|
||||
if not RECOMPILE_ONLY:
|
||||
if EUID != 0:
|
||||
error("Please run script as root to install MariaDb to system paths")
|
||||
sys.exit(1)
|
||||
message_split()
|
||||
message("Installing MariaDB")
|
||||
# disable_plugins_for_bootstrap stubbed
|
||||
make_dir(REPORT_PATH)
|
||||
run(f"chmod 777 {REPORT_PATH}")
|
||||
check_user_and_group("mysql")
|
||||
check_user_and_group("syslog")
|
||||
make_dir(CONFIG_DIR)
|
||||
with open(f"{CONFIG_DIR}/socket.cnf", "w") as f:
|
||||
f.write("[client-server]\n socket=/run/mysqld/mysqld.sock\n")
|
||||
make_dir("/var/lib/mysql")
|
||||
message("Running mysql_install_db")
|
||||
run("sudo -u mysql mysql_install_db --rpm --user=mysql > /dev/null")
|
||||
# enable_columnstore_back stubbed
|
||||
make_dir("/etc/columnstore")
|
||||
run(f"cp {MDB_SOURCE_PATH}/storage/columnstore/columnstore/oam/etc/Columnstore.xml /etc/columnstore/Columnstore.xml")
|
||||
run(f"cp {MDB_SOURCE_PATH}/storage/columnstore/columnstore/storage-manager/storagemanager.cnf /etc/columnstore/storagemanager.cnf")
|
||||
run(f"cp {MDB_SOURCE_PATH}/storage/columnstore/columnstore/oam/install_scripts/*.service /lib/systemd/system/")
|
||||
if "ubuntu" in OS or "debian" in OS:
|
||||
make_dir("/usr/share/mysql")
|
||||
make_dir("/etc/mysql/")
|
||||
run(f"cp {MDB_SOURCE_PATH}/debian/additions/debian-start.inc.sh /usr/share/mysql/debian-start.inc.sh")
|
||||
run(f"cp {MDB_SOURCE_PATH}/debian/additions/debian-start /etc/mysql/debian-start")
|
||||
Path("/etc/mysql/debian.cnf").touch()
|
||||
fix_config_files()
|
||||
if Path(DEBCONFIG_DIR).is_dir():
|
||||
message(f"Copying configs from {DEBCONFIG_DIR} to {CONFIG_DIR}")
|
||||
run(f"cp -rp {DEBCONFIG_DIR}/* {CONFIG_DIR}")
|
||||
make_dir("/var/lib/columnstore/data1")
|
||||
make_dir("/var/lib/columnstore/data1/systemFiles")
|
||||
make_dir("/var/lib/columnstore/data1/systemFiles/dbrm")
|
||||
make_dir("/run/mysqld/")
|
||||
make_dir(DATA_DIR)
|
||||
run(f"chmod +x {INSTALL_PREFIX}/bin/mariadb*")
|
||||
run("ldconfig")
|
||||
start_storage_manager_if_needed()
|
||||
message("Running columnstore-post-install")
|
||||
make_dir("/var/lib/columnstore/local")
|
||||
run("columnstore-post-install --rpmmode=install")
|
||||
message("Running install_mcs_mysql")
|
||||
run("install_mcs_mysql.sh")
|
||||
run("chown -R syslog:syslog /var/log/mariadb/")
|
||||
run("chmod 777 /var/log/mariadb/")
|
||||
run("chmod 777 /var/log/mariadb/columnstore")
|
||||
|
||||
import time
|
||||
|
||||
def check_service(service, retries=3, delay=2):
|
||||
for attempt in range(1, retries+1):
|
||||
result = subprocess.run(f"systemctl is-active {service}", shell=True, capture_output=True, text=True)
|
||||
status = result.stdout.strip()
|
||||
if status == 'active':
|
||||
message(f"Service '{service}' is active.")
|
||||
return True
|
||||
else:
|
||||
warn(f"Service '{service}' not active (attempt {attempt}/{retries}), status: {status}")
|
||||
if attempt < retries:
|
||||
time.sleep(delay)
|
||||
error(f"Service '{service}' failed to become active after {retries} attempts.")
|
||||
return False
|
||||
|
||||
def start_service():
|
||||
message_split()
|
||||
message("Starting MariaDB services")
|
||||
run("systemctl start mariadb-columnstore", check=False)
|
||||
run("systemctl start mariadb", check=False)
|
||||
for svc in ["mariadb", "mariadb-columnstore", "mcs-controllernode", "mcs-ddlproc", "mcs-dmlproc", "mcs-primproc", "mcs-workernode@1", "mcs-writeengineserver"]:
|
||||
check_service(svc)
|
||||
|
||||
def smoke(SKIP_SMOKE, MDB_SOURCE_PATH):
|
||||
if not SKIP_SMOKE:
|
||||
message_split()
|
||||
message("Creating test database")
|
||||
run("mariadb -e 'create database if not exists test;'")
|
||||
message("Selecting magic numbers")
|
||||
sql_path = Path(MDB_SOURCE_PATH) / "storage/columnstore/columnstore/tests/scripts/smoke.sql"
|
||||
result = subprocess.run(f"mysql -N test < {sql_path}", shell=True, capture_output=True, text=True)
|
||||
MAGIC = result.stdout.strip()
|
||||
if MAGIC == '42':
|
||||
message("Great answer correct!")
|
||||
else:
|
||||
warn(f"Smoke failed, answer is '{MAGIC}'")
|
||||
|
||||
def disable_git_restore_frozen_revision(MDB_SOURCE_PATH):
|
||||
cwd = os.getcwd()
|
||||
try:
|
||||
os.chdir(MDB_SOURCE_PATH)
|
||||
run("git config submodule.storage/columnstore/columnstore.update none")
|
||||
finally:
|
||||
os.chdir(cwd)
|
||||
|
||||
def modify_packaging(OS, MDB_SOURCE_PATH):
|
||||
print("Modifying packaging...")
|
||||
cwd = os.getcwd()
|
||||
try:
|
||||
os.chdir(MDB_SOURCE_PATH)
|
||||
# Stub: pkg_format detection
|
||||
pkg_format = 'deb' if 'debian' in OS or 'ubuntu' in OS else 'rpm'
|
||||
if pkg_format == "deb":
|
||||
run("sed -i 's|.*-d storage/columnstore.*|elif [[ -d storage/columnstore/columnstore/debian ]]|' debian/autobake-deb.sh")
|
||||
if OS in ['ubuntu:22.04', 'ubuntu:24.04']:
|
||||
for i in ["mariadb-plugin-columnstore", "mariadb-server", "mariadb-server-core", "mariadb", "mariadb-10.6"]:
|
||||
run(f"echo '{i} any' >> /usr/share/lto-disabled-list/lto-disabled-list")
|
||||
run("grep mariadb /usr/share/lto-disabled-list/lto-disabled-list")
|
||||
if pkg_format == "deb":
|
||||
run("apt-cache madison liburing-dev | grep liburing-dev || { sed 's/liburing-dev/libaio-dev/g' -i debian/control && sed '/-DIGNORE_AIO_CHECK=YES/d' -i debian/rules && sed '/-DWITH_URING=yes/d' -i debian/rules; }")
|
||||
run("apt-cache madison libpmem-dev | grep 'libpmem-dev' || { sed '/libpmem-dev/d' -i debian/control && sed '/-DWITH_PMEM/d' -i debian/rules; }")
|
||||
run("sed '/libfmt-dev/d' -i debian/control")
|
||||
run("sed -i '/-DPLUGIN_COLUMNSTORE=NO/d' debian/rules")
|
||||
run("sed -i 's/--fail-missing/--list-missing/' debian/rules")
|
||||
for i in ["mariadb-plugin", "libmariadbd"]:
|
||||
run(f"sed -i '/Package: {i}.*/,/^$/d' debian/control")
|
||||
run("sed -i 's/Depends: galera.*/Depends:/' debian/control")
|
||||
for i in ["galera", "wsrep", "ha_sphinx", "embedded"]:
|
||||
run(f"sed -i '/{i}/d' debian/*.install")
|
||||
finally:
|
||||
os.chdir(cwd)
|
||||
|
||||
def build_package(OS, MDB_SOURCE_PATH, MDB_CMAKE_FLAGS):
|
||||
cwd = os.getcwd()
|
||||
try:
|
||||
os.chdir(MDB_SOURCE_PATH)
|
||||
pkg_format = 'deb' if 'debian' in OS or 'ubuntu' in OS else 'rpm'
|
||||
if pkg_format == 'rpm':
|
||||
command = f"cmake {' '.join(MDB_CMAKE_FLAGS)} && make -j$(nproc) package"
|
||||
else:
|
||||
command = (
|
||||
"export DEBIAN_FRONTEND=noninteractive; "
|
||||
"export DEB_BUILD_OPTIONS=parallel=$(nproc); "
|
||||
"export DH_BUILD_DDEBS=1; "
|
||||
"export BUILDPACKAGE_FLAGS=-b; "
|
||||
"mk-build-deps debian/control -t 'apt-get -y -o Debug::pkgProblemResolver=yes --no-install-recommends' -r -i && "
|
||||
f'CMAKEFLAGS="{' '.join(MDB_CMAKE_FLAGS)}" debian/autobake-deb.sh'
|
||||
)
|
||||
print(f"Building a package for {OS}")
|
||||
print(f"Build command: {command}")
|
||||
run(command)
|
||||
check_errorcode()
|
||||
finally:
|
||||
os.chdir(cwd)
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
message(f"Arguments received: {sys.argv[1:]}")
|
||||
|
||||
# Set up variables from args and defaults
|
||||
ASAN = args.asan
|
||||
MARIA_BUILD_PATH = Path(args.build_path).resolve()
|
||||
RUN_BENCHMARKS = args.run_microbench
|
||||
CLOUD_STORAGE_ENABLED = args.cloud
|
||||
FORCE_CMAKE_CONFIG = args.force_cmake_reconfig
|
||||
OS = args.distro
|
||||
INSTALL_DEPS = args.install_deps
|
||||
CUSTOM_CMAKE_FLAGS = args.custom_cmake_flags
|
||||
DO_NOT_FREEZE_REVISION = args.do_not_freeze_revision
|
||||
MAINTAINER_MODE = not args.alien
|
||||
DRAW_DEPS = args.draw_deps
|
||||
CPUS = args.parallel
|
||||
SKIP_SMOKE = args.skip_smoke
|
||||
USE_NINJA = args.ninja
|
||||
NO_CLEAN = args.no_clean_install
|
||||
# Reasonable defaults for unmapped variables
|
||||
BUILD_PACKAGES = False
|
||||
RESTART_SERVICES = True
|
||||
RECOMPILE_ONLY = False
|
||||
SKIP_UNIT_TESTS = False
|
||||
STATIC_BUILD = False
|
||||
TSAN = False
|
||||
UBSAN = False
|
||||
WITHOUT_COREDUMPS = False
|
||||
MAKEFILE_VERBOSE = False
|
||||
SCCACHE = False
|
||||
REPORT_PATH = "/tmp/mcs_report"
|
||||
DEBCONFIG_DIR = "/etc/mysql/mariadb.conf.d"
|
||||
CMAKE_BIN_NAME = "cmake"
|
||||
CTEST_BIN_NAME = "ctest"
|
||||
INSTALL_PREFIX = "/usr/"
|
||||
DATA_DIR = "/var/lib/mysql/data"
|
||||
CONFIG_DIR = "/etc/my.cnf.d"
|
||||
MDB_SOURCE_PATH = (Path(__file__).parent / '../../../..').resolve()
|
||||
MDB_SOURCE_PATH = str(MDB_SOURCE_PATH)
|
||||
# Compose env_vars for construct_cmake_flags
|
||||
env_vars = {
|
||||
'MCS_BUILD_TYPE': 'RelWithDebInfo',
|
||||
'INSTALL_PREFIX': INSTALL_PREFIX,
|
||||
'MAINTAINER_MODE': MAINTAINER_MODE,
|
||||
'SKIP_UNIT_TESTS': SKIP_UNIT_TESTS,
|
||||
'DRAW_DEPS': DRAW_DEPS,
|
||||
'DEP_GRAPH_PATH': str(MARIA_BUILD_PATH) + "/dependency_graph/mariadb.dot",
|
||||
'USE_NINJA': USE_NINJA,
|
||||
'STATIC_BUILD': STATIC_BUILD,
|
||||
'ASAN': ASAN,
|
||||
'TSAN': TSAN,
|
||||
'UBSAN': UBSAN,
|
||||
'WITHOUT_COREDUMPS': WITHOUT_COREDUMPS,
|
||||
'MAKEFILE_VERBOSE': MAKEFILE_VERBOSE,
|
||||
'SCCACHE': SCCACHE,
|
||||
'RUN_BENCHMARKS': RUN_BENCHMARKS,
|
||||
'OS': OS,
|
||||
'CUSTOM_CMAKE_FLAGS': CUSTOM_CMAKE_FLAGS,
|
||||
'REPORT_PATH': REPORT_PATH,
|
||||
}
|
||||
|
||||
if INSTALL_DEPS:
|
||||
install_deps(OS, "11")
|
||||
|
||||
if not DO_NOT_FREEZE_REVISION:
|
||||
disable_git_restore_frozen_revision(MDB_SOURCE_PATH)
|
||||
|
||||
MDB_CMAKE_FLAGS = construct_cmake_flags(args, env_vars)
|
||||
init_submodules(False, MDB_SOURCE_PATH)
|
||||
|
||||
if not BUILD_PACKAGES:
|
||||
stop_service()
|
||||
if not NO_CLEAN:
|
||||
clean_old_installation(REPORT_PATH, DATA_DIR, CONFIG_DIR)
|
||||
build_binary(MARIA_BUILD_PATH, MDB_SOURCE_PATH, FORCE_CMAKE_CONFIG, CMAKE_BIN_NAME, MDB_CMAKE_FLAGS, CPUS)
|
||||
run_unit_tests(SKIP_UNIT_TESTS, MARIA_BUILD_PATH, CTEST_BIN_NAME)
|
||||
run_microbenchmarks_tests(RUN_BENCHMARKS, MARIA_BUILD_PATH, CTEST_BIN_NAME)
|
||||
install(RECOMPILE_ONLY, os.geteuid(), REPORT_PATH, CONFIG_DIR, MDB_SOURCE_PATH, OS, DEBCONFIG_DIR, INSTALL_PREFIX, DATA_DIR)
|
||||
if RESTART_SERVICES:
|
||||
start_service()
|
||||
smoke(SKIP_SMOKE, MDB_SOURCE_PATH)
|
||||
else:
|
||||
modify_packaging(OS, MDB_SOURCE_PATH)
|
||||
build_package(OS, MDB_SOURCE_PATH, MDB_CMAKE_FLAGS)
|
||||
message_splitted("FINISHED")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@@ -18,7 +18,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "basic/conststring.h"
|
||||
#include "basic/collation.h" // class Charset
|
||||
#include "mariadb_charset/collation.h" // class Charset
|
||||
|
||||
namespace datatypes
|
||||
{
|
||||
|
@@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <stdexcept>
|
||||
#include "basic/collation.h" // CHARSET_INFO
|
||||
#include "mariadb_charset/collation.h" // CHARSET_INFO
|
||||
#include "ddlpkg.h"
|
||||
#include "mariadb_my_sys.h" // myf, MYF()
|
||||
|
||||
|
@@ -13,4 +13,4 @@ set(ddlpackageproc_LIB_SRCS
|
||||
)
|
||||
|
||||
columnstore_library(ddlpackageproc ${ddlpackageproc_LIB_SRCS})
|
||||
columnstore_link(ddlpackageproc ${NETSNMP_LIBRARIES} loggingcpp oamcpp messageqcpp)
|
||||
columnstore_link(ddlpackageproc loggingcpp oamcpp messageqcpp)
|
||||
|
@@ -13,4 +13,4 @@ set(dmlpackageproc_LIB_SRCS
|
||||
)
|
||||
|
||||
columnstore_library(dmlpackageproc ${dmlpackageproc_LIB_SRCS})
|
||||
columnstore_link(dmlpackageproc ${NETSNMP_LIBRARIES} loggingcpp oamcpp messageqcpp)
|
||||
columnstore_link(dmlpackageproc loggingcpp oamcpp messageqcpp)
|
||||
|
@@ -49,7 +49,6 @@ columnstore_library(execplan ${execplan_LIB_SRCS})
|
||||
columnstore_link(
|
||||
execplan
|
||||
messageqcpp
|
||||
${NETSNMP_LIBRARIES}
|
||||
${ENGINE_DT_LIB}
|
||||
pron
|
||||
oamcpp
|
||||
|
@@ -49,7 +49,7 @@
|
||||
#undef max
|
||||
|
||||
#include "mcs_datatype.h"
|
||||
#include "basic/collation.h" // CHARSET_INFO, class Charset
|
||||
#include "mariadb_charset/collation.h" // CHARSET_INFO, class Charset
|
||||
#include "nullstring.h"
|
||||
|
||||
class ExecPlanTest;
|
||||
|
@@ -47,8 +47,6 @@ using namespace logging;
|
||||
|
||||
#include "clientrotator.h"
|
||||
|
||||
//#include "idb_mysql.h"
|
||||
|
||||
/** Debug macro */
|
||||
#ifdef INFINIDB_DEBUG
|
||||
#define IDEBUG(x) \
|
||||
|
@@ -39,7 +39,7 @@
|
||||
#include "returnedcolumn.h"
|
||||
#include "dataconvert.h"
|
||||
|
||||
#include "basic/collation.h" // CHARSET_INFO
|
||||
#include "mariadb_charset/collation.h" // CHARSET_INFO
|
||||
|
||||
namespace messageqcpp
|
||||
{
|
||||
|
@@ -28,7 +28,7 @@ using namespace std;
|
||||
#include "basic/string_utils.h"
|
||||
|
||||
#include "bytestream.h"
|
||||
#include "basic/collation.h"
|
||||
#include "mariadb_charset/collation.h"
|
||||
|
||||
using namespace messageqcpp;
|
||||
|
||||
|
@@ -68,7 +68,15 @@ columnstore_library(joblist ${joblist_LIB_SRCS})
|
||||
target_include_directories(
|
||||
joblist BEFORE PUBLIC ${OPENSSL_INCLUDE_DIR} ${LIBMARIADB_BININC_DIR} ${LIBMARIADB_SRCINC_DIR}
|
||||
)
|
||||
columnstore_link(joblist loggingcpp boost_thread oamcpp querytele messageqcpp)
|
||||
columnstore_link(
|
||||
joblist
|
||||
loggingcpp
|
||||
boost_thread
|
||||
oamcpp
|
||||
querytele
|
||||
messageqcpp
|
||||
statistics_manager
|
||||
)
|
||||
|
||||
if(WITH_ORDERBY_UT)
|
||||
columnstore_executable(job_orderby_tests orderby-tests.cpp)
|
||||
|
@@ -71,7 +71,7 @@ using namespace dataconvert;
|
||||
#include "jlf_tuplejoblist.h"
|
||||
using namespace joblist;
|
||||
|
||||
#include "statistics.h"
|
||||
#include "statistics_manager/statistics.h"
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
|
@@ -63,7 +63,7 @@ if(COMMAND mysql_add_plugin)
|
||||
${PLUGIN_EXEC_LIBS}
|
||||
${PLUGIN_WRITE_LIBS}
|
||||
joblist_server
|
||||
${NETSNMP_LIBRARIES}
|
||||
statistics_manager
|
||||
${MARIADB_CLIENT_LIBS}
|
||||
${S3API_DEPS}
|
||||
threadpool
|
||||
@@ -89,10 +89,10 @@ else()
|
||||
${S3API_DEPS}
|
||||
${ENGINE_LDFLAGS}
|
||||
${ENGINE_WRITE_LIBS}
|
||||
${NETSNMP_LIBRARIES}
|
||||
${SERVER_BUILD_DIR}/libservices/libmysqlservices.a
|
||||
threadpool
|
||||
loggingcpp
|
||||
statistics_manager
|
||||
marias3
|
||||
)
|
||||
# define this dummy target for standalone builds (ie, when mysql_add_plugin doesn't exist)
|
||||
|
@@ -128,9 +128,9 @@ using namespace funcexp;
|
||||
#include "ha_mcs_sysvars.h"
|
||||
|
||||
#include "ha_mcs_datatype.h"
|
||||
#include "statistics.h"
|
||||
#include "ha_mcs_logging.h"
|
||||
#include "ha_subquery.h"
|
||||
#include "statistics_manager/statistics.h"
|
||||
|
||||
namespace cal_impl_if
|
||||
{
|
||||
|
@@ -14,10 +14,17 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
// One include file to deal with all the MySQL pollution of the
|
||||
// global namespace
|
||||
//
|
||||
// Don't include ANY mysql headers anywhere except here!
|
||||
|
||||
/* One include file to deal with all the MySQL pollution of the
|
||||
global namespace
|
||||
|
||||
Don't include ANY mysql headers anywhere except here!
|
||||
|
||||
WARN: if any cmake build target uses this include file,
|
||||
GenError from server must be added to the target dependencies
|
||||
to generate mysqld_error.h used below
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef TEST_MCSCONFIG_H
|
||||
|
@@ -6,4 +6,4 @@ set(DDLProc_SRCS ddlproc.cpp ddlprocessor.cpp ../utils/common/crashtrace.cpp)
|
||||
|
||||
columnstore_executable(DDLProc ${DDLProc_SRCS})
|
||||
|
||||
columnstore_link(DDLProc ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS} ${NETSNMP_LIBRARIES} threadpool loggingcpp)
|
||||
columnstore_link(DDLProc ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS} threadpool loggingcpp)
|
||||
|
@@ -12,7 +12,6 @@ columnstore_link(
|
||||
DMLProc
|
||||
${ENGINE_LDFLAGS}
|
||||
${ENGINE_WRITE_LIBS}
|
||||
${NETSNMP_LIBRARIES}
|
||||
threadpool
|
||||
ddlcleanuputil
|
||||
batchloader
|
||||
|
@@ -1,16 +0,0 @@
|
||||
include_directories(${ENGINE_COMMON_INCLUDES})
|
||||
|
||||
# ########## next target ###############
|
||||
|
||||
set(columnstoreSupport_SRCS columnstoreSupport.cpp mcsSupportUtil.cpp)
|
||||
|
||||
columnstore_executable(columnstoreSupport ${columnstoreSupport_SRCS})
|
||||
target_compile_options(columnstoreSupport PRIVATE -Wno-unused-result)
|
||||
columnstore_link(columnstoreSupport ${ENGINE_LDFLAGS} ncurses ${ENGINE_EXEC_LIBS})
|
||||
|
||||
columnstore_install_program(dbmsReport.sh, ${ENGINE_BINDIR})
|
||||
columnstore_install_program(bulklogReport.sh, ${ENGINE_BINDIR})
|
||||
columnstore_install_program(configReport.sh, ${ENGINE_BINDIR})
|
||||
columnstore_install_program(hardwareReport.sh, ${ENGINE_BINDIR})
|
||||
columnstore_install_program(logReport.sh, ${ENGINE_BINDIR})
|
||||
columnstore_install_program(resourceReport.sh, ${ENGINE_BINDIR})
|
@@ -1,39 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# $Id: logReport.sh 421 2007-04-05 15:46:55Z dhill $
|
||||
#
|
||||
if [ $1 ] ; then
|
||||
SERVER=$1
|
||||
else
|
||||
SERVER="localhost"
|
||||
fi
|
||||
|
||||
if [ $2 ] ; then
|
||||
DATE=$2
|
||||
else
|
||||
DATE=" "
|
||||
fi
|
||||
|
||||
#get temp directory
|
||||
tmpDir=`mcsGetConfig SystemConfig SystemTempFileDir`
|
||||
|
||||
rm -f ${tmpDir}/logReport.log
|
||||
|
||||
{
|
||||
echo " "
|
||||
echo "******************** Alarm Report for $SERVER ********************"
|
||||
echo " "
|
||||
|
||||
echo "-- Today's Alarms --"
|
||||
echo " "
|
||||
cat /var/log/mariadb/columnstore/alarm.log 2>/dev/null
|
||||
|
||||
if test -f /var/log/mariadb/columnstore/archive/alarm.log-$DATE ; then
|
||||
echo "-- Archived Alarms --"
|
||||
echo " "
|
||||
cat /var/log/mariadb/columnstore/archive/alarm.log-$DATE 2>/dev/null
|
||||
fi
|
||||
|
||||
} > ${tmpDir}/logReport.log
|
||||
|
||||
exit 0
|
@@ -1,60 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Estimates the row count for a given table. Uses number of extents * 8M for the estimate.
|
||||
#
|
||||
|
||||
#
|
||||
# Initialize variables.
|
||||
#
|
||||
|
||||
if [ -z "$MYSQLCMD" ]; then
|
||||
MYSQLCMD="mysql -u root"
|
||||
fi
|
||||
|
||||
#
|
||||
# Validate that there are two parameters - schema and table.
|
||||
#
|
||||
if [ $# -ne 2 ]; then
|
||||
echo ""
|
||||
echo "Reports the approximate row count for the given table."
|
||||
echo ""
|
||||
echo "Parameters:"
|
||||
echo " Schema"
|
||||
echo " Table"
|
||||
fi
|
||||
db=$1
|
||||
table=$2
|
||||
|
||||
#
|
||||
# Validate that the table exists.
|
||||
#
|
||||
sql="select count(*) from systable where \`schema\`='$db' and tablename='$table';"
|
||||
count=`$MYSQLCMD calpontsys --skip-column-names -e "$sql;"`
|
||||
if [ $count -le 0 ]; then
|
||||
echo ""
|
||||
echo "$db.$table does not exist in Columnstore."
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Grab the objectid and column width for a column in the table.
|
||||
#
|
||||
sql="select objectid from syscolumn where \`schema\`='$db' and tablename='$table' limit 1;"
|
||||
objectid=`$MYSQLCMD calpontsys --skip-column-names -e "$sql"`
|
||||
sql="select columnlength from syscolumn where objectid=$objectid;"
|
||||
colWidth=`$MYSQLCMD calpontsys --skip-column-names -e "$sql"`
|
||||
|
||||
#
|
||||
# Use editem to count the extents.
|
||||
#
|
||||
extentCount=`editem -o $objectid | wc -l`
|
||||
let extentCount-=2 # Take out the 2 extra rows for header and blank line at end.
|
||||
let approximateRowCount=$extentCount*8192*1024;
|
||||
|
||||
echo ""
|
||||
echo "Approximate row count for $db.$table is $approximateRowCount."
|
||||
echo ""
|
||||
|
||||
exit 0
|
@@ -1,30 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# $Id: logReport.sh 421 2007-04-05 15:46:55Z dhill $
|
||||
#
|
||||
if [ $1 ] ; then
|
||||
MODULE=$1
|
||||
else
|
||||
MODULE="pm1"
|
||||
fi
|
||||
|
||||
if [ $2 ] ; then
|
||||
OUT_FILE=$2
|
||||
else
|
||||
OUT_FILE=${MODULE}_logReport.txt
|
||||
fi
|
||||
|
||||
{
|
||||
|
||||
if test -d /var/lib/columnstore/data/bulk ; then
|
||||
echo " "
|
||||
echo "-- Check for Errors in Bulk Logs --"
|
||||
echo " "
|
||||
echo "################# egrep '(ERR|CRIT)' /var/lib/columnstore/data/bulk/log/*.err #################"
|
||||
echo " "
|
||||
egrep '(ERR|CRIT)' /var/lib/columnstore/data/bulk/log/*.err 2>/dev/null
|
||||
fi
|
||||
|
||||
} >> $OUT_FILE
|
||||
|
||||
exit 0
|
@@ -1,897 +0,0 @@
|
||||
/* Copyright (C) 2013 Calpont Corp. */
|
||||
/* Copyright (C) 2016 MariaDB Corporation */
|
||||
|
||||
/******************************************************************************************
|
||||
* $Id: columnstoreSupport.cpp 64 2006-10-12 22:21:51Z dhill $
|
||||
*
|
||||
*
|
||||
*
|
||||
******************************************************************************************/
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
#include <iterator>
|
||||
#include <numeric>
|
||||
#include <deque>
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
#include <fstream>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <limits.h>
|
||||
#include <sstream>
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
#include "stdio.h"
|
||||
#include "ctype.h"
|
||||
#include <netdb.h>
|
||||
#include <readline.h>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include "mcsconfig.h"
|
||||
#include "liboamcpp.h"
|
||||
#include "configcpp.h"
|
||||
#include "installdir.h"
|
||||
#include "mcsSupportUtil.h"
|
||||
#include "columnstoreversion.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace oam;
|
||||
using namespace config;
|
||||
|
||||
typedef struct Child_Module_struct
|
||||
{
|
||||
std::string moduleName;
|
||||
std::string moduleIP;
|
||||
std::string hostName;
|
||||
} ChildModule;
|
||||
|
||||
typedef std::vector<ChildModule> ChildModuleList;
|
||||
|
||||
string currentDate;
|
||||
string systemName;
|
||||
string localModule;
|
||||
string localModuleHostName;
|
||||
ChildModuleList childmodulelist;
|
||||
ChildModuleList parentmodulelist;
|
||||
ChildModule childmodule;
|
||||
|
||||
string rootPassword = "";
|
||||
string debug_flag = "0";
|
||||
string mysqlpw = " ";
|
||||
string tmpDir;
|
||||
|
||||
int runningThreads = 0;
|
||||
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
typedef boost::tuple<ChildModuleList::iterator, string> threadInfo_t;
|
||||
|
||||
bool LOCAL = false;
|
||||
|
||||
void* childReportThread(threadInfo_t* st)
|
||||
{
|
||||
assert(st);
|
||||
ChildModuleList::iterator& list = boost::get<0>(*st);
|
||||
string reportType = boost::get<1>(*st);
|
||||
|
||||
string remoteModuleName = (*list).moduleName;
|
||||
string remoteModuleIP = (*list).moduleIP;
|
||||
string remoteHostName = (*list).hostName;
|
||||
|
||||
pthread_mutex_lock(&mutex1);
|
||||
runningThreads++;
|
||||
// cout << "++ " << runningThreads << endl;
|
||||
pthread_mutex_unlock(&mutex1);
|
||||
|
||||
string outputFile;
|
||||
|
||||
if (reportType == "log")
|
||||
{
|
||||
outputFile = remoteModuleName + "_" + reportType + "Report.tar.gz";
|
||||
}
|
||||
else
|
||||
{
|
||||
outputFile = remoteModuleName + "_" + reportType + "Report.txt";
|
||||
|
||||
FILE* pOutputFile = fopen(outputFile.c_str(), "a");
|
||||
if (pOutputFile == NULL)
|
||||
{
|
||||
printf("Could not open file: %s", outputFile.c_str());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fprintf(pOutputFile,
|
||||
"********************************************************************************\n"
|
||||
"\n"
|
||||
" System %s\n"
|
||||
" columnstoreSupportReport script ran from Module %s on %s\n"
|
||||
" SoftwareVersion = %s-%s"
|
||||
"\n"
|
||||
"********************************************************************************\n"
|
||||
"\n"
|
||||
" %s report\n"
|
||||
"\n"
|
||||
"********************************************************************************\n",
|
||||
systemName.c_str(), localModule.c_str(), currentDate.c_str(), columnstore_version.c_str(),
|
||||
columnstore_release.c_str(), reportType.c_str());
|
||||
}
|
||||
|
||||
cout << "Get " + reportType + " report data for " + remoteModuleName + " " << endl;
|
||||
|
||||
string cmd = "remote_command.sh " + remoteModuleIP + " " + rootPassword + ";" + reportType + "Report.sh " +
|
||||
remoteModuleName + "' " + debug_flag + " - forcetty";
|
||||
int rtnCode = system(cmd.c_str());
|
||||
|
||||
if (WEXITSTATUS(rtnCode) != 0)
|
||||
{
|
||||
cout << "Error with running remote_command.sh, exiting..." << endl;
|
||||
}
|
||||
|
||||
cmd = "remote_scp_get.sh " + remoteModuleIP + " " + rootPassword + " " + tmpDir + "/" + outputFile +
|
||||
" > /dev/null 2>&1";
|
||||
rtnCode = system(cmd.c_str());
|
||||
|
||||
if (WEXITSTATUS(rtnCode) != 0)
|
||||
cout << "ERROR: failed to retrieve " << tmpDir << "/" << outputFile << " from " + remoteHostName << endl;
|
||||
|
||||
pthread_mutex_lock(&mutex1);
|
||||
runningThreads--;
|
||||
// cout << "-- " << runningThreads << endl;
|
||||
pthread_mutex_unlock(&mutex1);
|
||||
|
||||
// exit thread
|
||||
pthread_exit(0);
|
||||
}
|
||||
|
||||
void* reportThread(string* reporttype)
|
||||
{
|
||||
assert(reporttype);
|
||||
string reportType = *reporttype;
|
||||
|
||||
Oam oam;
|
||||
|
||||
pthread_mutex_lock(&mutex1);
|
||||
runningThreads++;
|
||||
// cout << "++ " << runningThreads << endl;
|
||||
pthread_mutex_unlock(&mutex1);
|
||||
|
||||
string outputFile = localModule + "_" + reportType + "Report.txt";
|
||||
|
||||
FILE* pOutputFile = fopen(outputFile.c_str(), "a");
|
||||
if (pOutputFile == NULL)
|
||||
{
|
||||
printf("Could not open file: %s", outputFile.c_str());
|
||||
exit(1);
|
||||
}
|
||||
// get local report
|
||||
fprintf(pOutputFile,
|
||||
"********************************************************************************\n"
|
||||
"\n"
|
||||
" System %s\n"
|
||||
" columnstoreSupportReport script ran from Module %s on %s\n"
|
||||
" SoftwareVersion = %s-%s"
|
||||
"\n"
|
||||
"********************************************************************************\n"
|
||||
"\n"
|
||||
" %s report\n"
|
||||
"\n"
|
||||
"********************************************************************************\n",
|
||||
systemName.c_str(), localModule.c_str(), currentDate.c_str(), columnstore_version.c_str(),
|
||||
columnstore_release.c_str(), reportType.c_str());
|
||||
|
||||
fclose(pOutputFile);
|
||||
// run on child servers and get report
|
||||
if (!LOCAL)
|
||||
{
|
||||
ChildModuleList::iterator list1 = childmodulelist.begin();
|
||||
|
||||
for (; list1 != childmodulelist.end(); list1++)
|
||||
{
|
||||
threadInfo_t* st = new threadInfo_t;
|
||||
*st = boost::make_tuple(list1, reportType);
|
||||
|
||||
pthread_t childreportthread;
|
||||
int status = pthread_create(&childreportthread, NULL, (void* (*)(void*)) & childReportThread, st);
|
||||
|
||||
if (status != 0)
|
||||
{
|
||||
cout << "ERROR: childreportthread: pthread_create failed, return status = " + oam.itoa(status)
|
||||
<< endl;
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (reportType == "log")
|
||||
{
|
||||
// run log config on local server
|
||||
cout << "Get log config data for " + localModule << endl;
|
||||
|
||||
string cmd = "logReport.sh " + localModule + " " + outputFile;
|
||||
system(cmd.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
string cmd = reportType + "Report.sh " + localModule + " " + outputFile;
|
||||
system(cmd.c_str());
|
||||
|
||||
if (reportType == "config")
|
||||
{
|
||||
pOutputFile = fopen(outputFile.c_str(), "a");
|
||||
if (pOutputFile == NULL)
|
||||
{
|
||||
printf("Could not open file: %s", outputFile.c_str());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fprintf(pOutputFile,
|
||||
"\n******************** System Network Configuration ******************************\n\n");
|
||||
getSystemNetworkConfig(pOutputFile);
|
||||
|
||||
fprintf(pOutputFile,
|
||||
"\n******************** System Module Configure **********************************\n\n");
|
||||
getModuleTypeConfig(pOutputFile);
|
||||
|
||||
fprintf(pOutputFile,
|
||||
"\n******************** System Storage Configuration *****************************\n\n");
|
||||
getStorageConfig(pOutputFile);
|
||||
|
||||
fprintf(pOutputFile,
|
||||
"\n******************** System Storage Status ************************************\n\n");
|
||||
getStorageStatus(pOutputFile);
|
||||
|
||||
// BT: most of this is tedious to collect and can be manually looked up in the debug.log file
|
||||
// fprintf(pOutputFile,"\n******************** System Status
|
||||
// ********************************************\n\n"); printSystemStatus(pOutputFile);
|
||||
// printProcessStatus(pOutputFile);
|
||||
// printAlarmSummary(pOutputFile);
|
||||
//
|
||||
// fprintf(pOutputFile,"\n******************** System Directories
|
||||
// ***************************************\n\n"); getSystemDirectories(pOutputFile);
|
||||
|
||||
boost::filesystem::path configFile =
|
||||
std::string(MCSSYSCONFDIR) + std::string("/columnstore/Columnstore.xml");
|
||||
boost::filesystem::copy_file(configFile, "./Columnstore.xml",
|
||||
boost::filesystem::copy_options::overwrite_existing);
|
||||
boost::filesystem::path SMconfigFile =
|
||||
std::string(MCSSYSCONFDIR) + std::string("/columnstore/storagemanager.cnf");
|
||||
boost::filesystem::copy_file(SMconfigFile, "./storagemanager.cnf",
|
||||
boost::filesystem::copy_options::overwrite_existing);
|
||||
system("sed -i 's/.*aws_access_key_id.*/aws_access_key_id={PRIVATE}/' ./storagemanager.cnf");
|
||||
system("sed -i 's/.*aws_secret_access_key.*/aws_secret_access_key={PRIVATE}/' ./storagemanager.cnf");
|
||||
fclose(pOutputFile);
|
||||
}
|
||||
|
||||
/*
|
||||
// TODO: This can be ported from mcsadmin if needed most info included does not seem useful at this time
|
||||
if (reportType == "resource" )
|
||||
{
|
||||
if (LOCAL)
|
||||
{
|
||||
fprintf(pOutputFile,"\n******************** mcsadmin getModuleResourceUsage
|
||||
**************************\n\n"); string cmd = "mcsadmin getModuleResourceUsage " + localModule + " >> " +
|
||||
outputFile; system(cmd.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(pOutputFile,"\n******************** mcsadmin getSystemResourceUsage
|
||||
**************************\n\n"); string cmd = "mcsadmin getSystemResourceUsage >> " + outputFile;
|
||||
system(cmd.c_str());
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
// exit thread
|
||||
pthread_mutex_lock(&mutex1);
|
||||
runningThreads--;
|
||||
// cout << "-- " << runningThreads << endl;
|
||||
pthread_mutex_unlock(&mutex1);
|
||||
|
||||
pthread_exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
Oam oam;
|
||||
|
||||
Config* sysConfig = Config::makeConfig();
|
||||
string SystemSection = "SystemConfig";
|
||||
string InstallSection = "Installation";
|
||||
|
||||
bool HARDWARE = false;
|
||||
bool CONFIG = false;
|
||||
bool DBMS = false;
|
||||
bool RESOURCE = false;
|
||||
bool LOG = false;
|
||||
bool BULKLOG = false;
|
||||
bool HADOOP = false;
|
||||
|
||||
// get current time and date
|
||||
time_t now;
|
||||
now = time(NULL);
|
||||
struct tm tm;
|
||||
localtime_r(&now, &tm);
|
||||
char timestamp[200];
|
||||
strftime(timestamp, 200, "%m:%d:%y-%H:%M:%S", &tm);
|
||||
currentDate = timestamp;
|
||||
|
||||
char helpArg[3] = "-h";
|
||||
|
||||
// Get System Name
|
||||
try
|
||||
{
|
||||
oam.getSystemConfig("SystemName", systemName);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
systemName = "unassigned";
|
||||
}
|
||||
|
||||
// get Local Module Name and Server Install Indicator
|
||||
string singleServerInstall = "n";
|
||||
|
||||
oamModuleInfo_t st;
|
||||
|
||||
try
|
||||
{
|
||||
st = oam.getModuleInfo();
|
||||
localModule = boost::get<0>(st);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
cout << endl << "**** Failed : Failed to read Local Module Name" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
argv[1] = &helpArg[0];
|
||||
argc = 2;
|
||||
}
|
||||
|
||||
string DataFilePlugin;
|
||||
|
||||
try
|
||||
{
|
||||
DataFilePlugin = sysConfig->getConfig(SystemSection, "DataFilePlugin");
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
cout << "ERROR: Problem accessing Columnstore configuration file" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
tmpDir = startup::StartUp::tmpDir();
|
||||
|
||||
for (int i = 1; i < argc; i++)
|
||||
{
|
||||
if (string("-h") == argv[i])
|
||||
{
|
||||
cout << endl;
|
||||
cout << "'columnstoreSupport' generates a Set of System Support Report Files in a tar file" << endl;
|
||||
cout << "called columnstoreSupportReport.'system-name'.tar.gz in the local directory." << endl;
|
||||
cout << "It should be run on the server with the DBRM front-end." << endl;
|
||||
cout << "Check the Admin Guide for additional information." << endl;
|
||||
cout << endl;
|
||||
cout << "Usage: columnstoreSupport [-h][-a][-hw][-s][-c][-db][-r][-l][-bl][-lc][-p "
|
||||
"'root-password'][-de]";
|
||||
|
||||
cout << endl;
|
||||
cout << " -h help" << endl;
|
||||
cout << " -a Output all Reports (excluding Bulk Logs Reports)" << endl;
|
||||
cout << " -hw Output Hardware Reports only" << endl;
|
||||
cout << " -c Output Configuration/Status Reports only" << endl;
|
||||
cout << " -db Output DBMS Reports only" << endl;
|
||||
cout << " -r Output Resource Reports only" << endl;
|
||||
cout << " -l Output Columnstore Log/Alarms Reports only" << endl;
|
||||
cout << " -bl Output Columnstore Bulk Log Reports only" << endl;
|
||||
cout << " -lc Output Reports for Local Server only" << endl;
|
||||
cout << " -p password (multi-server systems), root-password or 'ssh' to use 'ssh keys'"
|
||||
<< endl;
|
||||
cout << " -de Debug Flag" << endl;
|
||||
|
||||
exit(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string("-a") == argv[i])
|
||||
{
|
||||
HARDWARE = true;
|
||||
CONFIG = true;
|
||||
DBMS = true;
|
||||
RESOURCE = true;
|
||||
LOG = true;
|
||||
HADOOP = (DataFilePlugin.empty() ? false : true);
|
||||
}
|
||||
else if (string("-hw") == argv[i])
|
||||
HARDWARE = true;
|
||||
else if (string("-c") == argv[i])
|
||||
CONFIG = true;
|
||||
else if (string("-db") == argv[i])
|
||||
DBMS = true;
|
||||
else if (string("-r") == argv[i])
|
||||
RESOURCE = true;
|
||||
else if (string("-l") == argv[i])
|
||||
LOG = true;
|
||||
else if (string("-bl") == argv[i])
|
||||
BULKLOG = true;
|
||||
else if (string("-lc") == argv[i])
|
||||
LOCAL = true;
|
||||
else if (string("-p") == argv[i])
|
||||
{
|
||||
i++;
|
||||
|
||||
if (argc == i)
|
||||
{
|
||||
cout << "ERROR: missing root password argument" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
rootPassword = argv[i];
|
||||
|
||||
// add single quote for special characters
|
||||
if (rootPassword != "ssh")
|
||||
{
|
||||
rootPassword = "'" + rootPassword + "'";
|
||||
}
|
||||
}
|
||||
else if (string("-mp") == argv[i])
|
||||
{
|
||||
i++;
|
||||
|
||||
if (argc == i)
|
||||
{
|
||||
cout << "ERROR: missing MariaDB Columnstore root user password argument" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
mysqlpw = argv[i];
|
||||
mysqlpw = "'" + mysqlpw + "'";
|
||||
}
|
||||
else if (string("-de") == argv[i])
|
||||
debug_flag = "1";
|
||||
else if (string("-hd") == argv[i])
|
||||
{
|
||||
HADOOP = (DataFilePlugin.empty() ? false : true);
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "Invalid Option of '" << argv[i] << "', run with '-h' for help" << endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// default to -a if nothing is set
|
||||
if (!HARDWARE && !CONFIG && !DBMS && !RESOURCE && !LOG && !BULKLOG && !HADOOP)
|
||||
{
|
||||
HARDWARE = true;
|
||||
CONFIG = true;
|
||||
DBMS = true;
|
||||
RESOURCE = true;
|
||||
LOG = true;
|
||||
HADOOP = (DataFilePlugin.empty() ? false : true);
|
||||
}
|
||||
|
||||
// get Parent OAM Module Name and setup of it's Custom OS files
|
||||
string PrimaryUMModuleName;
|
||||
|
||||
try
|
||||
{
|
||||
PrimaryUMModuleName = sysConfig->getConfig(SystemSection, "PrimaryUMModuleName");
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
cout << "ERROR: Problem getting Parent OAM Module Name" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (PrimaryUMModuleName == "unassigned")
|
||||
PrimaryUMModuleName = localModule;
|
||||
|
||||
if ((localModule != PrimaryUMModuleName) && DBMS)
|
||||
{
|
||||
char* pcommand = 0;
|
||||
char* p;
|
||||
string argument = "n";
|
||||
|
||||
while (true)
|
||||
{
|
||||
cout << endl << "You selected to get the DBMS data." << endl;
|
||||
cout << "You need to run the columnstoreSupport command on module '" << PrimaryUMModuleName
|
||||
<< "' to get that information." << endl;
|
||||
cout << "Or you can proceed on to get all data except the DBMS." << endl;
|
||||
|
||||
pcommand = readline(" Do you want to proceed: (y or n) [n]: ");
|
||||
|
||||
if (pcommand && *pcommand)
|
||||
{
|
||||
p = strtok(pcommand, " ");
|
||||
argument = p;
|
||||
free(pcommand);
|
||||
pcommand = 0;
|
||||
}
|
||||
|
||||
if (pcommand)
|
||||
{
|
||||
free(pcommand);
|
||||
pcommand = 0;
|
||||
}
|
||||
|
||||
if (argument == "y")
|
||||
{
|
||||
cout << endl;
|
||||
break;
|
||||
}
|
||||
else if (argument == "n")
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// get number of worker-nodes, will tell us if a single server system
|
||||
// get Parent OAM Module Name and setup of it's Custom OS files
|
||||
try
|
||||
{
|
||||
string NumWorkers = sysConfig->getConfig("DBRM_Controller", "NumWorkers");
|
||||
|
||||
if (NumWorkers == "1")
|
||||
singleServerInstall = "y";
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
|
||||
if (singleServerInstall == "n" && !LOCAL)
|
||||
if (HARDWARE || CONFIG || RESOURCE || LOG || HADOOP)
|
||||
if (rootPassword.empty())
|
||||
{
|
||||
cout << "ERROR: Multi-Module System, Password Argument required or use '-lc' option, check help for "
|
||||
"more information"
|
||||
<< endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
// get Parent OAM Module Name and setup of it's Custom OS files
|
||||
// string parentOAMModuleName;
|
||||
ChildModule parentOAMModule;
|
||||
|
||||
try
|
||||
{
|
||||
parentOAMModule.moduleName = sysConfig->getConfig(SystemSection, "ParentOAMModuleName");
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
cout << "ERROR: Problem getting Parent OAM Module Name" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
// Get list of configured system modules
|
||||
SystemModuleTypeConfig sysModuleTypeConfig;
|
||||
|
||||
try
|
||||
{
|
||||
oam.getSystemConfig(sysModuleTypeConfig);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
cout << "ERROR: Problem reading the Columnstore System Configuration file" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
string ModuleSection = "SystemModuleConfig";
|
||||
|
||||
for (unsigned int i = 0; i < sysModuleTypeConfig.moduletypeconfig.size(); i++)
|
||||
{
|
||||
string moduleType = sysModuleTypeConfig.moduletypeconfig[i].ModuleType;
|
||||
int moduleCount = sysModuleTypeConfig.moduletypeconfig[i].ModuleCount;
|
||||
|
||||
if (moduleCount == 0)
|
||||
// no modules equipped for this Module Type, skip
|
||||
continue;
|
||||
|
||||
// get IP addresses and Host Names
|
||||
DeviceNetworkList::iterator listPT = sysModuleTypeConfig.moduletypeconfig[i].ModuleNetworkList.begin();
|
||||
|
||||
for (; listPT != sysModuleTypeConfig.moduletypeconfig[i].ModuleNetworkList.end(); listPT++)
|
||||
{
|
||||
string moduleName = (*listPT).DeviceName;
|
||||
HostConfigList::iterator pt1 = (*listPT).hostConfigList.begin();
|
||||
string moduleIPAddr = (*pt1).IPAddr;
|
||||
string moduleHostName = (*pt1).HostName;
|
||||
|
||||
if (moduleName == localModule)
|
||||
{
|
||||
localModuleHostName = moduleHostName;
|
||||
}
|
||||
|
||||
// save Child modules
|
||||
if (moduleName != localModule && moduleType != "xm")
|
||||
{
|
||||
childmodule.moduleName = moduleName;
|
||||
childmodule.moduleIP = moduleIPAddr;
|
||||
childmodule.hostName = moduleHostName;
|
||||
childmodulelist.push_back(childmodule);
|
||||
}
|
||||
|
||||
if (moduleName == parentOAMModule.moduleName)
|
||||
{
|
||||
parentOAMModule.moduleIP = moduleIPAddr;
|
||||
parentOAMModule.hostName = moduleHostName;
|
||||
parentOAMModule.moduleName = moduleName;
|
||||
}
|
||||
}
|
||||
} // end of i for loop
|
||||
|
||||
// create a clean Columnstore Support Report
|
||||
system("rm -f *_configReport.txt");
|
||||
system("rm -f *_dbmsReport.txt");
|
||||
system("rm -f *_hardwareReport.txt");
|
||||
system("rm -f *_logReport.txt");
|
||||
system("rm -f *_bulklogReport.txt");
|
||||
system("rm -f *_resourceReport.txt");
|
||||
|
||||
//
|
||||
// Configuration
|
||||
//
|
||||
if (CONFIG)
|
||||
{
|
||||
string reportType = "config";
|
||||
cout << "Get " + reportType + " report data for " + localModule << endl;
|
||||
pthread_t reportthread;
|
||||
int status = pthread_create(&reportthread, NULL, (void* (*)(void*)) & reportThread, &reportType);
|
||||
if (status != 0)
|
||||
{
|
||||
cout << "ERROR: reportthread: pthread_create failed, return status = " + oam.itoa(status);
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
//
|
||||
// Alarms and Columnstore Logs
|
||||
//
|
||||
if (LOG)
|
||||
{
|
||||
string reportType = "log";
|
||||
cout << "Get " + reportType + " report data for " + localModule << endl;
|
||||
pthread_t reportthread;
|
||||
int status = pthread_create(&reportthread, NULL, (void* (*)(void*)) & reportThread, &reportType);
|
||||
if (status != 0)
|
||||
{
|
||||
cout << "ERROR: reportthread: pthread_create failed, return status = " + oam.itoa(status);
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
//
|
||||
// Bulk Logs
|
||||
//
|
||||
if (BULKLOG)
|
||||
{
|
||||
string reportType = "bulklog";
|
||||
cout << "Get " + reportType + " report data for " + localModule << endl;
|
||||
pthread_t reportthread;
|
||||
int status = pthread_create(&reportthread, NULL, (void* (*)(void*)) & reportThread, &reportType);
|
||||
if (status != 0)
|
||||
{
|
||||
cout << "ERROR: reportthread: pthread_create failed, return status = " + oam.itoa(status);
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
//
|
||||
// Hardware
|
||||
//
|
||||
if (HARDWARE)
|
||||
{
|
||||
string reportType = "hardware";
|
||||
cout << "Get " + reportType + " report data for " + localModule << endl;
|
||||
pthread_t reportthread;
|
||||
int status = pthread_create(&reportthread, NULL, (void* (*)(void*)) & reportThread, &reportType);
|
||||
if (status != 0)
|
||||
{
|
||||
cout << "ERROR: reportthread: pthread_create failed, return status = " + oam.itoa(status);
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
//
|
||||
// Resources
|
||||
//
|
||||
if (RESOURCE)
|
||||
{
|
||||
string reportType = "resource";
|
||||
cout << "Get " + reportType + " report data for " + localModule << endl;
|
||||
pthread_t reportthread;
|
||||
int status = pthread_create(&reportthread, NULL, (void* (*)(void*)) & reportThread, &reportType);
|
||||
if (status != 0)
|
||||
{
|
||||
cout << "ERROR: reportthread: pthread_create failed, return status = " + oam.itoa(status);
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
//
|
||||
// DBMS
|
||||
//
|
||||
if (DBMS)
|
||||
{
|
||||
cout << "Get dbms report data for " << localModule << endl;
|
||||
|
||||
string outputFile = localModule + "_dbmsReport.txt";
|
||||
|
||||
FILE* pOutputFile = fopen(outputFile.c_str(), "w");
|
||||
if (pOutputFile == NULL)
|
||||
{
|
||||
cout << "Could not open file: " + outputFile << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fprintf(pOutputFile,
|
||||
"********************************************************************************\n"
|
||||
"\n"
|
||||
" System %s\n"
|
||||
" columnstoreSupportReport script ran from Module %s on %s\n"
|
||||
" SoftwareVersion = %s-%s"
|
||||
"\n"
|
||||
"********************************************************************************\n"
|
||||
"\n"
|
||||
" DBMS report\n"
|
||||
"\n"
|
||||
"********************************************************************************\n",
|
||||
systemName.c_str(), localModule.c_str(), currentDate.c_str(), columnstore_version.c_str(),
|
||||
columnstore_release.c_str());
|
||||
|
||||
fclose(pOutputFile);
|
||||
|
||||
// run DBMS report on local server
|
||||
bool FAILED = false;
|
||||
|
||||
if (localModule != PrimaryUMModuleName)
|
||||
{
|
||||
cout << " FAILED: run columnstoreSupport on '" << PrimaryUMModuleName << "' to get the dbrm report"
|
||||
<< endl;
|
||||
FAILED = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// check if mysql is supported and get info
|
||||
string logFile = tmpDir + "/idbmysql.log";
|
||||
string columnstoreMysql = "mysql -u root ";
|
||||
string cmd = columnstoreMysql + " -e 'status' > " + logFile + " 2>&1";
|
||||
system(cmd.c_str());
|
||||
|
||||
// check for mysql password set
|
||||
string pwprompt = " ";
|
||||
|
||||
if (checkLogStatus(logFile, "ERROR 1045"))
|
||||
{
|
||||
cout << "NOTE: MariaDB Columnstore root user password is set" << endl;
|
||||
|
||||
// needs a password, was password entered on command line
|
||||
if (mysqlpw == " ")
|
||||
{
|
||||
// go check columnstore.cnf
|
||||
string file = std::string(MCSMYCNFDIR) + "/columnstore.cnf";
|
||||
ifstream oldFile(file.c_str());
|
||||
|
||||
vector<string> lines;
|
||||
char line[200];
|
||||
string buf;
|
||||
|
||||
while (oldFile.getline(line, 200))
|
||||
{
|
||||
buf = line;
|
||||
string::size_type pos = buf.find("password", 0);
|
||||
|
||||
if (pos != string::npos)
|
||||
{
|
||||
string::size_type pos1 = buf.find("=", 0);
|
||||
|
||||
if (pos1 != string::npos)
|
||||
{
|
||||
pos = buf.find("#", 0);
|
||||
|
||||
if (pos == string::npos)
|
||||
{
|
||||
// password arg in columnstore.cnf, go get password
|
||||
cout << "NOTE: Using password from columnstore.cnf" << endl;
|
||||
mysqlpw = buf.substr(pos1 + 1, 80);
|
||||
cout << mysqlpw << endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
oldFile.close();
|
||||
|
||||
if (mysqlpw == " ")
|
||||
{
|
||||
cout << "NOTE: No password provide on command line or found uncommented in columnstore.cnf"
|
||||
<< endl;
|
||||
cout << endl;
|
||||
string prompt = " *** Enter MariaDB Columnstore password > ";
|
||||
mysqlpw = getpass(prompt.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
// check for mysql password set
|
||||
pwprompt = "--password=" + mysqlpw;
|
||||
|
||||
string cmd = columnstoreMysql + pwprompt + " -e 'status' > " + logFile + " 2>&1";
|
||||
system(cmd.c_str());
|
||||
|
||||
if (checkLogStatus(logFile, "ERROR 1045"))
|
||||
{
|
||||
cout << "FAILED: Failed login using MariaDB Columnstore root user password '" << mysqlpw << "'"
|
||||
<< endl;
|
||||
FAILED = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!FAILED)
|
||||
{
|
||||
string cmd = "dbmsReport.sh " + localModule + " " + outputFile + " " + std::string(MCSSUPPORTDIR) +
|
||||
" " + pwprompt;
|
||||
system(cmd.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
BT: This doesn't appear to do anything
|
||||
fprintf(pOutputFile,"\n******************** Database Size Report
|
||||
*************************************\n\n"); getStorageStatus(pOutputFile);
|
||||
|
||||
string file = "databaseSizeReport";
|
||||
ifstream File (file.c_str());
|
||||
|
||||
if (File)
|
||||
{
|
||||
string cmd = "databaseSizeReport >> " + outputFile;
|
||||
system(cmd.c_str());
|
||||
}
|
||||
*/
|
||||
|
||||
boost::filesystem::path configFile = std::string(MCSMYCNFDIR) + "/columnstore.cnf";
|
||||
boost::filesystem::copy_file(configFile, "./columnstore.cnf",
|
||||
boost::filesystem::copy_options::overwrite_existing);
|
||||
}
|
||||
|
||||
int wait = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
// cout << "check " << runningThreads << endl;
|
||||
if (runningThreads < 1)
|
||||
break;
|
||||
|
||||
sleep(2);
|
||||
wait++;
|
||||
|
||||
// give it 60 minutes to complete
|
||||
if (wait >= 3600 * 5)
|
||||
{
|
||||
cout << "Timed out (60 minutes) waiting for Requests to complete" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
system("unix2dos *Report.txt > /dev/null 2>&1");
|
||||
system(
|
||||
"rm -rf columnstoreSupportReport;"
|
||||
"mkdir columnstoreSupportReport;"
|
||||
"mv *Report.txt columnstoreSupportReport/. > /dev/null 2>&1;"
|
||||
"mv Columnstore.xml columnstoreSupportReport/. > /dev/null 2>&1;"
|
||||
"mv columnstore.cnf columnstoreSupportReport/. > /dev/null 2>&1;"
|
||||
"mv storagemanager.cnf columnstoreSupportReport/. > /dev/null 2>&1;"
|
||||
"mv *Report.tar.gz columnstoreSupportReport/. > /dev/null 2>&1");
|
||||
string cmd = "tar -zcf columnstoreSupportReport." + systemName + ".tar.gz columnstoreSupportReport/*";
|
||||
system(cmd.c_str());
|
||||
|
||||
cout << endl
|
||||
<< "Columnstore Support Script Successfully completed, files located in columnstoreSupportReport." +
|
||||
systemName + ".tar.gz"
|
||||
<< endl;
|
||||
}
|
@@ -1,76 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# $Id: hardwareReport.sh 421 2007-04-05 15:46:55Z dhill $
|
||||
#
|
||||
if [ $1 ] ; then
|
||||
MODULE=$1
|
||||
else
|
||||
MODULE="pm1"
|
||||
fi
|
||||
|
||||
if [ $2 ] ; then
|
||||
OUT_FILE=$2
|
||||
else
|
||||
OUT_FILE=${MODULE}_logReport.txt
|
||||
fi
|
||||
|
||||
{
|
||||
echo " "
|
||||
echo "******************** Configuration/Status Report for ${MODULE} ********************"
|
||||
echo " "
|
||||
|
||||
chkconfig=`which chkconfig 2>/dev/null`
|
||||
if [ -n "$chkconfig" ]; then
|
||||
echo "-- chkconfig configuration --"
|
||||
echo " "
|
||||
echo "################# chkconfig --list | grep columnstore #################"
|
||||
echo " "
|
||||
chkconfig --list | grep columnstore 2>/dev/null
|
||||
fi
|
||||
|
||||
systemctl=`which systemctl 2>/dev/null`
|
||||
if [ -n "$systemctl" ]; then
|
||||
echo "-- systemctl configuration --"
|
||||
echo " "
|
||||
echo "################# systemctl list-unit-files --type=service | grep columnstore #################"
|
||||
echo " "
|
||||
systemctl list-unit-files --type=service | grep columnstore 2>/dev/null
|
||||
echo "################# systemctl list-unit-files --type=service | grep mariadb #################"
|
||||
echo " "
|
||||
systemctl list-unit-files --type=service | grep mariadb 2>/dev/null
|
||||
fi
|
||||
|
||||
updaterc=`which update-rc.d 2>/dev/null`
|
||||
if [ -n "$updaterc" ]; then
|
||||
echo "-- services configuration --"
|
||||
echo " "
|
||||
echo "################# service --status-all | grep columnstore #################"
|
||||
echo " "
|
||||
service --status-all | grep columnstore 2>/dev/null
|
||||
fi
|
||||
|
||||
|
||||
echo " "
|
||||
echo "-- fstab Configuration --"
|
||||
echo " "
|
||||
echo "################# cat /etc/fstab #################"
|
||||
echo " "
|
||||
cat /etc/fstab 2>/dev/null
|
||||
|
||||
echo " "
|
||||
echo "-- Server Processes --"
|
||||
echo " "
|
||||
echo "################# ps axu #################"
|
||||
echo " "
|
||||
ps axu
|
||||
|
||||
echo " "
|
||||
echo "-- Server Processes with resource usage --"
|
||||
echo " "
|
||||
echo "################# top -b -n 1 #################"
|
||||
echo " "
|
||||
top -b -n 1
|
||||
|
||||
} >> $OUT_FILE
|
||||
|
||||
exit 0
|
@@ -1,64 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# $Id: dbmsReport.sh
|
||||
#
|
||||
if [ $1 ] ; then
|
||||
MODULE=$1
|
||||
else
|
||||
MODULE="pm1"
|
||||
fi
|
||||
|
||||
if [ $2 ] ; then
|
||||
OUT_FILE=$2
|
||||
else
|
||||
OUT_FILE=${MODULE}_logReport.txt
|
||||
fi
|
||||
|
||||
if [ $3 ] ; then
|
||||
MCSSUPPORTDIR=$3
|
||||
else
|
||||
MCSSUPPORTDIR="/usr/share/columnstore"
|
||||
fi
|
||||
|
||||
if [ $4 ] ; then
|
||||
PW_PROMPT=$4
|
||||
else
|
||||
PW_PROMPT=""
|
||||
fi
|
||||
|
||||
{
|
||||
|
||||
columnstoreMysql="mysql -u root ${PW_PROMPT} "
|
||||
|
||||
if ${columnstoreMysql} -V > /dev/null 2>&1; then
|
||||
echo " "
|
||||
echo "******************** DBMS Columnstore Version *********************************"
|
||||
echo " "
|
||||
${columnstoreMysql} -e 'status'
|
||||
echo " "
|
||||
echo "******************** DBMS Columnstore System Column ***************************"
|
||||
echo " "
|
||||
${columnstoreMysql} -e 'desc calpontsys.syscolumn;'
|
||||
echo " "
|
||||
echo "******************** DBMS Columnstore System Table ****************************"
|
||||
echo " "
|
||||
${columnstoreMysql} -e 'desc calpontsys.systable;'
|
||||
echo " "
|
||||
echo "******************** DBMS Columnstore System Catalog Data *********************"
|
||||
echo " "
|
||||
${columnstoreMysql} calpontsys < $MCSSUPPORTDIR/dumpcat_mysql.sql
|
||||
echo " "
|
||||
echo "******************** DBMS Columnstore System Table Data ***********************"
|
||||
echo "******************** DBMS Columnstore Databases *******************************"
|
||||
echo " "
|
||||
${columnstoreMysql} -e 'show databases;'
|
||||
echo " "
|
||||
echo "******************** DBMS Columnstore variables *******************************"
|
||||
echo " "
|
||||
${columnstoreMysql} -e 'show variables;'
|
||||
echo " "
|
||||
fi
|
||||
} >> $OUT_FILE
|
||||
|
||||
exit 0
|
||||
|
@@ -1,130 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Reports the max value from the extent map for the given column.
|
||||
#
|
||||
|
||||
#
|
||||
# Initialize variables.
|
||||
#
|
||||
|
||||
if [ -z "$MYSQLCMD" ]; then
|
||||
MYSQLCMD="mysql -u root"
|
||||
fi
|
||||
|
||||
#
|
||||
# Validate that there are three parameters - schema and table and columnname.
|
||||
#
|
||||
if [ $# -ne 3 ]; then
|
||||
echo ""
|
||||
echo "Reports the max value for the given column."
|
||||
echo ""
|
||||
echo "Parameters:"
|
||||
echo " Schema"
|
||||
echo " Table"
|
||||
echo " Column"
|
||||
exit 1
|
||||
fi
|
||||
db=$1
|
||||
table=$2
|
||||
column=$3
|
||||
|
||||
#
|
||||
# Validate that the column exists.
|
||||
#
|
||||
sql="select count(*) from syscolumn where \`schema\`='$db' and tablename='$table' and columnname='$column';"
|
||||
count=`$MYSQLCMD calpontsys --skip-column-names -e "$sql;"`
|
||||
if [ $count -le 0 ]; then
|
||||
echo ""
|
||||
echo "$db.$table.$column does not exist in Columnstore."
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Validate that the column type is one that this script supports.
|
||||
# Supported Types:
|
||||
# 6 int
|
||||
# 8 date
|
||||
# 9 bigint
|
||||
# 11 datetime
|
||||
sql="select datatype from syscolumn where \`schema\`='$db' and tablename='$table' and columnname='$column';"
|
||||
dataType=`$MYSQLCMD calpontsys --skip-column-names -e "$sql"`
|
||||
if [ $dataType -ne 6 ] && [ $dataType -ne 8 ] && [ $dataType -ne 9 ] && [ $dataType -ne 11 ]; then
|
||||
echo ""
|
||||
echo "The column data type must be an int, bigint, date, or datetime."
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Grab the objectid for the column.
|
||||
#
|
||||
sql="select objectid from syscolumn where \`schema\`='$db' and tablename='$table' and columnname='$column';"
|
||||
objectid=`$MYSQLCMD calpontsys --skip-column-names -e "$sql"`
|
||||
|
||||
#
|
||||
# Set the editem specific parameter if the column is a date or datetime.
|
||||
#
|
||||
if [ $dataType -eq 8 ]; then
|
||||
parm="-t"
|
||||
elif [ $dataType -eq 11 ]; then
|
||||
parm="-s"
|
||||
fi
|
||||
|
||||
#
|
||||
# Use the editem utility to get the min and max value.
|
||||
#
|
||||
editem -o $objectid $parm | grep max | awk -v dataType=$dataType '
|
||||
BEGIN {
|
||||
allValid=1;
|
||||
foundValidExtent=0;
|
||||
}
|
||||
{
|
||||
if(dataType == 11) {
|
||||
state=substr($14, 1, length($14)-1); # Datetime has date and time as two fields.
|
||||
thisMin=$6 " " substr($7, 1, length($7)-1);
|
||||
thisMax=$9 " " substr($10, 1, length($10)-1);
|
||||
}
|
||||
else {
|
||||
state=substr($12, 1, length($12)-1);
|
||||
thisMin=substr($6, 1, length($6)-1);
|
||||
thisMax=substr($8, 1, length($8)-1);
|
||||
}
|
||||
if(state == "valid") {
|
||||
if(!foundValidExtent) {
|
||||
min=thisMin;
|
||||
max=thisMax;
|
||||
foundValidExtent=1;
|
||||
}
|
||||
else {
|
||||
if(thisMin < min) {
|
||||
min=thisMin;
|
||||
}
|
||||
if(thisMax > max) {
|
||||
max=thisMax;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
allValid=0;
|
||||
}
|
||||
}
|
||||
END {
|
||||
if(foundValidExtent == 1) {
|
||||
print "";
|
||||
print "Min=" min;
|
||||
print "Max=" max;
|
||||
print "";
|
||||
if(allValid == 0) {
|
||||
print "Not all extents had min and max values set. Answer is incomplete."
|
||||
}
|
||||
}
|
||||
else {
|
||||
print "";
|
||||
print "There were not any extents with valid min/max values. Unable to provide answer.";
|
||||
print "";
|
||||
}
|
||||
}'
|
||||
|
||||
exit 0
|
@@ -1,79 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# $Id: hardwareReport.sh 421 2007-04-05 15:46:55Z dhill $
|
||||
#
|
||||
if [ $1 ] ; then
|
||||
MODULE=$1
|
||||
else
|
||||
MODULE="pm1"
|
||||
fi
|
||||
|
||||
if [ $2 ] ; then
|
||||
OUT_FILE=$2
|
||||
else
|
||||
OUT_FILE=${MODULE}_logReport.txt
|
||||
fi
|
||||
|
||||
{
|
||||
echo " "
|
||||
echo "******************** Hardware Report for ${MODULE} ********************"
|
||||
echo " "
|
||||
|
||||
echo "-- Server OS Version --"
|
||||
echo " "
|
||||
echo "################# cat /proc/version #################"
|
||||
echo " "
|
||||
cat /proc/version 2>/dev/null
|
||||
echo " "
|
||||
echo "################# uname -a #################"
|
||||
echo " "
|
||||
uname -a
|
||||
echo " "
|
||||
echo "################# cat /etc/issue #################"
|
||||
echo " "
|
||||
cat /etc/issue 2>/dev/null
|
||||
echo " "
|
||||
echo "run columnstore_os_check.sh"
|
||||
echo " "
|
||||
echo "################# /bin/columnstore_os_check.sh #################"
|
||||
echo " "
|
||||
columnstore_os_check.sh 2>/dev/null
|
||||
|
||||
echo " "
|
||||
echo "-- Server Uptime --"
|
||||
echo " "
|
||||
echo "################# uptime #################"
|
||||
echo " "
|
||||
uptime
|
||||
|
||||
echo " "
|
||||
echo "-- Server cpu-info --"
|
||||
echo " "
|
||||
echo "################# cat /proc/cpuinfo #################"
|
||||
echo " "
|
||||
cat /proc/cpuinfo 2>/dev/null
|
||||
|
||||
echo " "
|
||||
echo "-- Server memory-info --"
|
||||
echo " "
|
||||
echo "################# cat /proc/meminfo #################"
|
||||
echo " "
|
||||
$cat /proc/meminfo 2>/dev/null
|
||||
|
||||
echo " "
|
||||
echo "-- Server mounts --"
|
||||
echo " "
|
||||
echo "################# cat /proc/mounts #################"
|
||||
echo " "
|
||||
cat /proc/mounts 2>/dev/null
|
||||
|
||||
echo " "
|
||||
echo "-- Server Ethernet Configuration --"
|
||||
echo " "
|
||||
echo "################# ifconfig -a #################"
|
||||
echo " "
|
||||
ifconfig -a 2>/dev/null
|
||||
|
||||
} >> $OUT_FILE
|
||||
|
||||
exit 0
|
@@ -1,52 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# $Id: logReport.sh 421 2007-04-05 15:46:55Z dhill $
|
||||
#
|
||||
if [ $1 ] ; then
|
||||
MODULE=$1
|
||||
else
|
||||
MODULE="pm1"
|
||||
fi
|
||||
|
||||
if [ $2 ] ; then
|
||||
OUT_FILE=$2
|
||||
else
|
||||
OUT_FILE=${MODULE}_logReport.txt
|
||||
fi
|
||||
|
||||
#get temp directory
|
||||
tmpDir=`mcsGetConfig SystemConfig SystemTempFileDir`
|
||||
|
||||
rm -f ${tmpDir}/${MODULE}_logReport.tar.gz
|
||||
tar -zcf ${tmpDir}/${MODULE}_logReport.tar.gz /var/log/mariadb/columnstore > /dev/null 2>&1
|
||||
cp ${tmpDir}/${MODULE}_logReport.tar.gz .
|
||||
tar -zcf ${MODULE}_mysqllogReport.tar.gz /var/log/mysql/*.err 2>/dev/null
|
||||
|
||||
echo '******************** Log Configuration ********************' >> $OUT_FILE
|
||||
echo '' >> $OUT_FILE
|
||||
echo 'MariaDB ColumnStore System Log Configuration Data' >> $OUT_FILE
|
||||
echo '' >> $OUT_FILE
|
||||
configFileName=`mcsGetConfig Installation SystemLogConfigFile`
|
||||
echo 'System Logging Configuration File being used: '${configFileName} >> $OUT_FILE
|
||||
echo '' >> $OUT_FILE
|
||||
echo -e 'Module\tConfigured Log Levels' >> $OUT_FILE
|
||||
echo -e '------\t---------------------------------------' >> $OUT_FILE
|
||||
moduleConfig=''
|
||||
if grep -q '/var/log/mariadb/columnstore/crit.log' ${configFileName}; then
|
||||
moduleConfig=${moduleConfig}' CRITICAL'
|
||||
fi
|
||||
if grep -q '/var/log/mariadb/columnstore/err.log' ${configFileName}; then
|
||||
moduleConfig=${moduleConfig}' ERROR'
|
||||
fi
|
||||
if grep -q '/var/log/mariadb/columnstore/warning.log' ${configFileName}; then
|
||||
moduleConfig=${moduleConfig}' WARNING'
|
||||
fi
|
||||
if grep -q '/var/log/mariadb/columnstore/info.log' ${configFileName}; then
|
||||
moduleConfig=${moduleConfig}' INFO'
|
||||
fi
|
||||
if grep -q '/var/log/mariadb/columnstore/debug.log' ${configFileName}; then
|
||||
moduleConfig=${moduleConfig}' DEBUG'
|
||||
fi
|
||||
echo -e ${MODULE}'\t'${moduleConfig} >> $OUT_FILE
|
||||
exit 0
|
||||
|
@@ -1,621 +0,0 @@
|
||||
/* Copyright (C) 2019 MariaDB Corporation
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; version 2 of
|
||||
the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
#include "mcsSupportUtil.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace oam;
|
||||
using namespace config;
|
||||
|
||||
void getSystemNetworkConfig(FILE* pOutputFile)
|
||||
{
|
||||
Oam oam;
|
||||
// get and display Module Network Config
|
||||
SystemModuleTypeConfig systemmoduletypeconfig;
|
||||
systemmoduletypeconfig.moduletypeconfig.clear();
|
||||
|
||||
// get max length of a host name for header formatting
|
||||
|
||||
int maxSize = 9;
|
||||
|
||||
try
|
||||
{
|
||||
oam.getSystemConfig(systemmoduletypeconfig);
|
||||
|
||||
for (unsigned int i = 0; i < systemmoduletypeconfig.moduletypeconfig.size(); i++)
|
||||
{
|
||||
if (systemmoduletypeconfig.moduletypeconfig[i].ModuleType.empty())
|
||||
// end of list
|
||||
break;
|
||||
|
||||
int moduleCount = systemmoduletypeconfig.moduletypeconfig[i].ModuleCount;
|
||||
string moduletype = systemmoduletypeconfig.moduletypeconfig[i].ModuleType;
|
||||
string moduletypedesc = systemmoduletypeconfig.moduletypeconfig[i].ModuleDesc;
|
||||
|
||||
if (moduleCount > 0)
|
||||
{
|
||||
DeviceNetworkList::iterator pt = systemmoduletypeconfig.moduletypeconfig[i].ModuleNetworkList.begin();
|
||||
|
||||
for (; pt != systemmoduletypeconfig.moduletypeconfig[i].ModuleNetworkList.end(); pt++)
|
||||
{
|
||||
HostConfigList::iterator pt1 = (*pt).hostConfigList.begin();
|
||||
|
||||
for (; pt1 != (*pt).hostConfigList.end(); pt1++)
|
||||
{
|
||||
if (maxSize < (int)(*pt1).HostName.size())
|
||||
maxSize = (*pt1).HostName.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (exception& e)
|
||||
{
|
||||
fprintf(pOutputFile, "**** getNetworkConfig Failed = %s\n\n", e.what());
|
||||
}
|
||||
|
||||
fprintf(pOutputFile, "%-15s%-30s%-10s%-14s%-20s\n", "Module Name", "Module Description", "NIC ID",
|
||||
"Host Name", "IP Address");
|
||||
fprintf(pOutputFile, "%-15s%-30s%-10s%-14s%-20s\n", "-----------", "-------------------------", "------",
|
||||
"---------", "---------------");
|
||||
|
||||
try
|
||||
{
|
||||
oam.getSystemConfig(systemmoduletypeconfig);
|
||||
|
||||
for (unsigned int i = 0; i < systemmoduletypeconfig.moduletypeconfig.size(); i++)
|
||||
{
|
||||
if (systemmoduletypeconfig.moduletypeconfig[i].ModuleType.empty())
|
||||
// end of list
|
||||
break;
|
||||
|
||||
int moduleCount = systemmoduletypeconfig.moduletypeconfig[i].ModuleCount;
|
||||
string moduletype = systemmoduletypeconfig.moduletypeconfig[i].ModuleType;
|
||||
string moduletypedesc = systemmoduletypeconfig.moduletypeconfig[i].ModuleDesc;
|
||||
|
||||
if (moduleCount > 0)
|
||||
{
|
||||
DeviceNetworkList::iterator pt = systemmoduletypeconfig.moduletypeconfig[i].ModuleNetworkList.begin();
|
||||
|
||||
for (; pt != systemmoduletypeconfig.moduletypeconfig[i].ModuleNetworkList.end(); pt++)
|
||||
{
|
||||
string modulename = (*pt).DeviceName;
|
||||
string moduleID = modulename.substr(MAX_MODULE_TYPE_SIZE, MAX_MODULE_ID_SIZE);
|
||||
string modulenamedesc = moduletypedesc + " #" + moduleID;
|
||||
|
||||
fprintf(pOutputFile, "%-15s%-30s", modulename.c_str(), modulenamedesc.c_str());
|
||||
|
||||
HostConfigList::iterator pt1 = (*pt).hostConfigList.begin();
|
||||
|
||||
for (; pt1 != (*pt).hostConfigList.end(); pt1++)
|
||||
{
|
||||
/* MCOL-1607. IPAddr may be a host name here b/c it is read straight
|
||||
from the config file. */
|
||||
string tmphost = getIPAddress(pt1->IPAddr);
|
||||
string ipAddr;
|
||||
if (tmphost.empty())
|
||||
ipAddr = pt1->IPAddr;
|
||||
else
|
||||
ipAddr = tmphost;
|
||||
string hostname = (*pt1).HostName;
|
||||
string nicID = oam.itoa((*pt1).NicID);
|
||||
|
||||
if (nicID != "1")
|
||||
{
|
||||
fprintf(pOutputFile, "%-45s", "");
|
||||
}
|
||||
fprintf(pOutputFile, "%-13s%-14s%-20s\n", nicID.c_str(), hostname.c_str(), ipAddr.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (exception& e)
|
||||
{
|
||||
fprintf(pOutputFile, "**** getNetworkConfig Failed = %s\n\n", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
void getModuleTypeConfig(FILE* pOutputFile)
|
||||
{
|
||||
Oam oam;
|
||||
SystemModuleTypeConfig systemmoduletypeconfig;
|
||||
ModuleTypeConfig moduletypeconfig;
|
||||
ModuleConfig moduleconfig;
|
||||
systemmoduletypeconfig.moduletypeconfig.clear();
|
||||
|
||||
try
|
||||
{
|
||||
oam.getSystemConfig(systemmoduletypeconfig);
|
||||
|
||||
fprintf(pOutputFile, "Module Type Configuration\n\n");
|
||||
|
||||
for (unsigned int i = 0; i < systemmoduletypeconfig.moduletypeconfig.size(); i++)
|
||||
{
|
||||
if (systemmoduletypeconfig.moduletypeconfig[i].ModuleType.empty())
|
||||
// end of list
|
||||
break;
|
||||
|
||||
int moduleCount = systemmoduletypeconfig.moduletypeconfig[i].ModuleCount;
|
||||
|
||||
if (moduleCount < 1)
|
||||
continue;
|
||||
|
||||
string moduletype = systemmoduletypeconfig.moduletypeconfig[i].ModuleType;
|
||||
|
||||
fprintf(pOutputFile, "ModuleType '%s' Configuration information\n", moduletype.c_str());
|
||||
fprintf(pOutputFile, "ModuleDesc = %s\n",
|
||||
systemmoduletypeconfig.moduletypeconfig[i].ModuleDesc.c_str());
|
||||
fprintf(pOutputFile, "ModuleCount = %i\n", moduleCount);
|
||||
|
||||
if (moduleCount > 0)
|
||||
{
|
||||
DeviceNetworkList::iterator pt = systemmoduletypeconfig.moduletypeconfig[i].ModuleNetworkList.begin();
|
||||
|
||||
for (; pt != systemmoduletypeconfig.moduletypeconfig[i].ModuleNetworkList.end(); pt++)
|
||||
{
|
||||
string modulename = (*pt).DeviceName;
|
||||
HostConfigList::iterator pt1 = (*pt).hostConfigList.begin();
|
||||
|
||||
for (; pt1 != (*pt).hostConfigList.end(); pt1++)
|
||||
{
|
||||
string ipAddr = (*pt1).IPAddr;
|
||||
string servername = (*pt1).HostName;
|
||||
fprintf(pOutputFile, "ModuleHostName and ModuleIPAddr for NIC ID %u on module '%s' = %s , %s\n",
|
||||
(*pt1).NicID, modulename.c_str(), servername.c_str(), ipAddr.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DeviceDBRootList::iterator pt = systemmoduletypeconfig.moduletypeconfig[i].ModuleDBRootList.begin();
|
||||
|
||||
for (; pt != systemmoduletypeconfig.moduletypeconfig[i].ModuleDBRootList.end(); pt++)
|
||||
{
|
||||
if ((*pt).dbrootConfigList.size() > 0)
|
||||
{
|
||||
fprintf(pOutputFile, "DBRootIDs assigned to module 'pm%u' = ", (*pt).DeviceID);
|
||||
DBRootConfigList::iterator pt1 = (*pt).dbrootConfigList.begin();
|
||||
|
||||
for (; pt1 != (*pt).dbrootConfigList.end();)
|
||||
{
|
||||
fprintf(pOutputFile, "%u", *pt1);
|
||||
pt1++;
|
||||
|
||||
if (pt1 != (*pt).dbrootConfigList.end())
|
||||
fprintf(pOutputFile, ", ");
|
||||
}
|
||||
}
|
||||
fprintf(pOutputFile, "\n");
|
||||
}
|
||||
|
||||
fprintf(pOutputFile, "ModuleCPUCriticalThreshold = %u%%\n",
|
||||
systemmoduletypeconfig.moduletypeconfig[i].ModuleCPUCriticalThreshold);
|
||||
fprintf(pOutputFile, "ModuleCPUMajorThreshold = %u%%\n",
|
||||
systemmoduletypeconfig.moduletypeconfig[i].ModuleCPUMajorThreshold);
|
||||
fprintf(pOutputFile, "ModuleCPUMinorThreshold = %u%%\n",
|
||||
systemmoduletypeconfig.moduletypeconfig[i].ModuleCPUMinorThreshold);
|
||||
fprintf(pOutputFile, "ModuleCPUMinorClearThreshold = %u%%\n",
|
||||
systemmoduletypeconfig.moduletypeconfig[i].ModuleCPUMinorClearThreshold);
|
||||
fprintf(pOutputFile, "ModuleDiskCriticalThreshold = %u%%\n",
|
||||
systemmoduletypeconfig.moduletypeconfig[i].ModuleDiskCriticalThreshold);
|
||||
fprintf(pOutputFile, "ModuleDiskMajorThreshold = %u%%\n",
|
||||
systemmoduletypeconfig.moduletypeconfig[i].ModuleDiskMajorThreshold);
|
||||
fprintf(pOutputFile, "ModuleDiskMinorThreshold = %u%%\n",
|
||||
systemmoduletypeconfig.moduletypeconfig[i].ModuleDiskMinorThreshold);
|
||||
fprintf(pOutputFile, "ModuleMemCriticalThreshold = %u%%\n",
|
||||
systemmoduletypeconfig.moduletypeconfig[i].ModuleMemCriticalThreshold);
|
||||
fprintf(pOutputFile, "ModuleMemMajorThreshold = %u%%\n",
|
||||
systemmoduletypeconfig.moduletypeconfig[i].ModuleMemMajorThreshold);
|
||||
fprintf(pOutputFile, "ModuleMemMinorThreshold = %u%%\n",
|
||||
systemmoduletypeconfig.moduletypeconfig[i].ModuleMemMinorThreshold);
|
||||
fprintf(pOutputFile, "ModuleSwapCriticalThreshold = %u%%\n",
|
||||
systemmoduletypeconfig.moduletypeconfig[i].ModuleSwapCriticalThreshold);
|
||||
fprintf(pOutputFile, "ModuleSwapMajorThreshold = %u%%\n",
|
||||
systemmoduletypeconfig.moduletypeconfig[i].ModuleSwapMajorThreshold);
|
||||
fprintf(pOutputFile, "ModuleSwapMinorThreshold = %u%%\n",
|
||||
systemmoduletypeconfig.moduletypeconfig[i].ModuleSwapMinorThreshold);
|
||||
|
||||
DiskMonitorFileSystems::iterator pt2 = systemmoduletypeconfig.moduletypeconfig[i].FileSystems.begin();
|
||||
int id = 1;
|
||||
|
||||
for (; pt2 != systemmoduletypeconfig.moduletypeconfig[i].FileSystems.end(); pt2++)
|
||||
{
|
||||
string fs = *pt2;
|
||||
fprintf(pOutputFile, "ModuleDiskMonitorFileSystem#%i = %s\n", id, fs.c_str());
|
||||
++id;
|
||||
}
|
||||
fprintf(pOutputFile, "\n");
|
||||
}
|
||||
}
|
||||
catch (exception& e)
|
||||
{
|
||||
cout << endl << "**** getModuleTypeConfig Failed = " << e.what() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void getStorageConfig(FILE* pOutputFile)
|
||||
{
|
||||
Oam oam;
|
||||
try
|
||||
{
|
||||
systemStorageInfo_t t;
|
||||
t = oam.getStorageConfig();
|
||||
|
||||
string cloud;
|
||||
|
||||
try
|
||||
{
|
||||
oam.getSystemConfig("Cloud", cloud);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
|
||||
string::size_type pos = cloud.find("amazon", 0);
|
||||
|
||||
if (pos != string::npos)
|
||||
cloud = "amazon";
|
||||
|
||||
fprintf(pOutputFile, "System Storage Configuration\n");
|
||||
|
||||
fprintf(pOutputFile, "Performance Module (DBRoot) Storage Type = %s\n", boost::get<0>(t).c_str());
|
||||
|
||||
if (cloud == "amazon")
|
||||
fprintf(pOutputFile, "User Module Storage Type = %s\n", boost::get<3>(t).c_str());
|
||||
|
||||
fprintf(pOutputFile, "System Assigned DBRoot Count = %i\n", boost::get<1>(t));
|
||||
|
||||
DeviceDBRootList moduledbrootlist = boost::get<2>(t);
|
||||
|
||||
typedef std::vector<int> dbrootList;
|
||||
dbrootList dbrootlist;
|
||||
|
||||
DeviceDBRootList::iterator pt = moduledbrootlist.begin();
|
||||
|
||||
for (; pt != moduledbrootlist.end(); pt++)
|
||||
{
|
||||
fprintf(pOutputFile, "DBRoot IDs assigned to 'pm%u' = ", (*pt).DeviceID);
|
||||
DBRootConfigList::iterator pt1 = (*pt).dbrootConfigList.begin();
|
||||
|
||||
for (; pt1 != (*pt).dbrootConfigList.end();)
|
||||
{
|
||||
fprintf(pOutputFile, "%u", *pt1);
|
||||
dbrootlist.push_back(*pt1);
|
||||
pt1++;
|
||||
|
||||
if (pt1 != (*pt).dbrootConfigList.end())
|
||||
fprintf(pOutputFile, ", ");
|
||||
}
|
||||
|
||||
fprintf(pOutputFile, "\n");
|
||||
}
|
||||
|
||||
// get any unassigned DBRoots
|
||||
/*DBRootConfigList undbrootlist;
|
||||
|
||||
try
|
||||
{
|
||||
oam.getUnassignedDbroot(undbrootlist);
|
||||
}
|
||||
catch (...) {}
|
||||
|
||||
if ( !undbrootlist.empty() )
|
||||
{
|
||||
fprintf(pOutputFile,"DBRoot IDs unassigned = ");
|
||||
DBRootConfigList::iterator pt1 = undbrootlist.begin();
|
||||
|
||||
for ( ; pt1 != undbrootlist.end() ;)
|
||||
{
|
||||
fprintf(pOutputFile,"%u",*pt1);
|
||||
pt1++;
|
||||
|
||||
if (pt1 != undbrootlist.end())
|
||||
fprintf(pOutputFile,", ");
|
||||
}
|
||||
|
||||
fprintf(pOutputFile,"\n");
|
||||
}*/
|
||||
|
||||
fprintf(pOutputFile, "\n");
|
||||
|
||||
// um volumes
|
||||
if (cloud == "amazon" && boost::get<3>(t) == "external")
|
||||
{
|
||||
ModuleTypeConfig moduletypeconfig;
|
||||
oam.getSystemConfig("um", moduletypeconfig);
|
||||
|
||||
for (int id = 1; id < moduletypeconfig.ModuleCount + 1; id++)
|
||||
{
|
||||
string volumeNameID = "UMVolumeName" + oam.itoa(id);
|
||||
string volumeName = oam::UnassignedName;
|
||||
string deviceNameID = "UMVolumeDeviceName" + oam.itoa(id);
|
||||
string deviceName = oam::UnassignedName;
|
||||
|
||||
try
|
||||
{
|
||||
oam.getSystemConfig(volumeNameID, volumeName);
|
||||
oam.getSystemConfig(deviceNameID, deviceName);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
|
||||
fprintf(pOutputFile, "Amazon EC2 Volume Name/Device Name for 'um%i': %s, %s", id, volumeName.c_str(),
|
||||
deviceName.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
// pm volumes
|
||||
if (cloud == "amazon" && boost::get<0>(t) == "external")
|
||||
{
|
||||
fprintf(pOutputFile, "\n");
|
||||
|
||||
DBRootConfigList dbrootConfigList;
|
||||
|
||||
try
|
||||
{
|
||||
oam.getSystemDbrootConfig(dbrootConfigList);
|
||||
|
||||
DBRootConfigList::iterator pt = dbrootConfigList.begin();
|
||||
|
||||
for (; pt != dbrootConfigList.end(); pt++)
|
||||
{
|
||||
string volumeNameID = "PMVolumeName" + oam.itoa(*pt);
|
||||
string volumeName = oam::UnassignedName;
|
||||
string deviceNameID = "PMVolumeDeviceName" + oam.itoa(*pt);
|
||||
string deviceName = oam::UnassignedName;
|
||||
|
||||
try
|
||||
{
|
||||
oam.getSystemConfig(volumeNameID, volumeName);
|
||||
oam.getSystemConfig(deviceNameID, deviceName);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (exception& e)
|
||||
{
|
||||
cout << endl << "**** getSystemDbrootConfig Failed : " << e.what() << endl;
|
||||
}
|
||||
|
||||
// print un-assigned dbroots
|
||||
/*DBRootConfigList::iterator pt1 = undbrootlist.begin();
|
||||
|
||||
for ( ; pt1 != undbrootlist.end() ; pt1++)
|
||||
{
|
||||
string volumeNameID = "PMVolumeName" + oam.itoa(*pt1);
|
||||
string volumeName = oam::UnassignedName;
|
||||
string deviceNameID = "PMVolumeDeviceName" + oam.itoa(*pt1);
|
||||
string deviceName = oam::UnassignedName;
|
||||
|
||||
try
|
||||
{
|
||||
oam.getSystemConfig( volumeNameID, volumeName);
|
||||
oam.getSystemConfig( deviceNameID, deviceName);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
string DataRedundancyConfig;
|
||||
int DataRedundancyCopies;
|
||||
string DataRedundancyStorageType;
|
||||
|
||||
try
|
||||
{
|
||||
oam.getSystemConfig("DataRedundancyConfig", DataRedundancyConfig);
|
||||
oam.getSystemConfig("DataRedundancyCopies", DataRedundancyCopies);
|
||||
oam.getSystemConfig("DataRedundancyStorageType", DataRedundancyStorageType);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
|
||||
if (DataRedundancyConfig == "y")
|
||||
{
|
||||
fprintf(pOutputFile, "\nData Redundant Configuration\n\n");
|
||||
fprintf(pOutputFile, "Copies Per DBroot = %i", DataRedundancyCopies);
|
||||
|
||||
oamModuleInfo_t st;
|
||||
string moduleType;
|
||||
|
||||
try
|
||||
{
|
||||
st = oam.getModuleInfo();
|
||||
moduleType = boost::get<1>(st);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
|
||||
if (moduleType != "pm")
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
DBRootConfigList dbrootConfigList;
|
||||
oam.getSystemDbrootConfig(dbrootConfigList);
|
||||
|
||||
DBRootConfigList::iterator pt = dbrootConfigList.begin();
|
||||
|
||||
for (; pt != dbrootConfigList.end(); pt++)
|
||||
{
|
||||
fprintf(pOutputFile, "DBRoot #%u has copies on PMs = ", *pt);
|
||||
|
||||
string pmList = "";
|
||||
|
||||
try
|
||||
{
|
||||
string errmsg;
|
||||
// oam.glusterctl(oam::GLUSTER_WHOHAS, oam.itoa(*pt), pmList, errmsg);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
|
||||
boost::char_separator<char> sep(" ");
|
||||
boost::tokenizer<boost::char_separator<char> > tokens(pmList, sep);
|
||||
|
||||
for (boost::tokenizer<boost::char_separator<char> >::iterator it = tokens.begin();
|
||||
it != tokens.end(); ++it)
|
||||
{
|
||||
fprintf(pOutputFile, "%s ", (*it).c_str());
|
||||
}
|
||||
|
||||
fprintf(pOutputFile, "\n");
|
||||
}
|
||||
|
||||
fprintf(pOutputFile, "\n");
|
||||
}
|
||||
catch (exception& e)
|
||||
{
|
||||
cout << endl << "**** getSystemDbrootConfig Failed : " << e.what() << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (exception& e)
|
||||
{
|
||||
cout << endl << "**** getStorageConfig Failed : " << e.what() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void getStorageStatus(FILE* pOutputFile)
|
||||
{
|
||||
Oam oam;
|
||||
|
||||
fprintf(pOutputFile, "System External DBRoot Storage Statuses\n\n");
|
||||
fprintf(pOutputFile, "Component Status Last Status Change\n");
|
||||
fprintf(pOutputFile, "------------ -------------------------- ------------------------\n");
|
||||
|
||||
/*try
|
||||
{
|
||||
oam.getSystemStatus(systemstatus, false);
|
||||
|
||||
if ( systemstatus.systemdbrootstatus.dbrootstatus.size() == 0 )
|
||||
{
|
||||
fprintf(pOutputFile," No External DBRoot Storage Configured\n\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for ( unsigned int i = 0 ; i < systemstatus.systemdbrootstatus.dbrootstatus.size(); i++)
|
||||
{
|
||||
if ( systemstatus.systemdbrootstatus.dbrootstatus[i].Name.empty() )
|
||||
// end of list
|
||||
break;
|
||||
|
||||
int state = systemstatus.systemdbrootstatus.dbrootstatus[i].OpState;
|
||||
string stime = systemstatus.systemdbrootstatus.dbrootstatus[i].StateChangeDate ;
|
||||
stime = stime.substr (0, 24);
|
||||
fprintf(pOutputFile,"DBRoot%s%-29s%-24s\n",
|
||||
systemstatus.systemdbrootstatus.dbrootstatus[i].Name.c_str(),
|
||||
oamState[state].c_str(),
|
||||
stime.c_str());
|
||||
}
|
||||
fprintf(pOutputFile,"\n");
|
||||
}
|
||||
catch (exception& e)
|
||||
{
|
||||
cout << endl << "**** getSystemStatus Failed = " << e.what() << endl;
|
||||
}*/
|
||||
|
||||
string DataRedundancyConfig;
|
||||
int DataRedundancyCopies;
|
||||
string DataRedundancyStorageType;
|
||||
|
||||
try
|
||||
{
|
||||
oam.getSystemConfig("DataRedundancyConfig", DataRedundancyConfig);
|
||||
oam.getSystemConfig("DataRedundancyCopies", DataRedundancyCopies);
|
||||
oam.getSystemConfig("DataRedundancyStorageType", DataRedundancyStorageType);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
*
|
||||
* checkLogStatus - Check for a phrase in a log file and return status
|
||||
*
|
||||
********************************************************************/
|
||||
bool checkLogStatus(std::string fileName, std::string phrase)
|
||||
{
|
||||
ifstream file(fileName.c_str());
|
||||
|
||||
if (!file.is_open())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
string buf;
|
||||
|
||||
while (getline(file, buf))
|
||||
{
|
||||
string::size_type pos = buf.find(phrase, 0);
|
||||
|
||||
if (pos != string::npos)
|
||||
// found phrase
|
||||
return true;
|
||||
}
|
||||
|
||||
if (file.bad())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
file.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
/******************************************************************************************
|
||||
* @brief Get Network IP Address for Host Name
|
||||
*
|
||||
* purpose: Get Network IP Address for Host Name
|
||||
*
|
||||
******************************************************************************************/
|
||||
string getIPAddress(string hostName)
|
||||
{
|
||||
static uint32_t my_bind_addr;
|
||||
struct hostent* ent;
|
||||
string IPAddr = "";
|
||||
Oam oam;
|
||||
|
||||
ent = gethostbyname(hostName.c_str());
|
||||
|
||||
if (ent != 0)
|
||||
{
|
||||
my_bind_addr = (uint32_t)((in_addr*)ent->h_addr_list[0])->s_addr;
|
||||
|
||||
uint8_t split[4];
|
||||
uint32_t ip = my_bind_addr;
|
||||
split[0] = (ip & 0xff000000) >> 24;
|
||||
split[1] = (ip & 0x00ff0000) >> 16;
|
||||
split[2] = (ip & 0x0000ff00) >> 8;
|
||||
split[3] = (ip & 0x000000ff);
|
||||
|
||||
IPAddr =
|
||||
oam.itoa(split[3]) + "." + oam.itoa(split[2]) + "." + oam.itoa(split[1]) + "." + oam.itoa(split[0]);
|
||||
}
|
||||
|
||||
return IPAddr;
|
||||
}
|
@@ -1,34 +0,0 @@
|
||||
/* Copyright (C) 2020 MariaDB Corporation
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; version 2 of
|
||||
the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <limits.h>
|
||||
#include <sstream>
|
||||
#include "configcpp.h"
|
||||
#include "liboamcpp.h"
|
||||
|
||||
void getSystemNetworkConfig(FILE* pOutputFile);
|
||||
void getModuleTypeConfig(FILE* pOutputFile);
|
||||
void getStorageConfig(FILE* pOutputFile);
|
||||
void getStorageStatus(FILE* pOutputFile);
|
||||
bool checkLogStatus(std::string filename, std::string phase);
|
||||
std::string getIPAddress(std::string hostName);
|
@@ -1,66 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# $Id: resourceReport.sh 421 2007-04-05 15:46:55Z dhill $
|
||||
#
|
||||
if [ $1 ] ; then
|
||||
MODULE=$1
|
||||
else
|
||||
MODULE="pm1"
|
||||
fi
|
||||
|
||||
if [ $2 ] ; then
|
||||
OUT_FILE=$2
|
||||
else
|
||||
OUT_FILE=${MODULE}_logReport.txt
|
||||
fi
|
||||
|
||||
{
|
||||
echo " "
|
||||
echo "******************** Resource Usage Report for ${MODULE} ********************"
|
||||
echo " "
|
||||
|
||||
echo " "
|
||||
echo "-- Shared Memory --"
|
||||
echo " "
|
||||
echo "################# ipcs -l #################"
|
||||
echo " "
|
||||
ipcs -l
|
||||
|
||||
echo "################# clearShm -n #################"
|
||||
echo " "
|
||||
clearShm -n
|
||||
|
||||
echo " "
|
||||
echo "-- Disk Usage --"
|
||||
echo " "
|
||||
echo "################# df -k #################"
|
||||
echo " "
|
||||
df -k
|
||||
|
||||
echo " "
|
||||
echo "-- Disk BRM Data files --"
|
||||
echo " "
|
||||
ls -l /var/lib/columnstore/data1/systemFiles/dbrm 2> /dev/null
|
||||
ls -l /var/lib/columnstore/dbrm 2> /dev/null
|
||||
|
||||
echo "################# cat /var/lib/columnstore/data1/systemFiles/dbrm/BRM_saves_current #################"
|
||||
echo " "
|
||||
cat /var/lib/columnstore/data1/systemFiles/dbrm/BRM_saves_current 2> /dev/null
|
||||
|
||||
echo " "
|
||||
echo "-- View Table Locks --"
|
||||
echo " "
|
||||
echo "################# cat bin/viewtablelock #################"
|
||||
echo " "
|
||||
viewtablelock 2> /dev/null
|
||||
|
||||
echo " "
|
||||
echo "-- BRM Extent Map --"
|
||||
echo " "
|
||||
echo "################# bin/editem -i #################"
|
||||
echo " "
|
||||
editem -i 2>/dev/null
|
||||
|
||||
} >> $OUT_FILE
|
||||
|
||||
exit 0
|
@@ -1,30 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# $Id: hardwareReport.sh 421 2007-04-05 15:46:55Z dhill $
|
||||
#
|
||||
if [ $1 ] ; then
|
||||
MODULE=$1
|
||||
else
|
||||
MODULE="pm1"
|
||||
fi
|
||||
|
||||
if [ $2 ] ; then
|
||||
OUT_FILE=$2
|
||||
else
|
||||
OUT_FILE=${MODULE}_logReport.txt
|
||||
fi
|
||||
|
||||
{
|
||||
echo " "
|
||||
echo "******************** Software Report for ${MODULE} ********************"
|
||||
echo " "
|
||||
|
||||
echo " "
|
||||
echo "-- Columnstore Package Details --"
|
||||
echo " "
|
||||
rpm -qi MariaDB-columnstore-engine
|
||||
echo " "
|
||||
|
||||
} >> $OUT_FILE
|
||||
|
||||
exit 0
|
@@ -1,34 +0,0 @@
|
||||
#
|
||||
# Not used
|
||||
#
|
||||
|
||||
# original Makefile.am contents follow:
|
||||
|
||||
# Copyright (C) 2014 InfiniDB, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
|
||||
# License as published by the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# $Id: Makefile.am 333 2009-04-03 20:35:04Z rdempsey $ Process this file with automake to produce Makefile.in
|
||||
#
|
||||
# AM_CPPFLAGS = $(idb_cppflags) AM_CFLAGS = $(idb_cflags) AM_CXXFLAGS = $(idb_cxxflags) AM_LDFLAGS = $(idb_ldflags)
|
||||
# bin_PROGRAMS = ReplayTransactionLog ReplayTransactionLog_SOURCES = replaytransactionlog.cpp
|
||||
# ReplayTransactionLog_CPPFLAGS = @idb_common_includes@ $(AM_CPPFLAGS) ReplayTransactionLog_LDFLAGS =
|
||||
# @idb_common_ldflags@ @idb_exec_libs@ -lreplaytxnlog $(AM_LDFLAGS)
|
||||
#
|
||||
# test:
|
||||
#
|
||||
# coverage:
|
||||
#
|
||||
# leakcheck:
|
||||
#
|
||||
# docs:
|
||||
#
|
||||
# bootstrap: install-data-am
|
||||
#
|
@@ -1,156 +0,0 @@
|
||||
/* Copyright (C) 2014 InfiniDB, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; version 2 of
|
||||
the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
// WWW - Add header comment.
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include "liboamcpp.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace oam;
|
||||
|
||||
#include "replaytxnlog.h"
|
||||
namespace
|
||||
{
|
||||
void usage(char* prog)
|
||||
{
|
||||
cout << endl;
|
||||
cout << "Usage: " << prog << " [options]" << endl;
|
||||
|
||||
cout << endl;
|
||||
cout << "This utility can be used after a backup is restored to report transactions that " << endl;
|
||||
cout << "occurred after the backup. It begins with the first transaction that was committed " << endl;
|
||||
cout << "after the backup and reports DDL and DML statements as well as imports." << endl;
|
||||
cout << endl;
|
||||
|
||||
cout << "Options:" << endl;
|
||||
/*
|
||||
cout << "-u <user> Database user id." << endl << endl;
|
||||
|
||||
cout << "-p <password> Password." << endl << endl;
|
||||
*/
|
||||
cout << "-d <stop date> Stop date and time as mm/dd/yy@hh:mm:ss or 'Now'." << endl;
|
||||
cout << " Only transactions committed before this date and time will be reported." << endl;
|
||||
cout << " The current date and time will be used if 'Now'." << endl << endl;
|
||||
|
||||
/*
|
||||
cout << "-i Ignore bulk load log entries." << endl;
|
||||
cout << " The program will pause and prompt at bulk load entries by default." << endl <<
|
||||
endl;
|
||||
|
||||
cout << "-e Report mode. The sql statements will be displayed to the console only. No" <<
|
||||
endl; cout << " transactions will be processed. The user and password will be ignored." <<
|
||||
endl << endl;
|
||||
*/
|
||||
|
||||
cout << "-h Display this help." << endl << endl;
|
||||
}
|
||||
|
||||
bool isRunningOnPm()
|
||||
{
|
||||
Oam oam;
|
||||
oamModuleInfo_t t;
|
||||
string moduleType;
|
||||
int installType = -1;
|
||||
|
||||
char* csc_ident = getenv("CALPONT_CSC_IDENT");
|
||||
|
||||
if (csc_ident == 0 || *csc_ident == 0)
|
||||
{
|
||||
// get local module info valdiate running on a pm
|
||||
try
|
||||
{
|
||||
t = oam.getModuleInfo();
|
||||
moduleType = boost::get<1>(t);
|
||||
installType = boost::get<5>(t);
|
||||
}
|
||||
catch (exception& e)
|
||||
{
|
||||
moduleType = "pm";
|
||||
}
|
||||
}
|
||||
else
|
||||
moduleType = csc_ident;
|
||||
|
||||
if (installType != oam::INSTALL_COMBINE_DM_UM_PM)
|
||||
{
|
||||
if (moduleType != "pm")
|
||||
{
|
||||
cerr << "Exiting, ReplayTransactionLog can only be run on a performance module (pm)" << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
string user;
|
||||
string password;
|
||||
string stopDate;
|
||||
bool ignoreBulk = false;
|
||||
bool reportMode = false;
|
||||
char c;
|
||||
|
||||
// Invokes member function `int operator ()(void);'
|
||||
while ((c = getopt(argc, argv, "u:p:d:ihe")) != -1)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
/*
|
||||
case 'u':
|
||||
user = optarg;
|
||||
break;
|
||||
case 'p':
|
||||
password = optarg;
|
||||
break;
|
||||
*/
|
||||
case 'd': stopDate = optarg; break;
|
||||
|
||||
/*
|
||||
case 'i':
|
||||
ignoreBulk = true;
|
||||
break;
|
||||
case 'e':
|
||||
reportMode = true;
|
||||
break;
|
||||
*/
|
||||
case 'h':
|
||||
usage(argv[0]);
|
||||
return 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isRunningOnPm())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ReplayTxnLog replayTxnLog(user, password, stopDate, ignoreBulk, reportMode);
|
||||
replayTxnLog.process();
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,66 +0,0 @@
|
||||
/* Copyright (C) 2014 InfiniDB, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; version 2 of
|
||||
the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
/***************************************************************************
|
||||
* wweeks@calpont.com *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
using namespace std;
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include "sessionmanager.h"
|
||||
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
using namespace execplan;
|
||||
|
||||
int maxNewTxns = 1000;
|
||||
int maxTxns = 1000;
|
||||
|
||||
class ExecPlanTest : public CppUnit::TestFixture
|
||||
{
|
||||
CPPUNIT_TEST_SUITE(ExecPlanTest);
|
||||
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
private:
|
||||
public:
|
||||
void setUp()
|
||||
{
|
||||
}
|
||||
|
||||
void tearDown()
|
||||
{
|
||||
}
|
||||
}; // test suite
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(ExecPlanTest);
|
||||
|
||||
#include <cppunit/extensions/TestFactoryRegistry.h>
|
||||
#include <cppunit/ui/text/TestRunner.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
CppUnit::TextUi::TestRunner runner;
|
||||
CppUnit::TestFactoryRegistry& registry = CppUnit::TestFactoryRegistry::getRegistry();
|
||||
runner.addTest(registry.makeTest());
|
||||
bool wasSuccessful = runner.run("", false);
|
||||
return (wasSuccessful ? 0 : 1);
|
||||
}
|
@@ -1,34 +0,0 @@
|
||||
#
|
||||
# Not used
|
||||
#
|
||||
|
||||
# original Makefile.am contents follow:
|
||||
|
||||
# Copyright (C) 2014 InfiniDB, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
|
||||
# License as published by the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# $Id: Makefile.am 333 2009-04-03 20:35:04Z rdempsey $ Process this file with automake to produce Makefile.in
|
||||
#
|
||||
# AM_CPPFLAGS = $(idb_cppflags) AM_CFLAGS = $(idb_cflags) AM_CXXFLAGS = $(idb_cxxflags) AM_LDFLAGS = $(idb_ldflags)
|
||||
# bin_PROGRAMS = sessionWalker sessionWalker_SOURCES = sessionwalker.cpp sessionWalker_CPPFLAGS = @idb_common_includes@
|
||||
# $(AM_CPPFLAGS) sessionWalker_LDFLAGS = @idb_common_ldflags@ @idb_common_libs@ @idb_write_libs@ @netsnmp_libs@
|
||||
# $(AM_LDFLAGS)
|
||||
#
|
||||
# test:
|
||||
#
|
||||
# coverage:
|
||||
#
|
||||
# leakcheck:
|
||||
#
|
||||
# docs:
|
||||
#
|
||||
# bootstrap: install-data-am
|
||||
#
|
@@ -1,135 +0,0 @@
|
||||
/* Copyright (C) 2014 InfiniDB, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; version 2 of
|
||||
the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
/***************************************************************************
|
||||
* $Id: sessionwalker.cpp 3072 2013-04-04 19:04:45Z rdempsey $
|
||||
*
|
||||
* jrodriguez@calpont.com
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
#include "sessionmonitor.h"
|
||||
using namespace execplan;
|
||||
|
||||
#include "vendordmlstatement.h"
|
||||
#include "calpontdmlpackage.h"
|
||||
#include "calpontdmlfactory.h"
|
||||
using namespace dmlpackage;
|
||||
|
||||
#include "bytestream.h"
|
||||
#include "messagequeue.h"
|
||||
using namespace messageqcpp;
|
||||
|
||||
namespace
|
||||
{
|
||||
void usage()
|
||||
{
|
||||
cout << "sessionwalker [-d|-h]" << endl
|
||||
<< " -r rollback all transactions found" << endl
|
||||
<< " -h display this help" << endl;
|
||||
}
|
||||
|
||||
void rollback(const SessionMonitor::MonSIDTIDEntry& txn)
|
||||
{
|
||||
VendorDMLStatement dmlStmt("ROLLBACK;", txn.sessionid);
|
||||
CalpontDMLPackage* pDMLPackage = CalpontDMLFactory::makeCalpontDMLPackage(dmlStmt);
|
||||
|
||||
if (pDMLPackage == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ByteStream bytestream;
|
||||
pDMLPackage->write(bytestream);
|
||||
delete pDMLPackage;
|
||||
MessageQueueClient mq("DMLProc");
|
||||
|
||||
try
|
||||
{
|
||||
cout << "sending ROLLBACK for sessionID " << txn.sessionid << endl;
|
||||
mq.write(bytestream);
|
||||
bytestream = mq.read();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
bool rflg = false;
|
||||
opterr = 0;
|
||||
int c;
|
||||
|
||||
while ((c = getopt(argc, argv, "rh")) != EOF)
|
||||
switch (c)
|
||||
{
|
||||
case 'r': rflg = true; break;
|
||||
|
||||
case 'h':
|
||||
usage();
|
||||
return 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
usage();
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
|
||||
vector<SessionMonitor::MonSIDTIDEntry*> toTxns;
|
||||
SessionMonitor* monitor = new SessionMonitor();
|
||||
|
||||
toTxns.clear();
|
||||
toTxns = monitor->timedOutTxns(); // get timed out txns
|
||||
|
||||
vector<SessionMonitor::MonSIDTIDEntry*>::iterator iter = toTxns.begin();
|
||||
vector<SessionMonitor::MonSIDTIDEntry*>::iterator end = toTxns.end();
|
||||
|
||||
vector<SessionMonitor::MonSIDTIDEntry*> tmp;
|
||||
|
||||
while (iter != end)
|
||||
{
|
||||
if ((*iter)->sessionid > 0)
|
||||
tmp.push_back(*iter);
|
||||
|
||||
++iter;
|
||||
}
|
||||
|
||||
toTxns.swap(tmp);
|
||||
|
||||
cout << toTxns.size() << " timed out transactions." << endl;
|
||||
|
||||
for (unsigned idx = 0; idx < toTxns.size(); idx++)
|
||||
{
|
||||
monitor->printTxns(*toTxns[idx]);
|
||||
|
||||
if (rflg)
|
||||
{
|
||||
rollback(*toTxns[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
delete monitor;
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,189 +0,0 @@
|
||||
/* Copyright (C) 2014 InfiniDB, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; version 2 of
|
||||
the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
/***************************************************************************
|
||||
* jrodriguez@calpont.com *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
using namespace std;
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include "sessionmonitor.h"
|
||||
#include "sessionmanager.h"
|
||||
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
using namespace execplan;
|
||||
|
||||
int maxNewTxns = 1000;
|
||||
int maxTxns = 1000;
|
||||
|
||||
class ExecPlanTest : public CppUnit::TestFixture
|
||||
{
|
||||
CPPUNIT_TEST_SUITE(ExecPlanTest);
|
||||
|
||||
CPPUNIT_TEST(MonitorTestPlan_1);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
private:
|
||||
public:
|
||||
void setUp()
|
||||
{
|
||||
}
|
||||
|
||||
void tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
int verifyLen;
|
||||
SessionManager* manager;
|
||||
SessionManager::TxnID managerTxns[1000];
|
||||
|
||||
int createTxns(const int& start, const int& end)
|
||||
{
|
||||
int first = start;
|
||||
int last = end;
|
||||
int newTxns = 0;
|
||||
|
||||
verifyLen = manager->verifySize();
|
||||
|
||||
for (int idx = first; idx < last && verifyLen < maxNewTxns; idx++)
|
||||
{
|
||||
managerTxns[idx] = manager->newTxnID((uint32_t)idx + 1000);
|
||||
CPPUNIT_ASSERT(managerTxns[idx].id > 0);
|
||||
CPPUNIT_ASSERT(managerTxns[idx].valid == true);
|
||||
verifyLen = manager->verifySize();
|
||||
CPPUNIT_ASSERT(verifyLen > 0);
|
||||
newTxns++;
|
||||
}
|
||||
|
||||
CPPUNIT_ASSERT(newTxns == last - first);
|
||||
return newTxns;
|
||||
}
|
||||
|
||||
int closeTxns(const int& start, const int& end)
|
||||
{
|
||||
int first = start;
|
||||
int last = end;
|
||||
int totalClosed = 0;
|
||||
|
||||
for (int idx = first; idx < last; idx++)
|
||||
{
|
||||
try
|
||||
{
|
||||
SessionManager::TxnID tmp = manager->getTxnID(idx + 1000);
|
||||
|
||||
if (tmp.valid == true)
|
||||
{
|
||||
manager->committed(tmp);
|
||||
CPPUNIT_ASSERT(tmp.valid == false);
|
||||
totalClosed++;
|
||||
}
|
||||
}
|
||||
catch (exception& e)
|
||||
{
|
||||
cerr << e.what() << endl;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return totalClosed;
|
||||
|
||||
} // closeTxns
|
||||
|
||||
void MonitorTestPlan_1()
|
||||
{
|
||||
int currStartTxn = 0;
|
||||
int currEndTxn = 5;
|
||||
int txnCntIncr = 5;
|
||||
const int sleepTime = 1;
|
||||
const int iterMax = 1;
|
||||
vector<SessionMonitor::MonSIDTIDEntry*> toTxns;
|
||||
|
||||
manager = new SessionManager();
|
||||
// CPPUNIT_ASSERT(manager->verifySize()==0);
|
||||
|
||||
SessionMonitor* monitor = NULL;
|
||||
|
||||
for (int jdx = 0; jdx < iterMax; jdx++)
|
||||
{
|
||||
// store the current state of the SessionManager
|
||||
monitor = new SessionMonitor();
|
||||
monitor->AgeLimit(sleepTime);
|
||||
delete monitor;
|
||||
int idx = 0;
|
||||
int grpStart = currStartTxn;
|
||||
|
||||
for (idx = 0; idx < 3; idx++)
|
||||
{
|
||||
createTxns(currStartTxn, currEndTxn);
|
||||
// CPPUNIT_ASSERT(manager->verifySize()==(idx+1)*txnCntIncr);
|
||||
|
||||
currStartTxn += txnCntIncr;
|
||||
currEndTxn += txnCntIncr;
|
||||
sleep(sleepTime + 1); // make sessions time out
|
||||
|
||||
monitor = new SessionMonitor(); // read Monitor data
|
||||
monitor->AgeLimit(sleepTime);
|
||||
toTxns.clear();
|
||||
toTxns = monitor->timedOutTxns(); // get timed out txns
|
||||
CPPUNIT_ASSERT(toTxns.size() == (uint32_t)txnCntIncr * idx);
|
||||
|
||||
delete monitor;
|
||||
}
|
||||
|
||||
int grpEnd = currEndTxn;
|
||||
monitor = new SessionMonitor();
|
||||
monitor->AgeLimit(sleepTime);
|
||||
closeTxns(grpStart, grpEnd); // close this iteration of txns
|
||||
// CPPUNIT_ASSERT(manager->verifySize()==0);
|
||||
toTxns = monitor->timedOutTxns(); // get timed out txns
|
||||
CPPUNIT_ASSERT(toTxns.size() == 0);
|
||||
|
||||
delete monitor;
|
||||
}
|
||||
|
||||
monitor = new SessionMonitor(); // readload Monitor data
|
||||
monitor->AgeLimit(sleepTime - 1);
|
||||
|
||||
toTxns.clear();
|
||||
toTxns = monitor->timedOutTxns(); // get timed out txns
|
||||
CPPUNIT_ASSERT(toTxns.size() == 0);
|
||||
delete monitor;
|
||||
|
||||
// CPPUNIT_ASSERT(manager->verifySize()==0);
|
||||
delete manager;
|
||||
}
|
||||
|
||||
}; // test suite
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(ExecPlanTest);
|
||||
|
||||
#include <cppunit/extensions/TestFactoryRegistry.h>
|
||||
#include <cppunit/ui/text/TestRunner.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
CppUnit::TextUi::TestRunner runner;
|
||||
CppUnit::TestFactoryRegistry& registry = CppUnit::TestFactoryRegistry::getRegistry();
|
||||
runner.addTest(registry.makeTest());
|
||||
bool wasSuccessful = runner.run("", false);
|
||||
return (wasSuccessful ? 0 : 1);
|
||||
}
|
@@ -14,4 +14,4 @@ set(dbbc_STAT_SRCS
|
||||
fsutils.cpp
|
||||
)
|
||||
columnstore_static_library(dbbc ${dbbc_STAT_SRCS})
|
||||
columnstore_link(dbbc ${NETSNMP_LIBRARIES} loggingcpp)
|
||||
columnstore_link(dbbc loggingcpp)
|
||||
|
@@ -5,4 +5,4 @@ include_directories(${ENGINE_COMMON_INCLUDES} ../blockcache ../primproc)
|
||||
set(processor_STAT_SRCS primitiveprocessor.cpp dictionary.cpp column.cpp)
|
||||
|
||||
columnstore_static_library(processor ${processor_STAT_SRCS})
|
||||
columnstore_link(processor ${NETSNMP_LIBRARIES} loggingcpp)
|
||||
columnstore_link(processor loggingcpp)
|
||||
|
@@ -40,7 +40,6 @@ using namespace boost;
|
||||
#include "simd_sse.h"
|
||||
#include "simd_arm.h"
|
||||
#include "utils/common/columnwidth.h"
|
||||
#include "utils/common/bit_cast.h"
|
||||
|
||||
#include "exceptclasses.h"
|
||||
|
||||
|
@@ -32,11 +32,11 @@ target_include_directories(PrimProc PRIVATE ${Boost_INCLUDE_DIRS})
|
||||
columnstore_link(
|
||||
PrimProc
|
||||
${ENGINE_LDFLAGS}
|
||||
${NETSNMP_LIBRARIES}
|
||||
${ENGINE_WRITE_LIBS}
|
||||
threadpool
|
||||
cacheutils
|
||||
dbbc
|
||||
processor
|
||||
loggingcpp
|
||||
statistics_manager
|
||||
)
|
||||
|
@@ -78,7 +78,7 @@
|
||||
#include "dbrm.h"
|
||||
|
||||
#include "mariadb_my_sys.h"
|
||||
#include "statistics.h"
|
||||
#include "statistics_manager/statistics.h"
|
||||
#include "serviceexemgr.h"
|
||||
#include "sqlfrontsessionthread.h"
|
||||
|
||||
|
@@ -58,7 +58,7 @@
|
||||
#include "dbrm.h"
|
||||
|
||||
#include "mariadb_my_sys.h"
|
||||
#include "statistics.h"
|
||||
#include "statistics_manager/statistics.h"
|
||||
|
||||
namespace exemgr
|
||||
{
|
||||
@@ -69,7 +69,7 @@ class Opt
|
||||
int m_debug;
|
||||
bool m_e;
|
||||
bool m_fg;
|
||||
Opt() : m_debug(0), m_e(false), m_fg(false){};
|
||||
Opt() : m_debug(0), m_e(false), m_fg(false) {};
|
||||
Opt(int argc, char* argv[]) : m_debug(0), m_e(false), m_fg(false)
|
||||
{
|
||||
int c;
|
||||
|
@@ -56,13 +56,13 @@
|
||||
#include "dbrm.h"
|
||||
|
||||
#include "mariadb_my_sys.h"
|
||||
#include "statistics.h"
|
||||
#include "statistics_manager/statistics.h"
|
||||
#include "serviceexemgr.h"
|
||||
|
||||
namespace exemgr
|
||||
{
|
||||
class SQLFrontSessionThread
|
||||
{
|
||||
class SQLFrontSessionThread
|
||||
{
|
||||
public:
|
||||
SQLFrontSessionThread(const messageqcpp::IOSocket& ios, joblist::DistributedEngineComm* ec,
|
||||
joblist::ResourceManager* rm)
|
||||
@@ -125,7 +125,8 @@ namespace exemgr
|
||||
void analyzeTableExecute(messageqcpp::ByteStream& bs, joblist::SJLP& jl, bool& stmtCounted);
|
||||
void analyzeTableHandleStats(messageqcpp::ByteStream& bs);
|
||||
uint64_t roundMB(uint64_t value) const;
|
||||
|
||||
public:
|
||||
void operator()();
|
||||
};
|
||||
}
|
||||
};
|
||||
} // namespace exemgr
|
||||
|
@@ -1,14 +1,15 @@
|
||||
add_subdirectory(dbbuilder)
|
||||
add_subdirectory(editem)
|
||||
add_subdirectory(dbloadxml)
|
||||
add_subdirectory(getConfig)
|
||||
add_subdirectory(cplogger)
|
||||
add_subdirectory(clearShm)
|
||||
add_subdirectory(cleartablelock)
|
||||
add_subdirectory(configMgt)
|
||||
add_subdirectory(cplogger)
|
||||
add_subdirectory(dbbuilder)
|
||||
add_subdirectory(dbloadxml)
|
||||
add_subdirectory(ddlcleanup)
|
||||
add_subdirectory(editem)
|
||||
add_subdirectory(getConfig)
|
||||
add_subdirectory(idbmeminfo)
|
||||
add_subdirectory(passwd)
|
||||
add_subdirectory(rebuildEM)
|
||||
add_subdirectory(rgprint)
|
||||
add_subdirectory(setConfig)
|
||||
add_subdirectory(viewtablelock)
|
||||
add_subdirectory(cleartablelock)
|
||||
add_subdirectory(ddlcleanup)
|
||||
add_subdirectory(idbmeminfo)
|
||||
add_subdirectory(rebuildEM)
|
||||
add_subdirectory(passwd)
|
||||
add_subdirectory(configMgt)
|
||||
|
@@ -6,4 +6,4 @@ set(cleartablelock_SRCS cleartablelock.cpp cleartablelockthread.cpp)
|
||||
|
||||
columnstore_executable(cleartablelock ${cleartablelock_SRCS})
|
||||
|
||||
columnstore_link(cleartablelock ${ENGINE_LDFLAGS} ${NETSNMP_LIBRARIES} ${ENGINE_WRITE_LIBS})
|
||||
columnstore_link(cleartablelock ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS})
|
||||
|
@@ -5,4 +5,4 @@ include_directories(${ENGINE_COMMON_INCLUDES})
|
||||
set(autoConfigure_SRCS autoConfigure.cpp)
|
||||
|
||||
add_executable(autoConfigure ${autoConfigure_SRCS})
|
||||
columnstore_link(autoConfigure ${ENGINE_LDFLAGS} ${NETSNMP_LIBRARIES} ${ENGINE_EXEC_LIBS})
|
||||
columnstore_link(autoConfigure ${ENGINE_LDFLAGS} ${ENGINE_EXEC_LIBS})
|
||||
|
@@ -6,4 +6,4 @@ set(dbbuilder_SRCS dbbuilder.cpp systemcatalog.cpp)
|
||||
|
||||
columnstore_executable(dbbuilder ${dbbuilder_SRCS})
|
||||
|
||||
columnstore_link(dbbuilder ${ENGINE_LDFLAGS} ${NETSNMP_LIBRARIES} ${ENGINE_WRITE_LIBS})
|
||||
columnstore_link(dbbuilder ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS})
|
||||
|
@@ -5,4 +5,4 @@ include_directories(${ENGINE_COMMON_INCLUDES})
|
||||
set(ddlcleanup_SRCS ddlcleanup.cpp)
|
||||
|
||||
columnstore_executable(ddlcleanup ${ddlcleanup_SRCS})
|
||||
columnstore_link(ddlcleanup ${ENGINE_LDFLAGS} ${NETSNMP_LIBRARIES} ${ENGINE_WRITE_LIBS} ddlcleanuputil)
|
||||
columnstore_link(ddlcleanup ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS} ddlcleanuputil)
|
||||
|
@@ -5,4 +5,4 @@ include_directories(${ENGINE_COMMON_INCLUDES})
|
||||
set(editem_SRCS editem.cpp)
|
||||
|
||||
columnstore_executable(editem ${editem_SRCS})
|
||||
columnstore_link(editem ${ENGINE_LDFLAGS} ${NETSNMP_LIBRARIES} ${ENGINE_EXEC_LIBS})
|
||||
columnstore_link(editem ${ENGINE_LDFLAGS} ${ENGINE_EXEC_LIBS})
|
||||
|
@@ -6,4 +6,4 @@ set(rgprint_SRCS rgprint.cpp)
|
||||
|
||||
columnstore_executable(rgprint ${rgprint_SRCS})
|
||||
|
||||
columnstore_link(rgprint ${ENGINE_LDFLAGS} ${NETSNMP_LIBRARIES} ${ENGINE_WRITE_LIBS})
|
||||
columnstore_link(rgprint ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS})
|
||||
|
@@ -5,4 +5,4 @@ include_directories(${ENGINE_COMMON_INCLUDES})
|
||||
set(setConfig_SRCS main.cpp)
|
||||
|
||||
columnstore_executable(mcsSetConfig ${setConfig_SRCS})
|
||||
columnstore_link(mcsSetConfig ${ENGINE_LDFLAGS} ${NETSNMP_LIBRARIES} ${ENGINE_EXEC_LIBS})
|
||||
columnstore_link(mcsSetConfig ${ENGINE_LDFLAGS} ${ENGINE_EXEC_LIBS})
|
||||
|
@@ -1,26 +1,28 @@
|
||||
# add_subdirectory(boost_idb)
|
||||
add_subdirectory(startup)
|
||||
add_subdirectory(common)
|
||||
add_subdirectory(configcpp)
|
||||
add_subdirectory(loggingcpp)
|
||||
add_subdirectory(messageqcpp)
|
||||
add_subdirectory(threadpool)
|
||||
add_subdirectory(rwlock)
|
||||
add_subdirectory(dataconvert)
|
||||
add_subdirectory(joiner)
|
||||
add_subdirectory(rowgroup)
|
||||
add_subdirectory(cacheutils)
|
||||
add_subdirectory(funcexp)
|
||||
add_subdirectory(udfsdk)
|
||||
add_subdirectory(compress)
|
||||
add_subdirectory(batchloader)
|
||||
add_subdirectory(ddlcleanup)
|
||||
add_subdirectory(querystats)
|
||||
add_subdirectory(windowfunction)
|
||||
add_subdirectory(idbdatafile)
|
||||
add_subdirectory(querytele)
|
||||
add_subdirectory(libmysql_client)
|
||||
add_subdirectory(regr)
|
||||
add_subdirectory(cacheutils)
|
||||
add_subdirectory(cloudio)
|
||||
add_subdirectory(common)
|
||||
add_subdirectory(compress)
|
||||
add_subdirectory(configcpp)
|
||||
add_subdirectory(dataconvert)
|
||||
add_subdirectory(ddlcleanup)
|
||||
add_subdirectory(funcexp)
|
||||
add_subdirectory(idbdatafile)
|
||||
add_subdirectory(joiner)
|
||||
add_subdirectory(libmarias3)
|
||||
add_subdirectory(libmysql_client)
|
||||
add_subdirectory(loggingcpp)
|
||||
add_subdirectory(mariadb_charset)
|
||||
add_subdirectory(messageqcpp)
|
||||
add_subdirectory(pron)
|
||||
add_subdirectory(querystats)
|
||||
add_subdirectory(querytele)
|
||||
add_subdirectory(regr)
|
||||
add_subdirectory(rowgroup)
|
||||
add_subdirectory(rwlock)
|
||||
add_subdirectory(startup)
|
||||
add_subdirectory(statistics_manager)
|
||||
add_subdirectory(threadpool)
|
||||
add_subdirectory(udfsdk)
|
||||
add_subdirectory(windowfunction)
|
||||
|
@@ -6,4 +6,4 @@ set(batchloader_LIB_SRCS batchloader.cpp)
|
||||
|
||||
columnstore_library(batchloader ${batchloader_LIB_SRCS})
|
||||
|
||||
columnstore_link(batchloader ${NETSNMP_LIBRARIES} oamcpp loggingcpp)
|
||||
columnstore_link(batchloader oamcpp loggingcpp)
|
||||
|
@@ -9,10 +9,17 @@ set(common_LIB_SRCS
|
||||
MonitorProcMem.cpp
|
||||
nullvaluemanip.cpp
|
||||
threadnaming.cpp
|
||||
utils_utf8.cpp
|
||||
statistics.cpp
|
||||
string_prefixes.cpp
|
||||
)
|
||||
|
||||
columnstore_library(common ${common_LIB_SRCS})
|
||||
columnstore_link(common boost_filesystem configcpp loggingcpp messageqcpp)
|
||||
columnstore_link(
|
||||
common
|
||||
PRIVATE
|
||||
boost_filesystem
|
||||
configcpp
|
||||
loggingcpp
|
||||
messageqcpp
|
||||
idbdatafile
|
||||
mariadb_charset
|
||||
)
|
||||
|
@@ -1,39 +0,0 @@
|
||||
/* Copyright (C) 2020 MariaDB Corporation
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; version 2 of
|
||||
the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
#include <cstring>
|
||||
|
||||
namespace utils
|
||||
{
|
||||
template <class To, class From>
|
||||
std::enable_if_t<
|
||||
sizeof(To) == sizeof(From) && std::is_trivially_copyable_v<From> && std::is_trivially_copyable_v<To>, To>
|
||||
// constexpr support needs compiler magic
|
||||
bitCast(const From& src) noexcept
|
||||
{
|
||||
static_assert(std::is_trivially_constructible_v<To>,
|
||||
"This implementation additionally requires "
|
||||
"destination type to be trivially constructible");
|
||||
|
||||
To dst;
|
||||
std::memcpy(&dst, &src, sizeof(To));
|
||||
return dst;
|
||||
}
|
||||
} // namespace utils
|
@@ -19,12 +19,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
|
||||
#ifndef __builtin_expect
|
||||
#define __builtin_expect(x, expected_value) (x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef LIKELY
|
||||
#define LIKELY(x) __builtin_expect((x), 1)
|
||||
#define UNLIKELY(x) __builtin_expect((x), 0)
|
||||
|
@@ -17,6 +17,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <new>
|
||||
|
||||
#include "branchpred.h"
|
||||
|
||||
namespace utils
|
||||
|
@@ -18,7 +18,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "hasher.h"
|
||||
#include "basic/collation.h"
|
||||
#include "mariadb_charset/collation.h"
|
||||
|
||||
namespace utils
|
||||
{
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
/* handling of the conversion of string prefixes to int64_t for quick range checking */
|
||||
|
||||
#include "basic/collation.h"
|
||||
#include "mariadb_charset/collation.h"
|
||||
#include "joblisttypes.h"
|
||||
|
||||
#include "string_prefixes.h"
|
||||
|
@@ -1,38 +0,0 @@
|
||||
/* Copyright (C) 2020 MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
|
||||
|
||||
#include "utils_utf8.h"
|
||||
|
||||
#include "mariadb_my_sys.h"
|
||||
|
||||
namespace datatypes
|
||||
{
|
||||
static inline CHARSET_INFO& get_charset_or_bin(int32_t charsetNumber)
|
||||
{
|
||||
CHARSET_INFO* cs = get_charset(charsetNumber, MYF(MY_WME));
|
||||
return cs ? *cs : my_charset_bin;
|
||||
}
|
||||
|
||||
Charset::Charset(uint32_t charsetNumber) : mCharset(&get_charset_or_bin(charsetNumber))
|
||||
{
|
||||
}
|
||||
|
||||
void Charset::setCharset(uint32_t charsetNumber)
|
||||
{
|
||||
mCharset = &get_charset_or_bin(charsetNumber);
|
||||
}
|
||||
|
||||
} // namespace datatypes
|
||||
|
@@ -20,16 +20,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#if defined(__FreeBSD__)
|
||||
//#include <cstdlib>
|
||||
#else
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
#include <cstdlib>
|
||||
|
||||
#include <clocale>
|
||||
#include "liboamcpp.h"
|
||||
|
||||
// Change the name from utf8. Even change the file name to something resembling char helper
|
||||
namespace utf8
|
||||
|
@@ -2,4 +2,4 @@ include_directories(${ENGINE_COMMON_INCLUDES})
|
||||
|
||||
set(ddlcleanuputil_LIB_SRCS ddlcleanuputil.cpp)
|
||||
columnstore_library(ddlcleanuputil ${ddlcleanuputil_LIB_SRCS})
|
||||
columnstore_link(ddlcleanuputil PRIVATE loggingcpp ${NETSNMP_LIBRARIES})
|
||||
columnstore_link(ddlcleanuputil PRIVATE loggingcpp)
|
||||
|
@@ -150,6 +150,7 @@ columnstore_link(
|
||||
pron
|
||||
loggingcpp
|
||||
dataconvert
|
||||
${MARIADB_STRING_LIBS}
|
||||
${NETSNMP_LIBRARIES}
|
||||
mariadb_charset
|
||||
)
|
||||
|
||||
columnstore_link(funcexp PRIVATE ${MARIADB_STRING_LIBS})
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#include <my_sys.h>
|
||||
#include <json_lib.h>
|
||||
|
||||
#include "basic/collation.h"
|
||||
#include "mariadb_charset/collation.h"
|
||||
#include "functor_bool.h"
|
||||
#include "functor_int.h"
|
||||
#include "functor_str.h"
|
||||
|
@@ -10,10 +10,10 @@
|
||||
#include <my_sys.h>
|
||||
// #include <json_lib.h>
|
||||
|
||||
#include "basic/collation.h"
|
||||
#include "mariadb_charset/collation.h"
|
||||
#include "functor_json.h"
|
||||
#include "functor_str.h"
|
||||
#include "basic/collation.h"
|
||||
#include "mariadb_charset/collation.h"
|
||||
#include "rowgroup.h"
|
||||
#include "treenode.h"
|
||||
#include "functioncolumn.h"
|
||||
|
@@ -14,12 +14,4 @@ set(idbdatafile_LIB_SRCS
|
||||
)
|
||||
|
||||
columnstore_library(idbdatafile ${idbdatafile_LIB_SRCS})
|
||||
columnstore_link(
|
||||
idbdatafile
|
||||
PRIVATE
|
||||
${NETSNMP_LIBRARIES}
|
||||
${ENGINE_OAM_LIBS}
|
||||
boost_filesystem
|
||||
boost_system
|
||||
compress
|
||||
)
|
||||
columnstore_link(idbdatafile PRIVATE ${ENGINE_OAM_LIBS} boost_filesystem boost_system compress)
|
||||
|
7
utils/mariadb_charset/CMakeLists.txt
Normal file
7
utils/mariadb_charset/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
include_directories(${ENGINE_COMMON_INCLUDES})
|
||||
|
||||
# ########## next target ###############
|
||||
|
||||
columnstore_static_library(mariadb_charset charset.cpp)
|
||||
columnstore_link(mariadb_charset PRIVATE ${MARIADB_STRING_LIBS})
|
||||
add_dependencies(mariadb_charset loggingcpp)
|
22
utils/mariadb_charset/charset.cpp
Normal file
22
utils/mariadb_charset/charset.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "mariadb_charset/collation.h"
|
||||
#include "mariadb_my_sys.h"
|
||||
#include "mcs_datatype.h"
|
||||
|
||||
namespace datatypes
|
||||
{
|
||||
static inline CHARSET_INFO& get_charset_or_bin(int32_t charsetNumber)
|
||||
{
|
||||
CHARSET_INFO* cs = get_charset(charsetNumber, MYF(MY_WME));
|
||||
return cs ? *cs : my_charset_bin;
|
||||
}
|
||||
|
||||
Charset::Charset(uint32_t charsetNumber) : mCharset(&get_charset_or_bin(charsetNumber))
|
||||
{
|
||||
}
|
||||
|
||||
void Charset::setCharset(uint32_t charsetNumber)
|
||||
{
|
||||
mCharset = &get_charset_or_bin(charsetNumber);
|
||||
}
|
||||
|
||||
} // namespace datatypes
|
@@ -25,7 +25,8 @@ columnstore_link(regr PRIVATE loggingcpp messageqcpp)
|
||||
|
||||
set(regr_mysql_LIB_SRCS regrmysql.cpp modamysql.cpp)
|
||||
|
||||
# Do anyone use it?
|
||||
columnstore_mysql_plugin_library(regr_mysql SHARED ${regr_mysql_LIB_SRCS})
|
||||
add_dependencies(regr_mysql external_boost)
|
||||
add_dependencies(regr_mysql external_boost GenError) # for "idb_mysql.h" that uses generated mysqld_error.h
|
||||
|
||||
set_target_properties(regr_mysql PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../../../)
|
||||
|
@@ -45,7 +45,7 @@
|
||||
#include "calpontsystemcatalog.h"
|
||||
#include "windowfunctioncolumn.h"
|
||||
#include "hasher.h"
|
||||
#include "basic/collation.h"
|
||||
#include "mariadb_charset/collation.h"
|
||||
|
||||
#define EXPORT
|
||||
|
||||
|
@@ -5,5 +5,5 @@ include_directories(${ENGINE_COMMON_INCLUDES})
|
||||
set(rowgroup_LIB_SRCS rowaggregation.cpp rowgroup.cpp rowstorage.cpp)
|
||||
|
||||
columnstore_library(rowgroup ${rowgroup_LIB_SRCS})
|
||||
columnstore_link(rowgroup PRIVATE ${NETSNMP_LIBRARIES} funcexp loggingcpp compress)
|
||||
columnstore_link(rowgroup PRIVATE funcexp loggingcpp compress)
|
||||
add_dependencies(rowgroup external_boost)
|
||||
|
@@ -53,7 +53,7 @@
|
||||
#include "branchpred.h"
|
||||
#include "datatypes/mcs_int128.h"
|
||||
|
||||
#include "basic/collation.h"
|
||||
#include "mariadb_charset/collation.h"
|
||||
#include "common/hashfamily.h"
|
||||
#include "buffertypes.h"
|
||||
|
||||
|
6
utils/statistics_manager/CMakeLists.txt
Normal file
6
utils/statistics_manager/CMakeLists.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
include_directories(${ENGINE_COMMON_INCLUDES})
|
||||
|
||||
# ########## next target ###############
|
||||
|
||||
columnstore_static_library(statistics_manager statistics.cpp)
|
||||
columnstore_link(statistics_manager PRIVATE rowgroup)
|
@@ -116,9 +116,8 @@ void StatisticsManager::analyzeSample(bool traceOn)
|
||||
// MCV statistics.
|
||||
std::vector<pair<uint64_t, uint32_t>> mcvList(columnMCV.begin(), columnMCV.end());
|
||||
std::sort(mcvList.begin(), mcvList.end(),
|
||||
[](const std::pair<uint64_t, uint32_t>& a, const std::pair<uint64_t, uint32_t>& b) {
|
||||
return a.second > b.second;
|
||||
});
|
||||
[](const std::pair<uint64_t, uint32_t>& a, const std::pair<uint64_t, uint32_t>& b)
|
||||
{ return a.second > b.second; });
|
||||
|
||||
// 200 buckets as Microsoft does.
|
||||
const auto mcvSize = std::min(columnMCV.size(), static_cast<uint64_t>(200));
|
@@ -17,3 +17,5 @@ columnstore_link(udfsdk PRIVATE loggingcpp messageqcpp)
|
||||
add_definitions(-DMYSQL_DYNAMIC_PLUGIN)
|
||||
set(udf_mysql_LIB_SRCS udfmysql.cpp)
|
||||
columnstore_mysql_plugin_library(udf_mysql SHARED ${udf_mysql_LIB_SRCS})
|
||||
|
||||
add_dependencies(udf_mysql GenError) # for "idb_mysql.h" that uses generated mysqld_error.h
|
||||
|
@@ -62,53 +62,41 @@ columnstore_link(dbrmctl ${ENGINE_LDFLAGS} ${ENGINE_OAM_LIBS} ${ENGINE_EXEC_LIBS
|
||||
set(reset_locks_SRCS reset_locks.cpp)
|
||||
|
||||
columnstore_executable(reset_locks ${reset_locks_SRCS})
|
||||
columnstore_link(reset_locks ${ENGINE_LDFLAGS} ${ENGINE_OAM_LIBS} ${ENGINE_EXEC_LIBS} ${NETSNMP_LIBRARIES})
|
||||
columnstore_link(reset_locks ${ENGINE_LDFLAGS} ${ENGINE_OAM_LIBS} ${ENGINE_EXEC_LIBS})
|
||||
|
||||
# ########## next target ###############
|
||||
|
||||
set(rollback_SRCS rollback.cpp)
|
||||
|
||||
columnstore_executable(rollback ${rollback_SRCS})
|
||||
columnstore_link(rollback ${ENGINE_LDFLAGS} ${ENGINE_OAM_LIBS} ${ENGINE_EXEC_LIBS} ${NETSNMP_LIBRARIES})
|
||||
columnstore_link(rollback ${ENGINE_LDFLAGS} ${ENGINE_OAM_LIBS} ${ENGINE_EXEC_LIBS})
|
||||
|
||||
# ########## next target ###############
|
||||
|
||||
set(save_brm_SRCS save_brm.cpp)
|
||||
|
||||
columnstore_executable(save_brm ${save_brm_SRCS})
|
||||
columnstore_link(save_brm ${ENGINE_LDFLAGS} ${ENGINE_OAM_LIBS} ${ENGINE_EXEC_LIBS} ${NETSNMP_LIBRARIES})
|
||||
columnstore_link(save_brm ${ENGINE_LDFLAGS} ${ENGINE_OAM_LIBS} ${ENGINE_EXEC_LIBS})
|
||||
|
||||
# ########## next target ###############
|
||||
|
||||
set(load_brm_SRCS load_brm.cpp)
|
||||
|
||||
columnstore_executable(load_brm ${load_brm_SRCS})
|
||||
columnstore_link(load_brm ${ENGINE_LDFLAGS} ${ENGINE_OAM_LIBS} ${ENGINE_EXEC_LIBS} ${NETSNMP_LIBRARIES})
|
||||
columnstore_link(load_brm ${ENGINE_LDFLAGS} ${ENGINE_OAM_LIBS} ${ENGINE_EXEC_LIBS})
|
||||
|
||||
columnstore_executable(mcs-load-em load_em.cpp)
|
||||
columnstore_link(
|
||||
mcs-load-em ${ENGINE_LDFLAGS} ${MARIADB_CLIENT_LIBS} ${ENGINE_OAM_LIBS} ${ENGINE_EXEC_LIBS} ${NETSNMP_LIBRARIES}
|
||||
)
|
||||
columnstore_link(mcs-load-em ${ENGINE_LDFLAGS} ${MARIADB_CLIENT_LIBS} ${ENGINE_OAM_LIBS} ${ENGINE_EXEC_LIBS})
|
||||
|
||||
columnstore_executable(mcs-load-brm-from-file load_brm_from_file.cpp)
|
||||
columnstore_link(
|
||||
mcs-load-brm-from-file
|
||||
${ENGINE_LDFLAGS}
|
||||
${MARIADB_CLIENT_LIBS}
|
||||
${ENGINE_OAM_LIBS}
|
||||
${ENGINE_EXEC_LIBS}
|
||||
${NETSNMP_LIBRARIES}
|
||||
mcs-load-brm-from-file ${ENGINE_LDFLAGS} ${MARIADB_CLIENT_LIBS} ${ENGINE_OAM_LIBS} ${ENGINE_EXEC_LIBS}
|
||||
boost_program_options
|
||||
)
|
||||
|
||||
columnstore_executable(mcs-shmem-locks shmem_locks.cpp)
|
||||
columnstore_link(
|
||||
mcs-shmem-locks
|
||||
${ENGINE_LDFLAGS}
|
||||
${MARIADB_CLIENT_LIBS}
|
||||
${ENGINE_OAM_LIBS}
|
||||
${ENGINE_EXEC_LIBS}
|
||||
${NETSNMP_LIBRARIES}
|
||||
mcs-shmem-locks ${ENGINE_LDFLAGS} ${MARIADB_CLIENT_LIBS} ${ENGINE_OAM_LIBS} ${ENGINE_EXEC_LIBS}
|
||||
boost_program_options
|
||||
)
|
||||
|
||||
|
@@ -29,7 +29,7 @@ set(we_bulk_STAT_SRCS
|
||||
add_definitions(-D_FILE_OFFSET_BITS=64)
|
||||
|
||||
columnstore_static_library(we_bulk ${we_bulk_STAT_SRCS})
|
||||
columnstore_link(we_bulk ${NETSNMP_LIBRARIES} loggingcpp boost_program_options)
|
||||
columnstore_link(we_bulk loggingcpp boost_program_options)
|
||||
|
||||
remove_definitions(-D_FILE_OFFSET_BITS=64)
|
||||
|
||||
@@ -42,7 +42,6 @@ columnstore_executable(cpimport.bin ${cpimport.bin_SRCS})
|
||||
columnstore_link(
|
||||
cpimport.bin
|
||||
${ENGINE_LDFLAGS}
|
||||
${NETSNMP_LIBRARIES}
|
||||
${ENGINE_WRITE_LIBS}
|
||||
${S3API_DEPS}
|
||||
we_bulk
|
||||
|
@@ -5,4 +5,4 @@ include_directories(${ENGINE_COMMON_INCLUDES})
|
||||
set(writeengineclient_LIB_SRCS we_clients.cpp we_ddlcommandclient.cpp we_dmlcommandclient.cpp)
|
||||
|
||||
columnstore_library(writeengineclient ${writeengineclient_LIB_SRCS})
|
||||
columnstore_link(writeengineclient ${NETSNMP_LIBRARIES} boost_thread oamcpp messageqcpp loggingcpp)
|
||||
columnstore_link(writeengineclient boost_thread oamcpp messageqcpp loggingcpp)
|
||||
|
@@ -7,6 +7,6 @@ set(writeengineredistribute_LIB_SRCS we_redistribute.cpp we_redistributecontrol.
|
||||
)
|
||||
|
||||
columnstore_library(writeengineredistribute ${writeengineredistribute_LIB_SRCS})
|
||||
columnstore_link(writeengineredistribute ${NETSNMP_LIBRARIES} loggingcpp oamcpp boost_thread messageqcpp)
|
||||
columnstore_link(writeengineredistribute loggingcpp oamcpp boost_thread messageqcpp)
|
||||
|
||||
target_compile_definitions(writeengineredistribute PUBLIC BOOST_NO_CXX11_SCOPED_ENUMS)
|
||||
|
@@ -18,12 +18,4 @@ set(WriteEngineServer_SRCS
|
||||
)
|
||||
|
||||
columnstore_executable(WriteEngineServer ${WriteEngineServer_SRCS})
|
||||
columnstore_link(
|
||||
WriteEngineServer
|
||||
${ENGINE_LDFLAGS}
|
||||
${NETSNMP_LIBRARIES}
|
||||
${ENGINE_WRITE_LIBS}
|
||||
threadpool
|
||||
writeengineredistribute
|
||||
loggingcpp
|
||||
)
|
||||
columnstore_link(WriteEngineServer ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS} threadpool writeengineredistribute loggingcpp)
|
||||
|
@@ -40,7 +40,7 @@
|
||||
#include "IDBDataFile.h"
|
||||
#include "IDBPolicy.h"
|
||||
#include "nullstring.h"
|
||||
#include "basic/collation.h" // For CHARSET_INFO struct
|
||||
#include "mariadb_charset/collation.h" // For CHARSET_INFO struct
|
||||
|
||||
#undef EXPORT
|
||||
#undef DELETE
|
||||
|
@@ -19,7 +19,6 @@ columnstore_executable(cpimport ${cpimport_SRCS})
|
||||
columnstore_link(
|
||||
cpimport
|
||||
${ENGINE_LDFLAGS}
|
||||
${NETSNMP_LIBRARIES}
|
||||
${ENGINE_WRITE_LIBS}
|
||||
batchloader
|
||||
threadpool
|
||||
|
@@ -37,12 +37,4 @@ set(writeengine_LIB_SRCS
|
||||
add_definitions(-D_FILE_OFFSET_BITS=64)
|
||||
|
||||
columnstore_library(writeengine ${writeengine_LIB_SRCS})
|
||||
columnstore_link(
|
||||
writeengine
|
||||
${NETSNMP_LIBRARIES}
|
||||
loggingcpp
|
||||
oamcpp
|
||||
boost_thread
|
||||
compress
|
||||
messageqcpp
|
||||
)
|
||||
columnstore_link(writeengine loggingcpp oamcpp boost_thread compress messageqcpp)
|
||||
|
Reference in New Issue
Block a user