diff --git a/dbcon/mysql/ha_calpont_impl.cpp b/dbcon/mysql/ha_calpont_impl.cpp index d4669c8d5..3b3a5f00b 100755 --- a/dbcon/mysql/ha_calpont_impl.cpp +++ b/dbcon/mysql/ha_calpont_impl.cpp @@ -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"; diff --git a/dbcon/mysql/install_calpont_mysql.sh b/dbcon/mysql/install_calpont_mysql.sh index aaa17473a..17c6e1817 100755 --- a/dbcon/mysql/install_calpont_mysql.sh +++ b/dbcon/mysql/install_calpont_mysql.sh @@ -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; diff --git a/oamapps/mcsadmin/mcsadmin.cpp b/oamapps/mcsadmin/mcsadmin.cpp index 7d8a6c153..795414eea 100644 --- a/oamapps/mcsadmin/mcsadmin.cpp +++ b/oamapps/mcsadmin/mcsadmin.cpp @@ -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); } diff --git a/oamapps/postConfigure/installer.cpp b/oamapps/postConfigure/installer.cpp index bc91217f0..569b699fa 100644 --- a/oamapps/postConfigure/installer.cpp +++ b/oamapps/postConfigure/installer.cpp @@ -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%"; diff --git a/procmon/main.cpp b/procmon/main.cpp index cc6835f3a..10da06f69 100644 --- a/procmon/main.cpp +++ b/procmon/main.cpp @@ -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 diff --git a/utils/winport/win_setup_mysql_part2.sql b/utils/winport/win_setup_mysql_part2.sql index 894e1583d..0a2a972fb 100644 --- a/utils/winport/win_setup_mysql_part2.sql +++ b/utils/winport/win_setup_mysql_part2.sql @@ -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;