Skip to content

Conversation

@GauthamBanasandra
Copy link
Member

Description of PR

jnihelper.c in HDFS native client uses dirent.h. This header file isn't available on Windows. Thus, we need to replace this with a cross platform compatible implementation for dirent.

How was this patch tested?

In progress.

For code changes:

  • Does the title or this PR starts with the corresponding JIRA issue id (e.g. 'HADOOP-17799. Your PR title ...')?
  • Object storage: have the integration tests been executed and the endpoint declared according to the connector-specific documentation?
  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE, LICENSE-binary, NOTICE-binary files?

@hadoop-yetus

This comment was marked as outdated.

@hadoop-yetus

This comment was marked as outdated.

@hadoop-yetus

This comment was marked as outdated.

@hadoop-yetus

This comment was marked as outdated.

@hadoop-yetus

This comment was marked as outdated.

@hadoop-yetus

This comment was marked as outdated.

@hadoop-yetus

This comment was marked as outdated.

* Reference types aren't allowed
  in std::variant. Thus, replacing it
  with the actual type.
* Added documentation.
* Fixed bug in NextFile()
  implementation.
* Need to include dirent.h
  inside the extern "C" block
  to avoid duplicate delcarations.
* The prototypes need to
   be under extern "C" in
   order prevent name
   mangling.
* Needed to create the
   root temp folder first.
* Needed to free x_platform_dirent.
* Need to clear the d_name
   char buffer to avoid invalid
   subsequent writes.
* Need to return the
  absolute paths for
  comparison of
  ListDirAndFiles.
* Added a USE_X_PLATFORM_DIRENT
  definition. Which forces the dirent
  from XPlatform library to be used
  instead of dirent.h in Linux.
@hadoop-yetus

This comment was marked as outdated.

@hadoop-yetus

This comment was marked as outdated.

@hadoop-yetus

This comment was marked as outdated.

@hadoop-yetus

This comment was marked as outdated.

@hadoop-yetus

This comment was marked as outdated.

@hadoop-yetus

This comment was marked as outdated.

@hadoop-yetus

This comment was marked as outdated.

@hadoop-yetus

This comment was marked as outdated.

@GauthamBanasandra GauthamBanasandra marked this pull request as ready for review June 5, 2022 17:24
@GauthamBanasandra GauthamBanasandra requested a review from goiri June 5, 2022 17:26
* Moved the inclusion of dirent.h on
  non-Windows platforms to the top for
  easier understanding of c-api/dirent.h.
@hadoop-yetus

This comment was marked as outdated.

@hadoop-yetus

This comment was marked as outdated.

@hadoop-yetus

This comment was marked as outdated.

* The method signatures in header
  files are already enclosed with
  extern "C" and thus, we don't need
  to wrap the implementation with
  extern "C".
@hadoop-yetus

This comment was marked as outdated.

* There were multiple #ifs and
  it was a bit cumbersome to
  understand.
* Thus, I've simplified it into
  multiple header files.
* core/dirent.h contains the core
  logic of dirent.h.
* extern/dirent.h wraps it in an
  extern block.
* c-api/dirent.h combines the
  two.
@GauthamBanasandra GauthamBanasandra requested a review from goiri June 8, 2022 16:55
@hadoop-yetus
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 40m 58s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 1s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 5 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 40m 24s trunk passed
+1 💚 compile 4m 2s trunk passed
+1 💚 mvnsite 0m 43s trunk passed
+1 💚 shadedclient 67m 53s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 22s the patch passed
+1 💚 compile 4m 1s the patch passed
+1 💚 cc 4m 1s the patch passed
+1 💚 golang 4m 1s the patch passed
+1 💚 javac 4m 1s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 mvnsite 0m 26s the patch passed
+1 💚 shadedclient 19m 26s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 32m 53s hadoop-hdfs-native-client in the patch passed.
+1 💚 asflicense 0m 53s The patch does not generate ASF License warnings.
169m 23s
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4370/14/artifact/out/Dockerfile
GITHUB PR #4370
Optional Tests dupname asflicense compile cc mvnsite javac unit codespell detsecrets golang
uname Linux 874ca20d247f 4.15.0-169-generic #177-Ubuntu SMP Thu Feb 3 10:50:38 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 946251e
Default Java Red Hat, Inc.-1.8.0_332-b09
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4370/14/testReport/
Max. process+thread count 699 (vs. ulimit of 5500)
modules C: hadoop-hdfs-project/hadoop-hdfs-native-client U: hadoop-hdfs-project/hadoop-hdfs-native-client
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4370/14/console
versions git=2.9.5 maven=3.6.3
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

extern "C" {
#endif

#include "x-platform/c-api/core/dirent.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point it is cleaner to do:

#if defined(WIN32) && defined(__cplusplus)
extern "C" {
#include "x-platform/c-api/core/dirent.h"
}
#else 
#include "x-platform/c-api/core/dirent.h"
#endif

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've filed a JIRA to track this - https://issues.apache.org/jira/browse/HDFS-16630.

@hadoop-yetus
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 21m 39s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 1s codespell was not available.
+0 🆗 detsecrets 0m 1s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 5 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 22m 20s trunk passed
+1 💚 compile 4m 10s trunk passed
+1 💚 mvnsite 1m 4s trunk passed
+1 💚 shadedclient 46m 56s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 32s the patch passed
+1 💚 compile 3m 49s the patch passed
+1 💚 cc 3m 49s the patch passed
+1 💚 golang 3m 49s the patch passed
+1 💚 javac 3m 49s the patch passed
+1 💚 blanks 0m 1s The patch has no blanks issues.
+1 💚 mvnsite 0m 37s the patch passed
+1 💚 shadedclient 19m 20s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 33m 17s hadoop-hdfs-native-client in the patch passed.
+1 💚 asflicense 1m 2s The patch does not generate ASF License warnings.
129m 45s
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4370/14/artifact/out/Dockerfile
GITHUB PR #4370
Optional Tests dupname asflicense compile cc mvnsite javac unit codespell detsecrets golang
uname Linux fc518442ef5b 4.15.0-169-generic #177-Ubuntu SMP Thu Feb 3 10:50:38 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 946251e
Default Java Red Hat, Inc.-1.8.0_312-b07
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4370/14/testReport/
Max. process+thread count 548 (vs. ulimit of 5500)
modules C: hadoop-hdfs-project/hadoop-hdfs-native-client U: hadoop-hdfs-project/hadoop-hdfs-native-client
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4370/14/console
versions git=2.27.0 maven=3.6.3
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@hadoop-yetus
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 21m 33s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 1s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 5 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 24m 34s trunk passed
+1 💚 compile 3m 38s trunk passed
+1 💚 mvnsite 0m 43s trunk passed
+1 💚 shadedclient 55m 4s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 22s the patch passed
+1 💚 compile 3m 17s the patch passed
+1 💚 cc 3m 17s the patch passed
+1 💚 golang 3m 17s the patch passed
+1 💚 javac 3m 17s the patch passed
+1 💚 blanks 0m 1s The patch has no blanks issues.
+1 💚 mvnsite 0m 26s the patch passed
+1 💚 shadedclient 26m 14s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 32m 12s hadoop-hdfs-native-client in the patch passed.
+1 💚 asflicense 0m 47s The patch does not generate ASF License warnings.
142m 25s
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4370/14/artifact/out/Dockerfile
GITHUB PR #4370
Optional Tests dupname asflicense compile cc mvnsite javac unit codespell detsecrets golang
uname Linux b5fdddcbfca4 4.15.0-169-generic #177-Ubuntu SMP Thu Feb 3 10:50:38 UTC 2022 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 946251e
Default Java Debian-11.0.15+10-post-Debian-1deb10u1
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4370/14/testReport/
modules C: hadoop-hdfs-project/hadoop-hdfs-native-client U: hadoop-hdfs-project/hadoop-hdfs-native-client
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4370/14/console
versions git=2.20.1 maven=3.6.0
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@hadoop-yetus
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 44s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 1s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 5 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 21m 14s trunk passed
+1 💚 compile 4m 7s trunk passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1
+1 💚 compile 4m 1s trunk passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚 mvnsite 0m 46s trunk passed
+1 💚 shadedclient 50m 9s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 23s the patch passed
+1 💚 compile 3m 47s the patch passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1
+1 💚 cc 3m 47s the patch passed
+1 💚 golang 3m 47s the patch passed
+1 💚 javac 3m 47s the patch passed
+1 💚 compile 3m 45s the patch passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚 cc 3m 45s the patch passed
+1 💚 golang 3m 45s the patch passed
+1 💚 javac 3m 45s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 mvnsite 0m 27s the patch passed
+1 💚 shadedclient 19m 36s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 33m 17s hadoop-hdfs-native-client in the patch passed.
+1 💚 asflicense 0m 47s The patch does not generate ASF License warnings.
115m 24s
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4370/14/artifact/out/Dockerfile
GITHUB PR #4370
Optional Tests dupname asflicense compile cc mvnsite javac unit codespell detsecrets golang
uname Linux 2f699c3505fe 4.15.0-169-generic #177-Ubuntu SMP Thu Feb 3 10:50:38 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 946251e
Default Java Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4370/14/testReport/
Max. process+thread count 549 (vs. ulimit of 5500)
modules C: hadoop-hdfs-project/hadoop-hdfs-native-client U: hadoop-hdfs-project/hadoop-hdfs-native-client
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-4370/14/console
versions git=2.25.1 maven=3.6.3
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@GauthamBanasandra GauthamBanasandra merged commit d557c44 into apache:trunk Jun 10, 2022
@GauthamBanasandra GauthamBanasandra deleted the dirent-x-platform branch June 10, 2022 04:29
HarshitGupta11 pushed a commit to HarshitGupta11/hadoop that referenced this pull request Nov 28, 2022
* jnihelper.c in HDFS native client uses
  dirent.h. This header file isn't available
  on Windows.
* This PR provides a cross platform
  compatible implementation for dirent
  under the XPlatform library.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants