diff --git a/storage/ndb/include/mgmapi/mgmapi.h b/storage/ndb/include/mgmapi/mgmapi.h index 883d3c43699..017a5954d8d 100644 --- a/storage/ndb/include/mgmapi/mgmapi.h +++ b/storage/ndb/include/mgmapi/mgmapi.h @@ -555,6 +555,17 @@ extern "C" { */ int ndb_mgm_set_connect_timeout(NdbMgmHandle handle, unsigned int seconds); + /** + * Sets the number of milliseconds for timeout for read and write operations + * to the socket + * Default is 50,000 for read, 1000 for write + * + * @param handle NdbMgmHandle + * @param rw_milliseconds number of milliseconds + * @return zero on success + */ + int ndb_mgm_set_timeout(NdbMgmHandle handle, unsigned int rw_milliseconds); + /** * Connects to a management server. Connectstring is set by * ndb_mgm_set_connectstring(). diff --git a/storage/ndb/src/mgmapi/mgmapi.cpp b/storage/ndb/src/mgmapi/mgmapi.cpp index 6bb01cb244b..a0a6493f41d 100644 --- a/storage/ndb/src/mgmapi/mgmapi.cpp +++ b/storage/ndb/src/mgmapi/mgmapi.cpp @@ -444,6 +444,16 @@ int ndb_mgm_set_connect_timeout(NdbMgmHandle handle, unsigned int seconds) return 0; } +extern "C" +int ndb_mgm_set_timeout(NdbMgmHandle handle, unsigned int rw_milliseconds) +{ + if(!handle) + return -1; + + handle->read_timeout= handle->write_timeout= rw_milliseconds; + return 0; +} + /** * Connect to a management server */ diff --git a/storage/ndb/test/ndbapi/testMgm.cpp b/storage/ndb/test/ndbapi/testMgm.cpp index 0c6c05a0594..08b9305f13d 100644 --- a/storage/ndb/test/ndbapi/testMgm.cpp +++ b/storage/ndb/test/ndbapi/testMgm.cpp @@ -240,6 +240,8 @@ int runTestApiTimeout1(NDBT_Context* ctx, NDBT_Step* step) ndbout << "Inserted session error" << endl; + ndb_mgm_set_timeout(h,1000,1000); + cc= ndb_mgm_check_connection(h); if(cc < 0) result= NDBT_OK;