Commit 6a0ad011 authored by unknown's avatar unknown

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

parent 685c1fb3
......@@ -281,8 +281,6 @@ Dbdict::execDUMP_STATE_ORD(Signal* signal)
#define MEMINFO(x, y) infoEvent(x ": %d %d", y.getSize(), y.getNoOfFree())
if(signal->theData[0] == 1226){
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_rope_pool", c_rope_pool);
}
......@@ -2037,10 +2035,14 @@ void Dbdict::execREAD_CONFIG_REQ(Signal* signal)
c_obj_pool.setSize(tablerecSize+c_maxNoOfTriggers);
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_filegroup_pool.setSize(10);
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_opCreateTable.setSize(8);
......@@ -2121,22 +2123,6 @@ void Dbdict::execREAD_CONFIG_REQ(Signal* signal)
new (ptr.p) DictObject();
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()
/* ---------------------------------------------------------------- */
......@@ -14831,6 +14817,8 @@ Dbdict::create_fg_prepare_start(Signal* signal, SchemaOp* op){
break;
}
new (fg_ptr.p) Filegroup();
{
Rope name(c_rope_pool, obj_ptr.p->m_name);
if(!name.assign(fg.FilegroupName, len, hash)){
......@@ -15070,6 +15058,8 @@ Dbdict::create_file_prepare_start(Signal* signal, SchemaOp* op){
break;
}
new (filePtr.p) File();
{
Rope name(c_rope_pool, obj_ptr.p->m_name);
if(!name.assign(f.FileName, len, hash)){
......@@ -15084,7 +15074,7 @@ Dbdict::create_file_prepare_start(Signal* signal, SchemaOp* op){
break;
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);
break;
}
......@@ -15310,7 +15300,7 @@ Dbdict::create_file_abort_complete(Signal* signal, SchemaOp* op)
break;
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);
break;
}
......@@ -15511,7 +15501,7 @@ Dbdict::drop_fg_commit_start(Signal* signal, SchemaOp* op)
* Mark all undofiles as dropped
*/
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];
for(list.first(filePtr); !filePtr.isNull(); list.next(filePtr))
{
......
......@@ -534,6 +534,7 @@ public:
File() {}
Uint32 key;
Uint32 m_magic;
Uint32 m_obj_ptr_i;
Uint32 m_filegroup_id;
Uint32 m_type;
......@@ -552,12 +553,17 @@ public:
bool equal(const File& obj) const { return key == obj.key;}
};
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 {
Filegroup(){}
Uint32 key;
Uint32 m_obj_ptr_i;
Uint32 m_magic;
Uint32 m_type;
Uint32 m_version;
......@@ -571,7 +577,7 @@ public:
struct {
Uint32 m_undo_buffer_size;
DLList<File>::HeadPOD m_files;
File_list::HeadPOD m_files;
} m_logfilegroup;
};
......@@ -586,11 +592,13 @@ public:
bool equal(const Filegroup& obj) const { return key == obj.key;}
};
typedef Ptr<Filegroup> FilegroupPtr;
typedef RecordPool<Filegroup, RWPool> Filegroup_pool;
typedef KeyTableImpl<Filegroup_pool, Filegroup> Filegroup_hash;
ArrayPool<File> c_file_pool;
KeyTable<File> c_file_hash;
ArrayPool<Filegroup> c_filegroup_pool;
KeyTable<Filegroup> c_filegroup_hash;
File_pool c_file_pool;
Filegroup_pool c_filegroup_pool;
File_hash c_file_hash;
Filegroup_hash c_filegroup_hash;
RopePool c_rope_pool;
......
......@@ -44,11 +44,16 @@
/**
* Record types
*/
#define RT_PGMAN_PAGE_REQUEST MAKE_TID(1, 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_EXTENT_INFO MAKE_TID(4, RG_DISK_RECORDS)
#define RT_PGMAN_PAGE_REQUEST MAKE_TID( 1, 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_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
......@@ -22,22 +22,31 @@
/**
* KeyTable2 is DLHashTable2 with hardcoded Uint32 key named "key".
*/
template <class T>
class KeyTable : public DLHashTable<T> {
template <typename P, typename T>
class KeyTableImpl : public DLHashTableImpl<P, T> {
public:
KeyTable(ArrayPool<T>& pool) :
DLHashTable<T>(pool) {
KeyTableImpl(P & pool) :
DLHashTableImpl<P, T>(pool) {
}
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 {
T rec;
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
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