fix lockblock bug in checkpoint thread

when do check point work, if exception happens,  blocks of the file will not be unlocked and related OutputStream & InputStream will not be closed.
Alright thanks
On Nov 4, 2014 8:58 PM, "shimingfei" <notifications@github.com> wrote:

> In core/src/main/java/tachyon/worker/WorkerStorage.java:
>
> > +            for (int k = 0; k < fileInfo.blockIds.size(); k ++) {
> > +              File tempFile =
> > +                  new File(CommonUtils.concat(mLocalDataFolder.toString(),
> > +                      fileInfo.blockIds.get(k)));
> > +              fileSizeByte += tempFile.length();
> > +              InputStream is = closer.register(new FileInputStream(tempFile));
> > +              byte[] buf = new byte[16 * Constants.KB];
> > +              int got = is.read(buf);
> > +              while (got != -1) {
> > +                os.write(buf, 0, got);
> > +                got = is.read(buf);
> > +              }
> > +            }
> > +          } finally {
> > +            closer.close();
> > +            for (int k = 0; k < fileInfo.blockIds.size(); k ++) {
>
> it is OK, unlocking is on the block files that cached in memory, renaming
> is on the check point file. after the checkpoint file is finished, we can
> first unlock the block files and then rename the checkpoint file
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/amplab/tachyon/pull/512/files#r19855410>.
>