Return-Path: Delivered-To: apmail-hadoop-hbase-commits-archive@minotaur.apache.org Received: (qmail 31695 invoked from network); 7 May 2010 19:28:29 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 7 May 2010 19:28:29 -0000 Received: (qmail 53807 invoked by uid 500); 7 May 2010 19:28:29 -0000 Delivered-To: apmail-hadoop-hbase-commits-archive@hadoop.apache.org Received: (qmail 53768 invoked by uid 500); 7 May 2010 19:28:29 -0000 Mailing-List: contact hbase-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hbase-dev@hadoop.apache.org Delivered-To: mailing list hbase-commits@hadoop.apache.org Received: (qmail 53761 invoked by uid 99); 7 May 2010 19:28:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 May 2010 19:28:28 +0000 X-ASF-Spam-Status: No, hits=-1674.8 required=10.0 tests=ALL_TRUSTED,AWL,T_FILL_THIS_FORM_SHORT X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 May 2010 19:28:19 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C75372388A6B; Fri, 7 May 2010 19:26:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r942186 [6/18] - in /hadoop/hbase/trunk: ./ contrib/stargate/core/src/test/java/org/apache/hadoop/hbase/stargate/ core/src/main/java/org/apache/hadoop/hbase/ core/src/main/java/org/apache/hadoop/hbase/client/ core/src/main/java/org/apache/h... Date: Fri, 07 May 2010 19:26:51 -0000 To: hbase-commits@hadoop.apache.org From: stack@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100507192656.C75372388A6B@eris.apache.org> Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java Fri May 7 19:26:45 2010 @@ -31,7 +31,7 @@ import org.apache.hadoop.hbase.io.Immuta import org.apache.hadoop.util.StringUtils; /** - * Iterate over an HBase table data, return (ImmutableBytesWritable, Result) + * Iterate over an HBase table data, return (ImmutableBytesWritable, Result) * pairs. */ public class TableRecordReaderImpl { @@ -61,7 +61,7 @@ public class TableRecordReaderImpl { /** * Build the scanner. Not done in constructor to allow for extension. * - * @throws IOException When restarting the scan fails. + * @throws IOException When restarting the scan fails. */ public void init() throws IOException { restart(scan.getStartRow()); @@ -69,7 +69,7 @@ public class TableRecordReaderImpl { /** * Sets the HBase table. - * + * * @param htable The {@link HTable} to scan. */ public void setHTable(HTable htable) { @@ -78,7 +78,7 @@ public class TableRecordReaderImpl { /** * Sets the scan defining the actual details like columns etc. - * + * * @param scan The scan to set. */ public void setScan(Scan scan) { @@ -87,8 +87,8 @@ public class TableRecordReaderImpl { /** * Closes the split. - * - * + * + * */ public void close() { this.scanner.close(); @@ -96,7 +96,7 @@ public class TableRecordReaderImpl { /** * Returns the current key. - * + * * @return The current key. * @throws IOException * @throws InterruptedException When the job is aborted. @@ -108,7 +108,7 @@ public class TableRecordReaderImpl { /** * Returns the current value. - * + * * @return The current value. * @throws IOException When the value is faulty. * @throws InterruptedException When the job is aborted. @@ -120,7 +120,7 @@ public class TableRecordReaderImpl { /** * Positions the record reader to the next record. - * + * * @return true if there was another record. * @throws IOException When reading the record failed. * @throws InterruptedException When the job was aborted. @@ -131,7 +131,7 @@ public class TableRecordReaderImpl { try { value = this.scanner.next(); } catch (IOException e) { - LOG.debug("recovered from " + StringUtils.stringifyException(e)); + LOG.debug("recovered from " + StringUtils.stringifyException(e)); restart(lastRow); scanner.next(); // skip presumed already mapped row value = scanner.next(); @@ -146,12 +146,12 @@ public class TableRecordReaderImpl { /** * The current progress of the record reader through its data. - * + * * @return A number between 0.0 and 1.0, the fraction of the data read. */ public float getProgress() { // Depends on the total number of tuples return 0; } - + } Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/mapreduce/TableReducer.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/mapreduce/TableReducer.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/mapreduce/TableReducer.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/mapreduce/TableReducer.java Fri May 7 19:26:45 2010 @@ -24,16 +24,16 @@ import org.apache.hadoop.mapreduce.Reduc /** * Extends the basic Reducer class to add the required key and - * value input/output classes. While the input key and value as well as the - * output key can be anything handed in from the previous map phase the output - * value must be either a {@link org.apache.hadoop.hbase.client.Put Put} + * value input/output classes. While the input key and value as well as the + * output key can be anything handed in from the previous map phase the output + * value must be either a {@link org.apache.hadoop.hbase.client.Put Put} * or a {@link org.apache.hadoop.hbase.client.Delete Delete} instance when * using the {@link TableOutputFormat} class. *

- * This class is extended by {@link IdentityTableReducer} but can also be + * This class is extended by {@link IdentityTableReducer} but can also be * subclassed to implement similar features or any custom code needed. It has - * the advantage to enforce the output value to a specific basic type. - * + * the advantage to enforce the output value to a specific basic type. + * * @param The type of the input key. * @param The type of the input value. * @param The type of the output key. Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/mapreduce/TableSplit.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/mapreduce/TableSplit.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/mapreduce/TableSplit.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/mapreduce/TableSplit.java Fri May 7 19:26:45 2010 @@ -32,9 +32,9 @@ import org.apache.hadoop.mapreduce.Input * A table split corresponds to a key range (low, high). All references to row * below refer to the key of the row. */ -public class TableSplit extends InputSplit +public class TableSplit extends InputSplit implements Writable, Comparable { - + private byte [] tableName; private byte [] startRow; private byte [] endRow; @@ -48,7 +48,7 @@ implements Writable, Comparable

There is also a new hbase partitioner that will run as many reducers as -currently existing regions. The +currently existing regions. The {@link org.apache.hadoop.hbase.mapreduce.HRegionPartitioner} is suitable when your table is large and your upload is not such that it will greatly alter the number of existing regions when done; otherwise use the default @@ -119,7 +119,7 @@ The row id must be formatted as a {@link value as a {@link org.apache.hadoop.hbase.KeyValue} (A KeyValue holds the value for a cell and its coordinates; row/family/qualifier/timestamp, etc.). Note that you must specify a timestamp when you create the KeyValue in your map task -otherwise the KeyValue will be created with the default LATEST_TIMESTAMP (Long.MAX_VALUE). +otherwise the KeyValue will be created with the default LATEST_TIMESTAMP (Long.MAX_VALUE). Use System.currentTimeMillis() if your data does not inherently bear a timestamp. Your reduce task will also need to emit the KeyValues in order. See {@link org.apache.hadoop.hbase.mapreduce.KeyValueSortReducer} @@ -143,7 +143,7 @@ that is intimate with your tables key na to distribute keys among the reducers so a total order is maintained. If your keys are distributed with some regularity across a defined key space -- i.e. you know the start and end keys -- then the - {@link org.apache.hadoop.hbase.mapreduce.SimpleTotalOrderPartitioner} + {@link org.apache.hadoop.hbase.mapreduce.SimpleTotalOrderPartitioner} may be all you need.

See org.apache.hadoop.hbase.mapreduce.TestHFileOutputFormat for an example Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/AddColumn.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/AddColumn.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/AddColumn.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/AddColumn.java Fri May 7 19:26:45 2010 @@ -29,8 +29,8 @@ import java.io.IOException; class AddColumn extends ColumnOperation { private final HColumnDescriptor newColumn; - AddColumn(final HMaster master, final byte [] tableName, - final HColumnDescriptor newColumn) + AddColumn(final HMaster master, final byte [] tableName, + final HColumnDescriptor newColumn) throws IOException { super(master, tableName); this.newColumn = newColumn; Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/BaseScanner.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/BaseScanner.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/BaseScanner.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/BaseScanner.java Fri May 7 19:26:45 2010 @@ -56,11 +56,11 @@ import java.util.concurrent.atomic.Atomi /** * Base HRegion scanner class. Holds utilty common to ROOT and * META HRegion scanners. - * + * *

How do we know if all regions are assigned? After the initial scan of * the ROOT and META regions, all regions known at * that time will have been or are in the process of being assigned.

- * + * *

When a region is split the region server notifies the master of the * split and the new regions are assigned. But suppose the master loses the * split message? We need to periodically rescan the ROOT and @@ -69,34 +69,34 @@ import java.util.concurrent.atomic.Atomi *

  • If we rescan, any regions that are new but not assigned will have * no server info. Any regions that are not being served by the same * server will get re-assigned.
  • - * + * *
  • Thus a periodic rescan of the root region will find any new * META regions where we missed the META split * message or we failed to detect a server death and consequently need to * assign the region to a new server.
  • - * + * *
  • if we keep track of all the known META regions, then * we can rescan them periodically. If we do this then we can detect any * regions for which we missed a region split message.
  • * - * + * * Thus just keeping track of all the META regions permits * periodic rescanning which will detect unassigned regions (new or * otherwise) without the need to keep track of every region.

    - * + * *

    So the ROOT region scanner needs to wake up: *

      *
    1. when the master receives notification that the ROOT * region has been opened.
    2. *
    3. periodically after the first scan
    4. *
    - * + * * The META scanner needs to wake up: *
      *
    1. when a META region comes on line
    2. * periodically to rescan the online META regions *
    - * + * *

    A META region is not 'online' until it has been scanned * once. */ @@ -120,16 +120,16 @@ abstract class BaseScanner extends Chore } private final boolean rootRegion; protected final HMaster master; - + protected boolean initialScanComplete; - + protected abstract boolean initialScan(); protected abstract void maintenanceScan(); - - // will use this variable to synchronize and make sure we aren't interrupted + + // will use this variable to synchronize and make sure we aren't interrupted // mid-scan final Object scannerLock = new Object(); - + BaseScanner(final HMaster master, final boolean rootRegion, final AtomicBoolean stop) { super(master.getConfiguration(). @@ -138,17 +138,17 @@ abstract class BaseScanner extends Chore this.master = master; this.initialScanComplete = false; } - + /** @return true if initial scan completed successfully */ public boolean isInitialScanComplete() { return initialScanComplete; } - + @Override protected boolean initialChore() { return initialScan(); } - + @Override protected void chore() { maintenanceScan(); @@ -205,7 +205,7 @@ abstract class BaseScanner extends Chore e = RemoteExceptionHandler.decodeRemoteException((RemoteException) e); if (e instanceof UnknownScannerException) { // Reset scannerId so we do not try closing a scanner the other side - // has lost account of: prevents duplicated stack trace out of the + // has lost account of: prevents duplicated stack trace out of the // below close in the finally. scannerId = -1L; } @@ -223,7 +223,7 @@ abstract class BaseScanner extends Chore } // Scan is finished. - + // First clean up any meta region rows which had null HRegionInfos if (emptyRows.size() > 0) { LOG.warn("Found " + emptyRows.size() + " rows with empty HRegionInfo " + @@ -284,7 +284,7 @@ abstract class BaseScanner extends Chore * the filesystem, then a daughters was not added to .META. -- must have been * a crash before their addition. Add them here. * @param metaRegionName Meta region name: e.g. .META.,,1 - * @param server HRegionInterface of meta server to talk to + * @param server HRegionInterface of meta server to talk to * @param parent HRegionInfo of split offlined parent * @param rowContent Content of parent row in * metaRegionName @@ -292,7 +292,7 @@ abstract class BaseScanner extends Chore * the filesystem. * @throws IOException */ - private boolean cleanupAndVerifySplits(final byte [] metaRegionName, + private boolean cleanupAndVerifySplits(final byte [] metaRegionName, final HRegionInterface srvr, final HRegionInfo parent, Result rowContent) throws IOException { @@ -315,7 +315,7 @@ abstract class BaseScanner extends Chore return result; } - + /* * See if the passed daughter has references in the filesystem to the parent * and if not, remove the note of daughter region in the parent row: its @@ -331,7 +331,7 @@ abstract class BaseScanner extends Chore * @return True if this daughter still has references to the parent. * @throws IOException */ - private boolean checkDaughter(final byte [] metaRegionName, + private boolean checkDaughter(final byte [] metaRegionName, final HRegionInterface srvr, final HRegionInfo parent, final Result rowContent, final byte [] qualifier) throws IOException { @@ -397,7 +397,7 @@ abstract class BaseScanner extends Chore * @param daughter * @throws IOException */ - private void addDaughterRowChecked(final byte [] metaRegionName, + private void addDaughterRowChecked(final byte [] metaRegionName, final HRegionInterface srvr, final byte [] parent, final HRegionInfo split, final byte [] daughter) throws IOException { @@ -460,7 +460,7 @@ abstract class BaseScanner extends Chore * @param qualifier * @throws IOException */ - private void removeDaughterFromParent(final byte [] metaRegionName, + private void removeDaughterFromParent(final byte [] metaRegionName, final HRegionInterface srvr, final HRegionInfo parent, final HRegionInfo split, final byte [] qualifier) throws IOException { @@ -473,20 +473,20 @@ abstract class BaseScanner extends Chore srvr.delete(metaRegionName, delete); } - /* + /* * Checks if a daughter region -- either splitA or splitB -- still holds * references to parent. If not, removes reference to the split from * the parent meta region row so we don't check it any more. * @param metaRegionName Name of meta region to look in. * @param srvr Where region resides. - * @param parent Parent region name. + * @param parent Parent region name. * @param rowContent Keyed content of the parent row in meta region. * @param split Which column family. * @param qualifier Which of the daughters to look at, splitA or splitB. * @return True if still has references to parent. * @throws IOException */ - private boolean hasReferences(final byte [] metaRegionName, + private boolean hasReferences(final byte [] metaRegionName, final HRegionInterface srvr, final HRegionInfo parent, Result rowContent, final HRegionInfo split, byte [] qualifier) throws IOException { @@ -532,13 +532,13 @@ abstract class BaseScanner extends Chore */ protected void checkAssigned(final HRegionInterface regionServer, final MetaRegion meta, final HRegionInfo info, - final String serverAddress, final long startCode) + final String serverAddress, final long startCode) throws IOException { String serverName = null; String sa = serverAddress; long sc = startCode; if (sa == null || sa.length() <= 0) { - // Scans are sloppy. They don't respect row locks and they get and + // Scans are sloppy. They don't respect row locks and they get and // cache a row internally so may have data that is a little stale. Make // sure that for sure this serverAddress is null. We are trying to // avoid double-assignments. See hbase-1784. Will have to wait till Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ChangeTableState.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ChangeTableState.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ChangeTableState.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ChangeTableState.java Fri May 7 19:26:45 2010 @@ -45,8 +45,8 @@ class ChangeTableState extends TableOper new TreeMap>(); protected long lockid; - ChangeTableState(final HMaster master, final byte [] tableName, - final boolean onLine) + ChangeTableState(final HMaster master, final byte [] tableName, + final boolean onLine) throws IOException { super(master, tableName); this.online = onLine; Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ColumnOperation.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ColumnOperation.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ColumnOperation.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ColumnOperation.java Fri May 7 19:26:45 2010 @@ -31,8 +31,8 @@ import java.io.IOException; abstract class ColumnOperation extends TableOperation { private final Log LOG = LogFactory.getLog(this.getClass()); - - protected ColumnOperation(final HMaster master, final byte [] tableName) + + protected ColumnOperation(final HMaster master, final byte [] tableName) throws IOException { super(master, tableName); } Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/DeleteColumn.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/DeleteColumn.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/DeleteColumn.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/DeleteColumn.java Fri May 7 19:26:45 2010 @@ -30,8 +30,8 @@ import java.io.IOException; class DeleteColumn extends ColumnOperation { private final byte [] columnName; - DeleteColumn(final HMaster master, final byte [] tableName, - final byte [] columnName) + DeleteColumn(final HMaster master, final byte [] tableName, + final byte [] columnName) throws IOException { super(master, tableName); this.columnName = columnName; Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/HMaster.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/HMaster.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/HMaster.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/HMaster.java Fri May 7 19:26:45 2010 @@ -103,7 +103,7 @@ import java.util.concurrent.locks.Reentr * @see HMasterRegionInterface * @see Watcher */ -public class HMaster extends Thread implements HConstants, HMasterInterface, +public class HMaster extends Thread implements HConstants, HMasterInterface, HMasterRegionInterface, Watcher { // MASTER is name of the webapp and the attribute name used stuffing this //instance into web context. @@ -121,9 +121,9 @@ public class HMaster extends Thread impl private final Configuration conf; private final Path rootdir; private InfoServer infoServer; - private final int threadWakeFrequency; + private final int threadWakeFrequency; private final int numRetries; - + // Metrics is set when we call run. private final MasterMetrics metrics; @@ -152,8 +152,8 @@ public class HMaster extends Thread impl private long lastFragmentationQuery = -1L; private Map fragmentation = null; private final RegionServerOperationQueue regionServerOperationQueue; - - /** + + /** * Constructor * @param conf configuration * @throws IOException @@ -199,10 +199,10 @@ public class HMaster extends Thread impl this.zkMasterAddressWatcher.writeAddressToZooKeeper(this.address, true); this.regionServerOperationQueue = new RegionServerOperationQueue(this.conf, this.closed); - + serverManager = new ServerManager(this); regionManager = new RegionManager(this); - + setName(MASTER); this.metrics = new MasterMetrics(MASTER); // We're almost open for business @@ -327,7 +327,7 @@ public class HMaster extends Thread impl /** * @return HBase root dir. - * @throws IOException + * @throws IOException */ public Path getRootDir() { return this.rootdir; @@ -463,7 +463,7 @@ public class HMaster extends Thread impl LOG.fatal("Unhandled exception. Starting shutdown.", t); this.closed.set(true); } - + // Wait for all the remaining region servers to report in. this.serverManager.letRegionServersShutdown(); @@ -536,7 +536,7 @@ public class HMaster extends Thread impl assignedRegions.put(r.getRegionName(), r); } } - LOG.info("Inspection found " + assignedRegions.size() + " regions, " + + LOG.info("Inspection found " + assignedRegions.size() + " regions, " + (isRootRegionAssigned ? "with -ROOT-" : "but -ROOT- was MIA")); splitLogAfterStartup(); } @@ -667,7 +667,7 @@ public class HMaster extends Thread impl return mw; } - public HMsg [] regionServerReport(HServerInfo serverInfo, HMsg msgs[], + public HMsg [] regionServerReport(HServerInfo serverInfo, HMsg msgs[], HRegionInfo[] mostLoadedRegions) throws IOException { return adornRegionServerAnswer(serverInfo, @@ -677,7 +677,7 @@ public class HMaster extends Thread impl /** * Override if you'd add messages to return to regionserver hsi * @param messages Messages to add to - * @return Messages to return to + * @return Messages to return to */ protected HMsg [] adornRegionServerAnswer(final HServerInfo hsi, final HMsg [] msgs) { @@ -695,7 +695,7 @@ public class HMaster extends Thread impl } public void createTable(HTableDescriptor desc, byte [][] splitKeys) - throws IOException { + throws IOException { if (!isMasterRunning()) { throw new MasterNotRunningException(); } @@ -737,7 +737,7 @@ public class HMaster extends Thread impl } } - private synchronized void createTable(final HRegionInfo [] newRegions) + private synchronized void createTable(final HRegionInfo [] newRegions) throws IOException { String tableName = newRegions[0].getTableDesc().getNameAsString(); // 1. Check to see if table already exists. Get meta region where @@ -778,11 +778,11 @@ public class HMaster extends Thread impl } public void addColumn(byte [] tableName, HColumnDescriptor column) - throws IOException { + throws IOException { new AddColumn(this, tableName, column).process(); } - public void modifyColumn(byte [] tableName, byte [] columnName, + public void modifyColumn(byte [] tableName, byte [] columnName, HColumnDescriptor descriptor) throws IOException { new ModifyColumn(this, tableName, columnName, descriptor).process(); @@ -914,7 +914,7 @@ public class HMaster extends Thread impl } return null; } - + /** * Get row from meta table. * @param row @@ -930,7 +930,7 @@ public class HMaster extends Thread impl get.addFamily(family); return srvr.get(meta.getRegionName(), get); } - + /* * @param meta * @return Server connection to meta .META. region. @@ -941,12 +941,12 @@ public class HMaster extends Thread impl return this.connection.getHRegionConnection(meta.getServer()); } - public void modifyTable(final byte[] tableName, HConstants.Modify op, + public void modifyTable(final byte[] tableName, HConstants.Modify op, Writable[] args) throws IOException { switch (op) { case TABLE_SET_HTD: - if (args == null || args.length < 1 || + if (args == null || args.length < 1 || !(args[0] instanceof HTableDescriptor)) throw new IOException("SET_HTD request requires an HTableDescriptor"); HTableDescriptor htd = (HTableDescriptor) args[0]; @@ -993,12 +993,12 @@ public class HMaster extends Thread impl if (args.length == 2) { servername = Bytes.toString(((ImmutableBytesWritable)args[1]).get()); } - // Need hri + // Need hri Result rr = getFromMETA(regionname, HConstants.CATALOG_FAMILY); HRegionInfo hri = getHRegionInfo(rr.getRow(), rr); if (servername == null) { // Get server from the .META. if it wasn't passed as argument - servername = + servername = Bytes.toString(rr.getValue(CATALOG_FAMILY, SERVER_QUALIFIER)); } // Take region out of the intransistions in case it got stuck there doing @@ -1071,12 +1071,12 @@ public class HMaster extends Thread impl /* * When we find rows in a meta region that has an empty HRegionInfo, we * clean them up here. - * + * * @param s connection to server serving meta region * @param metaRegionName name of the meta region we scanned * @param emptyRows the row keys that had empty HRegionInfos */ - protected void deleteEmptyMetaRows(HRegionInterface s, + protected void deleteEmptyMetaRows(HRegionInterface s, byte [] metaRegionName, List emptyRows) { for (byte [] regionName: emptyRows) { @@ -1098,10 +1098,10 @@ public class HMaster extends Thread impl @Override public void process(WatchedEvent event) { LOG.debug(("Event " + event.getType() + " with path " + event.getPath())); - // Master should kill itself if its session expired or if its + // Master should kill itself if its session expired or if its // znode was deleted manually (usually for testing purposes) - if(event.getState() == KeeperState.Expired || - (event.getType().equals(EventType.NodeDeleted) && + if(event.getState() == KeeperState.Expired || + (event.getType().equals(EventType.NodeDeleted) && event.getPath().equals(this.zooKeeperWrapper.getMasterElectionZNode())) && !shutdownRequested.get()) { Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/MetaRegion.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/MetaRegion.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/MetaRegion.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/MetaRegion.java Fri May 7 19:26:45 2010 @@ -39,7 +39,7 @@ public class MetaRegion implements Compa } this.regionInfo = regionInfo; } - + @Override public String toString() { return "{server: " + this.server.toString() + ", regionname: " + @@ -62,13 +62,13 @@ public class MetaRegion implements Compa return regionInfo.getStartKey(); } - + /** @return the endKey */ public byte [] getEndKey() { return regionInfo.getEndKey(); } - + public HRegionInfo getRegionInfo() { return regionInfo; } Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/MetaScanner.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/MetaScanner.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/MetaScanner.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/MetaScanner.java Fri May 7 19:26:45 2010 @@ -30,24 +30,24 @@ import java.util.concurrent.TimeUnit; /** * MetaScanner META table. - * + * * When a META server comes on line, a MetaRegion object is * queued up by regionServerReport() and this thread wakes up. * - * It's important to do this work in a separate thread, or else the blocking + * It's important to do this work in a separate thread, or else the blocking * action would prevent other work from getting done. */ class MetaScanner extends BaseScanner { /** Initial work for the meta scanner is queued up here */ private volatile BlockingQueue metaRegionsToScan = new LinkedBlockingQueue(); - + private final List metaRegionsToRescan = new ArrayList(); - + /** * Constructor - * + * * @param master */ public MetaScanner(HMaster master) { @@ -88,7 +88,7 @@ class MetaScanner extends BaseScanner { // Make sure the file system is still available this.master.checkFileSystem(); } catch (Exception e) { - // If for some reason we get some other kind of exception, + // If for some reason we get some other kind of exception, // at least log it rather than go out silently. LOG.error("Unexpected exception", e); } @@ -102,7 +102,7 @@ class MetaScanner extends BaseScanner { (region == null && metaRegionsToScan.size() > 0) && !metaRegionsScanned()) { try { - region = metaRegionsToScan.poll(this.master.getThreadWakeFrequency(), + region = metaRegionsToScan.poll(this.master.getThreadWakeFrequency(), TimeUnit.MILLISECONDS); } catch (InterruptedException e) { // continue @@ -134,7 +134,7 @@ class MetaScanner extends BaseScanner { } /* - * Called by the meta scanner when it has completed scanning all meta + * Called by the meta scanner when it has completed scanning all meta * regions. This wakes up any threads that were waiting for this to happen. * @param totalRows Total rows scanned. * @param regionCount Count of regions in .META. table. @@ -171,10 +171,10 @@ class MetaScanner extends BaseScanner { } return this.master.isClosed(); } - + /** * Add another meta region to scan to the queue. - */ + */ void addMetaRegionToScan(MetaRegion m) { metaRegionsToScan.add(m); } Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ModifyColumn.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ModifyColumn.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ModifyColumn.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ModifyColumn.java Fri May 7 19:26:45 2010 @@ -30,9 +30,9 @@ import java.io.IOException; class ModifyColumn extends ColumnOperation { private final HColumnDescriptor descriptor; private final byte [] columnName; - - ModifyColumn(final HMaster master, final byte [] tableName, - final byte [] columnName, HColumnDescriptor descriptor) + + ModifyColumn(final HMaster master, final byte [] tableName, + final byte [] columnName, HColumnDescriptor descriptor) throws IOException { super(master, tableName); this.descriptor = descriptor; @@ -48,7 +48,7 @@ class ModifyColumn extends ColumnOperati updateRegionInfo(server, m.getRegionName(), i); } else { // otherwise, we have an error. throw new InvalidColumnNameException("Column family '" + - Bytes.toString(columnName) + + Bytes.toString(columnName) + "' doesn't exist, so cannot be modified."); } } Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ModifyTableMeta.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ModifyTableMeta.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ModifyTableMeta.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ModifyTableMeta.java Fri May 7 19:26:45 2010 @@ -38,8 +38,8 @@ class ModifyTableMeta extends TableOpera private HTableDescriptor desc; - ModifyTableMeta(final HMaster master, final byte [] tableName, - HTableDescriptor desc) + ModifyTableMeta(final HMaster master, final byte [] tableName, + HTableDescriptor desc) throws IOException { super(master, tableName); this.desc = desc; Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ProcessRegionClose.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ProcessRegionClose.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ProcessRegionClose.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ProcessRegionClose.java Fri May 7 19:26:45 2010 @@ -26,10 +26,10 @@ import java.io.IOException; /** * ProcessRegionClose is the way we do post-processing on a closed region. We - * only spawn one of these asynchronous tasks when the region needs to be + * only spawn one of these asynchronous tasks when the region needs to be * either offlined or deleted. We used to create one of these tasks whenever * a region was closed, but since closing a region that isn't being offlined - * or deleted doesn't actually require post processing, it's no longer + * or deleted doesn't actually require post processing, it's no longer * necessary. */ class ProcessRegionClose extends ProcessRegionStatusChange { @@ -42,7 +42,7 @@ class ProcessRegionClose extends Process * @param offlineRegion if true, set the region to offline in meta * @param reassignRegion if true, region is to be reassigned */ - public ProcessRegionClose(HMaster master, HRegionInfo regionInfo, + public ProcessRegionClose(HMaster master, HRegionInfo regionInfo, boolean offlineRegion, boolean reassignRegion) { super(master, regionInfo); @@ -74,7 +74,7 @@ class ProcessRegionClose extends Process // We can't proceed unless the meta region we are going to update // is online. metaRegionAvailable() will put this operation on the - // delayedToDoQueue, so return true so the operation is not put + // delayedToDoQueue, so return true so the operation is not put // back on the toDoQueue if (metaRegionAvailable()) { Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ProcessRegionOpen.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ProcessRegionOpen.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ProcessRegionOpen.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ProcessRegionOpen.java Fri May 7 19:26:45 2010 @@ -28,9 +28,9 @@ import org.apache.hadoop.hbase.util.Byte import java.io.IOException; -/** +/** * ProcessRegionOpen is instantiated when a region server reports that it is - * serving a region. This applies to all meta and user regions except the + * serving a region. This applies to all meta and user regions except the * root region which is handled specially. */ class ProcessRegionOpen extends ProcessRegionStatusChange { Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ProcessRegionStatusChange.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ProcessRegionStatusChange.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ProcessRegionStatusChange.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ProcessRegionStatusChange.java Fri May 7 19:26:45 2010 @@ -22,7 +22,7 @@ package org.apache.hadoop.hbase.master; import org.apache.hadoop.hbase.HRegionInfo; /** - * Abstract class that performs common operations for + * Abstract class that performs common operations for * @see ProcessRegionClose and @see ProcessRegionOpen */ abstract class ProcessRegionStatusChange extends RegionServerOperation { @@ -41,7 +41,7 @@ abstract class ProcessRegionStatusChange this.regionInfo = regionInfo; this.isMetaTable = regionInfo.isMetaTable(); } - + protected boolean metaRegionAvailable() { boolean available = true; if (isMetaTable) { Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ProcessServerShutdown.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ProcessServerShutdown.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ProcessServerShutdown.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ProcessServerShutdown.java Fri May 7 19:26:45 2010 @@ -39,7 +39,7 @@ import java.util.List; import java.util.Map; import java.util.Set; -/** +/** * Instantiated when a server's lease has expired, meaning it has crashed. * The region server's log file needs to be split up for each region it was * serving, and the regions need to get reassigned. @@ -119,19 +119,19 @@ class ProcessServerShutdown extends Regi return this.deadServerAddress; } - private void closeRegionsInTransition() { + private void closeRegionsInTransition() { Map inTransition = master.getRegionManager().getRegionsInTransitionOnServer(deadServer); for (Map.Entry entry : inTransition.entrySet()) { String regionName = entry.getKey(); RegionState state = entry.getValue(); - + LOG.info("Region " + regionName + " was in transition " + state + " on dead server " + deadServer + " - marking unassigned"); master.getRegionManager().setUnassigned(state.getRegionInfo(), true); } } - + @Override public String toString() { return "ProcessServerShutdown of " + this.deadServer; @@ -227,7 +227,7 @@ class ProcessServerShutdown extends Regi } // Scan complete. Remove any rows which had empty HRegionInfos - + if (emptyRows.size() > 0) { LOG.warn("Found " + emptyRows.size() + " rows with empty HRegionInfo while scanning meta region " + @@ -271,7 +271,7 @@ class ProcessServerShutdown extends Regi ScanMetaRegions(MetaRegion m, HMaster master) { super(m, master); } - + public Boolean call() throws IOException { if (LOG.isDebugEnabled()) { LOG.debug("process server shutdown scanning " + @@ -291,9 +291,9 @@ class ProcessServerShutdown extends Regi LOG.info("process shutdown of server " + this.deadServer + ": logSplit: " + logSplit + ", rootRescanned: " + rootRescanned + - ", numberOfMetaRegions: " + + ", numberOfMetaRegions: " + master.getRegionManager().numMetaRegions() + - ", onlineMetaRegions.size(): " + + ", onlineMetaRegions.size(): " + master.getRegionManager().numOnlineMetaRegions()); if (!logSplit) { // Process the old log file @@ -348,7 +348,7 @@ class ProcessServerShutdown extends Regi if (LOG.isDebugEnabled()) { LOG.debug("process server shutdown scanning root region on " + - master.getRegionManager().getRootRegionLocation().getBindAddress() + + master.getRegionManager().getRootRegionLocation().getBindAddress() + " finished " + Thread.currentThread().getName()); } rootRescanned = true; @@ -371,7 +371,7 @@ class ProcessServerShutdown extends Regi Bytes.toString(r.getRegionName()) + " on " + r.getServer()); } } - + closeRegionsInTransition(); // Remove this server from dead servers list. Finished splitting logs. Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/RegionManager.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/RegionManager.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/RegionManager.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/RegionManager.java Fri May 7 19:26:45 2010 @@ -58,16 +58,16 @@ import java.util.concurrent.atomic.Atomi /** * Class to manage assigning regions to servers, state of root and meta, etc. - */ + */ public class RegionManager implements HConstants { protected static final Log LOG = LogFactory.getLog(RegionManager.class); - + private AtomicReference rootRegionLocation = new AtomicReference(null); private final RootScanner rootScannerThread; final MetaScanner metaScannerThread; - + /** Set by root scanner to indicate the number of meta regions */ private final AtomicInteger numberOfMetaRegions = new AtomicInteger(); @@ -76,20 +76,20 @@ public class RegionManager implements HC new ConcurrentSkipListMap(Bytes.BYTES_COMPARATOR); private static final byte[] OVERLOADED = Bytes.toBytes("Overloaded"); - + private static final byte [] META_REGION_PREFIX = Bytes.toBytes(".META.,"); /** * Map of region name to RegionState for regions that are in transition such as - * + * * unassigned -> pendingOpen -> open * closing -> pendingClose -> closed; if (closed && !offline) -> unassigned - * + * * At the end of a transition, removeRegion is used to remove the region from * the map (since it is no longer in transition) - * + * * Note: Needs to be SortedMap so we can specify a comparator - * + * * @see RegionState inner-class below */ final SortedMap regionsInTransition = @@ -147,7 +147,7 @@ public class RegionManager implements HC Threads.setDaemonThreadRunning(rootScannerThread, "RegionManager.rootScanner"); Threads.setDaemonThreadRunning(metaScannerThread, - "RegionManager.metaScanner"); + "RegionManager.metaScanner"); } void unsetRootRegion() { @@ -158,7 +158,7 @@ public class RegionManager implements HC LOG.info("-ROOT- region unset (but not set to be reassigned)"); } } - + void reassignRootRegion() { unsetRootRegion(); if (!master.getShutdownRequested().get()) { @@ -171,12 +171,12 @@ public class RegionManager implements HC } } } - + /* * Assigns regions to region servers attempting to balance the load across - * all region servers. Note that no synchronization is necessary as the caller + * all region servers. Note that no synchronization is necessary as the caller * (ServerManager.processMsgs) already owns the monitor for the RegionManager. - * + * * @param info * @param mostLoadedRegions * @param returnMsgs @@ -198,21 +198,21 @@ public class RegionManager implements HC if (isSingleServer) { assignRegionsToOneServer(regionsToAssign, info, returnMsgs); } else { - // otherwise, give this server a few regions taking into account the + // otherwise, give this server a few regions taking into account the // load of all the other servers. assignRegionsToMultipleServers(thisServersLoad, regionsToAssign, info, returnMsgs); } } } - + /* * Make region assignments taking into account multiple servers' loads. * * Note that no synchronization is needed while we iterate over * regionsInTransition because this method is only called by assignRegions * whose caller owns the monitor for RegionManager - * + * * TODO: This code is unintelligible. REWRITE. Add TESTS! St.Ack 09/30/2009 * @param thisServersLoad * @param regionsToAssign @@ -220,7 +220,7 @@ public class RegionManager implements HC * @param returnMsgs */ private void assignRegionsToMultipleServers(final HServerLoad thisServersLoad, - final Set regionsToAssign, final HServerInfo info, + final Set regionsToAssign, final HServerInfo info, final ArrayList returnMsgs) { boolean isMetaAssign = false; for (RegionState s : regionsToAssign) { @@ -300,11 +300,11 @@ public class RegionManager implements HC /* * Assign all to the only server. An unlikely case but still possible. - * + * * Note that no synchronization is needed on regionsInTransition while - * iterating on it because the only caller is assignRegions whose caller owns + * iterating on it because the only caller is assignRegions whose caller owns * the monitor for RegionManager - * + * * @param regionsToAssign * @param serverName * @param returnMsgs @@ -366,11 +366,11 @@ public class RegionManager implements HC /* * Get the set of regions that should be assignable in this pass. - * + * * Note that no synchronization on regionsInTransition is needed because the * only caller (assignRegions, whose caller is ServerManager.processMsgs) owns * the monitor for RegionManager - */ + */ private Set regionsAwaitingAssignment(HServerAddress addr, boolean isSingleServer) { // set of regions we want to assign to this server @@ -413,7 +413,7 @@ public class RegionManager implements HC // and are on-line continue; } - if (!i.isMetaRegion() && + if (!i.isMetaRegion() && !master.getServerManager().canAssignUserRegions()) { LOG.debug("user region " + i.getRegionNameAsString() + " is in transition but not enough servers yet"); @@ -422,18 +422,18 @@ public class RegionManager implements HC if (s.isUnassigned()) { regionsToAssign.add(s); } - } + } } return regionsToAssign; } - + /* * Figure out the load that is next highest amongst all regionservers. Also, - * return how many servers exist at that load. + * return how many servers exist at that load. */ - private int computeNextHeaviestLoad(HServerLoad referenceLoad, + private int computeNextHeaviestLoad(HServerLoad referenceLoad, HServerLoad heavierLoad) { - + SortedMap> heavyServers = new TreeMap>(); synchronized (master.getLoadToServers()) { @@ -464,14 +464,14 @@ public class RegionManager implements HC * some or all of its most loaded regions, allowing it to reduce its load. * The closed regions will then get picked up by other underloaded machines. * - * Note that no synchronization is needed because the only caller + * Note that no synchronization is needed because the only caller * (assignRegions) whose caller owns the monitor for RegionManager */ - void unassignSomeRegions(final HServerInfo info, + void unassignSomeRegions(final HServerInfo info, int numRegionsToClose, final HRegionInfo[] mostLoadedRegions, ArrayList returnMsgs) { - LOG.debug("Choosing to reassign " + numRegionsToClose - + " regions. mostLoadedRegions has " + mostLoadedRegions.length + LOG.debug("Choosing to reassign " + numRegionsToClose + + " regions. mostLoadedRegions has " + mostLoadedRegions.length + " regions in it."); int regionIdx = 0; int regionsClosed = 0; @@ -516,23 +516,23 @@ public class RegionManager implements HC return !pathname.equals(HLog.HREGION_LOGDIR_NAME) && !pathname.equals(VERSION_FILE_NAME); } - + } /* * PathFilter that accepts all but compaction.dir names. */ static class RegionDirFilter implements PathFilter { - public boolean accept(Path path) { + public boolean accept(Path path) { return !path.getName().equals(HREGION_COMPACTIONDIR_NAME); } } /** * @return the rough number of the regions on fs - * Note: this method simply counts the regions on fs by accumulating all the dirs + * Note: this method simply counts the regions on fs by accumulating all the dirs * in each table dir (${HBASE_ROOT}/$TABLE) and skipping logfiles, compaction dirs. - * @throws IOException + * @throws IOException */ public int countRegionsOnFS() throws IOException { int regions = 0; @@ -569,7 +569,7 @@ public class RegionManager implements HC } return false; } - + /** * Return a map of the regions in transition on a server. * Returned map entries are region name -> RegionState @@ -604,9 +604,9 @@ public class RegionManager implements HC LOG.debug("meta and root scanners notified"); } } - + /** Stop the region assigner */ - public void stop() { + public void stop() { try { if (rootScannerThread.isAlive()) { rootScannerThread.join(); // Wait for the root scanner to finish. @@ -624,7 +624,7 @@ public class RegionManager implements HC master.getZooKeeperWrapper().clearRSDirectory(); master.getZooKeeperWrapper().close(); } - + /** * Block until meta regions are online or we're shutting down. * @return true if we found meta regions, false if we're closing. @@ -635,9 +635,9 @@ public class RegionManager implements HC numberOfMetaRegions.get() == onlineMetaRegions.size()); } } - + /** - * Search our map of online meta regions to find the first meta region that + * Search our map of online meta regions to find the first meta region that * should contain a pointer to newRegion. * @param newRegion * @return MetaRegion where the newRegion should live @@ -651,13 +651,13 @@ public class RegionManager implements HC } else { if (onlineMetaRegions.containsKey(newRegion.getRegionName())) { return onlineMetaRegions.get(newRegion.getRegionName()); - } + } return onlineMetaRegions.get(onlineMetaRegions.headMap( newRegion.getRegionName()).lastKey()); } } } - + /** * Get a set of all the meta regions that contain info about a given table. * @param tableName Table you need to know all the meta regions for @@ -724,8 +724,8 @@ public class RegionManager implements HC * written * @throws IOException */ - public void createRegion(HRegionInfo newRegion, HRegionInterface server, - byte [] metaRegionName) + public void createRegion(HRegionInfo newRegion, HRegionInterface server, + byte [] metaRegionName) throws IOException { // 2. Create the HRegion HRegion region = HRegion.createHRegion(newRegion, this.master.getRootDir(), @@ -734,11 +734,11 @@ public class RegionManager implements HC // 3. Insert into meta HRegionInfo info = region.getRegionInfo(); byte [] regionName = region.getRegionName(); - + Put put = new Put(regionName); put.add(CATALOG_FAMILY, REGIONINFO_QUALIFIER, Writables.getBytes(info)); server.put(metaRegionName, put); - + // 4. Close the new region to flush it to disk. Close its log file too. region.close(); region.getLog().closeAndDelete(); @@ -746,17 +746,17 @@ public class RegionManager implements HC // 5. Get it assigned to a server setUnassigned(info, true); } - - /** - * Set a MetaRegion as online. - * @param metaRegion + + /** + * Set a MetaRegion as online. + * @param metaRegion */ public void putMetaRegionOnline(MetaRegion metaRegion) { onlineMetaRegions.put(metaRegion.getStartKey(), metaRegion); } - /** - * Get a list of online MetaRegions + /** + * Get a list of online MetaRegions * @return list of MetaRegion objects */ public List getListOfOnlineMetaRegions() { @@ -766,26 +766,26 @@ public class RegionManager implements HC } return regions; } - - /** - * Count of online meta regions + + /** + * Count of online meta regions * @return count of online meta regions */ public int numOnlineMetaRegions() { return onlineMetaRegions.size(); } - - /** - * Check if a meta region is online by its name + + /** + * Check if a meta region is online by its name * @param startKey name of the meta region to check * @return true if the region is online, false otherwise */ public boolean isMetaRegionOnline(byte [] startKey) { return onlineMetaRegions.containsKey(startKey); } - - /** - * Set an online MetaRegion offline - remove it from the map. + + /** + * Set an online MetaRegion offline - remove it from the map. * @param startKey region name * @return the MetaRegion that was taken offline. */ @@ -845,7 +845,7 @@ public class RegionManager implements HC // Has an outstanding meta region to be assigned. return true; } - } + } } return false; } @@ -931,7 +931,7 @@ public class RegionManager implements HC /** * Remove a region from the region state map. - * + * * @param info */ public void removeRegion(HRegionInfo info) { @@ -939,7 +939,7 @@ public class RegionManager implements HC this.regionsInTransition.remove(info.getRegionNameAsString()); } } - + /** * @param regionName * @return true if the named region is in a transition state @@ -964,8 +964,8 @@ public class RegionManager implements HC return false; } - /** - * Set a region to unassigned + /** + * Set a region to unassigned * @param info Region to set unassigned * @param force if true mark region unassigned whatever its current state */ @@ -982,8 +982,8 @@ public class RegionManager implements HC s.setUnassigned(); } } - - /** + + /** * Check if a region is on the unassigned list * @param info HRegionInfo to check for * @return true if on the unassigned list, false if it isn't. Note that this @@ -999,11 +999,11 @@ public class RegionManager implements HC } return false; } - + /** * Check if a region has been assigned and we're waiting for a response from * the region server. - * + * * @param regionName name of the region * @return true if open, false otherwise */ @@ -1029,7 +1029,7 @@ public class RegionManager implements HC } } } - + /** * @param regionName * @return true if region is marked to be offlined. @@ -1044,8 +1044,8 @@ public class RegionManager implements HC return false; } - /** - * Mark a region as closing + /** + * Mark a region as closing * @param serverName * @param regionInfo * @param setOffline @@ -1067,11 +1067,11 @@ public class RegionManager implements HC this.regionsInTransition.put(regionInfo.getRegionNameAsString(), s); } } - - /** - * Remove the map of region names to region infos waiting to be offlined for a + + /** + * Remove the map of region names to region infos waiting to be offlined for a * given server - * + * * @param serverName * @return set of infos to close */ @@ -1087,10 +1087,10 @@ public class RegionManager implements HC } return result; } - + /** * Called when we have told a region server to close the region - * + * * @param regionName */ public void setPendingClose(String regionName) { @@ -1101,7 +1101,7 @@ public class RegionManager implements HC } } } - + /** * @param regionName */ @@ -1120,8 +1120,8 @@ public class RegionManager implements HC public void addMetaRegionToScan(MetaRegion m) { metaScannerThread.addMetaRegionToScan(m); } - - /** + + /** * Check if the initial root scan has been completed. * @return true if scan completed, false otherwise */ @@ -1129,22 +1129,22 @@ public class RegionManager implements HC return rootScannerThread.isInitialScanComplete(); } - /** + /** * Check if the initial meta scan has been completed. * @return true if meta completed, false otherwise - */ + */ public boolean isInitialMetaScanComplete() { return metaScannerThread.isInitialScanComplete(); } - /** + /** * Get the root region location. * @return HServerAddress describing root region server. */ public HServerAddress getRootRegionLocation() { return rootRegionLocation.get(); } - + /** * Block until either the root region location is available or we're shutting * down. @@ -1164,7 +1164,7 @@ public class RegionManager implements HC } } } - + /** * Return the number of meta regions. * @return number of meta regions @@ -1172,7 +1172,7 @@ public class RegionManager implements HC public int numMetaRegions() { return numberOfMetaRegions.get(); } - + /** * Bump the count of meta regions up one */ @@ -1221,9 +1221,9 @@ public class RegionManager implements HC synchronized (rootRegionLocation) { rootRegionLocation.set(new HServerAddress(address)); rootRegionLocation.notifyAll(); - } + } } - + /** * Set the number of meta regions. * @param num Number of meta regions @@ -1317,7 +1317,7 @@ public class RegionManager implements HC applyActions(serverInfo, returnMsgs, this.regionsToMajorCompact, HMsg.Type.MSG_REGION_MAJOR_COMPACT); } - + private void applyActions(final HServerInfo serverInfo, final ArrayList returnMsgs, final SortedMap> map, @@ -1342,28 +1342,28 @@ public class RegionManager implements HC * Class to balance region servers load. * It keeps Region Servers load in slop range by unassigning Regions * from most loaded servers. - * + * * Equilibrium is reached when load of all serves are in slop range - * [avgLoadMinusSlop, avgLoadPlusSlop], where + * [avgLoadMinusSlop, avgLoadPlusSlop], where * avgLoadPlusSlop = Math.ceil(avgLoad * (1 + this.slop)), and * avgLoadMinusSlop = Math.floor(avgLoad * (1 - this.slop)) - 1. */ private class LoadBalancer { private float slop; // hbase.regions.slop private final int maxRegToClose; // hbase.regions.close.max - + LoadBalancer(Configuration conf) { this.slop = conf.getFloat("hbase.regions.slop", (float)0.3); if (this.slop <= 0) this.slop = 1; //maxRegToClose to constrain balance closing per one iteration - // -1 to turn off + // -1 to turn off // TODO: change default in HBASE-862, need a suggestion this.maxRegToClose = conf.getInt("hbase.regions.close.max", -1); } /** * Balance server load by unassigning some regions. - * + * * @param info - server info * @param mostLoadedRegions - array of most loaded regions * @param returnMsgs - array of return massages @@ -1377,27 +1377,27 @@ public class RegionManager implements HC if(servLoad.getLoad() <= Math.ceil(avg) || avg <= 2.0) { return; } - + // check if current server is overloaded int numRegionsToClose = balanceFromOverloaded(servLoad, avg); - + // check if we can unload server by low loaded servers if(numRegionsToClose <= 0) { - numRegionsToClose = balanceToLowloaded(info.getServerName(), servLoad, + numRegionsToClose = balanceToLowloaded(info.getServerName(), servLoad, avg); } - + if(maxRegToClose > 0) { numRegionsToClose = Math.min(numRegionsToClose, maxRegToClose); } - + if(numRegionsToClose > 0) { - unassignSomeRegions(info, numRegionsToClose, mostLoadedRegions, + unassignSomeRegions(info, numRegionsToClose, mostLoadedRegions, returnMsgs); } } - /* + /* * Check if server load is not overloaded (with load > avgLoadPlusSlop). * @return number of regions to unassign. */ @@ -1414,12 +1414,12 @@ public class RegionManager implements HC return 0; } - /* - * Check if server is most loaded and can be unloaded to + /* + * Check if server is most loaded and can be unloaded to * low loaded servers (with load < avgLoadMinusSlop). * @return number of regions to unassign. */ - private int balanceToLowloaded(String srvName, HServerLoad srvLoad, + private int balanceToLowloaded(String srvName, HServerLoad srvLoad, double avgLoad) { SortedMap> loadToServers = @@ -1427,18 +1427,18 @@ public class RegionManager implements HC // check if server most loaded if (!loadToServers.get(loadToServers.lastKey()).contains(srvName)) return 0; - + // this server is most loaded, we will try to unload it by lowest // loaded servers int avgLoadMinusSlop = (int)Math.floor(avgLoad * (1 - this.slop)) - 1; int lowestLoad = loadToServers.firstKey().getNumberOfRegions(); - + if(lowestLoad >= avgLoadMinusSlop) return 0; // there is no low loaded servers - + int lowSrvCount = loadToServers.get(loadToServers.firstKey()).size(); int numRegionsToClose = 0; - + int numSrvRegs = srvLoad.getNumberOfRegions(); int numMoveToLowLoaded = (avgLoadMinusSlop - lowestLoad) * lowSrvCount; numRegionsToClose = numSrvRegs - (int)Math.ceil(avgLoad); @@ -1494,7 +1494,7 @@ public class RegionManager implements HC */ static class RegionState implements Comparable { private final HRegionInfo regionInfo; - + enum State { UNASSIGNED, // awaiting a server to be assigned PENDING_OPEN, // told a server to open, hasn't opened yet @@ -1502,13 +1502,13 @@ public class RegionManager implements HC CLOSING, // a msg has been enqueued to close ths region, but not delivered to RS yet PENDING_CLOSE, // msg has been delivered to RS to close this region CLOSED // region has been closed but not yet marked in meta - + } - + private State state; - + private boolean isOfflined; - + /* Set when region is assigned or closing */ private String serverName = null; @@ -1517,11 +1517,11 @@ public class RegionManager implements HC this.regionInfo = info; this.state = state; } - + synchronized HRegionInfo getRegionInfo() { return this.regionInfo; } - + synchronized byte [] getRegionName() { return this.regionInfo.getRegionName(); } @@ -1537,7 +1537,7 @@ public class RegionManager implements HC * @return true if the region is being opened */ synchronized boolean isOpening() { - return state == State.UNASSIGNED || + return state == State.UNASSIGNED || state == State.PENDING_OPEN || state == State.OPEN; } @@ -1550,7 +1550,7 @@ public class RegionManager implements HC } /* - * Note: callers of this method (reassignRootRegion, + * Note: callers of this method (reassignRootRegion, * regionsAwaitingAssignment, setUnassigned) ensure that this method is not * called unless it is safe to do so. */ @@ -1596,7 +1596,7 @@ public class RegionManager implements HC this.serverName = serverName; this.isOfflined = setOffline; } - + synchronized boolean isPendingClose() { return state == State.PENDING_CLOSE; } @@ -1612,7 +1612,7 @@ public class RegionManager implements HC synchronized boolean isClosed() { return state == State.CLOSED; } - + synchronized void setClosed() { if (state != State.PENDING_CLOSE && state != State.PENDING_OPEN && @@ -1623,7 +1623,7 @@ public class RegionManager implements HC } state = State.CLOSED; } - + synchronized boolean isOfflined() { return (state == State.CLOSING || state == State.PENDING_CLOSE) && isOfflined; @@ -1634,7 +1634,7 @@ public class RegionManager implements HC return ("name=" + Bytes.toString(getRegionName()) + ", state=" + this.state); } - + @Override public boolean equals(Object o) { if (this == o) { @@ -1645,12 +1645,12 @@ public class RegionManager implements HC } return this.compareTo((RegionState) o) == 0; } - + @Override public int hashCode() { return Bytes.toString(getRegionName()).hashCode(); } - + public int compareTo(RegionState o) { if (o == null) { return 1; Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/RegionServerOperation.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/RegionServerOperation.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/RegionServerOperation.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/RegionServerOperation.java Fri May 7 19:26:45 2010 @@ -28,13 +28,13 @@ import java.util.concurrent.Delayed; import java.util.concurrent.TimeUnit; abstract class RegionServerOperation implements Delayed, HConstants { - protected static final Log LOG = + protected static final Log LOG = LogFactory.getLog(RegionServerOperation.class.getName()); - + private long expire; protected final HMaster master; private int delay; - + protected RegionServerOperation(HMaster master) { this.master = master; this.delay = this.master.getConfiguration(). @@ -63,12 +63,12 @@ abstract class RegionServerOperation imp void setDelay(final int d) { this.delay = d; } - + public int compareTo(Delayed o) { return Long.valueOf(getDelay(TimeUnit.MILLISECONDS) - o.getDelay(TimeUnit.MILLISECONDS)).intValue(); } - + protected void requeue() { this.master.getRegionServerOperationQueue().putOnDelayQueue(this); } @@ -97,9 +97,9 @@ abstract class RegionServerOperation imp // in the run queue, put this request on the delay queue to give // other threads the opportunity to get the meta regions on-line. if (LOG.isDebugEnabled()) { - LOG.debug("numberOfMetaRegions: " + + LOG.debug("numberOfMetaRegions: " + master.getRegionManager().numMetaRegions() + - ", onlineMetaRegions.size(): " + + ", onlineMetaRegions.size(): " + master.getRegionManager().numOnlineMetaRegions()); LOG.debug("Requeuing because not all meta regions are online"); } Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/RegionServerOperationQueue.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/RegionServerOperationQueue.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/RegionServerOperationQueue.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/RegionServerOperationQueue.java Fri May 7 19:26:45 2010 @@ -51,7 +51,7 @@ import org.apache.hadoop.ipc.RemoteExcep public class RegionServerOperationQueue { // TODO: Build up the junit test of this class. private final Log LOG = LogFactory.getLog(this.getClass()); - + /** * Enums returned by {@link RegionServerOperationQueue#process()}; */ @@ -114,7 +114,7 @@ public class RegionServerOperationQueue * @return {@link ProcessingResultCode#PROCESSED}, * {@link ProcessingResultCode#REQUEUED}, * {@link ProcessingResultCode#REQUEUED_BUT_PROBLEM} - */ + */ public synchronized ProcessingResultCode process(final HServerAddress rootRegionLocation) { RegionServerOperation op = null; // Only process the delayed queue if root region is online. If offline, Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/RetryableMetaOperation.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/RetryableMetaOperation.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/RetryableMetaOperation.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/RetryableMetaOperation.java Fri May 7 19:26:45 2010 @@ -44,16 +44,16 @@ abstract class RetryableMetaOperation protected final Sleeper sleeper; protected final MetaRegion m; protected final HMaster master; - + protected HRegionInterface server; - + protected RetryableMetaOperation(MetaRegion m, HMaster master) { this.m = m; this.master = master; this.sleeper = new Sleeper(this.master.getThreadWakeFrequency(), this.master.getClosed()); } - + protected T doWithRetries() throws IOException, RuntimeException { List exceptions = new ArrayList(); @@ -77,7 +77,7 @@ abstract class RetryableMetaOperation if (tries == this.master.getNumRetries() - 1) { if (LOG.isDebugEnabled()) { StringBuilder message = new StringBuilder( - "Trying to contact region server for regionName '" + + "Trying to contact region server for regionName '" + Bytes.toString(m.getRegionName()) + "', but failed after " + (tries + 1) + " attempts.\n"); int i = 1; @@ -98,6 +98,6 @@ abstract class RetryableMetaOperation } this.sleeper.sleep(); } - return null; + return null; } } \ No newline at end of file Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/RootScanner.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/RootScanner.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/RootScanner.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/RootScanner.java Fri May 7 19:26:45 2010 @@ -61,7 +61,7 @@ class RootScanner extends BaseScanner { // Make sure the file system is still available master.checkFileSystem(); } catch (Exception e) { - // If for some reason we get some other kind of exception, + // If for some reason we get some other kind of exception, // at least log it rather than go out silently. LOG.error("Unexpected exception", e); } Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java Fri May 7 19:26:45 2010 @@ -54,7 +54,7 @@ import java.util.concurrent.atomic.Atomi import java.util.concurrent.atomic.AtomicInteger; /** - * The ServerManager class manages info about region servers - HServerInfo, + * The ServerManager class manages info about region servers - HServerInfo, * load numbers, dying servers, etc. */ public class ServerManager implements HConstants { @@ -84,10 +84,10 @@ public class ServerManager implements HC Collections.synchronizedSortedMap(new TreeMap>()); // Map of server names -> server load private final Map serversToLoad = - new ConcurrentHashMap(); + new ConcurrentHashMap(); private HMaster master; - + /* The regionserver will not be assigned or asked close regions if it * is currently opening >= this many regions. */ @@ -127,7 +127,7 @@ public class ServerManager implements HC sb.append("]"); deadServersList = sb.toString(); } - LOG.info(numServers + " region servers, " + numDeadServers + + LOG.info(numServers + " region servers, " + numDeadServers + " dead, average load " + averageLoad + (deadServersList != null? deadServers: "")); } @@ -161,7 +161,7 @@ public class ServerManager implements HC * @param serverInfo * @throws Leases.LeaseStillHeldException */ - void regionServerStartup(final HServerInfo serverInfo) + void regionServerStartup(final HServerInfo serverInfo) throws Leases.LeaseStillHeldException { HServerInfo info = new HServerInfo(serverInfo); String serverName = info.getServerName(); @@ -241,14 +241,14 @@ public class ServerManager implements HC /** * Called to process the messages sent from the region server to the master * along with the heart beat. - * + * * @param serverInfo * @param msgs * @param mostLoadedRegions Array of regions the region server is submitting * as candidates to be rebalanced, should it be overloaded * @return messages from master to region server indicating what region * server should do. - * + * * @throws IOException */ HMsg [] regionServerReport(final HServerInfo serverInfo, @@ -305,12 +305,12 @@ public class ServerManager implements HC // This state is reachable if: // // 1) RegionServer A started - // 2) RegionServer B started on the same machine, then + // 2) RegionServer B started on the same machine, then // clobbered A in regionServerStartup. // 3) RegionServer A returns, expecting to work as usual. // // The answer is to ask A to shut down for good. - + if (LOG.isDebugEnabled()) { LOG.debug("region server race condition detected: " + info.getServerName()); @@ -320,7 +320,7 @@ public class ServerManager implements HC removeServerInfo(info.getServerName(), info.getServerAddress()); this.serversToServerInfo.notifyAll(); } - + return new HMsg[] {HMsg.REGIONSERVER_STOP}; } else { return processRegionServerAllsWell(info, mostLoadedRegions, msgs); @@ -329,9 +329,9 @@ public class ServerManager implements HC /* * Region server is exiting with a clean shutdown. - * + * * In this case, the server sends MSG_REPORT_EXITING in msgs[0] followed by - * a MSG_REPORT_CLOSE for each region it was serving. + * a MSG_REPORT_CLOSE for each region it was serving. * @param serverInfo * @param msgs */ @@ -367,7 +367,7 @@ public class ServerManager implements HC } } } - + // There should not be any regions in transition for this server - the // server should finish transitions itself before closing Map inTransition = @@ -459,7 +459,7 @@ public class ServerManager implements HC case MSG_REPORT_PROCESS_OPEN: openingCount++; break; - + case MSG_REPORT_OPEN: processRegionOpen(serverInfo, region, returnMsgs); break; @@ -472,7 +472,7 @@ public class ServerManager implements HC processSplitRegion(region, incomingMsgs[++i].getRegionInfo(), incomingMsgs[++i].getRegionInfo()); break; - + case MSG_REPORT_SPLIT_INCLUDES_DAUGHTERS: processSplitRegion(region, incomingMsgs[i].getDaughterA(), incomingMsgs[i].getDaughterB()); @@ -494,7 +494,7 @@ public class ServerManager implements HC } // Figure out what the RegionServer ought to do, and write back. - + // Should we tell it close regions because its overloaded? If its // currently opening regions, leave it alone till all are open. if (openingCount < this.nobalancingCount) { @@ -520,7 +520,7 @@ public class ServerManager implements HC synchronized (master.getRegionManager()) { // Cancel any actions pending for the affected region. // This prevents the master from sending a SPLIT message if the table - // has already split by the region server. + // has already split by the region server. this.master.getRegionManager().endActions(region.getRegionName()); assignSplitDaughter(a); assignSplitDaughter(b); @@ -565,7 +565,7 @@ public class ServerManager implements HC * @param region * @param returnMsgs */ - private void processRegionOpen(HServerInfo serverInfo, + private void processRegionOpen(HServerInfo serverInfo, HRegionInfo region, ArrayList returnMsgs) { boolean duplicateAssignment = false; synchronized (master.getRegionManager()) { @@ -586,7 +586,7 @@ public class ServerManager implements HC } } else { // Not root region. If it is not a pending region, then we are - // going to treat it as a duplicate assignment, although we can't + // going to treat it as a duplicate assignment, although we can't // tell for certain that's the case. if (this.master.getRegionManager().isPendingOpen( region.getRegionNameAsString())) { @@ -596,20 +596,20 @@ public class ServerManager implements HC duplicateAssignment = true; } } - + if (duplicateAssignment) { LOG.warn("region server " + serverInfo.getServerAddress().toString() + " should not have opened region " + Bytes.toString(region.getRegionName())); // This Region should not have been opened. - // Ask the server to shut it down, but don't report it as closed. - // Otherwise the HMaster will think the Region was closed on purpose, + // Ask the server to shut it down, but don't report it as closed. + // Otherwise the HMaster will think the Region was closed on purpose, // and then try to reopen it elsewhere; that's not what we want. returnMsgs.add(new HMsg(HMsg.Type.MSG_REGION_CLOSE_WITHOUT_REPORT, region, "Duplicate assignment".getBytes())); } else { if (region.isRootRegion()) { - // it was assigned, and it's not a duplicate assignment, so take it out + // it was assigned, and it's not a duplicate assignment, so take it out // of the unassigned list. this.master.getRegionManager().removeRegion(region); @@ -666,7 +666,7 @@ public class ServerManager implements HC this.master.getRegionServerOperationQueue().put(op); } } - + /** Update a server load information because it's shutting down*/ private boolean removeServerInfo(final String serverName, final HServerAddress serverAddress) { @@ -713,9 +713,9 @@ public class ServerManager implements HC } } - /** - * Compute the average load across all region servers. - * Currently, this uses a very naive computation - just uses the number of + /** + * Compute the average load across all region servers. + * Currently, this uses a very naive computation - just uses the number of * regions being served, ignoring stats about number of requests. * @return the average load */ @@ -813,7 +813,7 @@ public class ServerManager implements HC } } } - + /** Watcher triggered when a RS znode is deleted */ private class ServerExpirer implements Watcher { private String server; Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/TableDelete.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/TableDelete.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/TableDelete.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/TableDelete.java Fri May 7 19:26:45 2010 @@ -31,7 +31,7 @@ import org.apache.hadoop.hbase.util.Byte import java.io.IOException; -/** +/** * Instantiated to delete a table. Table must be offline. */ class TableDelete extends TableOperation { @@ -63,13 +63,13 @@ class TableDelete extends TableOperation HRegion.removeRegionFromMETA(server, m.getRegionName(), i.getRegionName()); HRegion.deleteRegion(this.master.getFileSystem(), this.master.getRootDir(), i); - + } catch (IOException e) { LOG.error("failed to delete region " + Bytes.toString(i.getRegionName()), RemoteExceptionHandler.checkIOException(e)); } } - + // delete the table's folder from fs. this.master.getFileSystem().delete(new Path(this.master.getRootDir(), Bytes.toString(this.tableName)), true); Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ZKMasterAddressWatcher.java URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ZKMasterAddressWatcher.java?rev=942186&r1=942185&r2=942186&view=diff ============================================================================== --- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ZKMasterAddressWatcher.java (original) +++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ZKMasterAddressWatcher.java Fri May 7 19:26:45 2010 @@ -71,7 +71,7 @@ class ZKMasterAddressWatcher implements LOG.debug("Master address ZNode deleted, notifying waiting masters"); notifyAll(); } - } else if(type.equals(EventType.NodeCreated) && + } else if(type.equals(EventType.NodeCreated) && event.getPath().equals(this.zookeeper.clusterStateZNode)) { LOG.debug("Resetting watch on cluster state node."); this.zookeeper.setClusterStateWatch(this);