Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase, mail # dev - Minor versions for HFile and HFileBlock

Copy link to this message
Minor versions for HFile and HFileBlock
ramkrishna vasudevan 2013-06-20, 10:16
Minor versions are basically for the HFileBlock format.  So any change that
we try to do in the HFileBlock format we need to increase the minor version.

The FixedFileTrailer has the minor version 3 written in it.
static final int MAX_MINOR_VERSION = 3.
This forms the min version that is written to the FixedFileTrailer of the

Inside the HFileBlock constructor
if (minorVersion >= MINOR_VERSION_WITH_CHECKSUM) {
      this.checksumType = b.get();
      this.bytesPerChecksum = b.getInt();
      this.onDiskDataSizeWithHeader = b.getInt();
    } else {
      this.checksumType = ChecksumType.NULL.getCode();
      this.bytesPerChecksum = 0;
      this.onDiskDataSizeWithHeader = onDiskSizeWithoutHeader +

where static final int MINOR_VERSION_WITH_CHECKSUM = 1 and minorVersion  MAX_MINOR_VERSION.

So if i need to make some changes to the HFileBlock format adding some
additional bytes to the header, i need to increase the minorversion number.
But since the minor version is already 3 i need to introduce another
constant which is greater than 3
and then add the new bytes in the header.
Something like make
static final int MAX_MINOR_VERSION = 4.
Introduce a NEW_CONSTANT =4 in the HFileBlock
if(minorVersion  >= NEW_CONSTANT)
//Add new bytes.
where minorVersion = MAX_MINOR_VERSION .
So my concern is one Constant MINOR_VERSION_WITH_CHECKSUM = 1 and the new
one that i introduce now goes to 4. What i was thinking is increasing by 1
everywhere in the code should help but seeing the code that is not the
So is this approach valid or am i missing something?  Testing with this
approach am able to make an existing version of Trunk to work with new
changes that i had made.