hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Josh Elser (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-16377) ServerName check is ineffective in region_mover.rb
Date Tue, 09 Aug 2016 21:10:22 GMT

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

Josh Elser commented on HBASE-16377:
------------------------------------

Ruby strings do {{==}} and {{eql?}} as value checks. Might it not be better to make sure {{getServerNameForRegion}}
always returns a Ruby string? It seems like the meta region path might not (but I'm not sure
how that works with JRuby), while the other branch of {{getServerNameForRegion}} does return
a Ruby string:

Maybe make a change...

{code}
def getServerNameForRegion(admin, r)
  return nil unless admin.isTableEnabled(r.getTableName)
  if r.isMetaRegion()
    # Hack
    zkw = org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.new(admin.getConfiguration(),
"region_mover", nil)
    mtl = org.apache.hadoop.hbase.zookeeper.MetaTableLocator.new()
    begin
      while not mtl.isLocationAvailable(zkw)
        sleep 0.1
      end
      # Make a fake servername by appending ','
      metaServer = (mtl.getMetaRegionLocation(zkw).toString() + ",").to_s
      return metaServer
    ensure
      zkw.close()
    end
  end
{code}

I need to test this out some more, but the extra {{.to_s}} cal you added to {{currentServer}}
seems unnecessary to me. 

It appears that {{servername}} in this method is a {{ServerName}} so calling {{to_s}} on that
object does make sense (as the {{ServerName}} instance of passed along to the {{move}} method).

> ServerName check is ineffective in region_mover.rb
> --------------------------------------------------
>
>                 Key: HBASE-16377
>                 URL: https://issues.apache.org/jira/browse/HBASE-16377
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 1.1.2
>            Reporter: Ted Yu
>            Assignee: Ted Yu
>         Attachments: 16377.branch-1.v1.txt
>
>
> The following was observed during test of region_mover.rb :
> {code}
> 2016-08-08 11:17:05,341|beaver.machine|INFO|352|139926954637120|MainThread|2016-08-08
11:17:05,340 INFO  [RubyThread-9: hbase-client/bin/thread-pool.rb:28] region_mover: Moving
region  hbase:meta,,1.1588230740 (1 of 14) from xyz.openstacklocal,16020,1470654716593, to
server=xyz.openstacklocal,16020,1470654716593
> {code}
> There is check that target server should not be the same as current server:
> {code}
>     if currentServer and currentServer == servername
>       $LOG.info("Region " + r.getRegionNameAsString() + " (" + counter.to_s +
>         " of " + regions.length.to_s + ") already on target server=" + servername)
>       counter = counter + 1
>       next
>     end
> {code}
> However, the check is not effective.
> See comparison between object1 and object3:
> http://www.skorks.com/2009/09/ruby-equality-and-object-comparison/



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message