267
1251
char path[MAX_PATH_LEN];
1252
DBUG_ENTER("ha_pmdk::create");
1253
DBUG_PRINT("info", ("create"));
1254
1255
snprintf(path, MAX_PATH_LEN, "%s%s", name, PMEMOBJ_EXT);
1256
PMEMobjpool *pop = pmemobj_create(path, name,PMEMOBJ_MIN_POOL,
S_IRWXU);
1257
if (pop == NULL) {
1258
DBUG_PRINT("info", ("failed : %s error number :
%d",path,errCodeMap[errno]));
1259
DBUG_RETURN(errCodeMap[errno]);
1260
}
1261
DBUG_PRINT("info", ("Success"));
1262
pmemobj_close(pop);
1263
1264
DBUG_RETURN(0);
1265 }
Opening a Database Table
Before any read or write operations are performed on a table, the MariaDB server calls
the open()method to open the data and index tables. This method opens all the named
tables associated with the persistent memory storage engine at the time the storage
engine starts. A new table class variable, objtab, was added to hold the PMEMobjpool.
The names for the tables to be opened are provided by the MariaDB server. The index
container in volatile memory is populated using the open() function call at the time of
server start using the loadIndexTableFromPersistentMemory() function.
The pmemobj_open() function from libpmemobj is used to open an existing object
store memory pool (see Listing 13-5). The table is also opened at the time of a table
creation if any read/write action is triggered.
Listing 13-5. ha_pmdk.cc – Opening a database table
290 int ha_pmdk::open(const char *name, int mode, uint test_if_locked)
291 {
...
Chapter 13 enabling persistenCe Using a real-World appliCation
Précédent

- 291/457

Suivant