Skip to content

Commit

Permalink
#103 more testing on get restarts
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-conway committed Apr 27, 2015
1 parent 556bdcb commit 7ee0f26
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1067,13 +1067,9 @@ void getDataObjectFromIrods(final IRODSFile irodsFileToGet,
}

log.info("checking to see if this is a restart...");
/*
* FileRestartInfo fileRestartInfo = retrieveRestartInfoIfAvailable(
* RestartType.GET, irodsFileToGet.getAbsolutePath());
*/

FileRestartInfo fileRestartInfo = null; // TODO: issue77 for now get not
// supported
FileRestartInfo fileRestartInfo = retrieveRestartInfoIfAvailable(
RestartType.GET, irodsFileToGet.getAbsolutePath());

if (fileRestartInfo != null) {
log.info("restart processing for get..");
Expand Down Expand Up @@ -1141,7 +1137,8 @@ private void getRestartRetryTillMaxLoop(

FileRestartInfo myFileRestartInfo = retrieveRestartInfoIfAvailable(
fileRestartInfo.getRestartType(),
fileRestartInfo.getIrodsAbsolutePath());
fileRestartInfo.getIrodsAbsolutePath()); // just use file
// restart info

int offsetInMillis = 10000;
while (true) {
Expand All @@ -1162,6 +1159,7 @@ private void getRestartRetryTillMaxLoop(
break;

}

getRestartProcess(transferControlBlock, irodsFileToGet,
myFileRestartInfo, transferStatusCallbackListener);
log.info("restart done");
Expand Down Expand Up @@ -1492,26 +1490,35 @@ private int processGetAfterResourceDetermined(
lengthFromIrodsResponse, irodsFileLength,
transferControlBlock,
transferStatusCallbackListener, clientSideAction);

getIRODSProtocol().operationComplete(l1descInx);
FileRestartInfo fileRestartInfo = retrieveRestartInfoIfAvailable(
RestartType.GET, irodsFileToGet.getAbsolutePath());
if (fileRestartInfo != null) {
log.info("delete old restart stuff");
getIRODSSession().getRestartManager().deleteRestart(
fileRestartInfo.identifierFromThisInfo());
}

} catch (FileRestartManagementException e) {
log.error("transfer and restart failed", e);
throw e;
} catch (JargonException je) {
/*
* log.info("attempting a restart after exception", je);
* FileRestartInfo fileRestartInfo =
* retrieveRestartInfoIfAvailable( RestartType.GET,
* irodsFileToGet.getAbsolutePath()); if (fileRestartInfo !=
* null) { log.info("carrying out restart process..");
* getRestartRetryTillMaxLoop(transferControlBlock,
* irodsFileToGet, fileRestartInfo,
* transferStatusCallbackListener); }
*/
} catch (Throwable e) {

log.info("attempting a restart after exception", e);
FileRestartInfo fileRestartInfo = retrieveRestartInfoIfAvailable(
RestartType.GET, irodsFileToGet.getAbsolutePath());
if (fileRestartInfo != null) {
log.info("carrying out restart process..");
getRestartRetryTillMaxLoop(transferControlBlock,
irodsFileToGet, fileRestartInfo,
transferStatusCallbackListener);
}

log.error(
"jargon exception in get transfer, currently restart is not supported for get",
je);
throw je;
" exception in get transfer, currently restart is not supported for get",
e);
throw e;
}
} else {
dataAOHelper.processNormalGetTransfer(localFileToHoldData,
Expand Down Expand Up @@ -1604,10 +1611,14 @@ private void checkNbrThreadsAndProcessAsParallelIfMoreThanZeroThreads(
* Info may remain null if restart processing is not configured,
* otherwise, it will hold info on the current file restart status
*/
FileRestartInfo fileRestartInfo = retrieveOrCreateRestartInfoIfConfigured(
RestartType.GET, irodsSourceFile.getAbsolutePath(),
localFileToHoldData.getAbsolutePath(), numberOfThreads,
irodsFileLength);
FileRestartInfo fileRestartInfo = null;

/*
* retrieveOrCreateRestartInfoIfConfigured( RestartType.GET,
* irodsSourceFile.getAbsolutePath(),
* localFileToHoldData.getAbsolutePath(), numberOfThreads,
* irodsFileLength);
*/

if (numberOfThreads == 0) {
log.info("number of threads is zero, possibly parallel transfers were turned off via rule, process as normal");
Expand All @@ -1631,9 +1642,8 @@ localFileToHoldData, getIRODSAccessObjectFactory(),

try {
parallelGetTransferStrategy.transfer();
} catch (Exception e) {

// FIXME: #77 impl here!
} catch (Throwable e) {

log.error(
"exception in parallel transfer, connection will be abandoned",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ && getTransferControlBlock().getTransferOptions()

// ok, have a gap > 0, let's get our restart on

getSegment(gap, localFile, buffer, fileRestartInfo, i - 1,
getSegment(gap, localFile, buffer, fileRestartInfo, i,
irodsRandomAccessFile, intraFileStatusListener);
currentOffset += gap;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,19 +431,22 @@ private void seekToOffset(final RandomAccessFile local, final long offset)
return;

} else if (offset > 0) {

if (parallelGetFileTransferStrategy.getFileRestartInfo() != null) {
parallelGetFileTransferStrategy.getRestartManager()
.updateOffsetForSegment(
parallelGetFileTransferStrategy
.getFileRestartInfo()
.identifierFromThisInfo(),
getThreadNumber(), offset);
}

try {
if (offset == local.getFilePointer()) {
return; // at current location
}
local.seek(offset);
if (parallelGetFileTransferStrategy.getFileRestartInfo() != null) {
parallelGetFileTransferStrategy.getRestartManager()
.updateOffsetForSegment(
parallelGetFileTransferStrategy
.getFileRestartInfo()
.identifierFromThisInfo(),
getThreadNumber(), offset);
}

// log.debug("seek completed");
} catch (Exception e) {
log.error(IO_EXEPTION_IN_PARALLEL_TRANSFER,
Expand Down

0 comments on commit 7ee0f26

Please sign in to comment.