I am not that familiar with 0.90/trunk code. Looking at MetaReader.tableExists(), existence check logic hasn't changed from 0.20.6 Once 0.90 RC1 comes out, I will deploy onto our dev cluster.
Here is the diff. tyumac:external tyu$ diff hbase-0.20.6/src/java/org/apache/hadoop/hbase/master/HMaster.java ~/hbase-0.20.6/src/java/org/apache/hadoop/hbase/master/HMaster.java 27a28 > import java.util.HashSet; 61a63 > import org.apache.hadoop.hbase.client.Delete; 63a66 > import org.apache.hadoop.hbase.client.HTable; 798,806c796,827 < Result data = srvr.next(scannerid); < if (data != null && data.size() > 0) { < HRegionInfo info = Writables.getHRegionInfo( < data.getValue(CATALOG_FAMILY, REGIONINFO_QUALIFIER)); < if (info.getTableDesc().getNameAsString().equals(tableName)) { < // A region for this table already exists. Ergo table exists. < throw new TableExistsException(tableName); < } < } --- > HashSet<byte[]> regions = new HashSet<byte[]>(); > boolean cleanTable = false, // whether the table has a row in .META. whose start key is empty > exists = false; > Result data = srvr.next(scannerid); > while (data != null) { > if (data != null && data.size() > 0) { > HRegionInfo info = Writables.getHRegionInfo( > data.getValue(CATALOG_FAMILY, REGIONINFO_QUALIFIER)); > if (info.getTableDesc().getNameAsString().equals(tableName)) { > exists = true; > if (info.getStartKey().length == 0) { > cleanTable = true; > } else { > regions.add(info.getRegionName()); > } > } > } > data = srvr.next(scannerid); > } > if (exists) { > if (!cleanTable) { > HTable meta = new HTable(HConstants.META_TABLE_NAME); > for (byte[] region : regions) { > Delete d = new Delete(region); > meta.delete(d); > LOG.info("dangling row " + Bytes.toString(region) + " deleted from .META."); > } > } else { > // A region for this table already exists. Ergo table exists. > throw new TableExistsException(tableName); > } > } 1109a1131,1135 > if (null == infoMap) { > LOG.warn(Bytes.toString(CATALOG_FAMILY) + ":" + > Bytes.toString(REGIONINFO_QUALIFIER) + " is empty for row: " + > Bytes.toString(row)); > } On Wed, Nov 24, 2010 at 3:47 PM, Ryan Rawson <ryano...@gmail.com> wrote: > Please include a diff instead, it's hard to compare. > > Also I'm not sure there will be a 0.20.7. > > -ryan > > On Wed, Nov 24, 2010 at 3:45 PM, Ted Yu <yuzhih...@gmail.com> wrote: > > Hi, > > I wanted to automate the manual deletion of dangling row(s) in .META. > table. > > Please kindly comment on the following modification to > HMaster.createTable() > > which is base on 0.20.6 codebase: > > > > long scannerid = srvr.openScanner(metaRegionName, scan); > > try { > > HashSet<byte[]> regions = new HashSet<byte[]>(); > > boolean cleanTable = false, // whether the table has a row > in > > .META. whose start key is empty > > exists = false; > > Result data = srvr.next(scannerid); > > while (data != null) { > > if (data != null && data.size() > 0) { > > HRegionInfo info = Writables.getHRegionInfo( > > data.getValue(CATALOG_FAMILY, > > REGIONINFO_QUALIFIER)); > > if > (info.getTableDesc().getNameAsString().equals(tableName)) > > { > > exists = true; > > if (info.getStartKey().length == 0) { > > cleanTable = true; > > } else { > > regions.add(info.getRegionName()); > > } > > } > > } > > data = srvr.next(scannerid); > > } > > if (exists) { > > if (!cleanTable) { > > HTable meta = new HTable(HConstants.META_TABLE_NAME); > > for (byte[] region : regions) { > > Delete d = new Delete(region); > > meta.delete(d); > > LOG.info("dangling row " + Bytes.toString(region) + " > > deleted from .META."); > > } > > } else { > > // A region for this table already exists. Ergo table > > exists. > > throw new TableExistsException(tableName); > > } > > } > > } finally { > > srvr.close(scannerid); > > } > > > > Thanks > > >