Skip to content

Commit d1dff3d

Browse files
author
Sahil Takiar
committed
CDH-77708: Revert "CDH-61933: Prevent excessive logging of UnsupportedOperationException"
(cherry picked from commit b267252) (cherry picked from commit 2a6b3aa) This reverts commit 79f3445. Change-Id: I169f1525b1e446f07d1a33886cd08e7335acbf02
1 parent 20c7fd7 commit d1dff3d

File tree

5 files changed

+7
-24
lines changed

5 files changed

+7
-24
lines changed

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs-tests/test_libhdfs_ops.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ int main(int argc, char **argv) {
9898
if(!lfs) {
9999
fprintf(stderr, "Oops! Failed to connect to 'local' hdfs!\n");
100100
exit(-1);
101-
}
101+
}
102102

103103
{
104104
//Write tests
@@ -183,7 +183,7 @@ int main(int argc, char **argv) {
183183
}
184184
fprintf(stderr, "Current position: %" PRId64 "\n", currentPos);
185185

186-
if (hdfsFileUsesDirectRead(readFile)) {
186+
if (!hdfsFileUsesDirectRead(readFile)) {
187187
fprintf(stderr, "Direct read support incorrectly not detected "
188188
"for HDFS filesystem\n");
189189
exit(-1);
@@ -262,9 +262,8 @@ int main(int argc, char **argv) {
262262
totalResult += result;
263263
fprintf(stderr, "hdfsMove(local-local): %s\n", ((result = hdfsMove(lfs, srcPath, lfs, dstPath)) != 0 ? "Failed!" : "Success!"));
264264
totalResult += result;
265-
// TODO fix failures later HDFS-14083.
266-
// fprintf(stderr, "hdfsMove(remote-local): %s\n", ((result = hdfsMove(fs, srcPath, lfs, srcPath)) != 0 ? "Failed!" : "Success!"));
267-
// totalResult += result;
265+
fprintf(stderr, "hdfsMove(remote-local): %s\n", ((result = hdfsMove(fs, srcPath, lfs, srcPath)) != 0 ? "Failed!" : "Success!"));
266+
totalResult += result;
268267

269268
fprintf(stderr, "hdfsRename: %s\n", ((result = hdfsRename(fs, dstPath, srcPath)) != 0 ? "Failed!" : "Success!"));
270269
totalResult += result;
@@ -306,9 +305,7 @@ int main(int argc, char **argv) {
306305
totalResult++;
307306
fprintf(stderr, "waah! hdfsGetPathInfo for %s - FAILED!\n", slashTmp);
308307
}
309-
exit(0);
310308

311-
// TODO fix failures later HDFS-14083.
312309
fileList = 0;
313310
fileList = hdfsListDirectory(fs, newDirectory, &numEntries);
314311
if (!(fileList == NULL && numEntries == 0 && !errno)) {
@@ -459,7 +456,7 @@ int main(int argc, char **argv) {
459456
fprintf(stderr, "Wrote %d bytes\n", num_written_bytes);
460457

461458
if (hdfsFlush(fs, appendFile)) {
462-
fprintf(stderr, "Failed to 'flush' %s\n", appendPath);
459+
fprintf(stderr, "Failed to 'flush' %s\n", appendPath);
463460
exit(-1);
464461
}
465462
fprintf(stderr, "Flushed %s successfully!\n", appendPath);

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ set_target_properties(hdfs PROPERTIES
5656

5757
build_libhdfs_test(test_libhdfs_ops hdfs_static test_libhdfs_ops.c)
5858
link_libhdfs_test(test_libhdfs_ops hdfs_static ${JAVA_JVM_LIBRARY})
59-
add_libhdfs_test(test_libhdfs_ops hdfs_static)
6059
build_libhdfs_test(test_libhdfs_reads hdfs_static test_libhdfs_read.c)
6160
link_libhdfs_test(test_libhdfs_reads hdfs_static ${JAVA_JVM_LIBRARY})
6261
build_libhdfs_test(test_libhdfs_write hdfs_static test_libhdfs_write.c)

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/exception.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static const struct ExceptionInfo gExceptionInfo[] = {
8181
},
8282
{
8383
"java.lang.UnsupportedOperationException",
84-
NOPRINT_EXC_OPERATION_NOTSUPPORTED,
84+
0,
8585
ENOTSUP,
8686
},
8787
{

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/exception.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
#define NOPRINT_EXC_UNRESOLVED_LINK 0x04
7070
#define NOPRINT_EXC_PARENT_NOT_DIRECTORY 0x08
7171
#define NOPRINT_EXC_ILLEGAL_ARGUMENT 0x10
72-
#define NOPRINT_EXC_OPERATION_NOTSUPPORTED 0x20
7372

7473
/**
7574
* Get information about an exception.

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/hdfs.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,21 +1497,9 @@ tSize readDirect(hdfsFS fs, hdfsFile f, void* buffer, tSize length)
14971497
HADOOP_ISTRM, "read", "(Ljava/nio/ByteBuffer;)I", bb);
14981498
destroyLocalReference(env, bb);
14991499
if (jthr) {
1500-
if (f->flags & HDFS_FILE_SUPPORTS_DIRECT_READ) {
15011500
errno = printExceptionAndFree(env, jthr, PRINT_EXC_ALL,
15021501
"readDirect: FSDataInputStream#read");
1503-
} else {
1504-
// If the HDFS_FILE_SUPPORTS_DIRECT_READ is not set in the
1505-
// hdfs file handle, it means that this is a test to see if
1506-
// direct read can be done, called from hdfsOpenFIleImpl().
1507-
// In the cloud environment where byte buffered read is not
1508-
// supported the error log is filled with Exception of type
1509-
// UnspportedOperation. The change below prevents the excessive
1510-
// printing of the error message in cloud environment.
1511-
errno = printExceptionAndFree(env, jthr, NOPRINT_EXC_OPERATION_NOTSUPPORTED,
1512-
"readDirect: FSDataInputStream#read");
1513-
}
1514-
return -1;
1502+
return -1;
15151503
}
15161504
return (jVal.i < 0) ? 0 : jVal.i;
15171505
}

0 commit comments

Comments
 (0)