Author: eli
Date: Thu Jul 19 18:26:20 2012
New Revision: 1363460
URL: http://svn.apache.org/viewvc?rev=1363460&view=rev
Log:
HDFS-3675. libhdfs: follow documented return codes. Contributed by Colin
Patrick McCabe
Modified:
hadoop/common/branches/branch-2/hadoop-hdfs-project/ (props changed)
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/ (props
changed)
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/
(props changed)
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/native/
(props changed)
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs.c
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode/
(props changed)
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/
(props changed)
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/secondary/
(props changed)
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/hdfs/
(props changed)
Propchange: hadoop/common/branches/branch-2/hadoop-hdfs-project/
------------------------------------------------------------------------------
Merged /hadoop/common/trunk/hadoop-hdfs-project:r1363459
Propchange: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/
------------------------------------------------------------------------------
Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs:r1363459
Modified:
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1363460&r1=1363459&r2=1363460&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
(original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
Thu Jul 19 18:26:20 2012
@@ -163,6 +163,8 @@ Release 2.0.1-alpha - UNRELEASED
HDFS-3673. libhdfs: fix some compiler warnings. (Colin Patrick McCabe via
eli)
+ HDFS-3675. libhdfs: follow documented return codes. (Colin Patrick McCabe
via eli)
+
OPTIMIZATIONS
HDFS-2982. Startup performance suffers when there are many edit log
Propchange:
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/
------------------------------------------------------------------------------
Merged
/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java:r1363459
Propchange:
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/native/
------------------------------------------------------------------------------
Merged
/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native:r1363459
Modified:
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs.c
URL:
http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs.c?rev=1363460&r1=1363459&r2=1363460&view=diff
==============================================================================
---
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs.c
(original)
+++
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs.c
Thu Jul 19 18:26:20 2012
@@ -526,6 +526,7 @@ hdfsFS hdfsBuilderConnect(struct hdfsBui
if (jConfiguration == NULL) {
fprintf(stderr, "Can't construct instance of class "
"org.apache.hadoop.conf.Configuration\n");
+ errno = EINTERNAL;
goto done;
}
@@ -645,7 +646,7 @@ int hdfsDisconnect(hdfsFS fs)
if (env == NULL) {
errno = EINTERNAL;
- return -2;
+ return -1;
}
//Parameters
@@ -870,7 +871,7 @@ int hdfsCloseFile(hdfsFS fs, hdfsFile fi
if (env == NULL) {
errno = EINTERNAL;
- return -2;
+ return -1;
}
//Parameters
@@ -909,7 +910,7 @@ int hdfsExists(hdfsFS fs, const char *pa
JNIEnv *env = getJNIEnv();
if (env == NULL) {
errno = EINTERNAL;
- return -2;
+ return -1;
}
jobject jPath = constructNewObjectOfPath(env, path);
@@ -1420,9 +1421,9 @@ int hdfsCopy(hdfsFS srcFS, const char* s
if (jConfiguration == NULL) {
fprintf(stderr, "Can't construct instance of class "
"org.apache.hadoop.conf.Configuration\n");
- errno = EINTERNAL;
destroyLocalReference(env, jSrcPath);
destroyLocalReference(env, jDstPath);
+ errno = EINTERNAL;
return -1;
}
@@ -1493,9 +1494,9 @@ int hdfsMove(hdfsFS srcFS, const char* s
if (jConfiguration == NULL) {
fprintf(stderr, "Can't construct instance of class "
"org.apache.hadoop.conf.Configuration\n");
- errno = EINTERNAL;
destroyLocalReference(env, jSrcPath);
destroyLocalReference(env, jDstPath);
+ errno = EINTERNAL;
return -1;
}
@@ -1847,6 +1848,7 @@ int hdfsChown(hdfsFS fs, const char* pat
int hdfsChmod(hdfsFS fs, const char* path, short mode)
{
+ int ret;
// JAVA EQUIVALENT:
// fs.setPermission(path, FsPermission)
@@ -1866,18 +1868,18 @@ int hdfsChmod(hdfsFS fs, const char* pat
jobject jPermObj =
constructNewObjectOfClass(env, NULL, HADOOP_FSPERM,"(S)V",jmode);
if (jPermObj == NULL) {
- return -2;
+ errno = EINTERNAL;
+ return -1;
}
//Create an object of org.apache.hadoop.fs.Path
jobject jPath = constructNewObjectOfPath(env, path);
if (jPath == NULL) {
destroyLocalReference(env, jPermObj);
- return -3;
+ return -1;
}
//Create the directory
- int ret = 0;
jthrowable jExc = NULL;
if (invokeMethod(env, NULL, &jExc, INSTANCE, jFS, HADOOP_FS,
"setPermission", JMETHOD2(JPARAM(HADOOP_PATH),
JPARAM(HADOOP_FSPERM), JAVA_VOID),
@@ -1887,6 +1889,7 @@ int hdfsChmod(hdfsFS fs, const char* pat
ret = -1;
goto done;
}
+ ret = 0;
done:
destroyLocalReference(env, jPath);
@@ -1913,7 +1916,7 @@ int hdfsUtime(hdfsFS fs, const char* pat
jobject jPath = constructNewObjectOfPath(env, path);
if (jPath == NULL) {
fprintf(stderr, "could not construct path object\n");
- return -2;
+ return -1;
}
const tTime NO_CHANGE = -1;
Propchange:
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode/
------------------------------------------------------------------------------
Merged
/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode:r1363459
Propchange:
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/
------------------------------------------------------------------------------
Merged
/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs:r1363459
Propchange:
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/secondary/
------------------------------------------------------------------------------
Merged
/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/secondary:r1363459
Propchange:
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/hdfs/
------------------------------------------------------------------------------
Merged
/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/hdfs:r1363459