Automatically clean up orphaned relinkctl files
Final Release Note
Orphaned relinkctl files associated with an object directory (see Auto-Relink Setup) are automatically cleaned up on a subsequent reuse of that object directory. Previously this required a MUPIP RUNDOWN RELINKCTL command, or explicit deletion of the orphaned files. An orphaned relinkctl file exists if the last YottaDB process using it does not shutdown cleanly, typically the result of a SIGKILL, but also possible with SIGINT (sent by Ctrl-C) or SIGTERM (sent by MUPIP STOP). [#695 (closed)]
Description
Below is an example that illustrates how to create an orphaned relinkctl file. And uses mupip rundown -relinkctl
to clean that up. But what would be even better is for the yottadb
process to not issue the REQRLNKCTLRNDWN
file error and do the clean up (that mupip rundown -relinkctl
does) itself thereby proceeding to create a new relinkctl file and and avoid the mupip rundown -relinkctl
step.
$ $ydb_dist/yottadb -direct
YDB>set $zroutines=".*"
YDB>zshow "a"
Object Directory : /tmp
Relinkctl filename : /tmp/ydb-relinkctl-5f6e852182d6280af261a154f8015810
# of routines / max : 0 / 50000
# of attached processes : 3
Relinkctl shared memory : shmid: 622612 shmlen: 0x46d000
YDB>zsystem "kill -9 "_$job
Killed
# Delete the shared memory segment id (shmid) displayed above
$ ipcrm -m 622612
$ $ydb_dist/yottadb -direct
YDB>set $zroutines=".*"
%YDB-E-REQRLNKCTLRNDWN, Error accessing relinkctl file /tmp/ydb-relinkctl-5f6e852182d6280af261a154f8015810 for $ZROUTINES directory /tmp. Must be rundown
%YDB-E-SYSCALL, Error received from system call shmat() failed for shmid=622612 shmsize=4640768 [0x46d000] -- called from module sr_unix/relinkctl.c at line 396
%SYSTEM-E-ENO22, Invalid argument
$ $ydb_dist/mupip rundown -relinkctl "."
%YDB-I-RLNKCTLRNDWNSUC, Relinkctl file for $ZROUTINES directory /tmp successfully rundown
$ $ydb_dist/yottadb -direct
YDB>set $zroutines=".*"
YDB>halt
$
Draft Release Note
Since the introduction of the autorelink feature in GT.M in v???, if autorelink was in use, an unclean shutdown of the database required either the deletion of the the relinkctl file or relinkctl file rundown. This turned out to be a major user inconvenience as it happened frequently in the broader community. This change detects if this condition happens and automatically clean up the orphaned relinkctl files.