Tree repair
One should understand the difference between database backup and tree repair. Database backup is intended to prevent database accidents such as damage of the tables that make Smereka completely unusable. While making database backup table all archived "as is" with all possible logical errors.
Tree repair is intended to finding and fixing logical errors. This requires that the database was workable. To make the repair one should register in the system as global administrator and in the personal office click the link to "repair the tree".
Then one should select what types of inspections must be completed and set the mode – "Diagnosis" or "Repair". When prompted, "Diagnostics" will only count the number of injuries, and the command "Repair" not only detects but also corrects the detected errors.
Lost nodes search
The node is assumed to be lost if it's parent attribute does not coincide with the values id field for some record in the nodes table. Such a node and all its crown will not be shown correctly by Smereka. Repair consist in moving this node to a position of "Recycle bin" child node. There one can review and delete it or move in the desired position.
Cyclic references search
Cycle links (or recursive reference) is formed when some node have parent attribute that point to the child node. In the simplest case, the "AAA" node is an ancestor of the "BBB" node and "BBB" node is an ancestor of the "AAA" node. Cyclic reference leads Smereka to fail. Repair consist in breaking the cycle at arbitrary point and moving the root node to "Recycle bin".
Restoration of the sort order
Repair consist in re-assigning the seqpos attribute values. This operation is hierarchical and can be run for the whole trees or for the crown of some node.
Checking the symbolic names uniqueness
If the two sibling nodes have the same symbolic names, only one of them will be available via symbolic addressing (with numeric addressing both available). It is not possible to determine in advance which particular node will be chosen. Repair consist in assigning to a duplicate names numerical suffixes 0..9, 10..99, etc. If a symbolic name have the maximum length numeric suffixes replace the last characters of the name. This operation is hierarchical and can be run for the whole trees or for the crown of some node.
Search for lost attributes
The attribute is assumed to be lost if its nodeid field is not equal to the value of id field for some nodes table record. This attribute will never be used. Quick repair consist in removing all such records. Conservative repair consist in the joining of these attributes to the "Recycle bin". There one can review and delete it or use it in other way.
Check the links integrity
The links integrity occurs when all links attributes have the appropriate records in the nodes table. Repair consist in assigning all broken links the nil value.
Other errors
Recycle bin: subdomain must have only one Recycle bin. Other "Recycle bins" assumed to be errors. During the repair all found "Recycle bins" combined into one. The extra nodes are removed.