You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2021/06/02 11:58:56 UTC

[GitHub] [zookeeper] DimasKovas opened a new pull request #1706: ZOOKEEPER-4311: Close AtomicFileOutputStream properly

DimasKovas opened a new pull request #1706:
URL: https://github.com/apache/zookeeper/pull/1706


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [zookeeper] maoling commented on pull request #1706: ZOOKEEPER-4311: Close AtomicFileOutputStream properly

Posted by GitBox <gi...@apache.org>.
maoling commented on pull request #1706:
URL: https://github.com/apache/zookeeper/pull/1706#issuecomment-858359160


   @DimasKovas 
   - Looks reasonable. Some codes are copied from `hadoop`. I observed some codes uses the same way as you did.
   [1]https://github.com/apache/hadoop/blob/03cfc852791c14fad39db4e5b14104a276c08e59/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/util/PersistentLongFile.java#L78
   [2]https://github.com/apache/hadoop/blob/03cfc852791c14fad39db4e5b14104a276c08e59/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/util/MD5FileUtils.java#157
   
   - Do you think the following hadoop snippet still has the same issue as zk?
   [3]https://github.com/apache/hadoop/blob/03cfc852791c14fad39db4e5b14104a276c08e59/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/Journal.java#L1088


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [zookeeper] maoling commented on pull request #1706: ZOOKEEPER-4311: Close AtomicFileOutputStream properly

Posted by GitBox <gi...@apache.org>.
maoling commented on pull request #1706:
URL: https://github.com/apache/zookeeper/pull/1706#issuecomment-865536292


   @DimasKovas 
   
   - Thanks for your contribution. I really love this solid work. The change is minor, the work is great!
   
   - `CuttleFS` is a great tool to inject the `fsync` fault and I also read its paper: [Can Applications Recover from fsync Failures?] (https://www.usenix.org/system/files/atc20-rebello.pdf) which's great reading.
   
   - I also want to reproduce this issue with your approach, I have installed `docker` and `CuttleFS` successfully, but I cannot build `zk_cmd` with `g++ -Iinclude client.cpp  libzookeeper.a libhashtable.a -o zk_cmd -pthread -DTHREADED`. I cannot find the `libzookeeper.a`, I install the official zookeeper client c-binding, what I have is 
   `libzookeeper_mt.a` or `libzookeeper_st.a`. Could you please add more details about how to compile and build the `zk_cmd`?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [zookeeper] DimasKovas commented on pull request #1706: ZOOKEEPER-4311: Close AtomicFileOutputStream properly

Posted by GitBox <gi...@apache.org>.
DimasKovas commented on pull request #1706:
URL: https://github.com/apache/zookeeper/pull/1706#issuecomment-859629894


   I reproduced the scenario in which this bug leads to broken consistency guarantees after fsync failure (using filesystem emulator to simulate failures).
   Script, description and possible output are available in this repository: https://github.com/DimasKovas/zookeeper-4311


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [zookeeper] asfgit closed pull request #1706: ZOOKEEPER-4311: Close AtomicFileOutputStream properly

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #1706:
URL: https://github.com/apache/zookeeper/pull/1706


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [zookeeper] maoling commented on pull request #1706: ZOOKEEPER-4311: Close AtomicFileOutputStream properly

Posted by GitBox <gi...@apache.org>.
maoling commented on pull request #1706:
URL: https://github.com/apache/zookeeper/pull/1706#issuecomment-865536292


   @DimasKovas 
   
   - Thanks for your contribution. I really love this solid work. The change is minor, the work is great!
   
   - `CuttleFS` is a great tool to inject the `fsync` fault and I also read its paper: [Can Applications Recover from fsync Failures?] (https://www.usenix.org/system/files/atc20-rebello.pdf) which's great reading.
   
   - I also want to reproduce this issue with your approach, I have installed `docker` and `CuttleFS` successfully, but I cannot build `zk_cmd` with `g++ -Iinclude client.cpp  libzookeeper.a libhashtable.a -o zk_cmd -pthread -DTHREADED`. I cannot find the `libzookeeper.a`, I install the official zookeeper client c-binding, what I have is 
   `libzookeeper_mt.a` or `libzookeeper_st.a`. Could you please add more details about how to compile and build the `zk_cmd`?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [zookeeper] maoling commented on pull request #1706: ZOOKEEPER-4311: Close AtomicFileOutputStream properly

Posted by GitBox <gi...@apache.org>.
maoling commented on pull request #1706:
URL: https://github.com/apache/zookeeper/pull/1706#issuecomment-869610121


   @DimasKovas 
   
   - I still cannot compile the `zk_cmd`, I followed your guideline to install the `zookeeper client c-bindings `successfully(I don't observe anything wrong, `cli_mt 127.0.0.1:2181` to connect server successfully)
   
   ```
   g++ -std=c++11 client.cpp -lzookeeper_mt -DTHREADED -pthread -o zk_cmd
   ============
   /tmp/ccGKBzgy.o: In function `cmdCreate(_zhandle*, std::string const&, std::string const&)':
   client.cpp:(.text+0x355): undefined reference to `ZOO_PERSISTENT'
   collect2: error: ld returned 1 exit status
   ```
   - More context
   ```
   CentOS 7
   g++ --version
   g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
   Copyright (C) 2015 Free Software Foundation, Inc.
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [zookeeper] maoling commented on pull request #1706: ZOOKEEPER-4311: Close AtomicFileOutputStream properly

Posted by GitBox <gi...@apache.org>.
maoling commented on pull request #1706:
URL: https://github.com/apache/zookeeper/pull/1706#issuecomment-866519476


   @DimasKovas Forgive my poor `C `language. 
   - I follow your updated guideline and exec `g++ client.cpp -lzookeeper_mt -DTHREADED -pthread -o zk_cmd`. 
   and got:
   ```
   client.cpp:7:23: fatal error: zookeeper.h: No such file or directory
    #include <zookeeper.h>
   ```
   What or where is `zookeeper_mt`?
   - My `libzookeeper_mt` and `zookeeper.h` is at the following place:
   
   ```
   /usr/local/lib/libzookeeper_st.so.2
   /usr/local/lib/libzookeeper_mt.so.2
   /usr/local/lib/libzookeeper_mt.a
   /usr/local/lib/libzookeeper_mt.la
   /usr/local/lib/libzookeeper_mt.so
   /usr/local/lib/libzookeeper_st.so.2.0.0
   /usr/local/lib/libzookeeper_st.la
   /usr/local/lib/libzookeeper_st.so
   /usr/local/lib/libzookeeper_mt.so.2.0.0
   /usr/local/lib/libzookeeper_st.a
   /data/software/zookeeper/apache-zookeeper-3.7.0/zookeeper-client/zookeeper-client-c/libzookeeper_mt.la
   /data/software/zookeeper/apache-zookeeper-3.7.0/zookeeper-client/zookeeper-client-c/.libs/libzookeeper_mt.a
   /data/software/zookeeper/apache-zookeeper-3.7.0/zookeeper-client/zookeeper-client-c/.libs/libzookeeper_mt.la
   /data/software/zookeeper/apache-zookeeper-3.7.0/zookeeper-client/zookeeper-client-c/.libs/libzookeeper_st.la
   /data/software/zookeeper/apache-zookeeper-3.7.0/zookeeper-client/zookeeper-client-c/.libs/libzookeeper_mt.lai
   /data/software/zookeeper/apache-zookeeper-3.7.0/zookeeper-client/zookeeper-client-c/.libs/libzookeeper_st.a
   /data/software/zookeeper/apache-zookeeper-3.7.0/zookeeper-client/zookeeper-client-c/.libs/libzookeeper_st.lai
   /data/software/zookeeper/apache-zookeeper-3.7.0/zookeeper-client/zookeeper-client-c/libzookeeper_st.la
   ======================================
   usr/local/include/zookeeper/zookeeper.h
   /data/software/zookeeper/apache-zookeeper-3.7.0/zookeeper-client/zookeeper-client-c/include/zookeeper.h
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [zookeeper] DimasKovas commented on pull request #1706: ZOOKEEPER-4311: Close AtomicFileOutputStream properly

Posted by GitBox <gi...@apache.org>.
DimasKovas commented on pull request #1706:
URL: https://github.com/apache/zookeeper/pull/1706#issuecomment-865913100


   @maoling
   Thanks.
   I had installed zookeeper client c-binding from the sources using cmake, that's why there are some differences in library name/include paths. The libzookeeper_mt.a is what you need. I updated client.cpp and README.md, so I hope there will not be such problems anymore. Anyway, if something is not working - feel free to ask me, I will try to help.
   Note that I compiled c-bindings with `--without-openssl --without-sasl` options, otherwise you need to add them to the linker too


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [zookeeper] maoling closed pull request #1706: ZOOKEEPER-4311: Close AtomicFileOutputStream properly

Posted by GitBox <gi...@apache.org>.
maoling closed pull request #1706:
URL: https://github.com/apache/zookeeper/pull/1706


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [zookeeper] asfgit closed pull request #1706: ZOOKEEPER-4311: Close AtomicFileOutputStream properly

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #1706:
URL: https://github.com/apache/zookeeper/pull/1706


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [zookeeper] DimasKovas commented on pull request #1706: ZOOKEEPER-4311: Close AtomicFileOutputStream properly

Posted by GitBox <gi...@apache.org>.
DimasKovas commented on pull request #1706:
URL: https://github.com/apache/zookeeper/pull/1706#issuecomment-858447324


   > * Do you think the following hadoop snippet still has the same issue as zk?
   >   [3]https://github.com/apache/hadoop/blob/03cfc852791c14fad39db4e5b14104a276c08e59/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/Journal.java#L1088
   
   Yes, it does. The code looks absolutely the same, and the usage of IOUtils.closeStream in case of "success" silently hides IO-errors.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [zookeeper] maoling commented on pull request #1706: ZOOKEEPER-4311: Close AtomicFileOutputStream properly

Posted by GitBox <gi...@apache.org>.
maoling commented on pull request #1706:
URL: https://github.com/apache/zookeeper/pull/1706#issuecomment-860011043


   @DimasKovas
   Great work.  if no other concerns, I'll merge it at next weekend(06-19)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [zookeeper] DimasKovas commented on pull request #1706: ZOOKEEPER-4311: Close AtomicFileOutputStream properly

Posted by GitBox <gi...@apache.org>.
DimasKovas commented on pull request #1706:
URL: https://github.com/apache/zookeeper/pull/1706#issuecomment-866525294


   @maoling
   Yesterday I updated client.cpp too. The only difference is in this line, it should be `#include <zookeeper/zookeeper.h>`. Try to pull the repository again


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [zookeeper] DimasKovas commented on pull request #1706: ZOOKEEPER-4311: Close AtomicFileOutputStream properly

Posted by GitBox <gi...@apache.org>.
DimasKovas commented on pull request #1706:
URL: https://github.com/apache/zookeeper/pull/1706#issuecomment-856020586


   Broken tests seem to be unrelated. Tried to rebase, but it didn't help. Is restarting the best option to pass the tests?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org