mnesia:dirty_update_counter doesn't work as expected in mnesia_frag context
Aleksander Nycz <[email protected]> Fri, 10 Jul 2015 16:10:06 +0200
| Newsgroups | gmane.comp.lang.erlang.bugs |
|---|---|
| Message-ID | <[email protected]> |
Hello,
Please create frag table:
rd(testCounter, {key, value}).
testCounter
mnesia:create_table(tTest
, [{ram_copies, [node()]}
,{type,set}
,{attributes,record_info(fields, testCounter)}
,{record_name, testCounter}
,{frag_properties, [{n_fragments, 10},
{n_ram_copies, 1}, {node_pool, [node()]}]}])
and insert record using mnesia:write/3 func, that is called in
mnesia_frag access context:
mnesia:activity(sync_dirty, fun()-> mnesia:table_info(tTest, size) end,
[], mnesia_frag).
0
mnesia:activity(sync_dirty, fun() -> mnesia:write(tTest, {testCounter,
100, 200}, write) end, [], mnesia_frag).
ok
mnesia:activity(sync_dirty, fun()-> mnesia:table_info(tTest, size) end,
[], mnesia_frag).
1
[T || T <- ([tTest] ++ [list_to_atom("tTest_frag" ++ integer_to_list(N))
|| N <- lists:seq(2, 10)]), mnesia:table_info(T, size) > 0].
[tTest_frag2]
ets:tab2list(tTest_frag2).
[#testCounter{key = 100,value = 200}]
*We have 1 record in table in frag: tTest_frag2*
Now please "insert" record using mnesia:dirty_update_counter/3:
[mnesia:clear_table(T) || T <- ([tTest] ++ [list_to_atom("tTest_frag" ++
integer_to_list(N)) || N <- lists:seq(2, 10)])].
[{atomic,ok},
{atomic,ok},
{atomic,ok},
{atomic,ok},
{atomic,ok},
{atomic,ok},
{atomic,ok},
{atomic,ok},
{atomic,ok},
{atomic,ok}]
mnesia:activity(sync_dirty, fun()-> mnesia:table_info(tTest, size) end,
[], mnesia_frag).
0
mnesia:activity(sync_dirty, fun() -> mnesia:dirty_update_counter(tTest,
100, 200) end, [], mnesia_frag).
200
mnesia:activity(sync_dirty, fun()-> mnesia:table_info(tTest, size) end,
[], mnesia_frag).
1
[T || T <- ([tTest] ++ [list_to_atom("tTest_frag" ++ integer_to_list(N))
|| N <- lists:seq(2, 10)]), mnesia:table_info(T, size) > 0].
[tTest]
ets:tab2list(tTest).
[#testCounter{key = 100,value = 200}]
*Now record goes to 1st frag: tTest*
So it looks, that dirty_update_counter doesn't handle frag table properly.
Best regards
Aleksander Nycz
_______________________________________________
erlang-bugs mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-bugs
smime.p7s
(application/pkcs7-signature, 4.8 KB) - not displayed