| Author |
Message |
|
| Guest |
Posted: Fri Oct 29, 2010 6:32 am |
|
|
|
Guest
|
I launched a new erl node with a proper -sname, and I'm still experiencing
the same problem. Yes, nodes a@lenovo and b@lenovo are up and running.
(emacs@lenovo)17> backgammon:init().
{atomic,ok}
(emacs@lenovo)18> backgammon:insert_game(1, "Jeff").
{aborted,{no_exists,game_record}}
(emacs@lenovo)19> backgammon:init().
{aborted,{already_exists,game_record}}
(emacs@lenovo)20> mnesia:info().
---> Processes holding locks <---
---> Processes waiting for locks <---
---> Participant transactions <---
---> Coordinator transactions <---
---> Uncertain transactions <---
---> Active tables <---
schema : with 3 records occupying 656 words of mem
===> System info in version "4.4.13", debug level = none <===
opt_disc. Directory
"c:/Users/jeff/code/code/scratch/erlang/Mnesia.emacs@lenovo" is NOT used.
use fallback at restart = false
running db nodes = [emacs@lenovo]
stopped db nodes = []
master node tables = []
remote = [backgammon_games,game_record]
ram_copies = [schema]
disc_copies = []
disc_only_copies = []
[] = [backgammon_games,game_record]
[{emacs@lenovo,ram_copies}] = [schema]
4 transactions committed, 3 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
(emacs@lenovo)21> mnesia:delete_table(backgammon_games).
{aborted,{no_exists,backgammon_games}}
(emacs@lenovo)22> mnesia:delete_table(game_record).
{aborted,{no_exists,game_record}}
(emacs@lenovo)23> backgammon:init().
{aborted,{already_exists,game_record}}
(emacs@lenovo)24>
> -----Original Message-----
> From: Ulf Wiger [mailto:ulf.wiger@erlang-solutions.com]
> Sent: Sunday, October 24, 2010 3:02 PM
> To: Jeffrey Rennie
> Cc: erlang-questions@erlang.org
> Subject: Re: [erlang-questions] Ridiculuous newbie mnesia question.
>
>
> Hi Jeffrey,
>
> The problem is that you have specified that the backgammon_games
> table should have copies on a@lenovo and b@lenovo, but your
> Erlang shell has the node name nonode@nohost (i.e. Erlang was
> started without distribution).
>
> One might argue whether it wouldn't have been better if mnesia had
> refused to create the table in the first place. As it is now, it
> believes
> it exists, because there is an entry in the schema, but it refuses to
> delete it because it has no active replicas. But since that's not what
> it
> complains about, I can understand your confusion.
>
> BR,
> Ulf W
>
>
> On 24 Oct 2010, at 23:37, Jeffrey Rennie wrote:
>
> > I seem to be stuck in a state where I can't create a table because it
> > exists, but I can't delete the table because it doesn't exist!
> >
> > I searched the mnesia documentation, and I couldn't find a definition
> > of the "Tab" arg passed to many mnesia functions.
> >
> > Here's what I tried:
> >
> > Eshell V5.7.5 (abort with ^G)
> > 2> c(backgammon).
> > {ok,backgammon}
> > 5> c(backgammon).
> > {ok,backgammon}
> > 7> mnesia:start().
> > ok
> > 8> backgammon:init().
> > {atomic,ok}
> > 11> c(backgammon).
> > {ok,backgammon}
> > 12> backgammon:dumpfields().
> > [player_turn,dice,board]
> > 13> c(backgammon).
> > {ok,backgammon}
> > 14> backgammon:init().
> > {aborted,{already_exists,backgammon_games}}
> > 15> mnesia:info().
> > ---> Processes holding locks <---
> > ---> Processes waiting for locks <---
> > ---> Participant transactions <---
> > ---> Coordinator transactions <---
> > ---> Uncertain transactions <---
> > ---> Active tables <---
> > schema : with 2 records occupying 546 words of
> mem
> > ===> System info in version "4.4.13", debug level = none <===
> > opt_disc. Directory
> > "c:/Users/jeff/code/code/scratch/erlang/Mnesia.nonode@nohost" is NOT
> > used.
> > use fallback at restart = false
> > running db nodes = [nonode@nohost]
> > stopped db nodes = []
> > master node tables = []
> > remote = [backgammon_games]
> > ram_copies = [schema]
> > disc_copies = []
> > disc_only_copies = []
> > [] = [backgammon_games]
> > [{nonode@nohost,ram_copies}] = [schema]
> > 3 transactions committed, 1 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
> > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> > %% BEGIN CONFUSING BIT
> > 17> mnesia:delete_table(backgammon_games).
> > {aborted,{no_exists,backgammon_games}}
> > 18> backgammon:init().
> > {aborted,{already_exists,backgammon_games}}
> > 19>
> > %% END CONFUSING BIT
> > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> >
> >
> > Here's my backgammon.erl:
> > -module(backgammon).
> >
> > -compile(export_all).
> >
> > -include("backgammon.hrl").
> >
> > create_tables(MnesiaNodes) ->
> > mnesia:create_table(backgammon_games,
> > [{attributes, record_info(fields, game_record)},
> > {ram_copies, MnesiaNodes}]).
> >
> > init() ->
> > create_tables([a@lenovo, b@lenovo]).
> >
> > dumpfields() ->
> > record_info(fields, game_state).
> >
> > ________________________________________________________________
> > erlang-questions (at) erlang.org mailing list.
> > See http://www.erlang.org/faq.html
> > To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
> >
>
> Ulf Wiger, CTO, Erlang Solutions, Ltd.
> http://erlang-solutions.com
>
________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
| krestenkrab |
Posted: Fri Oct 29, 2010 6:32 am |
|
|
|
Joined: 02 May 2010
Posts: 7
|
Looks like your node is called noname@nohost (ie you did not specify -name option to the erl command) while your script expects it to be called a@lenovo?
I'm no expert in mnesia, but what happens if you actually have nodes a@lenovo and b@lenovo running?
Its obvious why the second create fails, but maybe you cannot delete because mnesia cannot find the named nodes?
Kresten
On 24/10/2010, at 23.38, "Jeffrey Rennie" <surferjeff@gmail.com> wrote:
> I seem to be stuck in a state where I can't create a table because it
> exists, but I can't delete the table because it doesn't exist!
>
> I searched the mnesia documentation, and I couldn't find a definition
> of the "Tab" arg passed to many mnesia functions.
>
> Here's what I tried:
>
> Eshell V5.7.5 (abort with ^G)
> 2> c(backgammon).
> {ok,backgammon}
> 5> c(backgammon).
> {ok,backgammon}
> 7> mnesia:start().
> ok
> 8> backgammon:init().
> {atomic,ok}
> 11> c(backgammon).
> {ok,backgammon}
> 12> backgammon:dumpfields().
> [player_turn,dice,board]
> 13> c(backgammon).
> {ok,backgammon}
> 14> backgammon:init().
> {aborted,{already_exists,backgammon_games}}
> 15> mnesia:info().
> ---> Processes holding locks <---
> ---> Processes waiting for locks <---
> ---> Participant transactions <---
> ---> Coordinator transactions <---
> ---> Uncertain transactions <---
> ---> Active tables <---
> schema : with 2 records occupying 546 words of mem
> ===> System info in version "4.4.13", debug level = none <===
> opt_disc. Directory
> "c:/Users/jeff/code/code/scratch/erlang/Mnesia.nonode@nohost" is NOT
> used.
> use fallback at restart = false
> running db nodes = [nonode@nohost]
> stopped db nodes = []
> master node tables = []
> remote = [backgammon_games]
> ram_copies = [schema]
> disc_copies = []
> disc_only_copies = []
> [] = [backgammon_games]
> [{nonode@nohost,ram_copies}] = [schema]
> 3 transactions committed, 1 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
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> %% BEGIN CONFUSING BIT
> 17> mnesia:delete_table(backgammon_games).
> {aborted,{no_exists,backgammon_games}}
> 18> backgammon:init().
> {aborted,{already_exists,backgammon_games}}
> 19>
> %% END CONFUSING BIT
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
>
> Here's my backgammon.erl:
> -module(backgammon).
>
> -compile(export_all).
>
> -include("backgammon.hrl").
>
> create_tables(MnesiaNodes) ->
> mnesia:create_table(backgammon_games,
> [{attributes, record_info(fields, game_record)},
> {ram_copies, MnesiaNodes}]).
>
> init() ->
> create_tables([a@lenovo, b@lenovo]).
>
> dumpfields() ->
> record_info(fields, game_state).
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
>
________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
| uwiger |
Posted: Fri Oct 29, 2010 6:32 am |
|
|
|
User
Joined: 03 Jul 2006
Posts: 604
Location: Sweden
|
Hi Jeffrey,
Looking at the mnesia:info() output, there are a couple of things
to note.
1. 'running db nodes = [emacs@lenovo]' means that while a@lenovo
and b@lenovo might be running at the erlang level, perhaps even
with mnesia runnin, they are not connected to emacs@lenovo
2. The line '"c:/.../Mnesia.emacs@lenovo" is NOT used' means that
you have not created a persistent schema. Normally, the persistent
schema indicates which nodes are part of the mnesia cluster. Any
other nodes that want to join should specify -mnesia extra_db_nodes Ns,
where Ns includes at least some of the nodes listed in the persistent schema.
To create a persistent schema, you run this before starting mnesia:
mnesia:create_schema(Nodes).
...with the nodes in Nodes all up and running. You only need to call it
from one node; it will create a schema on each node automatically.
BR,
Ulf W
On 25 Oct 2010, at 07:30, Jeffrey Rennie wrote:
> I launched a new erl node with a proper -sname, and I'm still experiencing
> the same problem. Yes, nodes a@lenovo and b@lenovo are up and running.
>
> (emacs@lenovo)17> backgammon:init().
> {atomic,ok}
> (emacs@lenovo)18> backgammon:insert_game(1, "Jeff").
> {aborted,{no_exists,game_record}}
> (emacs@lenovo)19> backgammon:init().
> {aborted,{already_exists,game_record}}
> (emacs@lenovo)20> mnesia:info().
> ---> Processes holding locks <---
> ---> Processes waiting for locks <---
> ---> Participant transactions <---
> ---> Coordinator transactions <---
> ---> Uncertain transactions <---
> ---> Active tables <---
> schema : with 3 records occupying 656 words of mem
> ===> System info in version "4.4.13", debug level = none <===
> opt_disc. Directory
> "c:/Users/jeff/code/code/scratch/erlang/Mnesia.emacs@lenovo" is NOT used.
> use fallback at restart = false
> running db nodes = [emacs@lenovo]
> stopped db nodes = []
> master node tables = []
> remote = [backgammon_games,game_record]
> ram_copies = [schema]
> disc_copies = []
> disc_only_copies = []
> [] = [backgammon_games,game_record]
> [{emacs@lenovo,ram_copies}] = [schema]
> 4 transactions committed, 3 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
> (emacs@lenovo)21> mnesia:delete_table(backgammon_games).
> {aborted,{no_exists,backgammon_games}}
> (emacs@lenovo)22> mnesia:delete_table(game_record).
> {aborted,{no_exists,game_record}}
> (emacs@lenovo)23> backgammon:init().
> {aborted,{already_exists,game_record}}
> (emacs@lenovo)24>
>
>
>> -----Original Message-----
>> From: Ulf Wiger [mailto:ulf.wiger@erlang-solutions.com]
>> Sent: Sunday, October 24, 2010 3:02 PM
>> To: Jeffrey Rennie
>> Cc: erlang-questions@erlang.org
>> Subject: Re: [erlang-questions] Ridiculuous newbie mnesia question.
>>
>>
>> Hi Jeffrey,
>>
>> The problem is that you have specified that the backgammon_games
>> table should have copies on a@lenovo and b@lenovo, but your
>> Erlang shell has the node name nonode@nohost (i.e. Erlang was
>> started without distribution).
>>
>> One might argue whether it wouldn't have been better if mnesia had
>> refused to create the table in the first place. As it is now, it
>> believes
>> it exists, because there is an entry in the schema, but it refuses to
>> delete it because it has no active replicas. But since that's not what
>> it
>> complains about, I can understand your confusion.
>>
>> BR,
>> Ulf W
>>
>>
>> On 24 Oct 2010, at 23:37, Jeffrey Rennie wrote:
>>
>>> I seem to be stuck in a state where I can't create a table because it
>>> exists, but I can't delete the table because it doesn't exist!
>>>
>>> I searched the mnesia documentation, and I couldn't find a definition
>>> of the "Tab" arg passed to many mnesia functions.
>>>
>>> Here's what I tried:
>>>
>>> Eshell V5.7.5 (abort with ^G)
>>> 2> c(backgammon).
>>> {ok,backgammon}
>>> 5> c(backgammon).
>>> {ok,backgammon}
>>> 7> mnesia:start().
>>> ok
>>> 8> backgammon:init().
>>> {atomic,ok}
>>> 11> c(backgammon).
>>> {ok,backgammon}
>>> 12> backgammon:dumpfields().
>>> [player_turn,dice,board]
>>> 13> c(backgammon).
>>> {ok,backgammon}
>>> 14> backgammon:init().
>>> {aborted,{already_exists,backgammon_games}}
>>> 15> mnesia:info().
>>> ---> Processes holding locks <---
>>> ---> Processes waiting for locks <---
>>> ---> Participant transactions <---
>>> ---> Coordinator transactions <---
>>> ---> Uncertain transactions <---
>>> ---> Active tables <---
>>> schema : with 2 records occupying 546 words of
>> mem
>>> ===> System info in version "4.4.13", debug level = none <===
>>> opt_disc. Directory
>>> "c:/Users/jeff/code/code/scratch/erlang/Mnesia.nonode@nohost" is NOT
>>> used.
>>> use fallback at restart = false
>>> running db nodes = [nonode@nohost]
>>> stopped db nodes = []
>>> master node tables = []
>>> remote = [backgammon_games]
>>> ram_copies = [schema]
>>> disc_copies = []
>>> disc_only_copies = []
>>> [] = [backgammon_games]
>>> [{nonode@nohost,ram_copies}] = [schema]
>>> 3 transactions committed, 1 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
>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>>> %% BEGIN CONFUSING BIT
>>> 17> mnesia:delete_table(backgammon_games).
>>> {aborted,{no_exists,backgammon_games}}
>>> 18> backgammon:init().
>>> {aborted,{already_exists,backgammon_games}}
>>> 19>
>>> %% END CONFUSING BIT
>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>>>
>>>
>>> Here's my backgammon.erl:
>>> -module(backgammon).
>>>
>>> -compile(export_all).
>>>
>>> -include("backgammon.hrl").
>>>
>>> create_tables(MnesiaNodes) ->
>>> mnesia:create_table(backgammon_games,
>>> [{attributes, record_info(fields, game_record)},
>>> {ram_copies, MnesiaNodes}]).
>>>
>>> init() ->
>>> create_tables([a@lenovo, b@lenovo]).
>>>
>>> dumpfields() ->
>>> record_info(fields, game_state).
>>>
>>> ________________________________________________________________
>>> erlang-questions (at) erlang.org mailing list.
>>> See http://www.erlang.org/faq.html
>>> To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
>>>
>>
>> Ulf Wiger, CTO, Erlang Solutions, Ltd.
>> http://erlang-solutions.com
>>
>
>
>
Ulf Wiger, CTO, Erlang Solutions, Ltd.
http://erlang-solutions.com
________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Fri Oct 29, 2010 6:32 am |
|
|
|
Guest
|
Although all these points are valid I would like to add a third point
which should solve this particular situation;
3. The line '[] = [backgammon_games,game_record]' means that no node,
which is a copy-holder of these tables, is connected. This means that
you should first start one of those nodes (or a "fake" of one with the
same nodename) and then start mnesia and do
mnesia:change_config(extra_db_nodes, N) (as Ulf mentioned) where N is a
copy-holder of those tables. When this is done the node name will show
up like this: '[{foo@lenovo, ram_copies}] =
[backgammon_games,game_record]' and then it is safe to remove the table.
The important part here is the "copy-holder" concept. An empty list
means "no one is available", but the local node still knows about it so
it "exists" but it doesn't exist in a place where you can change it (it
is in a different dimension > ). That is the reason why you can't
create it nor delete it.
/Mazen
On 25/10/2010 08:41, Ulf Wiger wrote:
> Hi Jeffrey,
>
> Looking at the mnesia:info() output, there are a couple of things
> to note.
>
> 1. 'running db nodes = [emacs@lenovo]' means that while a@lenovo
> and b@lenovo might be running at the erlang level, perhaps even
> with mnesia runnin, they are not connected to emacs@lenovo
>
> 2. The line '"c:/.../Mnesia.emacs@lenovo" is NOT used' means that
> you have not created a persistent schema. Normally, the persistent
> schema indicates which nodes are part of the mnesia cluster. Any
> other nodes that want to join should specify -mnesia extra_db_nodes Ns,
> where Ns includes at least some of the nodes listed in the persistent schema.
>
> To create a persistent schema, you run this before starting mnesia:
>
> mnesia:create_schema(Nodes).
>
> ...with the nodes in Nodes all up and running. You only need to call it
> from one node; it will create a schema on each node automatically.
>
> BR,
> Ulf W
>
> On 25 Oct 2010, at 07:30, Jeffrey Rennie wrote:
>
>> I launched a new erl node with a proper -sname, and I'm still experiencing
>> the same problem. Yes, nodes a@lenovo and b@lenovo are up and running.
>>
>> (emacs@lenovo)17> backgammon:init().
>> {atomic,ok}
>> (emacs@lenovo)18> backgammon:insert_game(1, "Jeff").
>> {aborted,{no_exists,game_record}}
>> (emacs@lenovo)19> backgammon:init().
>> {aborted,{already_exists,game_record}}
>> (emacs@lenovo)20> mnesia:info().
>> ---> Processes holding locks<---
>> ---> Processes waiting for locks<---
>> ---> Participant transactions<---
>> ---> Coordinator transactions<---
>> ---> Uncertain transactions<---
>> ---> Active tables<---
>> schema : with 3 records occupying 656 words of mem
>> ===> System info in version "4.4.13", debug level = none<===
>> opt_disc. Directory
>> "c:/Users/jeff/code/code/scratch/erlang/Mnesia.emacs@lenovo" is NOT used.
>> use fallback at restart = false
>> running db nodes = [emacs@lenovo]
>> stopped db nodes = []
>> master node tables = []
>> remote = [backgammon_games,game_record]
>> ram_copies = [schema]
>> disc_copies = []
>> disc_only_copies = []
>> [] = [backgammon_games,game_record]
>> [{emacs@lenovo,ram_copies}] = [schema]
>> 4 transactions committed, 3 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
>> (emacs@lenovo)21> mnesia:delete_table(backgammon_games).
>> {aborted,{no_exists,backgammon_games}}
>> (emacs@lenovo)22> mnesia:delete_table(game_record).
>> {aborted,{no_exists,game_record}}
>> (emacs@lenovo)23> backgammon:init().
>> {aborted,{already_exists,game_record}}
>> (emacs@lenovo)24>
>>
>>
>>> -----Original Message-----
>>> From: Ulf Wiger [mailto:ulf.wiger@erlang-solutions.com]
>>> Sent: Sunday, October 24, 2010 3:02 PM
>>> To: Jeffrey Rennie
>>> Cc: erlang-questions@erlang.org
>>> Subject: Re: [erlang-questions] Ridiculuous newbie mnesia question.
>>>
>>>
>>> Hi Jeffrey,
>>>
>>> The problem is that you have specified that the backgammon_games
>>> table should have copies on a@lenovo and b@lenovo, but your
>>> Erlang shell has the node name nonode@nohost (i.e. Erlang was
>>> started without distribution).
>>>
>>> One might argue whether it wouldn't have been better if mnesia had
>>> refused to create the table in the first place. As it is now, it
>>> believes
>>> it exists, because there is an entry in the schema, but it refuses to
>>> delete it because it has no active replicas. But since that's not what
>>> it
>>> complains about, I can understand your confusion.
>>>
>>> BR,
>>> Ulf W
>>>
>>>
>>> On 24 Oct 2010, at 23:37, Jeffrey Rennie wrote:
>>>
>>>> I seem to be stuck in a state where I can't create a table because it
>>>> exists, but I can't delete the table because it doesn't exist!
>>>>
>>>> I searched the mnesia documentation, and I couldn't find a definition
>>>> of the "Tab" arg passed to many mnesia functions.
>>>>
>>>> Here's what I tried:
>>>>
>>>> Eshell V5.7.5 (abort with ^G)
>>>> 2> c(backgammon).
>>>> {ok,backgammon}
>>>> 5> c(backgammon).
>>>> {ok,backgammon}
>>>> 7> mnesia:start().
>>>> ok
>>>> 8> backgammon:init().
>>>> {atomic,ok}
>>>> 11> c(backgammon).
>>>> {ok,backgammon}
>>>> 12> backgammon:dumpfields().
>>>> [player_turn,dice,board]
>>>> 13> c(backgammon).
>>>> {ok,backgammon}
>>>> 14> backgammon:init().
>>>> {aborted,{already_exists,backgammon_games}}
>>>> 15> mnesia:info().
>>>> ---> Processes holding locks<---
>>>> ---> Processes waiting for locks<---
>>>> ---> Participant transactions<---
>>>> ---> Coordinator transactions<---
>>>> ---> Uncertain transactions<---
>>>> ---> Active tables<---
>>>> schema : with 2 records occupying 546 words of
>>> mem
>>>> ===> System info in version "4.4.13", debug level = none<===
>>>> opt_disc. Directory
>>>> "c:/Users/jeff/code/code/scratch/erlang/Mnesia.nonode@nohost" is NOT
>>>> used.
>>>> use fallback at restart = false
>>>> running db nodes = [nonode@nohost]
>>>> stopped db nodes = []
>>>> master node tables = []
>>>> remote = [backgammon_games]
>>>> ram_copies = [schema]
>>>> disc_copies = []
>>>> disc_only_copies = []
>>>> [] = [backgammon_games]
>>>> [{nonode@nohost,ram_copies}] = [schema]
>>>> 3 transactions committed, 1 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
>>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>>>> %% BEGIN CONFUSING BIT
>>>> 17> mnesia:delete_table(backgammon_games).
>>>> {aborted,{no_exists,backgammon_games}}
>>>> 18> backgammon:init().
>>>> {aborted,{already_exists,backgammon_games}}
>>>> 19>
>>>> %% END CONFUSING BIT
>>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>>>>
>>>>
>>>> Here's my backgammon.erl:
>>>> -module(backgammon).
>>>>
>>>> -compile(export_all).
>>>>
>>>> -include("backgammon.hrl").
>>>>
>>>> create_tables(MnesiaNodes) ->
>>>> mnesia:create_table(backgammon_games,
>>>> [{attributes, record_info(fields, game_record)},
>>>> {ram_copies, MnesiaNodes}]).
>>>>
>>>> init() ->
>>>> create_tables([a@lenovo, b@lenovo]).
>>>>
>>>> dumpfields() ->
>>>> record_info(fields, game_state).
>>>>
>>>> ________________________________________________________________
>>>> erlang-questions (at) erlang.org mailing list.
>>>> See http://www.erlang.org/faq.html
>>>> To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
>>>>
>>> Ulf Wiger, CTO, Erlang Solutions, Ltd.
>>> http://erlang-solutions.com
>>>
>>
>>
> Ulf Wiger, CTO, Erlang Solutions, Ltd.
> http://erlang-solutions.com
>
>
>
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
>
________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Fri Oct 29, 2010 6:47 am |
|
|
|
Guest
|
I seem to be stuck in a state where I can't create a table because it
exists, but I can't delete the table because it doesn't exist!
I searched the mnesia documentation, and I couldn't find a definition
of the "Tab" arg passed to many mnesia functions.
Here's what I tried:
Eshell V5.7.5 (abort with ^G)
2> c(backgammon).
{ok,backgammon}
5> c(backgammon).
{ok,backgammon}
7> mnesia:start().
ok
8> backgammon:init().
{atomic,ok}
11> c(backgammon).
{ok,backgammon}
12> backgammon:dumpfields().
[player_turn,dice,board]
13> c(backgammon).
{ok,backgammon}
14> backgammon:init().
{aborted,{already_exists,backgammon_games}}
15> mnesia:info().
---> Processes holding locks <---
---> Processes waiting for locks <---
---> Participant transactions <---
---> Coordinator transactions <---
---> Uncertain transactions <---
---> Active tables <---
schema : with 2 records occupying 546 words of mem
===> System info in version "4.4.13", debug level = none <===
opt_disc. Directory
"c:/Users/jeff/code/code/scratch/erlang/Mnesia.nonode@nohost" is NOT
used.
use fallback at restart = false
running db nodes = [nonode@nohost]
stopped db nodes = []
master node tables = []
remote = [backgammon_games]
ram_copies = [schema]
disc_copies = []
disc_only_copies = []
[] = [backgammon_games]
[{nonode@nohost,ram_copies}] = [schema]
3 transactions committed, 1 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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% BEGIN CONFUSING BIT
17> mnesia:delete_table(backgammon_games).
{aborted,{no_exists,backgammon_games}}
18> backgammon:init().
{aborted,{already_exists,backgammon_games}}
19>
%% END CONFUSING BIT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Here's my backgammon.erl:
-module(backgammon).
-compile(export_all).
-include("backgammon.hrl").
create_tables(MnesiaNodes) ->
mnesia:create_table(backgammon_games,
[{attributes, record_info(fields, game_record)},
{ram_copies, MnesiaNodes}]).
init() ->
create_tables([a@lenovo, b@lenovo]).
dumpfields() ->
record_info(fields, game_state).
________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
| uwiger |
Posted: Fri Oct 29, 2010 7:02 am |
|
|
|
User
Joined: 03 Jul 2006
Posts: 604
Location: Sweden
|
On 27 Oct 2010, at 05:37, Jeffrey Rennie wrote:
> Thank you for your patience. I still haven't escaped from this wet paper
> bag:
>
>> Looking at the mnesia:info() output, there are a couple of things
>> to note.
>>
>> 1. 'running db nodes = [emacs@lenovo]' means that while a@lenovo
>> and b@lenovo might be running at the erlang level, perhaps even
>> with mnesia runnin, they are not connected to emacs@lenovo
>>
>
> Why aren't they connected? How do I connect them? I can ping them (see
> below.)
Use the extra_db_nodes parameter for the nodes that do not have a persistent
copy of the schema.
For example, if you have nodes A, B, and C, where A and B have a persistent
schema, you would initially create the schema from either A or B:
mnesia:create_schema([A,B]).
...making sure that both nodes A and B are reachable at the time.
Then when starting mnesia on C, you can either do this:
mnesia:start([{extra_db_nodes,[A,B]}])
or add it to the erl command line:
erl -sname c -mnesia extra_db_nodes \[a@lenovo,b@lenovo\]
note the shell-related escaping issues. If your node names have special
characters, you have to include the single quotes and escape them too.
You can also create a sys.config file, where you insert application environment
variables:
sys.config:
[{mnesia,
[ {extra_db_nodes, [a@lenovo, b@lenovo]} ]
}].
then start Erlang with erl -sname c -config sys
The extra_db_nodes parameter tells mnesia where to go and find the
persistent schema, so you would usually include all nodes that are known
to have a persistent schema in the list.
BR,
Ulf W
Ulf Wiger, CTO, Erlang Solutions, Ltd.
http://erlang-solutions.com
________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Fri Oct 29, 2010 7:07 am |
|
|
|
Guest
|
Thank you for your patience. I still haven't escaped from this wet paper
bag:
> Looking at the mnesia:info() output, there are a couple of things
> to note.
>
> 1. 'running db nodes = [emacs@lenovo]' means that while a@lenovo
> and b@lenovo might be running at the erlang level, perhaps even
> with mnesia runnin, they are not connected to emacs@lenovo
>
Why aren't they connected? How do I connect them? I can ping them (see
below.)
> 2. The line '"c:/.../Mnesia.emacs@lenovo" is NOT used' means that
> you have not created a persistent schema. Normally, the persistent
> schema indicates which nodes are part of the mnesia cluster. Any
> other nodes that want to join should specify -mnesia extra_db_nodes
> Ns,
> where Ns includes at least some of the nodes listed in the
> persistent schema.
>
> To create a persistent schema, you run this before starting mnesia:
>
> mnesia:create_schema(Nodes).
>
> ...with the nodes in Nodes all up and running. You only need to call it
> from one node; it will create a schema on each node automatically.
I tried that. I didn't specify the other nodes because the documentation
for mnesia:create_schema says to specify disk copy nodes only, and I want
ram copy nodes.
But mnesia:info() still shows me I'm not connected to anything:
-module(backgammon).
-compile(export_all).
-include("backgammon.hrl").
create_tables(MnesiaNodes) ->
mnesia:create_table(game_record,
[{attributes, record_info(fields, game_record)},
{ram_copies, MnesiaNodes}]).
init() ->
mnesia:create_schema([]),
mnesia:start(),
create_tables([a@lenovo, b@lenovo]).
(emacs@lenovo)4> backgammon:init().
{atomic,ok}
(emacs@lenovo)5> mnesia:info().
---> Processes holding locks <---
---> Processes waiting for locks <---
---> Participant transactions <---
---> Coordinator transactions <---
---> Uncertain transactions <---
---> Active tables <---
schema : with 2 records occupying 546 words of mem
===> System info in version "4.4.13", debug level = none <===
opt_disc. Directory
"c:/Users/jeff/code/code/scratch/erlang/Mnesia.emacs@lenovo" is used.
use fallback at restart = false
running db nodes = [emacs@lenovo]
stopped db nodes = []
master node tables = []
remote = [game_record]
ram_copies = []
disc_copies = [schema]
disc_only_copies = []
[] = [game_record]
[{emacs@lenovo,disc_copies}] = [schema]
3 transactions committed, 0 aborted, 0 restarted, 1 logged to disc
0 held locks, 0 in queue; 0 local transactions, 0 remote
0 transactions waits for other nodes: []
ok
(emacs@lenovo)6> net_adm:ping(a@lenovo).
pong
(emacs@lenovo)7> net_adm:ping(b@lenovo).
pong
(emacs@lenovo)8>
________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Fri Oct 29, 2010 7:07 am |
|
|
|
Guest
|
How did my first call to backgammon:init() succeed?
8> backgammon:init().
{atomic,ok}
> -----Original Message-----
> From: Ulf Wiger [mailto:ulf.wiger@erlang-solutions.com]
> Sent: Sunday, October 24, 2010 3:02 PM
> To: Jeffrey Rennie
> Cc: erlang-questions@erlang.org
> Subject: Re: [erlang-questions] Ridiculuous newbie mnesia question.
>
>
> Hi Jeffrey,
>
> The problem is that you have specified that the backgammon_games
> table should have copies on a@lenovo and b@lenovo, but your
> Erlang shell has the node name nonode@nohost (i.e. Erlang was
> started without distribution).
>
> One might argue whether it wouldn't have been better if mnesia had
> refused to create the table in the first place. As it is now, it
> believes
> it exists, because there is an entry in the schema, but it refuses to
> delete it because it has no active replicas. But since that's not what
> it
> complains about, I can understand your confusion.
>
> BR,
> Ulf W
>
>
> On 24 Oct 2010, at 23:37, Jeffrey Rennie wrote:
>
> > I seem to be stuck in a state where I can't create a table because it
> > exists, but I can't delete the table because it doesn't exist!
> >
> > I searched the mnesia documentation, and I couldn't find a definition
> > of the "Tab" arg passed to many mnesia functions.
> >
> > Here's what I tried:
> >
> > Eshell V5.7.5 (abort with ^G)
> > 2> c(backgammon).
> > {ok,backgammon}
> > 5> c(backgammon).
> > {ok,backgammon}
> > 7> mnesia:start().
> > ok
> > 8> backgammon:init().
> > {atomic,ok}
> > 11> c(backgammon).
> > {ok,backgammon}
> > 12> backgammon:dumpfields().
> > [player_turn,dice,board]
> > 13> c(backgammon).
> > {ok,backgammon}
> > 14> backgammon:init().
> > {aborted,{already_exists,backgammon_games}}
> > 15> mnesia:info().
> > ---> Processes holding locks <---
> > ---> Processes waiting for locks <---
> > ---> Participant transactions <---
> > ---> Coordinator transactions <---
> > ---> Uncertain transactions <---
> > ---> Active tables <---
> > schema : with 2 records occupying 546 words of
> mem
> > ===> System info in version "4.4.13", debug level = none <===
> > opt_disc. Directory
> > "c:/Users/jeff/code/code/scratch/erlang/Mnesia.nonode@nohost" is NOT
> > used.
> > use fallback at restart = false
> > running db nodes = [nonode@nohost]
> > stopped db nodes = []
> > master node tables = []
> > remote = [backgammon_games]
> > ram_copies = [schema]
> > disc_copies = []
> > disc_only_copies = []
> > [] = [backgammon_games]
> > [{nonode@nohost,ram_copies}] = [schema]
> > 3 transactions committed, 1 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
> > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> > %% BEGIN CONFUSING BIT
> > 17> mnesia:delete_table(backgammon_games).
> > {aborted,{no_exists,backgammon_games}}
> > 18> backgammon:init().
> > {aborted,{already_exists,backgammon_games}}
> > 19>
> > %% END CONFUSING BIT
> > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> >
> >
> > Here's my backgammon.erl:
> > -module(backgammon).
> >
> > -compile(export_all).
> >
> > -include("backgammon.hrl").
> >
> > create_tables(MnesiaNodes) ->
> > mnesia:create_table(backgammon_games,
> > [{attributes, record_info(fields, game_record)},
> > {ram_copies, MnesiaNodes}]).
> >
> > init() ->
> > create_tables([a@lenovo, b@lenovo]).
> >
> > dumpfields() ->
> > record_info(fields, game_state).
> >
> > ________________________________________________________________
> > erlang-questions (at) erlang.org mailing list.
> > See http://www.erlang.org/faq.html
> > To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
> >
>
> Ulf Wiger, CTO, Erlang Solutions, Ltd.
> http://erlang-solutions.com
>
________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
| uwiger |
Posted: Fri Oct 29, 2010 7:12 am |
|
|
|
User
Joined: 03 Jul 2006
Posts: 604
Location: Sweden
|
Hi Jeffrey,
The problem is that you have specified that the backgammon_games
table should have copies on a@lenovo and b@lenovo, but your
Erlang shell has the node name nonode@nohost (i.e. Erlang was
started without distribution).
One might argue whether it wouldn't have been better if mnesia had
refused to create the table in the first place. As it is now, it believes
it exists, because there is an entry in the schema, but it refuses to
delete it because it has no active replicas. But since that's not what it
complains about, I can understand your confusion.
BR,
Ulf W
On 24 Oct 2010, at 23:37, Jeffrey Rennie wrote:
> I seem to be stuck in a state where I can't create a table because it
> exists, but I can't delete the table because it doesn't exist!
>
> I searched the mnesia documentation, and I couldn't find a definition
> of the "Tab" arg passed to many mnesia functions.
>
> Here's what I tried:
>
> Eshell V5.7.5 (abort with ^G)
> 2> c(backgammon).
> {ok,backgammon}
> 5> c(backgammon).
> {ok,backgammon}
> 7> mnesia:start().
> ok
> 8> backgammon:init().
> {atomic,ok}
> 11> c(backgammon).
> {ok,backgammon}
> 12> backgammon:dumpfields().
> [player_turn,dice,board]
> 13> c(backgammon).
> {ok,backgammon}
> 14> backgammon:init().
> {aborted,{already_exists,backgammon_games}}
> 15> mnesia:info().
> ---> Processes holding locks <---
> ---> Processes waiting for locks <---
> ---> Participant transactions <---
> ---> Coordinator transactions <---
> ---> Uncertain transactions <---
> ---> Active tables <---
> schema : with 2 records occupying 546 words of mem
> ===> System info in version "4.4.13", debug level = none <===
> opt_disc. Directory
> "c:/Users/jeff/code/code/scratch/erlang/Mnesia.nonode@nohost" is NOT
> used.
> use fallback at restart = false
> running db nodes = [nonode@nohost]
> stopped db nodes = []
> master node tables = []
> remote = [backgammon_games]
> ram_copies = [schema]
> disc_copies = []
> disc_only_copies = []
> [] = [backgammon_games]
> [{nonode@nohost,ram_copies}] = [schema]
> 3 transactions committed, 1 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
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> %% BEGIN CONFUSING BIT
> 17> mnesia:delete_table(backgammon_games).
> {aborted,{no_exists,backgammon_games}}
> 18> backgammon:init().
> {aborted,{already_exists,backgammon_games}}
> 19>
> %% END CONFUSING BIT
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
>
> Here's my backgammon.erl:
> -module(backgammon).
>
> -compile(export_all).
>
> -include("backgammon.hrl").
>
> create_tables(MnesiaNodes) ->
> mnesia:create_table(backgammon_games,
> [{attributes, record_info(fields, game_record)},
> {ram_copies, MnesiaNodes}]).
>
> init() ->
> create_tables([a@lenovo, b@lenovo]).
>
> dumpfields() ->
> record_info(fields, game_state).
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
>
Ulf Wiger, CTO, Erlang Solutions, Ltd.
http://erlang-solutions.com
________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Fri Oct 29, 2010 7:37 am |
|
|
|
Guest
|
Thank you Mazen.
Where can I find a book or document that contains such detailed
explanations? I'm having a hard time grasping the big picture for mnesia.
I've read all the docs that are part of the erlang distribution.
> -----Original Message-----
> From: Mazen Harake [mailto:mazen.harake@erlang-solutions.com]
> Sent: Monday, October 25, 2010 12:57 AM
> To: erlang-questions@erlang.org
> Cc: Jeffrey Rennie
> Subject: Re: [erlang-questions] Ridiculuous newbie mnesia question.
>
> Although all these points are valid I would like to add a third point
> which should solve this particular situation;
>
> 3. The line '[] = [backgammon_games,game_record]' means that no node,
> which is a copy-holder of these tables, is connected. This means that
> you should first start one of those nodes (or a "fake" of one with the
> same nodename) and then start mnesia and do
> mnesia:change_config(extra_db_nodes, N) (as Ulf mentioned) where N is a
> copy-holder of those tables. When this is done the node name will show
> up like this: '[{foo@lenovo, ram_copies}] =
> [backgammon_games,game_record]' and then it is safe to remove the
> table.
>
> The important part here is the "copy-holder" concept. An empty list
> means "no one is available", but the local node still knows about it so
> it "exists" but it doesn't exist in a place where you can change it (it
> is in a different dimension > ). That is the reason why you can't
> create it nor delete it.
>
> /Mazen
>
> On 25/10/2010 08:41, Ulf Wiger wrote:
> > Hi Jeffrey,
> >
> > Looking at the mnesia:info() output, there are a couple of things
> > to note.
> >
> > 1. 'running db nodes = [emacs@lenovo]' means that while a@lenovo
> > and b@lenovo might be running at the erlang level, perhaps even
> > with mnesia runnin, they are not connected to emacs@lenovo
> >
> > 2. The line '"c:/.../Mnesia.emacs@lenovo" is NOT used' means that
> > you have not created a persistent schema. Normally, the
> persistent
> > schema indicates which nodes are part of the mnesia cluster. Any
> > other nodes that want to join should specify -mnesia
> extra_db_nodes Ns,
> > where Ns includes at least some of the nodes listed in the
> persistent schema.
> >
> > To create a persistent schema, you run this before starting mnesia:
> >
> > mnesia:create_schema(Nodes).
> >
> > ...with the nodes in Nodes all up and running. You only need to call
> it
> > from one node; it will create a schema on each node automatically.
> >
> > BR,
> > Ulf W
> >
> > On 25 Oct 2010, at 07:30, Jeffrey Rennie wrote:
> >
> >> I launched a new erl node with a proper -sname, and I'm still
> experiencing
> >> the same problem. Yes, nodes a@lenovo and b@lenovo are up and
> running.
> >>
> >> (emacs@lenovo)17> backgammon:init().
> >> {atomic,ok}
> >> (emacs@lenovo)18> backgammon:insert_game(1, "Jeff").
> >> {aborted,{no_exists,game_record}}
> >> (emacs@lenovo)19> backgammon:init().
> >> {aborted,{already_exists,game_record}}
> >> (emacs@lenovo)20> mnesia:info().
> >> ---> Processes holding locks<---
> >> ---> Processes waiting for locks<---
> >> ---> Participant transactions<---
> >> ---> Coordinator transactions<---
> >> ---> Uncertain transactions<---
> >> ---> Active tables<---
> >> schema : with 3 records occupying 656 words of
> mem
> >> ===> System info in version "4.4.13", debug level = none<===
> >> opt_disc. Directory
> >> "c:/Users/jeff/code/code/scratch/erlang/Mnesia.emacs@lenovo" is NOT
> used.
> >> use fallback at restart = false
> >> running db nodes = [emacs@lenovo]
> >> stopped db nodes = []
> >> master node tables = []
> >> remote = [backgammon_games,game_record]
> >> ram_copies = [schema]
> >> disc_copies = []
> >> disc_only_copies = []
> >> [] = [backgammon_games,game_record]
> >> [{emacs@lenovo,ram_copies}] = [schema]
> >> 4 transactions committed, 3 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
> >> (emacs@lenovo)21> mnesia:delete_table(backgammon_games).
> >> {aborted,{no_exists,backgammon_games}}
> >> (emacs@lenovo)22> mnesia:delete_table(game_record).
> >> {aborted,{no_exists,game_record}}
> >> (emacs@lenovo)23> backgammon:init().
> >> {aborted,{already_exists,game_record}}
> >> (emacs@lenovo)24>
> >>
> >>
> >>> -----Original Message-----
> >>> From: Ulf Wiger [mailto:ulf.wiger@erlang-solutions.com]
> >>> Sent: Sunday, October 24, 2010 3:02 PM
> >>> To: Jeffrey Rennie
> >>> Cc: erlang-questions@erlang.org
> >>> Subject: Re: [erlang-questions] Ridiculuous newbie mnesia question.
> >>>
> >>>
> >>> Hi Jeffrey,
> >>>
> >>> The problem is that you have specified that the backgammon_games
> >>> table should have copies on a@lenovo and b@lenovo, but your
> >>> Erlang shell has the node name nonode@nohost (i.e. Erlang was
> >>> started without distribution).
> >>>
> >>> One might argue whether it wouldn't have been better if mnesia had
> >>> refused to create the table in the first place. As it is now, it
> >>> believes
> >>> it exists, because there is an entry in the schema, but it refuses
> to
> >>> delete it because it has no active replicas. But since that's not
> what
> >>> it
> >>> complains about, I can understand your confusion.
> >>>
> >>> BR,
> >>> Ulf W
> >>>
> >>>
> >>> On 24 Oct 2010, at 23:37, Jeffrey Rennie wrote:
> >>>
> >>>> I seem to be stuck in a state where I can't create a table because
> it
> >>>> exists, but I can't delete the table because it doesn't exist!
> >>>>
> >>>> I searched the mnesia documentation, and I couldn't find a
> definition
> >>>> of the "Tab" arg passed to many mnesia functions.
> >>>>
> >>>> Here's what I tried:
> >>>>
> >>>> Eshell V5.7.5 (abort with ^G)
> >>>> 2> c(backgammon).
> >>>> {ok,backgammon}
> >>>> 5> c(backgammon).
> >>>> {ok,backgammon}
> >>>> 7> mnesia:start().
> >>>> ok
> >>>> 8> backgammon:init().
> >>>> {atomic,ok}
> >>>> 11> c(backgammon).
> >>>> {ok,backgammon}
> >>>> 12> backgammon:dumpfields().
> >>>> [player_turn,dice,board]
> >>>> 13> c(backgammon).
> >>>> {ok,backgammon}
> >>>> 14> backgammon:init().
> >>>> {aborted,{already_exists,backgammon_games}}
> >>>> 15> mnesia:info().
> >>>> ---> Processes holding locks<---
> >>>> ---> Processes waiting for locks<---
> >>>> ---> Participant transactions<---
> >>>> ---> Coordinator transactions<---
> >>>> ---> Uncertain transactions<---
> >>>> ---> Active tables<---
> >>>> schema : with 2 records occupying 546 words of
> >>> mem
> >>>> ===> System info in version "4.4.13", debug level = none<===
> >>>> opt_disc. Directory
> >>>> "c:/Users/jeff/code/code/scratch/erlang/Mnesia.nonode@nohost" is
> NOT
> >>>> used.
> >>>> use fallback at restart = false
> >>>> running db nodes = [nonode@nohost]
> >>>> stopped db nodes = []
> >>>> master node tables = []
> >>>> remote = [backgammon_games]
> >>>> ram_copies = [schema]
> >>>> disc_copies = []
> >>>> disc_only_copies = []
> >>>> [] = [backgammon_games]
> >>>> [{nonode@nohost,ram_copies}] = [schema]
> >>>> 3 transactions committed, 1 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
> >>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> >>>> %% BEGIN CONFUSING BIT
> >>>> 17> mnesia:delete_table(backgammon_games).
> >>>> {aborted,{no_exists,backgammon_games}}
> >>>> 18> backgammon:init().
> >>>> {aborted,{already_exists,backgammon_games}}
> >>>> 19>
> >>>> %% END CONFUSING BIT
> >>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> >>>>
> >>>>
> >>>> Here's my backgammon.erl:
> >>>> -module(backgammon).
> >>>>
> >>>> -compile(export_all).
> >>>>
> >>>> -include("backgammon.hrl").
> >>>>
> >>>> create_tables(MnesiaNodes) ->
> >>>> mnesia:create_table(backgammon_games,
> >>>> [{attributes, record_info(fields, game_record)},
> >>>> {ram_copies, MnesiaNodes}]).
> >>>>
> >>>> init() ->
> >>>> create_tables([a@lenovo, b@lenovo]).
> >>>>
> >>>> dumpfields() ->
> >>>> record_info(fields, game_state).
> >>>>
> >>>> ________________________________________________________________
> >>>> erlang-questions (at) erlang.org mailing list.
> >>>> See http://www.erlang.org/faq.html
> >>>> To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
> >>>>
> >>> Ulf Wiger, CTO, Erlang Solutions, Ltd.
> >>> http://erlang-solutions.com
> >>>
> >>
> >>
> > Ulf Wiger, CTO, Erlang Solutions, Ltd.
> > http://erlang-solutions.com
> >
> >
> >
> >
> > ________________________________________________________________
> > erlang-questions (at) erlang.org mailing list.
> > See http://www.erlang.org/faq.html
> > To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
> >
________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|