Commit f867b02a authored by jonas@eel.(none)'s avatar jonas@eel.(none)

ndb dd - use shared pool for file/filegroup in dict

parent 9613c977
...@@ -281,8 +281,6 @@ Dbdict::execDUMP_STATE_ORD(Signal* signal) ...@@ -281,8 +281,6 @@ Dbdict::execDUMP_STATE_ORD(Signal* signal)
#define MEMINFO(x, y) infoEvent(x ": %d %d", y.getSize(), y.getNoOfFree()) #define MEMINFO(x, y) infoEvent(x ": %d %d", y.getSize(), y.getNoOfFree())
if(signal->theData[0] == 1226){ if(signal->theData[0] == 1226){
MEMINFO("c_obj_pool", c_obj_pool); MEMINFO("c_obj_pool", c_obj_pool);
MEMINFO("c_file_pool", c_file_pool);
MEMINFO("c_filegroup_pool", c_filegroup_pool);
MEMINFO("c_opRecordPool", c_opRecordPool); MEMINFO("c_opRecordPool", c_opRecordPool);
MEMINFO("c_rope_pool", c_rope_pool); MEMINFO("c_rope_pool", c_rope_pool);
} }
...@@ -2037,11 +2035,15 @@ void Dbdict::execREAD_CONFIG_REQ(Signal* signal) ...@@ -2037,11 +2035,15 @@ void Dbdict::execREAD_CONFIG_REQ(Signal* signal)
c_obj_pool.setSize(tablerecSize+c_maxNoOfTriggers); c_obj_pool.setSize(tablerecSize+c_maxNoOfTriggers);
c_obj_hash.setSize((tablerecSize+c_maxNoOfTriggers+1)/2); c_obj_hash.setSize((tablerecSize+c_maxNoOfTriggers+1)/2);
c_file_pool.setSize(10); Pool_context pc;
pc.m_block = this;
c_file_hash.setSize(16); c_file_hash.setSize(16);
c_filegroup_pool.setSize(10);
c_filegroup_hash.setSize(16); c_filegroup_hash.setSize(16);
c_file_pool.init(RT_DBDICT_FILE, pc);
c_filegroup_pool.init(RT_DBDICT_FILEGROUP, pc);
c_opRecordPool.setSize(256); // XXX need config params c_opRecordPool.setSize(256); // XXX need config params
c_opCreateTable.setSize(8); c_opCreateTable.setSize(8);
c_opDropTable.setSize(8); c_opDropTable.setSize(8);
...@@ -2121,22 +2123,6 @@ void Dbdict::execREAD_CONFIG_REQ(Signal* signal) ...@@ -2121,22 +2123,6 @@ void Dbdict::execREAD_CONFIG_REQ(Signal* signal)
new (ptr.p) DictObject(); new (ptr.p) DictObject();
objs.release(); objs.release();
} }
{
Ptr<File> ptr;
SLList<File> objs(c_file_pool);
while(objs.seize(ptr))
new (ptr.p) File();
objs.release();
}
{
Ptr<Filegroup> ptr;
SLList<Filegroup> objs(c_filegroup_pool);
while(objs.seize(ptr))
new (ptr.p) Filegroup();
objs.release();
}
}//execSIZEALT_REP() }//execSIZEALT_REP()
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
...@@ -14831,6 +14817,8 @@ Dbdict::create_fg_prepare_start(Signal* signal, SchemaOp* op){ ...@@ -14831,6 +14817,8 @@ Dbdict::create_fg_prepare_start(Signal* signal, SchemaOp* op){
break; break;
} }
new (fg_ptr.p) Filegroup();
{ {
Rope name(c_rope_pool, obj_ptr.p->m_name); Rope name(c_rope_pool, obj_ptr.p->m_name);
if(!name.assign(fg.FilegroupName, len, hash)){ if(!name.assign(fg.FilegroupName, len, hash)){
...@@ -15070,6 +15058,8 @@ Dbdict::create_file_prepare_start(Signal* signal, SchemaOp* op){ ...@@ -15070,6 +15058,8 @@ Dbdict::create_file_prepare_start(Signal* signal, SchemaOp* op){
break; break;
} }
new (filePtr.p) File();
{ {
Rope name(c_rope_pool, obj_ptr.p->m_name); Rope name(c_rope_pool, obj_ptr.p->m_name);
if(!name.assign(f.FileName, len, hash)){ if(!name.assign(f.FileName, len, hash)){
...@@ -15084,7 +15074,7 @@ Dbdict::create_file_prepare_start(Signal* signal, SchemaOp* op){ ...@@ -15084,7 +15074,7 @@ Dbdict::create_file_prepare_start(Signal* signal, SchemaOp* op){
break; break;
case DictTabInfo::LogfileGroup: case DictTabInfo::LogfileGroup:
{ {
LocalDLList<File> list(c_file_pool, fg_ptr.p->m_logfilegroup.m_files); Local_file_list list(c_file_pool, fg_ptr.p->m_logfilegroup.m_files);
list.add(filePtr); list.add(filePtr);
break; break;
} }
...@@ -15310,7 +15300,7 @@ Dbdict::create_file_abort_complete(Signal* signal, SchemaOp* op) ...@@ -15310,7 +15300,7 @@ Dbdict::create_file_abort_complete(Signal* signal, SchemaOp* op)
break; break;
case DictTabInfo::LogfileGroup: case DictTabInfo::LogfileGroup:
{ {
LocalDLList<File> list(c_file_pool, fg_ptr.p->m_logfilegroup.m_files); Local_file_list list(c_file_pool, fg_ptr.p->m_logfilegroup.m_files);
list.remove(f_ptr); list.remove(f_ptr);
break; break;
} }
...@@ -15511,7 +15501,7 @@ Dbdict::drop_fg_commit_start(Signal* signal, SchemaOp* op) ...@@ -15511,7 +15501,7 @@ Dbdict::drop_fg_commit_start(Signal* signal, SchemaOp* op)
* Mark all undofiles as dropped * Mark all undofiles as dropped
*/ */
Ptr<File> filePtr; Ptr<File> filePtr;
LocalDLList<File> list(c_file_pool, fg_ptr.p->m_logfilegroup.m_files); Local_file_list list(c_file_pool, fg_ptr.p->m_logfilegroup.m_files);
XSchemaFile * xsf = &c_schemaFile[c_schemaRecord.schemaPage != 0]; XSchemaFile * xsf = &c_schemaFile[c_schemaRecord.schemaPage != 0];
for(list.first(filePtr); !filePtr.isNull(); list.next(filePtr)) for(list.first(filePtr); !filePtr.isNull(); list.next(filePtr))
{ {
......
...@@ -534,6 +534,7 @@ public: ...@@ -534,6 +534,7 @@ public:
File() {} File() {}
Uint32 key; Uint32 key;
Uint32 m_magic;
Uint32 m_obj_ptr_i; Uint32 m_obj_ptr_i;
Uint32 m_filegroup_id; Uint32 m_filegroup_id;
Uint32 m_type; Uint32 m_type;
...@@ -552,12 +553,17 @@ public: ...@@ -552,12 +553,17 @@ public:
bool equal(const File& obj) const { return key == obj.key;} bool equal(const File& obj) const { return key == obj.key;}
}; };
typedef Ptr<File> FilePtr; typedef Ptr<File> FilePtr;
typedef RecordPool<File, RWPool> File_pool;
typedef DLListImpl<File_pool, File> File_list;
typedef LocalDLListImpl<File_pool, File> Local_file_list;
typedef KeyTableImpl<File_pool, File> File_hash;
struct Filegroup { struct Filegroup {
Filegroup(){} Filegroup(){}
Uint32 key; Uint32 key;
Uint32 m_obj_ptr_i; Uint32 m_obj_ptr_i;
Uint32 m_magic;
Uint32 m_type; Uint32 m_type;
Uint32 m_version; Uint32 m_version;
...@@ -571,7 +577,7 @@ public: ...@@ -571,7 +577,7 @@ public:
struct { struct {
Uint32 m_undo_buffer_size; Uint32 m_undo_buffer_size;
DLList<File>::HeadPOD m_files; File_list::HeadPOD m_files;
} m_logfilegroup; } m_logfilegroup;
}; };
...@@ -586,11 +592,13 @@ public: ...@@ -586,11 +592,13 @@ public:
bool equal(const Filegroup& obj) const { return key == obj.key;} bool equal(const Filegroup& obj) const { return key == obj.key;}
}; };
typedef Ptr<Filegroup> FilegroupPtr; typedef Ptr<Filegroup> FilegroupPtr;
typedef RecordPool<Filegroup, RWPool> Filegroup_pool;
typedef KeyTableImpl<Filegroup_pool, Filegroup> Filegroup_hash;
ArrayPool<File> c_file_pool; File_pool c_file_pool;
KeyTable<File> c_file_hash; Filegroup_pool c_filegroup_pool;
ArrayPool<Filegroup> c_filegroup_pool; File_hash c_file_hash;
KeyTable<Filegroup> c_filegroup_hash; Filegroup_hash c_filegroup_hash;
RopePool c_rope_pool; RopePool c_rope_pool;
......
...@@ -44,11 +44,16 @@ ...@@ -44,11 +44,16 @@
/** /**
* Record types * Record types
*/ */
#define RT_PGMAN_PAGE_REQUEST MAKE_TID(1, RG_DISK_OPERATIONS) #define RT_PGMAN_PAGE_REQUEST MAKE_TID( 1, RG_DISK_OPERATIONS)
#define RT_LGMAN_LOG_WAITER MAKE_TID( 2, RG_DISK_OPERATIONS)
#define RT_LGMAN_LOG_WAITER MAKE_TID(2, RG_DISK_OPERATIONS) #define RT_DBTUP_PAGE_REQUEST MAKE_TID( 3, RG_DISK_OPERATIONS)
#define RT_DBTUP_PAGE_REQUEST MAKE_TID(3, RG_DISK_OPERATIONS) #define RT_DBTUP_EXTENT_INFO MAKE_TID( 4, RG_DISK_RECORDS)
#define RT_DBTUP_EXTENT_INFO MAKE_TID(4, RG_DISK_RECORDS) #define RT_DBDICT_FILE MAKE_TID( 5, RG_DISK_RECORDS)
#define RT_DBDICT_FILEGROUP MAKE_TID( 6, RG_DISK_RECORDS)
#define RT_LGMAN_FILE MAKE_TID( 7, RG_DISK_RECORDS)
#define RT_LGMAN_FILEGROUP MAKE_TID( 8, RG_DISK_RECORDS)
#define RT_TSMAN_FILE MAKE_TID( 9, RG_DISK_RECORDS)
#define RT_TSMAN_FILEGROUP MAKE_TID(10, RG_DISK_RECORDS)
#endif #endif
...@@ -22,22 +22,31 @@ ...@@ -22,22 +22,31 @@
/** /**
* KeyTable2 is DLHashTable2 with hardcoded Uint32 key named "key". * KeyTable2 is DLHashTable2 with hardcoded Uint32 key named "key".
*/ */
template <class T> template <typename P, typename T>
class KeyTable : public DLHashTable<T> { class KeyTableImpl : public DLHashTableImpl<P, T> {
public: public:
KeyTable(ArrayPool<T>& pool) : KeyTableImpl(P & pool) :
DLHashTable<T>(pool) { DLHashTableImpl<P, T>(pool) {
} }
bool find(Ptr<T>& ptr, const T& rec) const { bool find(Ptr<T>& ptr, const T& rec) const {
return DLHashTable<T>::find(ptr, rec); return DLHashTableImpl<P, T>::find(ptr, rec);
} }
bool find(Ptr<T>& ptr, Uint32 key) const { bool find(Ptr<T>& ptr, Uint32 key) const {
T rec; T rec;
rec.key = key; rec.key = key;
return DLHashTable<T>::find(ptr, rec); return DLHashTableImpl<P, T>::find(ptr, rec);
} }
}; };
// Specializations
template <typename T>
class KeyTable : public KeyTableImpl<ArrayPool<T>, T>
{
public:
KeyTable(ArrayPool<T> & p) : KeyTableImpl<ArrayPool<T>, T>(p) {}
};
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment