HBASE-12389 Reduce the number of versions configured for the ACL table

This commit is contained in:
Andrew Purtell 2014-11-05 09:28:11 -08:00
parent 9255d6fdc7
commit e1b82fe91f
2 changed files with 17 additions and 20 deletions

View File

@ -56,7 +56,6 @@ import org.apache.hadoop.hbase.exceptions.DeserializationException;
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp; import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
import org.apache.hadoop.hbase.filter.QualifierFilter; import org.apache.hadoop.hbase.filter.QualifierFilter;
import org.apache.hadoop.hbase.filter.RegexStringComparator; import org.apache.hadoop.hbase.filter.RegexStringComparator;
import org.apache.hadoop.hbase.io.compress.Compression;
import org.apache.hadoop.hbase.master.MasterServices; import org.apache.hadoop.hbase.master.MasterServices;
import org.apache.hadoop.hbase.protobuf.ProtobufUtil; import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos; import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos;
@ -110,20 +109,6 @@ public class AccessControlLists {
public static final char NAMESPACE_PREFIX = '@'; public static final char NAMESPACE_PREFIX = '@';
/** Table descriptor for ACL internal table */
public static final HTableDescriptor ACL_TABLEDESC = new HTableDescriptor(ACL_TABLE_NAME);
static {
ACL_TABLEDESC.addFamily(
new HColumnDescriptor(ACL_LIST_FAMILY,
10, // Ten is arbitrary number. Keep versions to help debugging.
Compression.Algorithm.NONE.getName(), true, true, 8 * 1024,
HConstants.FOREVER, BloomType.NONE.toString(),
HConstants.REPLICATION_SCOPE_LOCAL).
// Set cache data blocks in L1 if more than one cache tier deployed; e.g. this will
// be the case if we are using CombinedBlockCache (Bucket Cache).
setCacheDataInL1(true));
}
/** /**
* Delimiter to separate user, column family, and qualifier in * Delimiter to separate user, column family, and qualifier in
* _acl_ table info: column keys */ * _acl_ table info: column keys */
@ -136,11 +121,23 @@ public class AccessControlLists {
private static Log LOG = LogFactory.getLog(AccessControlLists.class); private static Log LOG = LogFactory.getLog(AccessControlLists.class);
/** /**
* Check for existence of {@code _acl_} table and create it if it does not exist * Create the ACL table
* @param master reference to HMaster * @param master
* @throws IOException
*/ */
static void init(MasterServices master) throws IOException { static void createACLTable(MasterServices master) throws IOException {
master.createTable(ACL_TABLEDESC, null); master.createTable(new HTableDescriptor(ACL_TABLE_NAME)
.addFamily(new HColumnDescriptor(ACL_LIST_FAMILY)
.setMaxVersions(1)
.setInMemory(true)
.setBlockCacheEnabled(true)
.setBlocksize(8 * 1024)
.setBloomFilterType(BloomType.NONE)
.setScope(HConstants.REPLICATION_SCOPE_LOCAL)
// Set cache data blocks in L1 if more than one cache tier deployed; e.g. this will
// be the case if we are using CombinedBlockCache (Bucket Cache).
.setCacheDataInL1(true)),
null);
} }
/** /**

View File

@ -1070,7 +1070,7 @@ public class AccessController extends BaseMasterAndRegionObserver
if (!MetaTableAccessor.tableExists(ctx.getEnvironment().getMasterServices() if (!MetaTableAccessor.tableExists(ctx.getEnvironment().getMasterServices()
.getShortCircuitConnection(), AccessControlLists.ACL_TABLE_NAME)) { .getShortCircuitConnection(), AccessControlLists.ACL_TABLE_NAME)) {
// initialize the ACL storage table // initialize the ACL storage table
AccessControlLists.init(ctx.getEnvironment().getMasterServices()); AccessControlLists.createACLTable(ctx.getEnvironment().getMasterServices());
} else { } else {
aclTabAvailable = true; aclTabAvailable = true;
} }