PrepAway - Latest Free Exam Questions & Answers

what would another user see when trying to access this file?

You use the hadoop fs –put command to write a 300 MB file using an HDFS block size of 64 MB.
Just after this command has finished writing 200 MB of this file, what would another user see
when trying to access this file?

PrepAway - Latest Free Exam Questions & Answers

A.
They would see no content until the whole file is written and closed.

B.
They would see the content of the file through the last completed block.

C.
They would see the current state of the file, up to the last bit written by the command.

D.
They would see Hadoop throw an concurrentFileAccessException when they try to access this
file.

Explanation:
Note:
*put
Usage: hadoop fs -put <localsrc> … <dst>
Copy single src, or multiple srcs from local file system to the destination filesystem. Also reads
input from stdin and writes to destination filesystem.

7 Comments on “what would another user see when trying to access this file?

  1. Simon says:

    Vinod: based off of what?

    Page 75, ch 3 (HDFS), Tom White’s Hadoop Definitive Guide says that:


    After creating a file, it is visible in the filesystem namespace, as expected:
    Path p = new Path(“p”);
    fs.create(p);
    assertThat(fs.exists(p), is(true));

    However, any content written to the file is not guaranteed to be visible, even if the
    stream is flushed. So the file appears to have a length of zero:
    Path p = new Path(“p”);
    OutputStream out = fs.create(p);
    out.write(“content”.getBytes(“UTF-8″));
    out.flush();
    assertThat(fs.getFileStatus(p).getLen(), is(0L));

    Once more than a block’s worth of data has been written, the first block will be visible
    to new readers. This is true of subsequent blocks, too: it is always the current block
    being written that is not visible to other readers.”

    It’s either A or B. I’m leaning towards A, but D is definitely wrong




    0



    0
  2. Haresh says:

    Ans is A: Because, it is clearly mentioned in the question that “put” command is used. So, the correct answer would be A. But, As per “Hadoop: The Definitive Guide”, Option B is correct which should be considered in the case of FS API..




    0



    0

Leave a Reply to Simon Cancel reply

Your email address will not be published. Required fields are marked *