I plan to do this: if (keys == null || keys.getFirst() == null || keys.getFirst().length == 0) { HRegionLocation regLoc = table.getRegionLocation(HConstants.EMPTY_BYTE_ARRAY); if (null == regLoc) throw new IOException("Expecting at least one region."); List<InputSplit> splits = new ArrayList<InputSplit>(1); InputSplit split = new TableSplit(table.getTableName(), HConstants.EMPTY_BYTE_ARRAY, HConstants.EMPTY_BYTE_ARRAY, regLoc.getServerAddress().getHostname()); splits.add(split); return splits; }
On Tue, Nov 23, 2010 at 1:57 PM, Ted Yu <yuzhih...@gmail.com> wrote: > See: > https://issues.apache.org/jira/browse/HBASE-3271 > > > On Tue, Nov 23, 2010 at 1:47 PM, Stack <st...@duboce.net> wrote: > >> I'm pretty sure the export tool presumes user-space tables, not >> system-space tables. I'd doubt an export of .META. will work, at >> least not without code changes. >> >> That said, this is could be a useful facility. Want to make an issue Ted? >> >> St.Ack >> >> On Tue, Nov 23, 2010 at 1:04 PM, Ted Yu <yuzhih...@gmail.com> wrote: >> > Hi: >> > I tried to export .META. table in 0.20.6 and got: >> > >> > [had...@us01-ciqps1-name01 hbase]$ bin/hbase >> > org.apache.hadoop.hbase.mapreduce.Export .META. h-meta 1 0 0 >> > 10/11/23 20:59:05 INFO jvm.JvmMetrics: Initializing JVM Metrics with >> > processName=JobTracker, sessionId= >> > 2010-11-23 20:59:05.255::INFO: Logging to STDERR via >> > org.mortbay.log.StdErrLog >> > 2010-11-23 20:59:05.255::INFO: verisons=1, starttime=0, >> > endtime=9223372036854775807 >> > 10/11/23 20:59:05 INFO zookeeper.ZooKeeper: Client >> > environment:zookeeper.version=3.2.2-888565, built on 12/08/2009 21:51 >> GMT >> > 10/11/23 20:59:05 INFO zookeeper.ZooKeeper: Client environment: >> host.name= >> > us01-ciqps1-name01.carrieriq.com >> > 10/11/23 20:59:05 INFO zookeeper.ZooKeeper: Client >> > environment:java.version=1.6.0_21 >> > 10/11/23 20:59:05 INFO zookeeper.ZooKeeper: Client >> > environment:java.vendor=Sun Microsystems Inc. >> > 10/11/23 20:59:05 INFO zookeeper.ZooKeeper: Client >> > environment:java.home=/usr/java/jdk1.6.0_21/jre >> > 10/11/23 20:59:05 INFO zookeeper.ZooKeeper: Client >> > environment:java.class.path=/opt/msip/clients/... >> > 10/11/23 20:59:05 INFO zookeeper.ZooKeeper: Client >> > >> environment:java.library.path=/opt/msip/clients/CIQ-Performance/m2mDeployment/hbase/lib/native/Linux-amd64-64 >> > 10/11/23 20:59:05 INFO zookeeper.ZooKeeper: Client >> > environment:java.io.tmpdir=/tmp >> > 10/11/23 20:59:05 INFO zookeeper.ZooKeeper: Client >> > environment:java.compiler=<NA> >> > 10/11/23 20:59:05 INFO zookeeper.ZooKeeper: Client environment:os.name >> =Linux >> > 10/11/23 20:59:05 INFO zookeeper.ZooKeeper: Client >> environment:os.arch=amd64 >> > 10/11/23 20:59:05 INFO zookeeper.ZooKeeper: Client >> > environment:os.version=2.6.18-194.8.1.el5 >> > 10/11/23 20:59:05 INFO zookeeper.ZooKeeper: Client environment: >> user.name >> > =hadoop >> > 10/11/23 20:59:05 INFO zookeeper.ZooKeeper: Client >> > environment:user.home=/home/hadoop >> > 10/11/23 20:59:05 INFO zookeeper.ZooKeeper: Client >> > >> environment:user.dir=/opt/msip/clients/CIQ-Performance/m2mDeployment/3.1.0.8-282685/hbase-0.20.6 >> > 10/11/23 20:59:05 INFO zookeeper.ZooKeeper: Initiating client >> connection, >> > connectString=us01-ciqps1-name01.carrieriq.com:2181sessionTimeout=60000 >> > >> watcher=org.apache.hadoop.hbase.client.hconnectionmanager$clientzkwatc...@44050988 >> > 10/11/23 20:59:05 INFO zookeeper.ClientCnxn: >> zookeeper.disableAutoWatchReset >> > is false >> > 10/11/23 20:59:05 INFO zookeeper.ClientCnxn: Attempting connection to >> server >> > us01-ciqps1-name01.carrieriq.com/10.202.50.100:2181 >> > 10/11/23 20:59:05 INFO zookeeper.ClientCnxn: Priming connection to >> > java.nio.channels.SocketChannel[connected local=/10.202.50.100:31629remote= >> > us01-ciqps1-name01.carrieriq.com/10.202.50.100:2181] >> > 10/11/23 20:59:05 INFO zookeeper.ClientCnxn: Server connection >> successful >> > 10/11/23 20:59:05 DEBUG zookeeper.ZooKeeperWrapper: Read ZNode >> > /hbase/root-region-server got 10.202.50.112:60020 >> > 10/11/23 20:59:05 DEBUG client.HConnectionManager$TableServers: Found >> ROOT >> > at 10.202.50.112:60020 >> > 10/11/23 20:59:05 DEBUG client.HConnectionManager$TableServers: Cached >> > location for .META.,,1 is us01-ciqps1-grid02.carrieriq.com:60020 >> > Exception in thread "main" java.io.IOException: Expecting at least one >> > region. >> > at >> > >> org.apache.hadoop.hbase.mapreduce.TableInputFormatBase.getSplits(TableInputFormatBase.java:281) >> > at >> > org.apache.hadoop.mapred.JobClient.writeNewSplits(JobClient.java:885) >> > at >> > org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:779) >> > at org.apache.hadoop.mapreduce.Job.submit(Job.java:432) >> > at >> org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:447) >> > at org.apache.hadoop.hbase.mapreduce.Export.main(Export.java:146) >> > >> > Related code is: >> > if (keys == null || keys.getFirst() == null || >> > keys.getFirst().length == 0) { >> > throw new IOException("Expecting at least one region."); >> > } >> > >> > Has anyone done similar thing ? >> > >> > Thanks >> > >> > >