Skip to content

Commit

Permalink
Addressing review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsimsa committed Sep 28, 2015
1 parent f8fd5ce commit cb1fcef
Show file tree
Hide file tree
Showing 43 changed files with 389 additions and 374 deletions.
Expand Up @@ -163,12 +163,6 @@ public List<FileInfo> listStatus(TachyonFile file, ListStatusOptions options) th
} }
} }


/**
* {@inheritDoc}
*
* To add the data into Tachyon space perform an operation with the cache option specified, for
* example the load command of the Tachyon Shell.
*/
@Override @Override
public long loadMetadata(TachyonURI path, LoadMetadataOptions options) public long loadMetadata(TachyonURI path, LoadMetadataOptions options)
throws IOException, TachyonException { throws IOException, TachyonException {
Expand Down
Expand Up @@ -180,7 +180,7 @@ public void seek(long pos) throws IOException {
return; return;
} }
Preconditions.checkArgument(pos >= 0, "Seek position is negative: " + pos); Preconditions.checkArgument(pos >= 0, "Seek position is negative: " + pos);
Preconditions.checkArgument(pos <= mFileLength, "Seek position is past EOF: " + pos Preconditions.checkArgument(pos < mFileLength, "Seek position is past EOF: " + pos
+ ", fileSize = " + mFileLength); + ", fileSize = " + mFileLength);


seekBlockInStream(pos); seekBlockInStream(pos);
Expand Down
Expand Up @@ -60,7 +60,6 @@ public final class FileOutStream extends OutputStream implements Cancelable {
private final UnderStorageType mUnderStorageType; private final UnderStorageType mUnderStorageType;
private final FileSystemContext mContext; private final FileSystemContext mContext;
private final OutputStream mUnderStorageOutputStream; private final OutputStream mUnderStorageOutputStream;
private final WorkerClient mWorkerClient;
private final long mNonce; private final long mNonce;


private boolean mCanceled; private boolean mCanceled;
Expand Down Expand Up @@ -97,9 +96,7 @@ public FileOutStream(long fileId, OutStreamOptions options) throws IOException {
} }
} }
mUnderStorageOutputStream = ufs.create(fileName, (int) mBlockSize); mUnderStorageOutputStream = ufs.create(fileName, (int) mBlockSize);
mWorkerClient = BlockStoreContext.INSTANCE.acquireWorkerClient();
} else { } else {
mWorkerClient = null;
mUnderStorageOutputStream = null; mUnderStorageOutputStream = null;
} }
mClosed = false; mClosed = false;
Expand Down Expand Up @@ -136,11 +133,12 @@ public void close() throws IOException {
} else { } else {
mUnderStorageOutputStream.flush(); mUnderStorageOutputStream.flush();
mUnderStorageOutputStream.close(); mUnderStorageOutputStream.close();
WorkerClient workerClient = BlockStoreContext.INSTANCE.acquireWorkerClient();
try { try {
// TODO(yupeng): Investigate if this RPC can be moved to master. // TODO(yupeng): Investigate if this RPC can be moved to master.
mWorkerClient.addCheckpoint(mFileId, mNonce); workerClient.addCheckpoint(mFileId, mNonce);
} finally { } finally {
BlockStoreContext.INSTANCE.releaseWorkerClient(mWorkerClient); BlockStoreContext.INSTANCE.releaseWorkerClient(workerClient);
} }
canComplete = true; canComplete = true;
} }
Expand Down
Expand Up @@ -100,7 +100,7 @@ List<FileInfo> listStatus(TachyonFile file, ListStatusOptions options) throws IO
/** /**
* Loads metadata about a file in UFS to Tachyon. No data will be transferred. * Loads metadata about a file in UFS to Tachyon. No data will be transferred.
* *
* @param path the path to create the file in Tachyon * @param path the path for which to load metadat from UFS
* @param options method options * @param options method options
* @return the file id of the resulting file in Tachyon * @return the file id of the resulting file in Tachyon
* @throws IOException if a non-Tachyon exception occurs * @throws IOException if a non-Tachyon exception occurs
Expand Down
Expand Up @@ -66,19 +66,19 @@ protected void afterConnect() {
} }


/** /**
* Adds a checkpoint. * Persists a file.
* *
* @param fileId the file id * @param fileId the file id
* @param length the checkpoint length * @param length the checkpoint length
* @return whether operation succeeded or not * @return whether operation succeeded or not
* @throws IOException if an I/O error occurs * @throws IOException if an I/O error occurs
*/ */
public synchronized boolean addCheckpoint(long fileId, long length) throws IOException { public synchronized boolean persistFile(long fileId, long length) throws IOException {
int retry = 0; int retry = 0;
while (!mClosed && (retry ++) <= RPC_MAX_NUM_RETRY) { while (!mClosed && (retry ++) <= RPC_MAX_NUM_RETRY) {
connect(); connect();
try { try {
return mClient.addCheckpoint(fileId, length); return mClient.persistFile(fileId, length);
} catch (FileDoesNotExistException e) { } catch (FileDoesNotExistException e) {
throw new IOException(e); throw new IOException(e);
} catch (TException e) { } catch (TException e) {
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/tachyon/thrift/BlockInfo.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/src/main/java/tachyon/thrift/BlockLocation.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/src/main/java/tachyon/thrift/Command.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/src/main/java/tachyon/thrift/DependencyInfo.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/src/main/java/tachyon/thrift/FileBlockInfo.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/src/main/java/tachyon/thrift/FileInfo.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cb1fcef

Please sign in to comment.