Author: nigel Date: Fri Jun 29 09:27:42 2007 New Revision: 551947 URL: http://svn.apache.org/viewvc?view=rev&rev=551947 Log: HADOOP-1536. Remove file locks from libhdfs tests. Contributed by Dhruba.
Modified: lucene/hadoop/trunk/CHANGES.txt lucene/hadoop/trunk/src/c++/libhdfs/hdfs.c lucene/hadoop/trunk/src/c++/libhdfs/hdfs.h lucene/hadoop/trunk/src/c++/libhdfs/hdfs_test.c Modified: lucene/hadoop/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=551947&r1=551946&r2=551947 ============================================================================== --- lucene/hadoop/trunk/CHANGES.txt (original) +++ lucene/hadoop/trunk/CHANGES.txt Fri Jun 29 09:27:42 2007 @@ -265,6 +265,9 @@ 81. HADOOP-1485. Add metrics for monitoring shuffle. (Devaraj Das via cutting) + 82. HADOOP-1536. Remove file locks from libhdfs tests. + (Dhruba Borthakur via nigel) + Release 0.13.0 - 2007-06-08 Modified: lucene/hadoop/trunk/src/c++/libhdfs/hdfs.c URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/c%2B%2B/libhdfs/hdfs.c?view=diff&rev=551947&r1=551946&r2=551947 ============================================================================== --- lucene/hadoop/trunk/src/c++/libhdfs/hdfs.c (original) +++ lucene/hadoop/trunk/src/c++/libhdfs/hdfs.c Fri Jun 29 09:27:42 2007 @@ -948,81 +948,6 @@ -int hdfsLock(hdfsFS fs, const char* path, int shared) -{ - // JAVA EQUIVALENT: - // Path p = new Path(path); - // fs.lock(p); - - //Get the JNIEnv* corresponding to current thread - JNIEnv* env = getJNIEnv(); - - //Parameters - jobject jFS = (jobject)fs; - jboolean jb_shared = shared; - - //Create an object of org.apache.hadoop.fs.Path - jobject jPath = constructNewObjectOfPath(env, path); - if (jPath == NULL) { - return -1; - } - - //Lock the file - int retval = 0; - if (invokeMethod(env, NULL, INSTANCE, jFS, HADOOP_FS, - "lock", "(Lorg/apache/hadoop/fs/Path;Z)V", - jPath, jb_shared) != 0) { - fprintf(stderr, "Call to org.apache.fs.FileSystem::lock failed!\n"); - errno = EINTERNAL; - retval = -1; - } - - //Delete unnecessary local references - destroyLocalReference(env, jPath); - - return retval; -} - - - -int hdfsReleaseLock(hdfsFS fs, const char* path) -{ - // JAVA EQUIVALENT: - // Path f = new Path(path); - // fs.release(f); - - //Get the JNIEnv* corresponding to current thread - JNIEnv* env = getJNIEnv(); - - jobject jFS = (jobject)fs; - - //Create an object of java.io.File - jobject jPath = constructNewObjectOfPath(env, path); - if (jPath == NULL) { - return -1; - } - - //Release the lock on the file - int retval = 0; - if (invokeMethod(env, NULL, INSTANCE, jFS, HADOOP_FS, "release", - "(Lorg/apache/hadoop/fs/Path;)V", jPath) != 0) { - fprintf(stderr, "Call to org.apache.hadoop.fs.FileSystem::" - "release failed!\n"); - errno = EINTERNAL; - retval = -1; - goto done; - } - - done: - - //Delete unnecessary local references - destroyLocalReference(env, jPath); - - return retval; -} - - - char* hdfsGetWorkingDirectory(hdfsFS fs, char* buffer, size_t bufferSize) { // JAVA EQUIVALENT: Modified: lucene/hadoop/trunk/src/c++/libhdfs/hdfs.h URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/c%2B%2B/libhdfs/hdfs.h?view=diff&rev=551947&r1=551946&r2=551947 ============================================================================== --- lucene/hadoop/trunk/src/c++/libhdfs/hdfs.h (original) +++ lucene/hadoop/trunk/src/c++/libhdfs/hdfs.h Fri Jun 29 09:27:42 2007 @@ -267,25 +267,6 @@ int hdfsRename(hdfsFS fs, const char* oldPath, const char* newPath); - /** - * hdfsLock - Obtain a lock on the file. - * @param fs The configured filesystem handle. - * @param path The path of the file. - * @param shared Shared/exclusive lock-type. - * @return Returns 0 on success, -1 on error. - */ - int hdfsLock(hdfsFS fs, const char* path, int shared); - - - /** - * hdfsReleaseLock - Release the lock. - * @param fs The configured filesystem handle. - * @param path The path of the file. - * @return Returns 0 on success, -1 on error. - */ - int hdfsReleaseLock(hdfsFS fs, const char* path); - - /** * hdfsGetWorkingDirectory - Get the current working directory for * the given filesystem. Modified: lucene/hadoop/trunk/src/c++/libhdfs/hdfs_test.c URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/c%2B%2B/libhdfs/hdfs_test.c?view=diff&rev=551947&r1=551946&r2=551947 ============================================================================== --- lucene/hadoop/trunk/src/c++/libhdfs/hdfs_test.c (original) +++ lucene/hadoop/trunk/src/c++/libhdfs/hdfs_test.c Fri Jun 29 09:27:42 2007 @@ -138,11 +138,6 @@ fprintf(stderr, "hdfsCopy(remote-remote): %s\n", ((result = hdfsCopy(fs, srcPath, fs, dstPath)) ? "Failed!" : "Success!")); totalResult += result; - fprintf(stderr, "hdfsLock: %s\n", ((result = hdfsLock(fs, srcPath, 1)) ? "Failed!" : "Success!")); - totalResult += result; - fprintf(stderr, "hdfsReleaseLock: %s\n", ((result = hdfsReleaseLock(fs, srcPath)) ? "Failed!" : "Success!")); - totalResult += result; - const char* slashTmp = "/tmp"; const char* newDirectory = "/tmp/newdir"; fprintf(stderr, "hdfsCreateDirectory: %s\n", ((result = hdfsCreateDirectory(fs, newDirectory)) ? "Failed!" : "Success!"));