[erlang-questions] RE: Mnesia Fragmentation - Adding a new fragment
Ulf Wiger
ulf.wiger@REDACTED
Sat Feb 12 03:18:23 CET 2011
Hi Matthew,
Mnesia actually does all the rehashing within the schema transaction that adds the fragment, so the table will be locked. Queries within transactions will run either before or after the rehash. Dirty queries may return unexpected results.
And, yes, mnesia will put the disc_copies on different nodes. It is not in fact possible to have two replicas of a table on the same node. Mnesia will abort if there are not enough nodes in the node pool to create the requested number of replicas.
BR,
Ulf W
On 11 Feb 2011, at 18:58, Evans, Matthew wrote:
> I'll reformat the question a bit better :)
>
>
> ----Original Message-----
> Hi,
>
> When I add a new node with a new fragment to an existing fragmented table the documentation says:
>
> ============================
> {add_frag, NodesOrDist}
>
> Adds one new fragment to a fragmented table. All records in one of the old fragments will be rehashed and about half of them will be moved to the new (last) fragment. All other fragmented tables, which refers to this table in their foreign key, will automatically get a new fragment, and their records will also be dynamically rehashed in the same manner as for the main table.
> ============================
>
> The question is that what happens to db queries during this period? If they use the new hash on the key to find the fragment then during the rehashing period lookups will fail (likewise if they use the old hash).
>
> The other question relates to backups of fragments (the n_disc_copies option). Can we guarantee that this backup fragment will be on a different node (if many nodes are available) to its mate?
>
> Thanks
>
> Matt
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
Ulf Wiger, CTO, Erlang Solutions, Ltd.
http://erlang-solutions.com
More information about the erlang-questions
mailing list