You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by en...@apache.org on 2016/05/27 00:11:02 UTC
[1/3] hbase git commit: HBASE-10358 Shell changes for setting
consistency per request (yi liang)
Repository: hbase
Updated Branches:
refs/heads/branch-1 22aa50143 -> 70c3a7854
refs/heads/branch-1.3 b1e498e77 -> 25e21ee19
refs/heads/master fdaf3be84 -> b89d88a19
HBASE-10358 Shell changes for setting consistency per request (yi liang)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/b89d88a1
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/b89d88a1
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/b89d88a1
Branch: refs/heads/master
Commit: b89d88a19306f25e8aca57ea1b01b725ffe861e9
Parents: fdaf3be
Author: Enis Soztutar <en...@apache.org>
Authored: Thu May 26 14:20:01 2016 -0700
Committer: Enis Soztutar <en...@apache.org>
Committed: Thu May 26 17:01:03 2016 -0700
----------------------------------------------------------------------
hbase-shell/src/main/ruby/hbase/table.rb | 10 ++++++++--
hbase-shell/src/main/ruby/shell/commands/get.rb | 4 ++--
hbase-shell/src/main/ruby/shell/commands/scan.rb | 5 ++---
hbase-shell/src/main/ruby/shell/formatter.rb | 9 +++++++--
4 files changed, 19 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/b89d88a1/hbase-shell/src/main/ruby/hbase/table.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/hbase/table.rb b/hbase-shell/src/main/ruby/hbase/table.rb
index b5769ca..6cb5dcb 100644
--- a/hbase-shell/src/main/ruby/hbase/table.rb
+++ b/hbase-shell/src/main/ruby/hbase/table.rb
@@ -282,6 +282,7 @@ EOF
def _get_internal(row, *args)
get = org.apache.hadoop.hbase.client.Get.new(row.to_s.to_java_bytes)
maxlength = -1
+ count = 0
@converters.clear()
# Normalize args
@@ -370,6 +371,10 @@ EOF
result = @table.get(get)
return nil if result.isEmpty
+ # Get stale info from results
+ is_stale = result.isStale
+ count += 1
+
# Print out results. Result can be Cell or RowResult.
res = {}
result.listCells.each do |c|
@@ -389,7 +394,7 @@ EOF
end
# If block given, we've yielded all the results, otherwise just return them
- return ((block_given?) ? nil : res)
+ return ((block_given?) ? [count, is_stale]: res)
end
#----------------------------------------------------------------------------------------------
@@ -509,6 +514,7 @@ EOF
while iter.hasNext
row = iter.next
key = org.apache.hadoop.hbase.util.Bytes::toStringBinary(row.getRow)
+ is_stale |= row.isStale
row.listCells.each do |c|
family = org.apache.hadoop.hbase.util.Bytes::toStringBinary(c.getFamilyArray,
@@ -536,7 +542,7 @@ EOF
end
scanner.close()
- return ((block_given?) ? count : res)
+ return ((block_given?) ? [count, is_stale] : res)
end
# Apply OperationAttributes to puts/scans/gets
http://git-wip-us.apache.org/repos/asf/hbase/blob/b89d88a1/hbase-shell/src/main/ruby/shell/commands/get.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/get.rb b/hbase-shell/src/main/ruby/shell/commands/get.rb
index 1ab13cb..b8bfd52 100644
--- a/hbase-shell/src/main/ruby/shell/commands/get.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/get.rb
@@ -84,11 +84,11 @@ EOF
now = Time.now
formatter.header(["COLUMN", "CELL"])
- table._get_internal(row, *args) do |column, value|
+ count, is_stale = table._get_internal(row, *args) do |column, value|
formatter.row([ column, value ])
end
- formatter.footer(now)
+ formatter.footer(now, count, is_stale)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/b89d88a1/hbase-shell/src/main/ruby/shell/commands/scan.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/scan.rb b/hbase-shell/src/main/ruby/shell/commands/scan.rb
index 6f49f80..381acef 100644
--- a/hbase-shell/src/main/ruby/shell/commands/scan.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/scan.rb
@@ -109,12 +109,11 @@ EOF
scan = table._hash_to_scan(args)
#actually do the scanning
- count = table._scan_internal(args, scan) do |row, cells|
+ count, is_stale = table._scan_internal(args, scan) do |row, cells|
formatter.row([ row, cells ])
end
- formatter.footer(now, count)
-
+ formatter.footer(now, count, is_stale)
# if scan metrics were enabled, print them after the results
if (scan != nil && scan.isScanMetricsEnabled())
formatter.scan_metrics(scan.getScanMetrics(), args["METRICS"])
http://git-wip-us.apache.org/repos/asf/hbase/blob/b89d88a1/hbase-shell/src/main/ruby/shell/formatter.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/formatter.rb b/hbase-shell/src/main/ruby/shell/formatter.rb
index 47c9c8d..6e598fb 100644
--- a/hbase-shell/src/main/ruby/shell/formatter.rb
+++ b/hbase-shell/src/main/ruby/shell/formatter.rb
@@ -177,11 +177,16 @@ module Shell
end
end
- def footer(start_time = nil, row_count = nil)
+ def footer(start_time = nil, row_count = nil, is_stale = false)
return unless start_time
row_count ||= @row_count
# Only output elapsed time and row count if startTime passed
- @out.puts("%d row(s) in %.4f seconds" % [row_count, Time.now - start_time])
+ @out.print("%d row(s) in %.4f seconds" % [row_count, Time.now - start_time])
+ if is_stale == true
+ @out.puts(" (possible stale results) ")
+ else
+ @out.puts("")
+ end
end
end
[3/3] hbase git commit: HBASE-10358 Shell changes for setting
consistency per request (yi liang)
Posted by en...@apache.org.
HBASE-10358 Shell changes for setting consistency per request (yi liang)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/25e21ee1
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/25e21ee1
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/25e21ee1
Branch: refs/heads/branch-1.3
Commit: 25e21ee196d18fa0490d386ed21eeea7a9ecfeb0
Parents: b1e498e
Author: Enis Soztutar <en...@apache.org>
Authored: Thu May 26 14:20:01 2016 -0700
Committer: Enis Soztutar <en...@apache.org>
Committed: Thu May 26 17:05:45 2016 -0700
----------------------------------------------------------------------
hbase-shell/src/main/ruby/hbase/table.rb | 10 ++++++++--
hbase-shell/src/main/ruby/shell/commands/get.rb | 4 ++--
hbase-shell/src/main/ruby/shell/commands/scan.rb | 5 ++---
hbase-shell/src/main/ruby/shell/formatter.rb | 9 +++++++--
4 files changed, 19 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/25e21ee1/hbase-shell/src/main/ruby/hbase/table.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/hbase/table.rb b/hbase-shell/src/main/ruby/hbase/table.rb
index 74868c2..40095c8 100644
--- a/hbase-shell/src/main/ruby/hbase/table.rb
+++ b/hbase-shell/src/main/ruby/hbase/table.rb
@@ -281,6 +281,7 @@ EOF
def _get_internal(row, *args)
get = org.apache.hadoop.hbase.client.Get.new(row.to_s.to_java_bytes)
maxlength = -1
+ count = 0
@converters.clear()
# Normalize args
@@ -369,6 +370,10 @@ EOF
result = @table.get(get)
return nil if result.isEmpty
+ # Get stale info from results
+ is_stale = result.isStale
+ count += 1
+
# Print out results. Result can be Cell or RowResult.
res = {}
result.list.each do |kv|
@@ -386,7 +391,7 @@ EOF
end
# If block given, we've yielded all the results, otherwise just return them
- return ((block_given?) ? nil : res)
+ return ((block_given?) ? [count, is_stale]: res)
end
#----------------------------------------------------------------------------------------------
@@ -505,6 +510,7 @@ EOF
while iter.hasNext
row = iter.next
key = org.apache.hadoop.hbase.util.Bytes::toStringBinary(row.getRow)
+ is_stale |= row.isStale
row.list.each do |kv|
family = String.from_java_bytes(kv.getFamily)
@@ -530,7 +536,7 @@ EOF
end
scanner.close()
- return ((block_given?) ? count : res)
+ return ((block_given?) ? [count, is_stale] : res)
end
# Apply OperationAttributes to puts/scans/gets
http://git-wip-us.apache.org/repos/asf/hbase/blob/25e21ee1/hbase-shell/src/main/ruby/shell/commands/get.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/get.rb b/hbase-shell/src/main/ruby/shell/commands/get.rb
index 1ab13cb..b8bfd52 100644
--- a/hbase-shell/src/main/ruby/shell/commands/get.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/get.rb
@@ -84,11 +84,11 @@ EOF
now = Time.now
formatter.header(["COLUMN", "CELL"])
- table._get_internal(row, *args) do |column, value|
+ count, is_stale = table._get_internal(row, *args) do |column, value|
formatter.row([ column, value ])
end
- formatter.footer(now)
+ formatter.footer(now, count, is_stale)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/25e21ee1/hbase-shell/src/main/ruby/shell/commands/scan.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/scan.rb b/hbase-shell/src/main/ruby/shell/commands/scan.rb
index 7278578..106eccf 100644
--- a/hbase-shell/src/main/ruby/shell/commands/scan.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/scan.rb
@@ -109,12 +109,11 @@ EOF
scan = table._hash_to_scan(args)
#actually do the scanning
- count = table._scan_internal(args, scan) do |row, cells|
+ count, is_stale = table._scan_internal(args, scan) do |row, cells|
formatter.row([ row, cells ])
end
- formatter.footer(now, count)
-
+ formatter.footer(now, count, is_stale)
# if scan metrics were enabled, print them after the results
if (scan != nil && scan.isScanMetricsEnabled())
formatter.scan_metrics(scan.getScanMetrics(), args["METRICS"])
http://git-wip-us.apache.org/repos/asf/hbase/blob/25e21ee1/hbase-shell/src/main/ruby/shell/formatter.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/formatter.rb b/hbase-shell/src/main/ruby/shell/formatter.rb
index 47c9c8d..6e598fb 100644
--- a/hbase-shell/src/main/ruby/shell/formatter.rb
+++ b/hbase-shell/src/main/ruby/shell/formatter.rb
@@ -177,11 +177,16 @@ module Shell
end
end
- def footer(start_time = nil, row_count = nil)
+ def footer(start_time = nil, row_count = nil, is_stale = false)
return unless start_time
row_count ||= @row_count
# Only output elapsed time and row count if startTime passed
- @out.puts("%d row(s) in %.4f seconds" % [row_count, Time.now - start_time])
+ @out.print("%d row(s) in %.4f seconds" % [row_count, Time.now - start_time])
+ if is_stale == true
+ @out.puts(" (possible stale results) ")
+ else
+ @out.puts("")
+ end
end
end
[2/3] hbase git commit: HBASE-10358 Shell changes for setting
consistency per request (yi liang)
Posted by en...@apache.org.
HBASE-10358 Shell changes for setting consistency per request (yi liang)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/70c3a785
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/70c3a785
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/70c3a785
Branch: refs/heads/branch-1
Commit: 70c3a7854f148acb1a04c6d873884c6b2f703cb9
Parents: 22aa501
Author: Enis Soztutar <en...@apache.org>
Authored: Thu May 26 14:20:01 2016 -0700
Committer: Enis Soztutar <en...@apache.org>
Committed: Thu May 26 17:04:18 2016 -0700
----------------------------------------------------------------------
hbase-shell/src/main/ruby/hbase/table.rb | 10 ++++++++--
hbase-shell/src/main/ruby/shell/commands/get.rb | 4 ++--
hbase-shell/src/main/ruby/shell/commands/scan.rb | 5 ++---
hbase-shell/src/main/ruby/shell/formatter.rb | 9 +++++++--
4 files changed, 19 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/70c3a785/hbase-shell/src/main/ruby/hbase/table.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/hbase/table.rb b/hbase-shell/src/main/ruby/hbase/table.rb
index 74868c2..40095c8 100644
--- a/hbase-shell/src/main/ruby/hbase/table.rb
+++ b/hbase-shell/src/main/ruby/hbase/table.rb
@@ -281,6 +281,7 @@ EOF
def _get_internal(row, *args)
get = org.apache.hadoop.hbase.client.Get.new(row.to_s.to_java_bytes)
maxlength = -1
+ count = 0
@converters.clear()
# Normalize args
@@ -369,6 +370,10 @@ EOF
result = @table.get(get)
return nil if result.isEmpty
+ # Get stale info from results
+ is_stale = result.isStale
+ count += 1
+
# Print out results. Result can be Cell or RowResult.
res = {}
result.list.each do |kv|
@@ -386,7 +391,7 @@ EOF
end
# If block given, we've yielded all the results, otherwise just return them
- return ((block_given?) ? nil : res)
+ return ((block_given?) ? [count, is_stale]: res)
end
#----------------------------------------------------------------------------------------------
@@ -505,6 +510,7 @@ EOF
while iter.hasNext
row = iter.next
key = org.apache.hadoop.hbase.util.Bytes::toStringBinary(row.getRow)
+ is_stale |= row.isStale
row.list.each do |kv|
family = String.from_java_bytes(kv.getFamily)
@@ -530,7 +536,7 @@ EOF
end
scanner.close()
- return ((block_given?) ? count : res)
+ return ((block_given?) ? [count, is_stale] : res)
end
# Apply OperationAttributes to puts/scans/gets
http://git-wip-us.apache.org/repos/asf/hbase/blob/70c3a785/hbase-shell/src/main/ruby/shell/commands/get.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/get.rb b/hbase-shell/src/main/ruby/shell/commands/get.rb
index 1ab13cb..b8bfd52 100644
--- a/hbase-shell/src/main/ruby/shell/commands/get.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/get.rb
@@ -84,11 +84,11 @@ EOF
now = Time.now
formatter.header(["COLUMN", "CELL"])
- table._get_internal(row, *args) do |column, value|
+ count, is_stale = table._get_internal(row, *args) do |column, value|
formatter.row([ column, value ])
end
- formatter.footer(now)
+ formatter.footer(now, count, is_stale)
end
end
end
http://git-wip-us.apache.org/repos/asf/hbase/blob/70c3a785/hbase-shell/src/main/ruby/shell/commands/scan.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/commands/scan.rb b/hbase-shell/src/main/ruby/shell/commands/scan.rb
index 7278578..106eccf 100644
--- a/hbase-shell/src/main/ruby/shell/commands/scan.rb
+++ b/hbase-shell/src/main/ruby/shell/commands/scan.rb
@@ -109,12 +109,11 @@ EOF
scan = table._hash_to_scan(args)
#actually do the scanning
- count = table._scan_internal(args, scan) do |row, cells|
+ count, is_stale = table._scan_internal(args, scan) do |row, cells|
formatter.row([ row, cells ])
end
- formatter.footer(now, count)
-
+ formatter.footer(now, count, is_stale)
# if scan metrics were enabled, print them after the results
if (scan != nil && scan.isScanMetricsEnabled())
formatter.scan_metrics(scan.getScanMetrics(), args["METRICS"])
http://git-wip-us.apache.org/repos/asf/hbase/blob/70c3a785/hbase-shell/src/main/ruby/shell/formatter.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/shell/formatter.rb b/hbase-shell/src/main/ruby/shell/formatter.rb
index 47c9c8d..6e598fb 100644
--- a/hbase-shell/src/main/ruby/shell/formatter.rb
+++ b/hbase-shell/src/main/ruby/shell/formatter.rb
@@ -177,11 +177,16 @@ module Shell
end
end
- def footer(start_time = nil, row_count = nil)
+ def footer(start_time = nil, row_count = nil, is_stale = false)
return unless start_time
row_count ||= @row_count
# Only output elapsed time and row count if startTime passed
- @out.puts("%d row(s) in %.4f seconds" % [row_count, Time.now - start_time])
+ @out.print("%d row(s) in %.4f seconds" % [row_count, Time.now - start_time])
+ if is_stale == true
+ @out.puts(" (possible stale results) ")
+ else
+ @out.puts("")
+ end
end
end