hbasehbasetestingutility

In HBase, when max version parameter set, what does it do exactly?


I'm working on a mock HTable in memory. I compared my HTable with a mini-cluster's HTable. Mini-cluster is something used for HBase application test, I use it here to get some standard result. In mini-cluster, there's a

HBaseTestingUtility.createTable(byte[] tableName, byte[] family, int numVersions)

api. when the numVersions set,

HTable.get(Get)

will return at most numVersions versions of result, even if the maxVersion parameter in Get is set bigger than numVersions. And if the parameter isn't set, the default value is 1. But in some other test, I find that in fact, there's many versions saved when numVersions is 1. So I want to know what happen when the numVersions is set exactly.


Solution

  • 'numVersions' sets the amount of rows that remain, at maximum, after major compaction. In other words, more versions of a row may be saved, but those are scheduled for cleanup. Those rows are still there, but may not be read as that would create unreliable behavior.