Lesson: javadocs lie Do the two different values really need to be different? And because of backwards compatibility we're stuck with this.
On Thu, Jun 21, 2018 at 1:49 PM, Anthony Baker <aba...@pivotal.io> wrote: > From a brief review of the source code, I believe that: > > DiskInitFile.OPLOG_MAGIC_SEQ_ID is used for *.if files > Oplog.OPLOG_MAGIC_SEQ_ID is used for all other oplog file types > > HTH, > Anthony > > > > > > On Jun 21, 2018, at 1:36 PM, Kirk Lund <kl...@apache.org> wrote: > > > > Please help me understand OPLOG_MAGIC_SEQ_ID in the oplog code... > > > > There is a constant called OPLOG_MAGIC_SEQ_ID which is a byte > representing > > the beginning of every oplog file. Makes sense so far. > > > > There are two different constants called OPLOG_MAGIC_SEQ_ID each with a > > different value. One is in Oplog.java and the other is in > DiskInitFile.java > > (IF). The javadocs of each seems to imply that every oplog type has its > own > > different magic number. But the javadocs also list CRF, DRF, KRF, IF (and > > IRF but only in Oplog.java) as the Oplog types. If that's the explanation > > for why we have two different values, then should we have a different > > constant for each Oplog file type? > > > > I started refactoring all of these byte constants into an Enum so that I > > can use Enum names in trace log statements instead of cryptic byte codes > > but then found some of these constants are defined in more than one place > > with different values. > > > > Oplog.java: > > > > /** > > * Persist oplog file magic number. Written once at the beginning of > > every oplog file; CRF, DRF, > > * KRF, IF and IRF. Followed by 6 byte magic number. Each oplog type has > > a different magic number > > * Followed by EndOfRecord Fix for bug 43824 > > * > > * @since GemFire 8.0 > > */ > > static final byte OPLOG_MAGIC_SEQ_ID = 92; > > > > DiskInitFile.java: > > > > /** > > * Persist oplog file magic number. Written once at the beginning of > > every oplog file; CRF, DRF, > > * KRF, and IF. Followed by 6 byte magic number. Each oplog type has a > > different magic number > > * Followed by EndOfRecord Fix for bug 43824 > > * > > * @since GemFire 8.0 > > */ > > public static final byte OPLOG_MAGIC_SEQ_ID = 89; > >