Review Board 1.7.22

HIVE-3764: Support metastore version consistency check

Review Request #14169 - Created Sept. 17, 2013 and updated

Prasad Mujumdar
ashutoshc, brocknoland
This is a 0.12 specific patch. The trunk patch will include additional metastore scripts which I will attach separately to the ticket.

- Added a new table in the metastore schema to store the Hive version in the metastore.
- Metastore handler compare the version stored in the schema with its own version. If there's a mismatch, then it can either record the correct version or raise error. The behavior is configurable via a new Hive config. This config when set, also restrict dataNucleus to auto upgrade the schema.
- The new schema creation and upgrade scripts record the new version in the metastore version table.
- Added 0.12 upgrade scripts for all supported DBs to creates the new table version tables in 0.12 metastore schema

The current patch has the verification turned off by default. I would prefer to keep it enabled, though it require any add-hoc setup to explicitly disable it (or create the metastore schema by running scripts). The default can be changed or left as is as per the consensus. 
Added new tests for schema verification. Manually tested the upgrades using derby and MySQL.
Review request changed
Updated (Sept. 18, 2013, 5:45 a.m.)
Changes per review feedback.
- rename the comment field.
- fixed typos and updated variable name
- fixed the version comparison case
- build script update to set the hive dist path for testing (was missed in the original diff when the large patch was split into two.)