So running mnesia in a multi-node (2 node) cluster with disc_copies as an option, when I log onto the server and inspect the directory contents with ls -l
, I see the following mnesia table sizes:
Node 1:
-rw-r--r-- 1 root root 8 Jul 25 20:58 applications.DCD
-rw-r--r-- 1 root root 1530 Jul 26 00:25 applications.DCL
-rw-r--r-- 1 root root 132 Jul 26 01:10 LATEST.LOG
-rw-r--r-- 1 root root 8 Jul 25 20:58 table.DCD
-rw-r--r-- 1 root root 237451 Jul 26 00:43 table.DCL
-rw-r--r-- 1 root root 8 Jul 25 20:58 kite_table.DCD
-rw-r--r-- 1 root root 80707 Jul 26 00:43 kite_table.DCL
-rw-r--r-- 1 root root 14730 Jul 26 01:03 schema.DAT
Node 2:
-rw-r--r-- 1 root root 196 Jul 26 01:13 DECISION_TAB.LOG
-rw-r--r-- 1 root root 1238 Jul 26 01:10 applications.DCD
-rw-r--r-- 1 root root 132 Jul 26 01:13 LATEST.LOG
-rw-r--r-- 1 root root 233483 Jul 26 01:10 table.DCD
-rw-r--r-- 1 root root 80674 Jul 26 01:10 kite_table.DCD
-rw-r--r-- 1 root root 17032 Jul 26 01:09 schema.DAT
But extracting the same data with a call to :mnesia.info()
, I see:
Node 1:
table : with 64 records occupying 38477 words of mem
kite_table : with 1 records occupying 13562 words of mem
applications: with 4 records occupying 488 words of mem
schema : with 9 records occupying 1486 words of mem
Node 2:
table : with 64 records occupying 38477 words of mem
kite_table : with 1 records occupying 13562 words of mem
applications: with 4 records occupying 488 words of mem
schema : with 9 records occupying 1486 words of mem
Then it appears the data is the same size and consistent. Can anyone explain the apparent inconsistency?
The code below shows a typical call done in the system for :mnesia.create_table/2
opts = [
{:attributes, [id: nil, data: %{}]},
{:type, :set},
{:index, []},
{:disc_copies, [node() | Node.list([:visible])]}
]
:mnesia.create_table(:kite_table, opts)
{disc_copies, [n1@mymbp2, n2@mymbp2]}
in themnesia:create_table()
function, and I'm seeing the same thing as you. – 7stud