HBASE-1056 [migration] enable blockcaching on .META. table
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@727301 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
78f6a6c434
commit
46eca98e13
|
@ -176,6 +176,7 @@ Release 0.19.0 - Unreleased
|
||||||
HBASE-1055 Better vm stats on startup
|
HBASE-1055 Better vm stats on startup
|
||||||
HBASE-1065 Minor logging improvements in the master
|
HBASE-1065 Minor logging improvements in the master
|
||||||
HBASE-1053 bring recent rpc changes down from hadoop
|
HBASE-1053 bring recent rpc changes down from hadoop
|
||||||
|
HBASE-1056 [migration] enable blockcaching on .META. table
|
||||||
|
|
||||||
NEW FEATURES
|
NEW FEATURES
|
||||||
HBASE-875 Use MurmurHash instead of JenkinsHash [in bloomfilters]
|
HBASE-875 Use MurmurHash instead of JenkinsHash [in bloomfilters]
|
||||||
|
|
|
@ -43,11 +43,12 @@ public interface HConstants {
|
||||||
static final String VERSION_FILE_NAME = "hbase.version";
|
static final String VERSION_FILE_NAME = "hbase.version";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current version of file system
|
* Current version of file system.
|
||||||
* Version 4 supports only one kind of bloom filter.
|
* Version 4 supports only one kind of bloom filter.
|
||||||
* Version 5 changes versions in catalog table regions.
|
* Version 5 changes versions in catalog table regions.
|
||||||
|
* Version 6 enables blockcaching on catalog tables.
|
||||||
*/
|
*/
|
||||||
public static final String FILE_SYSTEM_VERSION = "5";
|
public static final String FILE_SYSTEM_VERSION = "6";
|
||||||
|
|
||||||
// Configuration parameters
|
// Configuration parameters
|
||||||
|
|
||||||
|
|
|
@ -654,7 +654,7 @@ public class HTableDescriptor implements WritableComparable<HTableDescriptor> {
|
||||||
HConstants.ROOT_TABLE_NAME,
|
HConstants.ROOT_TABLE_NAME,
|
||||||
new HColumnDescriptor[] { new HColumnDescriptor(HConstants.COLUMN_FAMILY,
|
new HColumnDescriptor[] { new HColumnDescriptor(HConstants.COLUMN_FAMILY,
|
||||||
10, // Ten is arbitrary number. Keep versions to help debuggging.
|
10, // Ten is arbitrary number. Keep versions to help debuggging.
|
||||||
HColumnDescriptor.CompressionType.NONE, false, false,
|
HColumnDescriptor.CompressionType.NONE, false, true,
|
||||||
Integer.MAX_VALUE, HConstants.FOREVER, false) });
|
Integer.MAX_VALUE, HConstants.FOREVER, false) });
|
||||||
|
|
||||||
/** Table descriptor for <code>.META.</code> catalog table */
|
/** Table descriptor for <code>.META.</code> catalog table */
|
||||||
|
@ -662,7 +662,7 @@ public class HTableDescriptor implements WritableComparable<HTableDescriptor> {
|
||||||
HConstants.META_TABLE_NAME, new HColumnDescriptor[] {
|
HConstants.META_TABLE_NAME, new HColumnDescriptor[] {
|
||||||
new HColumnDescriptor(HConstants.COLUMN_FAMILY,
|
new HColumnDescriptor(HConstants.COLUMN_FAMILY,
|
||||||
10, // Ten is arbitrary number. Keep versions to help debuggging.
|
10, // Ten is arbitrary number. Keep versions to help debuggging.
|
||||||
HColumnDescriptor.CompressionType.NONE, false, false,
|
HColumnDescriptor.CompressionType.NONE, false, true,
|
||||||
Integer.MAX_VALUE, HConstants.FOREVER, false),
|
Integer.MAX_VALUE, HConstants.FOREVER, false),
|
||||||
new HColumnDescriptor(HConstants.COLUMN_FAMILY_HISTORIAN,
|
new HColumnDescriptor(HConstants.COLUMN_FAMILY_HISTORIAN,
|
||||||
HConstants.ALL_VERSIONS, HColumnDescriptor.CompressionType.NONE,
|
HConstants.ALL_VERSIONS, HColumnDescriptor.CompressionType.NONE,
|
||||||
|
|
|
@ -1006,7 +1006,7 @@ public class HStore implements HConstants {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create readers for the passed in list of HStoreFiles and add them to
|
* Create readers for the passed in list of HStoreFiles and add them to
|
||||||
* <code>readers</code> list.
|
* <code>readers</code> list. Used compacting.
|
||||||
* @param readers Add Readers here.
|
* @param readers Add Readers here.
|
||||||
* @param files List of HSFs to make Readers for.
|
* @param files List of HSFs to make Readers for.
|
||||||
* @return Count of rows for bloom filter sizing. Returns -1 if no bloom
|
* @return Count of rows for bloom filter sizing. Returns -1 if no bloom
|
||||||
|
|
|
@ -191,7 +191,7 @@ public class Migrate extends Configured implements Tool {
|
||||||
throw new IOException(msg);
|
throw new IOException(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
migrateTo5();
|
migrate4To6();
|
||||||
|
|
||||||
if (!readOnly) {
|
if (!readOnly) {
|
||||||
// Set file system version
|
// Set file system version
|
||||||
|
@ -208,16 +208,19 @@ public class Migrate extends Configured implements Tool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the fileystem version from 4 to 5.
|
// Move the fileystem version from 4 to 6.
|
||||||
// In here we rewrite the catalog table regions so they keep 10 versions
|
// In here we rewrite the catalog table regions so they keep 10 versions
|
||||||
// instead of 1.
|
// instead of 1.
|
||||||
private void migrateTo5() throws IOException {
|
private void migrate4To6() throws IOException {
|
||||||
if (this.readOnly && this.migrationNeeded) {
|
if (this.readOnly && this.migrationNeeded) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final MetaUtils utils = new MetaUtils(this.conf);
|
final MetaUtils utils = new MetaUtils(this.conf);
|
||||||
try {
|
try {
|
||||||
|
// These two operations are effectively useless. -ROOT- is hardcode,
|
||||||
|
// at least until hbase 0.20.0 when we store it out in ZK.
|
||||||
updateVersions(utils.getRootRegion().getRegionInfo());
|
updateVersions(utils.getRootRegion().getRegionInfo());
|
||||||
|
enableBlockCache(utils.getRootRegion().getRegionInfo());
|
||||||
// Scan the root region
|
// Scan the root region
|
||||||
utils.scanRootRegion(new MetaUtils.ScannerListener() {
|
utils.scanRootRegion(new MetaUtils.ScannerListener() {
|
||||||
public boolean processRow(HRegionInfo info)
|
public boolean processRow(HRegionInfo info)
|
||||||
|
@ -227,6 +230,7 @@ public class Migrate extends Configured implements Tool {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
updateVersions(utils.getRootRegion(), info);
|
updateVersions(utils.getRootRegion(), info);
|
||||||
|
enableBlockCache(utils.getRootRegion(), info);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -236,8 +240,41 @@ public class Migrate extends Configured implements Tool {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Move from old pre-v5 hregioninfo to current HRegionInfo
|
* Enable blockcaching on catalog tables.
|
||||||
* Persist back into <code>r</code>
|
* @param mr
|
||||||
|
* @param oldHri
|
||||||
|
*/
|
||||||
|
void enableBlockCache(HRegion mr, HRegionInfo oldHri)
|
||||||
|
throws IOException {
|
||||||
|
if (!enableBlockCache(oldHri)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
BatchUpdate b = new BatchUpdate(oldHri.getRegionName());
|
||||||
|
b.put(HConstants.COL_REGIONINFO, Writables.getBytes(oldHri));
|
||||||
|
mr.batchUpdate(b);
|
||||||
|
LOG.info("Enabled blockcache on " + oldHri.getRegionNameAsString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param hri Update versions.
|
||||||
|
* @param true if we changed value
|
||||||
|
*/
|
||||||
|
private boolean enableBlockCache(final HRegionInfo hri) {
|
||||||
|
boolean result = false;
|
||||||
|
HColumnDescriptor hcd =
|
||||||
|
hri.getTableDesc().getFamily(HConstants.COLUMN_FAMILY);
|
||||||
|
if (hcd == null) {
|
||||||
|
LOG.info("No info family in: " + hri.getRegionNameAsString());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
// Set blockcache enabled.
|
||||||
|
hcd.setBlockCacheEnabled(true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Update versions kept in historian.
|
||||||
* @param mr
|
* @param mr
|
||||||
* @param oldHri
|
* @param oldHri
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue