User Tools

Site Tools


troubleshooting:disaster

Disaster Recovery

Someday, no matter how careful you filtered your power supplies, no matter how carefully you cleaned the dust off your hard drives and measured their temperature, no matter what, you're going to lose your computer. The disk drive, the CPU the power supply, something is going to fail.

  • Are you running Time Machine? If not why on earth not? An external drive is cheap and it's an excellent layer of protection against data corruption. You could go all out and mirror your boot drive or setup a hot spare but a simple time machine backup is cheap and is so easy to setup you could be finished by the time you're done reading this.
  • XTension goes to a lot of effort to not corrupt your database no matter what is happening to your disk or system. Your scripts especially are vulnerable because ultimately the data comes from the system and XTension is not in control of getting and sending the data. The big binary blob of data I get from the system to save is opaque and I cannot validate it. But I can at least validate that it exists and I do. Then I create a temporary file and write the data to that. After verifying that the temporary file exists and contains the data that I want it to I perform an atomic file swap with the old data file. This should not ever fail, heh, and after returning from it I validate that the old file is now the new file and vice versa and only if all this looks good and no error was returned from the file system to I finally delete the old data. And yet STILL the system manages for some people in some extraordinary circumstance have reported that scripts have become corrupted. This is extraordinarily rare and always happens as a part of some other major systemic failure and it should also be entirely reversible if you know the built in mechanisms of repair available in XTension.
  • XTension makes a backup copy of your database every night at midnight. The database is updated on disk, a copy of the live database is made and zipped up and older saved databases are rolled over. At any given time the state and scripts of your database from the last 7 days are stored along side the currently active database. If something horrible happens and you catch it within a week you should be able to unzip the files and replace the currently active file entirely. If only a specific script has become corrupted you should be able to move just that from the unzipped file into the active database and not lose any changes in unit statuses that have happened. See the next item for more on the database structure.

NOTE: XTension versions prior to 9.3.12 (build 977) may not include the root folder in the zipped backups. At some point the OS command to zip up a file changed. When you unzip a database backup created by one of these versions you may find that it contains a folder called “Contents” and not the folder/package called “XTension Database.” All your data is still in there though, you just have to create that folder manually. Create a folder and name it “XTension Database” and move the unzipped Contents folder into it. Now you have a valid database that you can move into the proper position to replace a corrupted or otherwise not working database.

  • The database is not a single file, it's a bundle with all the data saved as regular files inside of it. You can view the structure by control (or left) clicking on the file in the Finder and selecting “show package contents” units and scripts are arranged in folders by their names (unless you've named them something which is not a valid file name in which case it will be automatically generated and you'll need to look into the folder and script data to figure it out)
  • If your scripts cannot be recovered in any of these ways then you may also be able to recover the text of them from within the program. Every time you save changes to a script XTension saves that text into an undo queue in the file. If the file is intact except for the system script data then the text will still be there. If you can open the edit window for the script, even if the text is not there, you should be able to select the revert toolbar item and get back the last text you compiled and save it fresh.
troubleshooting/disaster.txt · Last modified: 2023/02/13 14:52 by 127.0.0.1