MiniM Knowledge Base | Oct 9, 2010
About block export of globals
MiniM Database Server implements block export and import of globals. This article describes block export usage in practical tasks.
To correctly understand core of block export and import of globals it is need to know base principles of database organization. Phisical data storage of globals is based on the Bayer's tree, and consists of node and leaf blocks. Node block consists of keys and references to other child blocks and this child blocks can be node blocks too or leaf blocks. Leaf blocks consists of keys and assosiated data for this keys.
Each database contains other secondary blocks - globals catalog, allocation and backup marks blocks and chains of blocks to store big strings.
Chains of blocks for big strings allow to store in one string up to 32 kilobytes of data while one block can contain only up to 8 kilobytes. If value of global with selected keys is a big string, block contain only reference to appropriate chain of big string blocks.
Moreover, all node blocks and leaf blocks contains special data with global name, what part this block are.
For block data export MiniM Database Server uses only leaf blocks and chains of big string blocks. This information is enough fo full data restore at import data. At the next data import from block data export MiniM Database Server reads name of global and key's values from leaf block, stored data or chain of big string blocks and inserts this data into database.
Unlike of traditional data export block export stores blocks entirely, without dividing by any parts by keys or values, but at import from block format server parses keys and data separately. So, import from block export works so slowly than block export.
Unlike of traditional data export formats, where theoretically can be exported only selected keys and values, block export does not divide blocks to keys and values and store all keys and data are available on the leaf block. To search leaf blocks of global name MiniM Database Server starts from the root global block, which is pointed from global catalog. Next MiniM walks by bloks reqursively until all leaf blocks bee exported. So, block export can export only all global's keys and data and global can be exported only entirely.
While process executes block data export, all block of this global are available to other processes to read only. So, block data export executes as a snapshot.
Unlike of block export import of data from this format executes not at phisical level, but at logical level. At import MiniM Database Server parses leaf block structure and select keys and values. Next each found key with value inserts into current database. So, all key are available in the current database for global imported are stored unchanged or replaces as with traditional data import.
While block export is used, blocks are stored in the file in the same state as this blocks are present in the database. For string keys MiniM uses special encoding rule to use national symbol encoding file (collation file) and phisical symbol representation in the common case can be other than logical representation. To read keys values from block MiniM Database Server apply reverse decoding from phisical to logical representation and also use collation file.
The same decoding executes at import from file of block data export. So operator must understand that collation file must be the same as used at block export. Thus, block data export have one more important distinctions from traditional formats - traditional formats uses logical keys data representation but block data export uses phisical keys data representation. If it is required to transfer data with different collation this requires to use only traditional global export formats. If several MiniM servers work with the same collation defined, operator can use as well block data export format.
MiniM Database Server uses own block export format and this format differs from block export formats of other MUMPS implementations and can not be used to transfer data to other MUMPS servers then MiniM Database Servers.Eugene Karataev