You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by mb...@apache.org on 2014/11/04 13:35:35 UTC

[1/3] git commit: HBASE-12414 Move HFileLink.exists() to base class

Repository: hbase
Updated Branches:
  refs/heads/0.98 3c08eb021 -> 8b0fed475
  refs/heads/branch-1 c84b13514 -> b827b6d02
  refs/heads/master 371bb39ee -> 7442e5bd6


HBASE-12414 Move HFileLink.exists() to base class


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/8b0fed47
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/8b0fed47
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/8b0fed47

Branch: refs/heads/0.98
Commit: 8b0fed475e629f2298c440223513573a7de3e593
Parents: 3c08eb0
Author: Matteo Bertozzi <ma...@cloudera.com>
Authored: Tue Nov 4 12:25:51 2014 +0000
Committer: Matteo Bertozzi <ma...@cloudera.com>
Committed: Tue Nov 4 12:25:51 2014 +0000

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/io/FileLink.java    | 29 ++++++++++++++------
 .../org/apache/hadoop/hbase/io/HFileLink.java   |  9 ------
 2 files changed, 20 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/8b0fed47/hbase-server/src/main/java/org/apache/hadoop/hbase/io/FileLink.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/FileLink.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/FileLink.java
index f7340bf..b7cab0f 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/FileLink.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/FileLink.java
@@ -337,22 +337,33 @@ public class FileLink {
   public String toString() {
     StringBuilder str = new StringBuilder(getClass().getName());
     str.append(" locations=[");
-    int i = 0;
-    for (Path location: locations) {
-      if (i++ > 0) str.append(", ");
-      str.append(location.toString());
+    for (int i = 0; i < locations.length; ++i) {
+      if (i > 0) str.append(", ");
+      str.append(locations[i].toString());
     }
     str.append("]");
     return str.toString();
   }
 
   /**
+   * @return true if the file pointed by the link exists
+   */
+  public boolean exists(final FileSystem fs) throws IOException {
+    for (int i = 0; i < locations.length; ++i) {
+      if (fs.exists(locations[i])) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  /**
    * @return the path of the first available link.
    */
   public Path getAvailablePath(FileSystem fs) throws IOException {
-    for (Path path: locations) {
-      if (fs.exists(path)) {
-        return path;
+    for (int i = 0; i < locations.length; ++i) {
+      if (fs.exists(locations[i])) {
+        return locations[i];
       }
     }
     throw new FileNotFoundException("Unable to open link: " + this);
@@ -366,9 +377,9 @@ public class FileLink {
    * @throws IOException on unexpected error.
    */
   public FileStatus getFileStatus(FileSystem fs) throws IOException {
-    for (Path path: locations) {
+    for (int i = 0; i < locations.length; ++i) {
       try {
-        return fs.getFileStatus(path);
+        return fs.getFileStatus(locations[i]);
       } catch (FileNotFoundException e) {
         // Try another file location
       }

http://git-wip-us.apache.org/repos/asf/hbase/blob/8b0fed47/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HFileLink.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HFileLink.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HFileLink.java
index 3926759..2ef59d1 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HFileLink.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HFileLink.java
@@ -246,15 +246,6 @@ public class HFileLink extends FileLink {
   }
 
   /**
-   * Returns true if the HFileLink exists
-   */
-  public boolean exists(final FileSystem fs) throws IOException {
-    return fs.exists(this.originPath) ||
-           fs.exists(this.tempPath) ||
-           fs.exists(this.archivePath);
-  }
-
-  /**
    * Create a new HFileLink name
    *
    * @param hfileRegionInfo - Linked HFile Region Info


[2/3] git commit: HBASE-12414 Move HFileLink.exists() to base class

Posted by mb...@apache.org.
HBASE-12414 Move HFileLink.exists() to base class


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/b827b6d0
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/b827b6d0
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/b827b6d0

Branch: refs/heads/branch-1
Commit: b827b6d02e110ea23f48e3a66da99abec1463873
Parents: c84b135
Author: Matteo Bertozzi <ma...@cloudera.com>
Authored: Tue Nov 4 12:25:51 2014 +0000
Committer: Matteo Bertozzi <ma...@cloudera.com>
Committed: Tue Nov 4 12:31:21 2014 +0000

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/io/FileLink.java    | 29 ++++++++++++++------
 .../org/apache/hadoop/hbase/io/HFileLink.java   |  9 ------
 2 files changed, 20 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/b827b6d0/hbase-server/src/main/java/org/apache/hadoop/hbase/io/FileLink.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/FileLink.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/FileLink.java
index f7340bf..b7cab0f 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/FileLink.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/FileLink.java
@@ -337,22 +337,33 @@ public class FileLink {
   public String toString() {
     StringBuilder str = new StringBuilder(getClass().getName());
     str.append(" locations=[");
-    int i = 0;
-    for (Path location: locations) {
-      if (i++ > 0) str.append(", ");
-      str.append(location.toString());
+    for (int i = 0; i < locations.length; ++i) {
+      if (i > 0) str.append(", ");
+      str.append(locations[i].toString());
     }
     str.append("]");
     return str.toString();
   }
 
   /**
+   * @return true if the file pointed by the link exists
+   */
+  public boolean exists(final FileSystem fs) throws IOException {
+    for (int i = 0; i < locations.length; ++i) {
+      if (fs.exists(locations[i])) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  /**
    * @return the path of the first available link.
    */
   public Path getAvailablePath(FileSystem fs) throws IOException {
-    for (Path path: locations) {
-      if (fs.exists(path)) {
-        return path;
+    for (int i = 0; i < locations.length; ++i) {
+      if (fs.exists(locations[i])) {
+        return locations[i];
       }
     }
     throw new FileNotFoundException("Unable to open link: " + this);
@@ -366,9 +377,9 @@ public class FileLink {
    * @throws IOException on unexpected error.
    */
   public FileStatus getFileStatus(FileSystem fs) throws IOException {
-    for (Path path: locations) {
+    for (int i = 0; i < locations.length; ++i) {
       try {
-        return fs.getFileStatus(path);
+        return fs.getFileStatus(locations[i]);
       } catch (FileNotFoundException e) {
         // Try another file location
       }

http://git-wip-us.apache.org/repos/asf/hbase/blob/b827b6d0/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HFileLink.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HFileLink.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HFileLink.java
index 3926759..2ef59d1 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HFileLink.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HFileLink.java
@@ -246,15 +246,6 @@ public class HFileLink extends FileLink {
   }
 
   /**
-   * Returns true if the HFileLink exists
-   */
-  public boolean exists(final FileSystem fs) throws IOException {
-    return fs.exists(this.originPath) ||
-           fs.exists(this.tempPath) ||
-           fs.exists(this.archivePath);
-  }
-
-  /**
    * Create a new HFileLink name
    *
    * @param hfileRegionInfo - Linked HFile Region Info


[3/3] git commit: HBASE-12414 Move HFileLink.exists() to base class

Posted by mb...@apache.org.
HBASE-12414 Move HFileLink.exists() to base class


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/7442e5bd
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/7442e5bd
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/7442e5bd

Branch: refs/heads/master
Commit: 7442e5bd623c383272397f6c5b99cc435b4d107f
Parents: 371bb39
Author: Matteo Bertozzi <ma...@cloudera.com>
Authored: Tue Nov 4 12:25:51 2014 +0000
Committer: Matteo Bertozzi <ma...@cloudera.com>
Committed: Tue Nov 4 12:33:29 2014 +0000

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/io/FileLink.java    | 29 ++++++++++++++------
 .../org/apache/hadoop/hbase/io/HFileLink.java   |  9 ------
 2 files changed, 20 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/7442e5bd/hbase-server/src/main/java/org/apache/hadoop/hbase/io/FileLink.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/FileLink.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/FileLink.java
index f7340bf..b7cab0f 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/FileLink.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/FileLink.java
@@ -337,22 +337,33 @@ public class FileLink {
   public String toString() {
     StringBuilder str = new StringBuilder(getClass().getName());
     str.append(" locations=[");
-    int i = 0;
-    for (Path location: locations) {
-      if (i++ > 0) str.append(", ");
-      str.append(location.toString());
+    for (int i = 0; i < locations.length; ++i) {
+      if (i > 0) str.append(", ");
+      str.append(locations[i].toString());
     }
     str.append("]");
     return str.toString();
   }
 
   /**
+   * @return true if the file pointed by the link exists
+   */
+  public boolean exists(final FileSystem fs) throws IOException {
+    for (int i = 0; i < locations.length; ++i) {
+      if (fs.exists(locations[i])) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  /**
    * @return the path of the first available link.
    */
   public Path getAvailablePath(FileSystem fs) throws IOException {
-    for (Path path: locations) {
-      if (fs.exists(path)) {
-        return path;
+    for (int i = 0; i < locations.length; ++i) {
+      if (fs.exists(locations[i])) {
+        return locations[i];
       }
     }
     throw new FileNotFoundException("Unable to open link: " + this);
@@ -366,9 +377,9 @@ public class FileLink {
    * @throws IOException on unexpected error.
    */
   public FileStatus getFileStatus(FileSystem fs) throws IOException {
-    for (Path path: locations) {
+    for (int i = 0; i < locations.length; ++i) {
       try {
-        return fs.getFileStatus(path);
+        return fs.getFileStatus(locations[i]);
       } catch (FileNotFoundException e) {
         // Try another file location
       }

http://git-wip-us.apache.org/repos/asf/hbase/blob/7442e5bd/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HFileLink.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HFileLink.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HFileLink.java
index 3926759..2ef59d1 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HFileLink.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HFileLink.java
@@ -246,15 +246,6 @@ public class HFileLink extends FileLink {
   }
 
   /**
-   * Returns true if the HFileLink exists
-   */
-  public boolean exists(final FileSystem fs) throws IOException {
-    return fs.exists(this.originPath) ||
-           fs.exists(this.tempPath) ||
-           fs.exists(this.archivePath);
-  }
-
-  /**
    * Create a new HFileLink name
    *
    * @param hfileRegionInfo - Linked HFile Region Info