Author: eli
Date: Thu Jul 19 18:22:56 2012
New Revision: 1363457
URL: http://svn.apache.org/viewvc?rev=1363457&view=rev
Log:
HDFS-3673. libhdfs: fix some compiler warnings. Contributed by Colin Patrick
McCabe
Modified:
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs.c
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs.h
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs_test.h
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/jni_helper.c
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/test/test_libhdfs_read.c
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/test_libhdfs_threaded.c
Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1363457&r1=1363456&r2=1363457&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Thu Jul 19
18:22:56 2012
@@ -345,6 +345,8 @@ Branch-2 ( Unreleased changes )
HDFS-3666. Plumb more exception messages to terminate. (eli)
+ HDFS-3673. libhdfs: fix some compiler warnings. (Colin Patrick McCabe via
eli)
+
OPTIMIZATIONS
HDFS-2982. Startup performance suffers when there are many edit log
Modified:
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs.c
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs.c?rev=1363457&r1=1363456&r2=1363457&view=diff
==============================================================================
---
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs.c
(original)
+++
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs.c
Thu Jul 19 18:22:56 2012
@@ -275,7 +275,7 @@ done:
*/
static int jStrToCstr(JNIEnv *env, jstring jstr, char **cstr)
{
- char *tmp;
+ const char *tmp;
tmp = (*env)->GetStringUTFChars(env, jstr, NULL);
*cstr = strdup(tmp);
@@ -632,7 +632,7 @@ done:
if (ret)
errno = ret;
- return gFsRef;
+ return (hdfsFS)gFsRef;
}
int hdfsDisconnect(hdfsFS fs)
@@ -667,7 +667,7 @@ int hdfsDisconnect(hdfsFS fs)
}
//Release unnecessary references
- (*env)->DeleteGlobalRef(env, fs);
+ (*env)->DeleteGlobalRef(env, jFS);
return 0;
}
Modified:
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs.h
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs.h?rev=1363457&r1=1363456&r2=1363457&view=diff
==============================================================================
---
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs.h
(original)
+++
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs.h
Thu Jul 19 18:22:56 2012
@@ -81,15 +81,6 @@ extern "C" {
*/
int hdfsFileIsOpenForWrite(hdfsFile file);
- /**
- * Disable the direct read optimization for a file.
- *
- * This is mainly provided for unit testing purposes.
- *
- * @param file The HDFS file
- */
- void hdfsFileDisableDirectRead(hdfsFile file);
-
/**
* hdfsConnectAsUser - Connect to a hdfs file system as a specific user
* Connect to the hdfs.
@@ -101,7 +92,6 @@ extern "C" {
*/
hdfsFS hdfsConnectAsUser(const char* nn, tPort port, const char *user);
-
/**
* hdfsConnect - Connect to a hdfs file system.
* Connect to the hdfs.
Modified:
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs_test.h
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs_test.h?rev=1363457&r1=1363456&r2=1363457&view=diff
==============================================================================
---
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs_test.h
(original)
+++
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs_test.h
Thu Jul 19 18:22:56 2012
@@ -19,7 +19,7 @@
#ifndef LIBHDFS_HDFS_TEST_H
#define LIBHDFS_HDFS_TEST_H
-struct hdfs_internal;
+struct hdfsFile_internal;
/**
* Some functions that are visible only for testing.
@@ -38,7 +38,16 @@ extern "C" {
* @return 1 if the file is using the direct read optimization,
* 0 otherwise.
*/
- int hdfsFileUsesDirectRead(struct hdfs_internal *file);
+ int hdfsFileUsesDirectRead(struct hdfsFile_internal *file);
+
+ /**
+ * Disable the direct read optimization for a file.
+ *
+ * This is mainly provided for unit testing purposes.
+ *
+ * @param file The HDFS file
+ */
+ void hdfsFileDisableDirectRead(struct hdfsFile_internal *file);
#ifdef __cplusplus
}
#endif
Modified:
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/jni_helper.c
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/jni_helper.c?rev=1363457&r1=1363456&r2=1363457&view=diff
==============================================================================
---
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/jni_helper.c
(original)
+++
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/jni_helper.c
Thu Jul 19 18:22:56 2012
@@ -550,7 +550,8 @@ JNIEnv* getJNIEnv(void)
ret = pthread_key_create(&gTlsKey, hdfsThreadDestructor);
if (ret) {
pthread_mutex_unlock(&jvmMutex);
- fprintf("pthread_key_create failed with error %d\n", ret);
+ fprintf(stderr, "getJNIEnv: pthread_key_create failed with "
+ "error %d\n", ret);
return NULL;
}
gTlsKeyInitialized = 1;
@@ -569,7 +570,7 @@ JNIEnv* getJNIEnv(void)
}
tls = calloc(1, sizeof(struct hdfsTls));
if (!tls) {
- fprintf(stderr, "getJNIEnv: OOM allocating %d bytes\n",
+ fprintf(stderr, "getJNIEnv: OOM allocating %zd bytes\n",
sizeof(struct hdfsTls));
return NULL;
}
Modified:
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/test/test_libhdfs_read.c
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/test/test_libhdfs_read.c?rev=1363457&r1=1363456&r2=1363457&view=diff
==============================================================================
---
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/test/test_libhdfs_read.c
(original)
+++
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/test/test_libhdfs_read.c
Thu Jul 19 18:22:56 2012
@@ -35,7 +35,6 @@ int main(int argc, char **argv) {
}
const char* rfile = argv[1];
- tSize fileTotalSize = strtoul(argv[2], NULL, 10);
tSize bufferSize = strtoul(argv[3], NULL, 10);
hdfsFile readFile = hdfsOpenFile(fs, rfile, O_RDONLY, bufferSize, 0, 0);
Modified:
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/test_libhdfs_threaded.c
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/test_libhdfs_threaded.c?rev=1363457&r1=1363456&r2=1363457&view=diff
==============================================================================
---
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/test_libhdfs_threaded.c
(original)
+++
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/test_libhdfs_threaded.c
Thu Jul 19 18:22:56 2012
@@ -25,6 +25,7 @@
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#define TLH_MAX_THREADS 100