diff --git a/storage/ndb/include/kernel/signaldata/CreateTable.hpp b/storage/ndb/include/kernel/signaldata/CreateTable.hpp index 44a95469b380c5e7ef9c5808a4b6f35ddbe702eb..b43a5e76eaf59fc77dc5d624bafa3635aa5b47bc 100644 --- a/storage/ndb/include/kernel/signaldata/CreateTable.hpp +++ b/storage/ndb/include/kernel/signaldata/CreateTable.hpp @@ -95,7 +95,8 @@ public: InvalidTablespace = 755, VarsizeBitfieldNotSupported = 757, NotATablespace = 758, - InvalidTablespaceVersion = 759 + InvalidTablespaceVersion = 759, + OutOfStringBuffer = 773 }; private: diff --git a/storage/ndb/include/mgmapi/mgmapi_config_parameters.h b/storage/ndb/include/mgmapi/mgmapi_config_parameters.h index c257a61bcabd3e3af3ab9ab8db3656e24b114610..0ba3f92a7d17c9a79c61b6aeb50da733ee15cbd4 100644 --- a/storage/ndb/include/mgmapi/mgmapi_config_parameters.h +++ b/storage/ndb/include/mgmapi/mgmapi_config_parameters.h @@ -85,6 +85,8 @@ #define CFG_DB_MAX_OPEN_FILES 159 +#define CFG_DB_STRING_MEMORY 161 + #define CFG_NODE_ARBIT_RANK 200 #define CFG_NODE_ARBIT_DELAY 201 diff --git a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index 9755a65aa5371381843d8cbb30002cf8f24278a8..745b0fa8beff715ec212979113fa6330eac47b54 100644 --- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -2016,8 +2016,30 @@ void Dbdict::execREAD_CONFIG_REQ(Signal* signal) c_schemaOp.setSize(8); //c_opDropObj.setSize(8); c_Trans.setSize(8); - c_rope_pool.setSize(100000/28); + Uint32 rps = 0; + rps += tablerecSize * (MAX_TAB_NAME_SIZE + MAX_FRM_DATA_SIZE); + rps += attributesize * (MAX_ATTR_NAME_SIZE + MAX_ATTR_DEFAULT_VALUE_SIZE); + rps += c_maxNoOfTriggers * MAX_TAB_NAME_SIZE; + rps += (10 + 10) * MAX_TAB_NAME_SIZE; + + Uint32 sm = 5; + ndb_mgm_get_int_parameter(p, CFG_DB_STRING_MEMORY, &sm); + if (sm == 0) + sm = 5; + + Uint32 sb = 0; + if (sm < 100) + { + sb = (rps * sm) / 100; + } + else + { + sb = sm; + } + + c_rope_pool.setSize(sb/28 + 100); + // Initialize BAT for interface to file system NewVARIABLE* bat = allocateBat(2); bat[0].WA = &c_schemaPageRecordArray.getPtr(0)->word[0]; @@ -5795,7 +5817,8 @@ void Dbdict::handleTabInfoInit(SimpleProperties::Reader & it, { Rope name(c_rope_pool, tablePtr.p->tableName); - ndbrequire(name.assign(tableDesc.TableName, tableNameLength, name_hash)); + tabRequire(name.assign(tableDesc.TableName, tableNameLength, name_hash), + CreateTableRef::OutOfStringBuffer); } Ptr<DictObject> obj_ptr; @@ -5827,7 +5850,8 @@ void Dbdict::handleTabInfoInit(SimpleProperties::Reader & it, { Rope frm(c_rope_pool, tablePtr.p->frmData); - ndbrequire(frm.assign(tableDesc.FrmData, tableDesc.FrmLen)); + tabRequire(frm.assign(tableDesc.FrmData, tableDesc.FrmLen), + CreateTableRef::OutOfStringBuffer); } tablePtr.p->ngLen = tableDesc.FragmentDataLen; @@ -5942,7 +5966,13 @@ void Dbdict::handleTabInfo(SimpleProperties::Reader & it, */ { Rope name(c_rope_pool, attrPtr.p->attributeName); - name.assign(attrDesc.AttributeName, len, name_hash); + if (!name.assign(attrDesc.AttributeName, len, name_hash)) + { + jam(); + parseP->errorCode = CreateTableRef::OutOfStringBuffer; + parseP->errorLine = __LINE__; + return; + } } attrPtr.p->attributeId = i; //attrPtr.p->attributeId = attrDesc.AttributeId; @@ -14568,7 +14598,7 @@ Dbdict::create_fg_prepare_start(Signal* signal, SchemaOp* op){ { Rope name(c_rope_pool, obj_ptr.p->m_name); if(!name.assign(fg.FilegroupName, len, hash)){ - op->m_errorCode = CreateTableRef::TableNameTooLong; + op->m_errorCode = CreateTableRef::OutOfStringBuffer; c_obj_pool.release(obj_ptr); c_filegroup_pool.release(fg_ptr); break; @@ -14774,7 +14804,7 @@ Dbdict::create_file_prepare_start(Signal* signal, SchemaOp* op){ { Rope name(c_rope_pool, obj_ptr.p->m_name); if(!name.assign(f.FileName, len, hash)){ - op->m_errorCode = CreateTableRef::TableNameTooLong; + op->m_errorCode = CreateTableRef::OutOfStringBuffer; c_obj_pool.release(obj_ptr); c_file_pool.release(filePtr); break; diff --git a/storage/ndb/src/mgmsrv/ConfigInfo.cpp b/storage/ndb/src/mgmsrv/ConfigInfo.cpp index 817943f5e513be306f8120dc4f599177e906455b..29b76a05a5af1404afee9fe3c6991d963f9172e2 100644 --- a/storage/ndb/src/mgmsrv/ConfigInfo.cpp +++ b/storage/ndb/src/mgmsrv/ConfigInfo.cpp @@ -1202,6 +1202,18 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "0", STR_VALUE(MAX_INT_RNIL) }, + { + CFG_DB_STRING_MEMORY, + "StringMemory", + DB_TOKEN, + "Default size of string memory (0 -> 5% of max 1-100 -> %of max, >100 -> actual bytes)", + ConfigInfo::CI_USED, + false, + ConfigInfo::CI_INT, + "0", + "0", + STR_VALUE(MAX_INT_RNIL) }, + /*************************************************************************** * API ***************************************************************************/ diff --git a/storage/ndb/src/ndbapi/ndberror.c b/storage/ndb/src/ndbapi/ndberror.c index 73f08e8ac772b5c07fdc2d1a2e5dd2e0665c67bc..d9f96feb1ee05c7fa4caf5bef9bedea1e338b848 100644 --- a/storage/ndb/src/ndbapi/ndberror.c +++ b/storage/ndb/src/ndbapi/ndberror.c @@ -391,7 +391,8 @@ ErrorBundle ErrorCodes[] = { { 1229, DMEC, SE, "Too long frm data supplied" }, { 1231, DMEC, SE, "Invalid table or index to scan" }, { 1232, DMEC, SE, "Invalid table or index to scan" }, - + { 773, DMEC, SE, "Out of string memory, please modify StringMemory config parameter" }, + /** * FunctionNotImplemented */