Mnesia table events

Sivakumar Krishnasamy ksivakumar@REDACTED
Fri Aug 16 09:18:31 CEST 2002


Hi Dan Gudmundsson,
   Thanks for your reply.
   What will happen if I subscribe for table events on both the nodes (a@REDACTED, a1@REDACTED), but perform replicated table operations in a@REDACTED ?.
   Will the events be distributed to both subscribed processes in a@REDACTED and a1@REDACTED ??.

     Node A                                                 Node B (A1) 
     (a@REDACTED)1> mnesia:start().                               (a1@REDACTED)1>  mnesia:start().
      ok                                                            ok

     (a@REDACTED)2> mnesia:change_config(extra_db_nodes, [a1@REDACTED]).    
     {ok,[a1@REDACTED]}                                               

     (a@REDACTED)3> mnesia:create_table(a,[{ram_copies,[a@REDACTED,a1@REDACTED]}]).
     {atomic,ok}                                                  

     (a@REDACTED)4> mnesia:subscribe({table, a}).            (a1@REDACTED)3>  mnesia:subscribe({table, a}).
     {ok,a@REDACTED}                                                          {ok,a1@REDACTED}     

     (a@REDACTED)4> mnesia:dirty_write({a,1,1}).                      
         ok 
  
     Note: So performing table operation in a@REDACTED creates an event and it is captured by the subscribed process in a1@REDACTED Am I right ?? 

     (a@REDACTED)5>                                                   (a1@REDACTED)4> flush().
     Will I get event here too??                         Shell got {mnesia_table_event,
                                                                        {write,{a,1,1},{dirty,<127.32.0>}}}

    

Regards,
Sivakumar Krishnasamy.
    


----- Original Message ----- 
From: "Dan Gudmundsson" <dgud@REDACTED>
To: "Sivakumar Krishnasamy" <ksivakumar@REDACTED>
Cc: <erlang-questions@REDACTED>
Sent: Friday, August 16, 2002 11:34 AM
Subject: Mnesia table events


> 
> You only get events on the node where you called the subscribe command:
> 
> Node A                                                 Node B (A1)
> 
> (a@REDACTED)1> mnesia:start().                               (a1@REDACTED)1>  mnesia:start().
> ok                                                    ok
> (a@REDACTED)2> mnesia:change_config(extra_db_nodes, [a1@REDACTED]).    
> {ok,[a1@REDACTED]}                                               
> (a@REDACTED)3> mnesia:create_table(a,[{ram_copies,[a@REDACTED,a1@REDACTED]}]).
> {atomic,ok}                                                  
> (a@REDACTED)4>                                               (a1@REDACTED)3>  mnesia:subscribe({table, a}).
> (a@REDACTED)4>                                               {ok,a1@REDACTED}
> (a@REDACTED)4> mnesia:dirty_write({a,1,1}).                      
> ok 
> (a@REDACTED)5>       (a1@REDACTED)4> flush().
>       Shell got {mnesia_table_event,
>                                                        {write,{a,1,1},{dirty,<127.32.0>}}}
> 
> /Dan
> 
> 
> 
> 
> Sivakumar Krishnasamy writes:
>  > Hi all,
>  >     I have created a table, which is replicated in 2 nodes ..say Node A and Node B. If I insert a value in Node A, then it's is replicated in Node B.
>  >     Is it possible to subscribe for capturing table events in Node B, to capture table events When I perform table operations like write/delete in Node A for the replicated table. 
>  >     When I tried the above scenario, I am getting events only in Node A, and node B doesn't seems to generate any table events, when its replicated table is accessed in Node A.
>  >  
>  > Regards,
>  > Sivakumar Krishnasamy.
>  >    
>  >     
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20020816/c328c4bc/attachment.htm>


More information about the erlang-questions mailing list