mnesia_frag_hash

MODULE

MODULE SUMMARY

DESCRIPTION

Which module that is selected to implement the mnesia_frag_hash
behaviour for a particular fragmented table is specified together
with the other frag_properties. The hash_module defines
the module name. The hash_state defines the initial hash state.

It implements dynamic hashing which is a kind of hashing
that grows nicely when new fragments are added. It is well
suited for scalable hash tables

In order to scale well, it is a good idea ensure that the
records are evenly distributed over all fragments including
the new one.

The NewState will be stored as hash_state among the
other frag_properties.

As a part of the add_frag procedure, Mnesia will iterate
over all fragments corresponding to the IterFrags numbers
and invoke key_to_frag_number(NewState,RecordKey) for
each record. If the new fragment differs from the old
fragment, the record will be moved to the new fragment.

As the add_frag procedure is a part of a schema
transaction Mnesia will acquire a write locks on the
affected tables. That is both the fragments corresponding
to IterFrags and those corresponding to
AdditionalLockFrags.

The NewState will be stored as hash_state among the
other frag_properties.

As a part of the del_frag procedure, Mnesia will iterate
over all fragments corresponding to the IterFrags numbers
and invoke key_to_frag_number(NewState,RecordKey) for
each record. If the new fragment differs from the old
fragment, the record will be moved to the new fragment.

Note that all records in the last fragment must be moved to
another fragment as the entire fragment will be deleted.

As the del_frag procedure is a part of a schema
transaction Mnesia will acquire a write locks on the
affected tables. That is both the fragments corresponding
to IterFrags and those corresponding to
AdditionalLockFrags.