Sometimes a situation will arise in which the developer would like to change a log record format. For example DERBY-606 describes such a situation. Changing a log record format presents some special upgrade considerations, which the developer needs to be careful to consider.
Directly changing the format of a log record is not really allowed. What you need to do is support the old log record and add a new log record which has the changed format.
- For soft upgrade you need to always read/write the old log record.
- For hard upgrade you need to write new format and be able to read both old and new log record.
Once you have hard upgraded you don't have to worry about older versions of the software encountering this unknown new log record.
Also, note that if you choose a fix which in any way alters what is written, you basically have to add a new log record in case of hard upgrade (and bug will continue to exist in soft upgrade).
== Implementing the new Log Record ==
You can save copying code by having the new log record extend the existing one and just update the getTypeFormatId(), readExternal(), writeExternal() routines. This way soft upgrade can still read/write the old record. Need some code to write the new vs. the old one in case of hard upgrade.