228
$ pmeminsp ca -pmem-file /mnt/pmem/file -- ./listing_12-15
++ Analysis starts
data = 1234
++ Analysis completes
++ Data is stored in folder "/data/.pmeminspdata/data/listing_12-15"
$ pmeminsp rp -- listing_12-19 listing_12-15
Analysis complete. No problems detected.
Stores Not Added into a Transaction
When working within a transaction block, it is assumed that all the modified persistent
memory addresses were added to it at the beginning, which also implies that their
previous values are copied to an undo log. This allows the transaction to implicitly flush
added memory addresses at the end of the block or roll back to the old values in the
event of an unexpected failure. A modification within a transaction to an address that is
not added to the transaction is a bug that you must be aware of.
Consider the code in Listing 12-21 that uses the libpmemobj library from PMDK. It
shows an example of writing within a transaction using a memory address that is not
explicitly tracked by the transaction.
Listing 12-21. Example of writing within a transaction with a memory address
not added to the transaction
33 #include
34
35 struct my_root {
36
int value;
37
int is_odd;
38 };
39
40 // registering type 'my_root' in the layout
41 POBJ_LAYOUT_BEGIN(example);
42 POBJ_LAYOUT_ROOT(example, struct my_root);
43 POBJ_LAYOUT_END(example);
44
Chapter 12 Debugging persistent MeMory appliCations
$ pmeminsp ca -pmem-file /mnt/pmem/file -- ./listing_12-15
++ Analysis starts
data = 1234
++ Analysis completes
++ Data is stored in folder "/data/.pmeminspdata/data/listing_12-15"
$ pmeminsp rp -- listing_12-19 listing_12-15
Analysis complete. No problems detected.
Stores Not Added into a Transaction
When working within a transaction block, it is assumed that all the modified persistent
memory addresses were added to it at the beginning, which also implies that their
previous values are copied to an undo log. This allows the transaction to implicitly flush
added memory addresses at the end of the block or roll back to the old values in the
event of an unexpected failure. A modification within a transaction to an address that is
not added to the transaction is a bug that you must be aware of.
Consider the code in Listing 12-21 that uses the libpmemobj library from PMDK. It
shows an example of writing within a transaction using a memory address that is not
explicitly tracked by the transaction.
Listing 12-21. Example of writing within a transaction with a memory address
not added to the transaction
33 #include
34
35 struct my_root {
36
int value;
37
int is_odd;
38 };
39
40 // registering type 'my_root' in the layout
41 POBJ_LAYOUT_BEGIN(example);
42 POBJ_LAYOUT_ROOT(example, struct my_root);
43 POBJ_LAYOUT_END(example);
44
Chapter 12 Debugging persistent MeMory appliCations
