hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r599138 - in /lucene/hadoop/trunk/src/contrib/hbase: CHANGES.txt src/java/org/apache/hadoop/hbase/HConnectionManager.java src/java/org/apache/hadoop/hbase/HMaster.java src/java/org/apache/hadoop/hbase/HTable.java
Date Wed, 28 Nov 2007 20:38:01 GMT
Author: jimk
Date: Wed Nov 28 12:38:00 2007
New Revision: 599138

URL: http://svn.apache.org/viewvc?rev=599138&view=rev
Log:
HADOOP-2261 HTable.abort no longer throws exception if there is no active update.
HADOOP-2287 Make hbase unit tests take less time to complete.
HADOOP-2262 Retry n times instead of n**2 times.

Modified:
    lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt
    lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HConnectionManager.java
    lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HMaster.java
    lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HTable.java

Modified: lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt?rev=599138&r1=599137&r2=599138&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt (original)
+++ lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt Wed Nov 28 12:38:00 2007
@@ -51,9 +51,10 @@
     HADOOP-2139 (phase 2) Make region server more event driven
     HADOOP-2289 Useless efforts of looking for the non-existant table in select
                 command.
-    HADOOP-2262 HADOOP-2261 fail fast on non-existing table, change abort to
-                function after commit even if commit was successful
     HADOOP-2257 Show a total of all requests and regions on the web ui
+    HADOOP-2261 HTable.abort no longer throws exception if there is no active update.
+    HADOOP-2287 Make hbase unit tests take less time to complete.
+    HADOOP-2262 Retry n times instead of n**2 times.
 
 Release 0.15.1
 Branch 0.15

Modified: lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HConnectionManager.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HConnectionManager.java?rev=599138&r1=599137&r2=599138&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HConnectionManager.java
(original)
+++ lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HConnectionManager.java
Wed Nov 28 12:38:00 2007
@@ -503,9 +503,6 @@
         }
         if (!waited) {
           try {
-            for (int tries = 0; tries < numRetries; tries++) {
-              boolean success = true;                         // assume this works
-
               SortedMap<Text, HRegionLocation> metaServers =
                 this.tablesToServers.get(META_TABLE_NAME);
               if (metaServers == null) {
@@ -515,22 +512,9 @@
               metaServers = metaServers.tailMap(firstMetaRegion);
 
               for (HRegionLocation t: metaServers.values()) {
-                try {
                   srvrs.putAll(scanOneMetaRegion(t, tableName));
-
-                } catch (IOException e) {
-                  if (tries < numRetries - 1) {
-                    metaServers = findServersForTable(META_TABLE_NAME);
-                    success = false;
-                    break;
-                  }
-                  throw e;
-                }
-              }
-              if (success) {
-                break;
               }
-            }
+
           } finally {
             synchronized (this.tablesBeingLocated) {
               // Wake up the threads waiting for us to find the table
@@ -738,9 +722,6 @@
                 regionInfo, new HServerAddress(serverAddress)));
           }
         } catch (IOException e) {
-          if (e instanceof TableNotFoundException) {
-            throw e;                                    // don't retry
-          }
           if (tries == numRetries - 1) {                // no retries left
             if (e instanceof RemoteException) {
               e = RemoteExceptionHandler.decodeRemoteException((RemoteException) e);

Modified: lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HMaster.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HMaster.java?rev=599138&r1=599137&r2=599138&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HMaster.java (original)
+++ lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HMaster.java Wed
Nov 28 12:38:00 2007
@@ -1296,39 +1296,45 @@
     String serverName = serverInfo.getServerAddress().toString().trim();
     long serverLabel = getServerLabel(serverName);
     if (msgs.length > 0 && msgs[0].getMsg() == HMsg.MSG_REPORT_EXITING) {
-      // HRegionServer is shutting down. Cancel the server's lease.
-      // Note that canceling the server's lease takes care of updating
-      // serversToServerInfo, etc.
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("Region server " + serverName +
+      synchronized (serversToServerInfo) {
+        try {
+          // HRegionServer is shutting down. Cancel the server's lease.
+          // Note that canceling the server's lease takes care of updating
+          // serversToServerInfo, etc.
+          if (LOG.isDebugEnabled()) {
+            LOG.debug("Region server " + serverName +
             ": MSG_REPORT_EXITING -- cancelling lease");
-      }
-      
-      if (cancelLease(serverName, serverLabel)) {
-        // Only process the exit message if the server still has a lease.
-        // Otherwise we could end up processing the server exit twice.
-        LOG.info("Region server " + serverName +
+          }
+
+          if (cancelLease(serverName, serverLabel)) {
+            // Only process the exit message if the server still has a lease.
+            // Otherwise we could end up processing the server exit twice.
+            LOG.info("Region server " + serverName +
             ": MSG_REPORT_EXITING -- lease cancelled");
-        // Get all the regions the server was serving reassigned
-        // (if we are not shutting down).
-        if (!closed.get()) {
-          for (int i = 1; i < msgs.length; i++) {
-            HRegionInfo info = msgs[i].getRegionInfo();
-            if (info.getTableDesc().getName().equals(ROOT_TABLE_NAME)) {
-              rootRegionLocation.set(null);
-            } else if (info.getTableDesc().getName().equals(META_TABLE_NAME)) {
-              onlineMetaRegions.remove(info.getStartKey());
+            // Get all the regions the server was serving reassigned
+            // (if we are not shutting down).
+            if (!closed.get()) {
+              for (int i = 1; i < msgs.length; i++) {
+                HRegionInfo info = msgs[i].getRegionInfo();
+                if (info.getTableDesc().getName().equals(ROOT_TABLE_NAME)) {
+                  rootRegionLocation.set(null);
+                } else if (info.getTableDesc().getName().equals(META_TABLE_NAME)) {
+                  onlineMetaRegions.remove(info.getStartKey());
+                }
+
+                this.unassignedRegions.put(info.getRegionName(), info);
+                this.assignAttempts.put(info.getRegionName(), Long.valueOf(0L));
+              }
             }
-
-            this.unassignedRegions.put(info.getRegionName(), info);
-            this.assignAttempts.put(info.getRegionName(), Long.valueOf(0L));
           }
+
+          // We don't need to return anything to the server because it isn't
+          // going to do any more work.
+          return new HMsg[0];
+        } finally {
+          serversToServerInfo.notifyAll();
         }
       }
-
-      // We don't need to return anything to the server because it isn't
-      // going to do any more work.
-      return new HMsg[0];
     }
 
     if (closed.get()) {
@@ -1433,9 +1439,6 @@
           loadToServers.put(load, servers);
         }
       }
-    }
-    synchronized (serversToServerInfo) {
-      serversToServerInfo.notifyAll();
     }
     return leaseCancelled;
   }

Modified: lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HTable.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HTable.java?rev=599138&r1=599137&r2=599138&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HTable.java (original)
+++ lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HTable.java Wed
Nov 28 12:38:00 2007
@@ -573,6 +573,32 @@
    * Start an atomic row insertion/update.  No changes are committed until the 
    * call to commit() returns. A call to abort() will abandon any updates in
    * progress.
+   * 
+   * <p>
+   * Example:
+   * <br>
+   * <pre><span style="font-family: monospace;">
+   * long lockid = table.startUpdate(new Text(article.getName()));
+   * for (File articleInfo: article.listFiles(new NonDirectories())) {
+   *   String article = null;
+   *   try {
+   *     DataInputStream in = new DataInputStream(new FileInputStream(articleInfo));
+   *     article = in.readUTF();
+   *   } catch (IOException e) {
+   *     // Input error - abandon update
+   *     table.abort(lockid);
+   *     throw e;
+   *   }
+   *   try {
+   *     table.put(lockid, columnName(articleInfo.getName()), article.getBytes());
+   *   } catch (RuntimeException e) {
+   *     // Put failed - abandon update
+   *     table.abort(lockid);
+   *     throw e;
+   *   }
+   * }
+   * table.commit(lockid);
+   * </span></pre>
    *
    * 
    * @param row Name of row to start update against.  Note, choose row names
@@ -686,7 +712,12 @@
   }
   
   /** 
-   * Abort a row mutation
+   * Abort a row mutation.
+   * 
+   * This method should be called only when an update has been started and it
+   * is determined that the update should not be committed.
+   * 
+   * Releases resources being held by the update in progress.
    *
    * @param lockid lock id returned from startUpdate
    */
@@ -699,12 +730,16 @@
   }
   
   /** 
-   * Finalize a row mutation
+   * Finalize a row mutation.
+   * 
    * When this method is specified, we pass the server a value that says use
    * the 'latest' timestamp.  If we are doing a put, on the server-side, cells
    * will be given the servers's current timestamp.  If the we are commiting
    * deletes, then delete removes the most recently modified cell of stipulated
    * column.
+   * 
+   * @see #commit(long, long)
+   * 
    * @param lockid lock id returned from startUpdate
    * @throws IOException
    */
@@ -713,7 +748,8 @@
   }
 
   /** 
-   * Finalize a row mutation
+   * Finalize a row mutation and release any resources associated with the update.
+   * 
    * @param lockid lock id returned from startUpdate
    * @param timestamp time to associate with the change
    * @throws IOException



Mime
View raw message