1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-05-28 13:01:26 +03:00

MCOL-962 Add mcsSystemReady(), mcsSystemReadOnly() and mcsWritesSuspended()

This commit is contained in:
David Hall 2018-01-10 12:17:57 -06:00
parent d61ff56989
commit 1ffeda44d6
6 changed files with 136 additions and 7 deletions

View File

@ -1819,6 +1819,130 @@ void calsettrace_deinit(UDF_INIT* initid)
{
}
#ifdef _MSC_VER
__declspec(dllexport)
#endif
// Return 1 if system is ready for reads or 0 if not.
long long mcssystemready(UDF_INIT* initid, UDF_ARGS* args,
char* is_null, char* error)
{
long long rtn = 0;
Oam oam;
DBRM dbrm(true);
SystemStatus systemstatus;
try
{
oam.getSystemStatus(systemstatus);
if (systemstatus.SystemOpState == ACTIVE
&& dbrm.getSystemReady()
&& dbrm.getSystemQueryReady())
{
return 1;
}
}
catch (...)
{
*error = 1;
}
return rtn;
}
#ifdef _MSC_VER
__declspec(dllexport)
#endif
my_bool mcssystemready_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
{
return 0;
}
#ifdef _MSC_VER
__declspec(dllexport)
#endif
void mcssystemready_deinit(UDF_INIT* initid)
{
}
#ifdef _MSC_VER
__declspec(dllexport)
#endif
// Return 1 if system is read only; 0 if writeable
long long mcssystemreadonly(UDF_INIT* initid, UDF_ARGS* args,
char* is_null, char* error)
{
long long rtn = 0;
DBRM dbrm(true);
try
{
if (dbrm.isReadWrite()) // Returns 0 for writable, 5 for read only
{
rtn = 1;
}
}
catch (...)
{
*error = 1;
rtn = 1;
}
return rtn;
}
#ifdef _MSC_VER
__declspec(dllexport)
#endif
my_bool mcssystemreadonly_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
{
return 0;
}
#ifdef _MSC_VER
__declspec(dllexport)
#endif
void mcssystemreadonly_deinit(UDF_INIT* initid)
{
}
#ifdef _MSC_VER
__declspec(dllexport)
#endif
// Return 1 if system is read only; 0 if writeable
long long mcswritessuspended(UDF_INIT* initid, UDF_ARGS* args,
char* is_null, char* error)
{
long long rtn = 0;
DBRM dbrm(true);
try
{
if (dbrm.getSystemSuspended())
{
rtn = 1;
}
}
catch (...)
{
*error = 1;
rtn = 1;
}
return rtn;
}
#ifdef _MSC_VER
__declspec(dllexport)
#endif
my_bool mcswritessuspended_init(UDF_INIT* initid, UDF_ARGS* args, char* message)
{
return 0;
}
#ifdef _MSC_VER
__declspec(dllexport)
#endif
void mcswritessuspended_deinit(UDF_INIT* initid)
{
}
#define MAXSTRINGLENGTH 50
const char* PmSmallSideMaxMemory = "pmmaxmemorysmallside";

View File

@ -82,6 +82,9 @@ CREATE FUNCTION idbextentmin RETURNS STRING soname 'libcalmysql.so';
CREATE FUNCTION idbextentmax RETURNS STRING soname 'libcalmysql.so';
CREATE FUNCTION idbpartition RETURNS STRING soname 'libcalmysql.so';
CREATE FUNCTION idblocalpm RETURNS INTEGER soname 'libcalmysql.so';
CREATE FUNCTION mcssystemready RETURNS INTEGER soname 'libcalmysql.so';
CREATE FUNCTION mcssystemreadonly RETURNS INTEGER soname 'libcalmysql.so';
CREATE FUNCTION mcswritessuspended RETURNS INTEGER soname 'libcalmysql.so';
CREATE DATABASE IF NOT EXISTS infinidb_vtable;
CREATE DATABASE IF NOT EXISTS infinidb_querystats;

View File

@ -1878,7 +1878,7 @@ int processCommand(string* arguments)
}
string DataRedundancyConfig;
string DataRedundancyCopies;
int DataRedundancyCopies;
string DataRedundancyStorageType;
try {
oam.getSystemConfig("DataRedundancyConfig", DataRedundancyConfig);
@ -3565,7 +3565,7 @@ int processCommand(string* arguments)
}
string DataRedundancyConfig;
string DataRedundancyCopies;
int DataRedundancyCopies;
string DataRedundancyStorageType;
try {
oam.getSystemConfig("DataRedundancyConfig", DataRedundancyConfig);
@ -5552,7 +5552,7 @@ int processCommand(string* arguments)
}
}
string command = startup::StartUp::installDir() + "/bin/remote_command.sh " + (*hostConfigIter).IPAddr + " " + password + " 'mkdir -p " + startup::StartUp::installDir() + "/gluster/brick" + oam.itoa(brickID) + "'";
int status = system(command.c_str());
// int status = system(command.c_str());
brickID++;
}
}
@ -5853,7 +5853,7 @@ int processCommand(string* arguments)
}
}
if ( DataRedundancyConfig == "y" && devicenetworklist.size() != DataRedundancyCopies) {
if ( DataRedundancyConfig == "y" && devicenetworklist.size() != (size_t)DataRedundancyCopies) {
cout << endl << "**** removeModule Failed : Data Redundancy requires you to remove modules in groups equal to number of copies" << endl;
quit = true;
}
@ -6828,7 +6828,6 @@ int processCommand(string* arguments)
{
string DataRedundancyConfig = "n";
int DataRedundancyCopies;
try {
oam.getSystemConfig( "DataRedundancyConfig", DataRedundancyConfig);
}

View File

@ -250,7 +250,7 @@ int main(int argc, char *argv[])
catch (...) {}
//get memory stats
long long total = myinfo.totalram / 1024 / 1000;
// long long total = myinfo.totalram / 1024 / 1000;
// adjust max memory, 25% of total memory
string percent = "25%";

View File

@ -165,7 +165,7 @@ int main(int argc, char **argv)
//re-read local system info with updated Columnstore.xml
sleep(1);
Config* sysConfig = Config::makeConfig();
// Config* sysConfig = Config::makeConfig();
MonitorConfig config;
//PMwithUM config

View File

@ -9,6 +9,9 @@ CREATE FUNCTION calonlinealter RETURNS INTEGER SONAME 'libcalmysql.dll';
CREATE FUNCTION calviewtablelock RETURNS STRING SONAME 'libcalmysql.dll';
CREATE FUNCTION calcleartablelock RETURNS STRING SONAME 'libcalmysql.dll';
CREATE FUNCTION calgetsqlcount RETURNS STRING SONAME 'libcalmysql.dll';
CREATE FUNCTION mcssystemready RETURNS INTEGER SONAME 'libcalmysql.dll';
CREATE FUNCTION mcssystemreadonly RETURNS INTEGER SONAME 'libcalmysql.dll';
CREATE FUNCTION mcswritessuspended RETURNS INTEGER SONAME 'libcalmysql.dll';
create database if not exists calpontsys;
use calpontsys;