HBASE-7570 rename user metadata dictionary in shell from CONFIG

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1433730 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2013-01-15 23:10:05 +00:00
parent 289c12dea3
commit 5f60754608
7 changed files with 14 additions and 19 deletions

View File

@ -446,7 +446,7 @@ public final class HConstants {
public static final String NAME = "NAME";
public static final String VERSIONS = "VERSIONS";
public static final String IN_MEMORY = "IN_MEMORY";
public static final String CONFIG = "CONFIG";
public static final String METADATA = "METADATA";
/**
* This is a retry backoff multiplier table similar to the BSD TCP syn

View File

@ -931,7 +931,7 @@ public class HColumnDescriptor implements WritableComparable<HColumnDescriptor>
// print all non-reserved, advanced config keys as a separate subset
if (hasConfigKeys) {
s.append(", ");
s.append(HConstants.CONFIG).append(" => ");
s.append(HConstants.METADATA).append(" => ");
s.append('{');
boolean printComma = false;
for (ImmutableBytesWritable k : values.keySet()) {

View File

@ -801,7 +801,7 @@ public class HTableDescriptor implements WritableComparable<HTableDescriptor> {
// print all non-reserved, advanced config keys as a separate subset
if (printCommaForAttr) s.append(", ");
printCommaForAttr = true;
s.append(HConstants.CONFIG).append(" => ");
s.append(HConstants.METADATA).append(" => ");
s.append("{");
boolean printCommaForCfg = false;
for (ImmutableBytesWritable k : configKeys) {

View File

@ -39,7 +39,7 @@ module HBaseConstants
NAME = org.apache.hadoop.hbase.HConstants::NAME
VERSIONS = org.apache.hadoop.hbase.HConstants::VERSIONS
IN_MEMORY = org.apache.hadoop.hbase.HConstants::IN_MEMORY
CONFIG = org.apache.hadoop.hbase.HConstants::CONFIG
METADATA = org.apache.hadoop.hbase.HConstants::METADATA
STOPROW = "STOPROW"
STARTROW = "STARTROW"
ENDROW = STOPROW

View File

@ -259,9 +259,7 @@ module Hbase
htd.setReadOnly(JBoolean.valueOf(arg.delete(READONLY))) if arg[READONLY]
htd.setMemStoreFlushSize(JLong.valueOf(arg.delete(MEMSTORE_FLUSHSIZE))) if arg[MEMSTORE_FLUSHSIZE]
htd.setDeferredLogFlush(JBoolean.valueOf(arg.delete(DEFERRED_LOG_FLUSH))) if arg[DEFERRED_LOG_FLUSH]
if arg[CONFIG]
apply_config(htd, arg.delete(CONFIG))
end
set_user_metadata(htd, arg.delete(METADATA)) if arg[METADATA]
arg.each_key do |ignored_key|
puts("An argument ignored (unknown or overridden): %s" % [ ignored_key ])
@ -448,7 +446,7 @@ module Hbase
# 3) Some args for the table, optionally with METHOD => table_att (deprecated)
raise(ArgumentError, "NAME argument in an unexpected place") if name
htd.setOwnerString(arg.delete(OWNER)) if arg[OWNER]
apply_config(htd, arg.delete(CONFIG)) if arg[CONFIG]
set_user_metadata(htd, arg.delete(METADATA)) if arg[METADATA]
htd.setMaxFileSize(JLong.valueOf(arg.delete(MAX_FILESIZE))) if arg[MAX_FILESIZE]
htd.setReadOnly(JBoolean.valueOf(arg.delete(READONLY))) if arg[READONLY]
htd.setMemStoreFlushSize(JLong.valueOf(arg.delete(MEMSTORE_FLUSHSIZE))) if arg[MEMSTORE_FLUSHSIZE]
@ -614,10 +612,8 @@ module Hbase
end
end
if config = arg.delete(CONFIG)
apply_config(family, config)
end
set_user_metadata(family, arg.delete(METADATA)) if arg[METADATA]
arg.each_key do |unknown_key|
puts("Unknown argument ignored for column family %s: %s" % [name, unknown_key])
end
@ -647,11 +643,10 @@ module Hbase
put.add(org.apache.hadoop.hbase.HConstants::CATALOG_FAMILY, org.apache.hadoop.hbase.HConstants::REGIONINFO_QUALIFIER, org.apache.hadoop.hbase.util.Writables.getBytes(hri))
meta.put(put)
end
# Apply config to table/column descriptor
def apply_config(descriptor, config)
raise(ArgumentError, "#{CONFIG} must be a Hash type") unless config.kind_of?(Hash)
for k,v in config
# Apply user metadata to table/column descriptor
def set_user_metadata(descriptor, metadata)
raise(ArgumentError, "#{METADATA} must be a Hash type") unless metadata.kind_of?(Hash)
for k,v in metadata
v = v.to_s unless v.nil?
descriptor.setValue(k, v)
end

View File

@ -72,7 +72,7 @@ There could be more than one alteration in one command:
hbase> alter 't1', { NAME => 'f1', VERSIONS => 3 },
{ MAX_FILESIZE => '134217728' }, { METHOD => 'delete', NAME => 'f2' },
OWNER => 'johndoe', CONFIG => { 'mykey' => 'myvalue' }
OWNER => 'johndoe', METADATA => { 'mykey' => 'myvalue' }
EOF
end

View File

@ -40,7 +40,7 @@ Examples:
hbase> create 't1', 'f1', SPLITS => ['10', '20', '30', '40']
hbase> create 't1', 'f1', SPLITS_FILE => 'splits.txt', OWNER => 'johndoe'
hbase> create 't1', {NAME => 'f1', VERSIONS => 5}, CONFIG => { 'mykey' => 'myvalue' }
hbase> create 't1', {NAME => 'f1', VERSIONS => 5}, METADATA => { 'mykey' => 'myvalue' }
hbase> # Optionally pre-split the table into NUMREGIONS, using
hbase> # SPLITALGO ("HexStringSplit", "UniformSplit" or classname)
hbase> create 't1', 'f1', {NUMREGIONS => 15, SPLITALGO => 'HexStringSplit'}