cheatsheets devlog projects

replication.md

How to Clear Replication on UniVerse 10.3.6

2022-11-04 2

This is specifically for older versions of UniVerse as replication has changed in UniVerse 11.

Replication in UniVerse sets 2 flags on a file and these flags are contained in the header. The first flag located at the header position, byte 552 or 0x228 marks the file as published or subscribed. The second flag is located at byte 556 which is the key to UV_UDRPUB.

These flags are set on both the DICT and the DATA sections of the files. This means you will need to clear both files of the replication bits to turn off replication.

To test if a file is set for replication, you can do a quick and dirty test by trying to resize the file. You cannot resize replicated files, and so if you want to resize a replicated file, you would save the flags, clear the flags and then do the resize. Then you would set the flags again after the resize was done.

For our case, we can get away with just clearing the bits. We are migrating to a new version of UniVerse and no longer need replication so we are going for the sledgehammer approach. We simply want to turn off replication.

Rocket gave us a routine, UDR, that checks the flags of a given file and if it is replicated, it will save the flags and clear the flags. You can also use the routine to restore flags. These flags are saved as multivalue records in a udrsave.txt file that is in /usr/uv.

We wrote a routine called FIND.REPLICATION based off the UDR program that will loop through a given list and first check the replication flags and then if they are set it will execute UDR CLEAR FILE.NAME. This way we can get a bit more information and track all the files we are clearing. We don’t particularly care about saving the flag information as the goal is to get rid of it completely. FIND.REPLICATION will need to be run twice, once for the data section and once for the dictionaries. The routine prompts for which type of file you want to clear.

FIND.REPLICATION - This program will take a list of files and check the replication flags and if they are set it will execute “UDR CLEAR FILE.NAME” or “UDR CLEAR DICT FILE.NAME”

UDR - This program was provided by Rocket and will clear a single data section or dict.