[erlang-questions] running out of memory trying to add_frag on a large mnesia table

Marc Sugiyama <>
Wed Nov 5 01:04:31 CET 2008


I have a large, fragmented mnesia table.  I'm trying to add more
fragments to it (see below).  When I do:

mnesia:change_table_frag(pvobject, {add_frag, [node()]).

erl dies trying to allocate memory.  top showed beam.smp using 2gb
shortly before the memory allocation failure.  I'm looking for some
ideas about how I can refragment this table.  My goal is to reduce the
size of each fragment, but I'll be keeping all the fragments on the
one machine.

Thanks.

Marc




pvobject       : with 2247463  records occupying 1030593978 bytes on disc
pvobject_frag9 : with 2244007  records occupying 996368400 bytes on disc
pvobject_frag8 : with 4384060  records occupying 1944822252 bytes on disc
pvobject_frag7 : with 4378299  records occupying 1943621636 bytes on disc
pvobject_frag6 : with 4388504  records occupying 1944472080 bytes on disc
pvobject_frag5 : with 4375236  records occupying 1942309152 bytes on disc
pvobject_frag4 : with 4372202  records occupying 1943407648 bytes on disc
pvobject_frag3 : with 4387990  records occupying 1944152852 bytes on disc
pvobject_frag2 : with 2246356  records occupying 1030532870 bytes on disc
schema         : with 11       records occupying 1651     words of mem
pvobject_frag10: with 2246679  records occupying 1030323718 bytes on disc
===> System info in version "4.4.3", debug level = none <===
opt_disc. Directory "/var/home/pvadmin/mnesia" is used.
use fallback at restart = false
running db nodes   = []
stopped db nodes   = []
master node tables = []
remote             = []
ram_copies         = []
disc_copies        = [schema]
disc_only_copies   = [pvobject,pvobject_frag10,pvobject_frag2,pvobject_frag3,
                      pvobject_frag4,pvobject_frag5,pvobject_frag6,
                      pvobject_frag7,pvobject_frag8,pvobject_frag9]
[{,disc_copies}] = [schema]
[{,disc_only_copies}] = [pvobject_frag10,pvobject_frag2,
                                            pvobject_frag3,pvobject_frag4,
                                            pvobject_frag5,pvobject_frag6,
                                            pvobject_frag7,pvobject_frag8,
                                            pvobject_frag9,pvobject]
2 transactions committed, 0 aborted, 0 restarted, 0 logged to disc
0 held locks, 0 in queue; 0 local transactions, 0 remote
0 transactions waits for other nodes: []
ok



More information about the erlang-questions mailing list