Database / Mnesia intermediate to advanced Interview questions
How do you move a table copy from one node to another while the system stays live?
mnesia:move_table_copy(Table, FromNode, ToNode) relocates a table's replica from one node to
another without taking the table offline — useful for rebalancing load, retiring a node, or migrating
data ahead of decommissioning old hardware.
mnesia:move_table_copy(session, 'old_node@host', 'new_node@host').
Internally, this is effectively an add_table_copy/3 onto the new node (copying the current
data across) followed by a del_table_copy/2 on the old one, performed as a coordinated operation
so the table remains continuously available for reads and writes throughout — readers and writers don't
need to pause or retry while the move is in progress, though the operation itself takes time proportional to
how much data has to be copied.
More Related questions...