You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "stack (JIRA)" <ji...@apache.org> on 2014/05/18 07:00:17 UTC

[jira] [Commented] (HBASE-6506) Setting CACHE_BLOCKS to false in an hbase shell scan doesn't work

    [ https://issues.apache.org/jira/browse/HBASE-6506?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14000995#comment-14000995 ] 

stack commented on HBASE-6506:
------------------------------

I made a fix and then added a puts after getting value to see what it is (the attached 'fix' patch does not include the 'puts').  

{code}
diff --git a/hbase-shell/src/main/ruby/hbase/table.rb b/hbase-shell/src/main/ruby/hbase/table.rb
index 1984177..be946d1 100644
--- a/hbase-shell/src/main/ruby/hbase/table.rb
+++ b/hbase-shell/src/main/ruby/hbase/table.rb
@@ -376,7 +376,9 @@ EOF
         stoprow = args["STOPROW"]
         timestamp = args["TIMESTAMP"]
         columns = args["COLUMNS"] || args["COLUMN"] || []
-        cache_blocks = args["CACHE_BLOCKS"] || true
+        # If CACHE_BLOCKS not set, then default 'true'.
+        cache_blocks = args["CACHE_BLOCKS"].nil? ? true: args["CACHE_BLOCKS"]
+        puts cache_blocks
         cache = args["CACHE"] || 0
         reversed = args["REVERSED"] || false
         versions = args["VERSIONS"] || 1
{code}

See below for my setting CACHE_BLOCKS and see how we print right value in each case.

{code}
hbase(main):002:0> scan 't1', {COLUMNS => ['c1'], CACHE_BLOCKS => false}
ROW                                                  COLUMN+CELL
false
0 row(s) in 0.0470 seconds

hbase(main):003:0> scan 't1', {COLUMNS => ['c1'], CACHE_BLOCKS => true}
ROW                                                  COLUMN+CELL
true
0 row(s) in 0.0070 seconds

hbase(main):004:0> scan 't1', {COLUMNS => ['c1']}
ROW                                                  COLUMN+CELL
true
0 row(s) in 0.0050 seconds
{code}

> Setting CACHE_BLOCKS to false in an hbase shell scan doesn't work
> -----------------------------------------------------------------
>
>                 Key: HBASE-6506
>                 URL: https://issues.apache.org/jira/browse/HBASE-6506
>             Project: HBase
>          Issue Type: Bug
>          Components: shell
>    Affects Versions: 0.94.0
>            Reporter: Josh Wymer
>            Priority: Minor
>              Labels: cache, ruby, scan, shell
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I was attempting to prevent blocks from being cached by setting CACHE_BLOCKS => false in the hbase shell when doing a scan but I kept seeing tons of evictions when I ran it. After inspecting "table.rb" I found this line:
> cache = args["CACHE_BLOCKS"] || true
> The problem then is that if CACHE_BLOCKS is false then this expression will always return true. Therefore, it's impossible to turn off block caching. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)