Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This page tells you how to work with Git. See HowToContribute How To Contribute for instructions on building and testing Hadoop.


Table of Contents

Key Git Concepts

The key concepts of Git.

...

You need a copy of git on your system. Some IDEs ship with Git support; this page assumes you are using the command line.

Clone a local Git repository from the Apache repository. The Hadoop subprojects (common, HDFS, and MapReduce) live inside a combined repository called `hadoop.git`.

Code Block
git clone git://git.apache.org/hadoop.git

...

Code Block
https://git-wip-usgitbox.apache.org/repos/asf/hadoop.git

...



Then generate a patch file listing the differences between your trunk and your branch

Code Block
git diff --no-prefix trunk > ../hadoop-patches/HDFS-775-1.patch

...

Code Block
diff --git src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
index 42ba15e..6383239 100644
--- src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
+++ src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
@@ -355,12 +355,14 @@ public class FSDataset implements FSConstants, FSDatasetInterface {
       return dfsUsage.getUsed();
     }

+    /**
+     * Calculate the capacity of the filesystem, after removing any
+     * reserved capacity.
+     * @return the unreserved number of bytes left in this filesystem. May be zero.
+     */
     long getCapacity() throws IOException {
-      if (reserved > usage.getCapacity()) {
-        return 0;
-      }
-
-      return usage.getCapacity()-reserved;
+      long remaining = usage.getCapacity() - reserved;
+      return remaining > 0 ? remaining : 0;
     }

     long getAvailable() throws IOException {

...


Updating your patch

If your patch is not immediately accepted, do not be offended: it happens to us all. It introduces a problem: your branches become out of date. You need to check out the latest apache version, merge your branches with it, and then push the changes back to GitHub.

...