You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
Deep build refactoring phase 2 (#3564)
* configcpp refactored * chore(build): massive removals, auto add files to debian install file * chore(build): configure before autobake * chore(build): use custom cmake commands for components, mariadb-plugin-columnstore.install generated * chore(build): install deps as separate step for build-packages * more deps * chore(codemanagement, build): build refactoring stage2 * chore(safety): Locked Map for MessageqCpp with a simpler way Please enter the commit message for your changes. Lines starting * chore(codemanagement, ci): better coredumps handling, deps fixed * Delete build/bootstrap_mcs.py * Update charset.cpp (add license)
This commit is contained in:
@ -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);
|
||||
}
|
Reference in New Issue
Block a user