Does HDFS allow a client to read a file which is already opened for writing?

Free Online Certification Courses – Learn Today. Lead Tomorrow. Forums Apache Hadoop Does HDFS allow a client to read a file which is already opened for writing?

Viewing 1 reply thread
  • Author
    Posts
    • #4774
      DataFlair TeamDataFlair Team
      Spectator

      In HDFS,can we read from the file which is already open for writing?
      What happens, when client try to read from file already opened for writing in HDFS?

    • #4776
      DataFlair TeamDataFlair Team
      Spectator

      Yes, the client can read the file which is already opened for writing.
      But, the problem in reading a file which is currently being written, lies in the consistency of data i.e. Hadoop HDFS does not provide the surety that the data which has been written into the file will be visible to a new reader before the file has been closed.

      For this, one can call the hflush operation explicitly which will push all the data in the buffer into write pipeline and then the hflush operation will wait for acknowledgments from the datanodes. Hence, by doing this, the data that has been written into the file before the hflush operation visible to the reader for sure.

      For more details, please refer: HDFS read-write operations

Viewing 1 reply thread
  • You must be logged in to reply to this topic.