AnsweredAssumed Answered

MapR-FS java api - getFileLength() not reporting correct length

Question asked by mregmi on Aug 19, 2015
I'm trying to read data off MapR-FS using MapR Java api.  These are real time files and are constantly being written by external processes. This means file size is growing constantly.

I'm running into a situation where api is not providing/reporting correct file length via getFileLength() method.

Code is very similar as follows:

        conf = new Configuration();
        fs = FileSystem.get(conf);
        filepath = new Path(DIR_NAME + file.getName());
        log.info("Opening file :" + filepath);
        fSDataInputStream = fs.open(filepath);
        log.info("The file length : " +fSDataInputStream.getFileLength());
        For eg, The file length : 29313832883 (when file was opened)

Above code works perfectly and file length is also correct. However as I'm reading the file, I'm also constantly checking the file size via fSDataInputStream.getFileLength() which reports exact same size as earlier when file was opened.  File has grown drastically.

       For eg, size is still - The file length : 29313832883

Any help would be appreciated.

Thank you


Outcomes