Skip to content

Commit

Permalink
Revert debug changes (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
bastrik authored Oct 14, 2020
1 parent 0e20842 commit 3db7684
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,6 @@ public int read(byte[] b, int off, int len) throws IOException {
}

private int readInternal(byte[] b, int off, int len) throws IOException {
if (mPos >= mLength)
{
return -1;
}

readChunk();
if (mCurrentChunk == null) {
mEOF = true;
Expand All @@ -279,16 +274,11 @@ private int readInternal(byte[] b, int off, int len) throws IOException {
Preconditions
.checkState(mPos >= mLength, PreconditionMessage.BLOCK_LENGTH_INCONSISTENT.toString(),
mId, mLength, mPos);
// Should this be -1? (ruizh)
return -1;
}
int toRead = Math.min(len, mCurrentChunk.readableBytes());
mCurrentChunk.readBytes(b, off, toRead);
mPos += toRead;
if (mPos >= mLength)
{
closeDataReader();
}
return toRead;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,8 @@ public Factory(FileSystemContext context, WorkerNetAddress address, long blockId
.toString());
mStream.send(request, mDataTimeoutMs);
OpenLocalBlockResponse response = mStream.receive(mDataTimeoutMs);
mStream.close();
Preconditions.checkState(response.hasPath());
mPath = response.getPath();
mBlockWorker.close();
} catch (Exception e) {
mBlockWorker.close();
throw e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ private void closeBlockInStream(BlockInStream stream) throws IOException {
if (blockSource == BlockInStream.BlockInStreamSource.LOCAL) {
return;
}
// triggerAsyncCaching(stream);
triggerAsyncCaching(stream);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ public void closeReaderOrWriter(long sessionId, long blockId) throws IOException
try (LockResource lr = new LockResource(mLock)) {
blockInfo = mBlocks.get(new Key(sessionId, blockId));
if (blockInfo == null) {
// LOG.warn("Key (block ID: {}, session ID {}) is not found when cleaning up the UFS block.",
// blockId, sessionId);
LOG.warn("Key (block ID: {}, session ID {}) is not found when cleaning up the UFS block.",
blockId, sessionId);
return;
}
}
Expand All @@ -166,8 +166,8 @@ public void releaseAccess(long sessionId, long blockId) {
try (LockResource lr = new LockResource(mLock)) {
Key key = new Key(sessionId, blockId);
if (!mBlocks.containsKey(key)) {
// LOG.warn("Key (block ID: {}, session ID {}) is not found when releasing the UFS block.",
// blockId, sessionId);
LOG.warn("Key (block ID: {}, session ID {}) is not found when releasing the UFS block.",
blockId, sessionId);
}
mBlocks.remove(key);
Set<Long> blockIds = mSessionIdToBlockIds.get(sessionId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,6 @@ private void openBlock(BlockReadRequestContext context)
context.setBlockReader(reader);
mWorker.accessBlock(request.getSessionId(), request.getId());
((FileChannel) reader.getChannel()).position(request.getStart());
// Close block after reading
mWorker.unlockBlock(context.getRequest().getSessionId(),
context.getRequest().getId());
return;
} catch (Exception e) {
mWorker.unlockBlock(lockId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ public OpenLocalBlockResponse call() throws Exception {
}
OpenLocalBlockResponse response = OpenLocalBlockResponse.newBuilder()
.setPath(mWorker.readBlock(mSessionId, mRequest.getBlockId(), mLockId)).build();
mWorker.unlockBlock(mLockId);
mLockId = BlockLockManager.INVALID_LOCK_ID;
return response;
}

Expand Down Expand Up @@ -145,7 +143,7 @@ public OpenLocalBlockResponse call() throws Exception {
mWorker.unlockBlock(mLockId);
mLockId = BlockLockManager.INVALID_LOCK_ID;
} else if (mRequest != null) {
// LOG.warn("Close a closed block {}.", mRequest.getBlockId());
LOG.warn("Close a closed block {}.", mRequest.getBlockId());
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ private int readInternal(String path, ByteBuffer buf, long size, long offset, Fu
long fd = fi.fh.get();
// FileInStream is not thread safe
try (LockResource r1 = new LockResource(getFileLock(fd).writeLock())) {
// LOG.warn("ReadInternal acquired lock for fileID={}", fd);
FileInStream is = mOpenFileEntries.get(fd);
if (is == null) {
LOG.error("Cannot find fd {} for {}", fd, path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ int flush_wrapper(const char *path, struct fuse_file_info *fi) {
}

int release_wrapper(const char *path, struct fuse_file_info *fi) {
LOGD("release: %s", path);
return jnifuse::JniFuseFileSystem::getInstance()->releaseOper->call(path, fi);
}

Expand Down

0 comments on commit 3db7684

Please sign in to comment.