From 997ca2a89a1258ee1891b443830dec37b2bd8dd3 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Wed, 22 Apr 2009 19:14:15 +0000 Subject: [PATCH] HBASE-1235 Add table enabled status to shell and UI git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@767624 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 ++ bin/Formatter.rb | 10 +++++----- bin/HBase.rb | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 2215fe4f94c..9e087bf868a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -147,6 +147,8 @@ Release 0.20.0 - Unreleased (Nitay Joffe via Andrew Purtell) HBASE-1309 HFile rejects key in Memcache with empty value HBASE-1331 Lower the default scanner caching value + HBASE-1235 Add table enabled status to shell and UI + (Lars George via Stack) Release 0.19.0 - 01/21/2009 INCOMPATIBLE CHANGES diff --git a/bin/Formatter.rb b/bin/Formatter.rb index ad5ecd4dd0f..a793290bb3a 100644 --- a/bin/Formatter.rb +++ b/bin/Formatter.rb @@ -13,14 +13,14 @@ module Formatter attr_reader :rowCount - def header(args = []) - row(args, false) if args.length > 0 + def header(args = [], widths = []) + row(args, false, widths) if args.length > 0 @rowCount = 0 end # Output a row. # Inset is whether or not to offset row by a space. - def row(args = [], inset = true) + def row(args = [], inset = true, widths = []) if not args or args.length == 0 # Print out nothing return @@ -38,8 +38,8 @@ module Formatter puts end elsif args.length == 2 - col1width = @maxWidth / 4 - col2width = @maxWidth - col1width - 2 + col1width = (not widths or widths.length == 0) ? @maxWidth / 4 : @maxWidth * widths[0] / 100 + col2width = (not widths or widths.length < 2) ? @maxWidth - col1width - 2 : @maxWidth * widths[1] / 100 - 2 splits1 = split(col1width, dump(args[0])) splits2 = split(col2width, dump(args[1])) biggest = (splits2.length > splits1.length)? splits2.length: splits1.length diff --git a/bin/HBase.rb b/bin/HBase.rb index c455e1d641c..c78b072eea6 100644 --- a/bin/HBase.rb +++ b/bin/HBase.rb @@ -57,13 +57,13 @@ module HBase def describe(tableName) now = Time.now - @formatter.header(["FAMILIES", "ENABLED"]) + @formatter.header(["DESCRIPTION", "ENABLED"], [64]) found = false tables = @admin.listTables().to_a tables.push(HTableDescriptor::META_TABLEDESC, HTableDescriptor::ROOT_TABLEDESC) for t in tables if t.getNameAsString() == tableName - @formatter.row([t.to_s, "%s" % [@admin.isTableEnabled(tableName)]]) + @formatter.row([t.to_s, "%s" % [@admin.isTableEnabled(tableName)]], true, [64]) found = true end end