mnesia_frag ????

Sanjaya Vitharana <>
Mon Jan 16 13:32:23 CET 2006


Hi .. !!!

Can any one show me where I'm doing wrong, I'm trying to write a single record & retrive it using mnesia_frag.

But it's not working :( for me.

()29> mnesia:table_info(profile_db, frag_properties).
[{base_table,profile_db},                    
 {foreign_key,undefined},
 {hash_module,mnesia_frag_hash},
 {hash_state,{hash_state,30,15,4}},
 {n_fragments,30},
 {node_pool,[]}]
()31> WriteFun1 = fun(DbFile, Rec) -> mnesia:write(DbFile, Rec, write)end.
#Fun<erl_eval.12.2225172>
()32> mnesia:activity(transaction, WriteFun1, [profile_db, {profile_db,777,"test",333,1234,5678,1234}], mnesia_frag).
ok  --- Here it shows as it works
()33> ReadFun = fun(Db,DBKey) ->  mnesia:dirty_read(Db, DBKey)end.
#Fun<erl_eval.12.2225172>
()34> mnesia:activity(transaction, ReadFun, [profile_db,777], mnesia_frag).
[] -- but empty list given when try to retrive
()35> mnesia:dirty_first(profile_db).
'$end_of_table'  --- since the db should contains only 2 records, I tried this. but :(
()36> 


Furthermore I have used below, to create the DB.

-record(profile_db, {mobile_no, prof_details, type, last_update_date, first_creation_date, fax_no}).

   Res = mnesia:create_table(profile_db,[
                      {disc_copies, NodeList},
                      {type, ordered_set},
                      {index, [type, last_update_date, first_creation_date, fax_no]},
                      {frag_properties, [{n_fragments, 30}]},
                      {attributes, record_info(fields, profile_db)}
                      ]),

----------------------------------------------------------------------------------------------------------------------------------------------------
consider the mnesia:info() result below, and note that the 
profile_db_frag2: with 1        records occupying 95       words of mem
disc_copies        = [schema]

but I have used  {disc_copies, NodeList}
----------------------------------------------------------------------------------------------------------------------------------------------------

()43> mnesia:info().                                 
---> Processes holding locks <--- 
---> Processes waiting for locks <--- 
---> Participant transactions <--- 
---> Coordinator transactions <---
---> Uncertain transactions <--- 
---> Active tables <--- 
profile_db     : with 0        records occupying 70       words of mem
profile_db_frag2: with 1        records occupying 95       words of mem
......
profile_db_frag13: with 1        records occupying 95       words of mem
.......
profile_db_frag29: with 0        records occupying 70       words of mem
profile_db_frag30: with 0        records occupying 70       words of mem
schema         : with 31       records occupying 4380     words of mem
===> System info in version "4.2.3", debug level = none <===
opt_disc. Directory "/usr2/omni_vm_prof/db/vmdb" is used.
use fallback at restart = false
running db nodes   = []
stopped db nodes   = [] 
master node tables = []
remote             = []
ram_copies         = [profile_db,
                      profile_db_frag10,
                      profile_db_frag11,
                      
                      ... 
                      
                      profile_db_frag8,
                      profile_db_frag9]
disc_copies        = [schema]
disc_only_copies   = []
[{,disc_copies}] = [schema]
[{,ram_copies}] = [profile_db_frag30,
                                profile_db_frag29,
                                
                                .....

                                profile_db_frag3,
                                profile_db_frag2,
                                profile_db]
12 transactions committed, 5 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
()44>             


I have confused with the results, can anyone explane this ??

Thanks in advance.

Sanjaya Vitharana
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20060116/ed8e5ad6/attachment.html>


More information about the erlang-questions mailing list