hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Serega Sheypak <serega.shey...@gmail.com>
Subject Re: Splits are not preserved during table copy using getAdmin().createTable(tableDescriptor);
Date Fri, 03 Oct 2014 15:33:14 GMT
Ok, I found them:
hTable.getRegionLocations().descendingKeySet()
and
HRegionInfo has startKey and endKey
I have to prepare splits[][].
I'm confused a little, how keys should be placed there? splits[][] shoud by
and array with length=region count and width = 2?


2014-10-03 17:57 GMT+04:00 Serega Sheypak <serega.sheypak@gmail.com>:

> Hi, here is my code:
>
> public void dropIfExistsAndCreate(String sourceTableName, String
> newTableName) throws IOException {
>         LOG.info(String.format("Use [%s] to create [%s]", sourceTableName,
> newTableName));
>         HTableDescriptor descriptor = getDescriptor(sourceTableName);
>         dropIfExists(newTableName); // doesn't matter
>         createTable(descriptor, newTableName);
>     }
>
>     private void createTable(HTableDescriptor descriptor, String
> newTableName) throws IOException {
>         descriptor.setName(Bytes.toBytes(newTableName));
>         getAdmin().createTable(descriptor);
>         LOG.info(String.format("Table created[%s]", newTableName));
>     }
>
> My source table has 256 regions, newly created table has no splits.
> Is there any possibility to copy splits from source table?
>
> I supposed, that HTableDescriptor encasulates splits, but it was bad
> assumption.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message