Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase, mail # dev - Issues with close_region


Copy link to this message
-
Issues with close_region
Lars George 2011-06-17, 06:49
Hi,

First there is a bug in admin.rb by the looks:

    # Closes a region
    def close_region(region_name, server = nil)
      @admin.closeRegion(region_name, server ? [server].to_java : nil)
    end

while the calling close_region.rb does this

...
  hbase> close_region 'REGIONNAME'
  hbase> close_region 'REGIONNAME', 'REGIONSERVER_IP:PORT'
EOF
      end

      def command(region_name, server = nil)
        format_simple_command do
          admin.close_region(region_name, server)
        end
      end
The region server is no array of strings, but just one string, so admin.rb
should be

     # Closes a region
    def close_region(region_name, server = nil)
      @admin.closeRegion(region_name, server)
    end

That fixes the call. The next issue is, you cannot close a region that is
not in META, although you are handing in the region name and server address,
in the 0.90 branch:

      if (hostAndPort != null) {
        HServerAddress hsa = new HServerAddress(hostAndPort);
        Pair<HRegionInfo, HServerAddress> pair           MetaReader.getRegion(ct, regionname);
        if (pair == null || pair.getSecond() == null) {
          LOG.info("No server in .META. for " +
            Bytes.toString(regionname) + "; pair=" + pair);
        } else {
          closeRegion(hsa, pair.getFirst());
        }
      } else {

trunk has:

      if (hostAndPort != null) {
        Pair<HRegionInfo, ServerName> pair = MetaReader.getRegion(ct,
regionname);
        if (pair == null || pair.getSecond() == null) {
          LOG.info("No server in .META. for " +
            Bytes.toStringBinary(regionname) + "; pair=" + pair);
        } else {
          closeRegion(pair.getSecond(), pair.getFirst());
        }

so seems to be fixed there, but would not work for a 0.90.x release. Should
this be backported?

Lars