diff --git a/minoc/VERSION b/minoc/VERSION index 35809b89..a8d5aa3a 100644 --- a/minoc/VERSION +++ b/minoc/VERSION @@ -4,6 +4,6 @@ # tags with and without build number so operators use the versioned # tag but we always keep a timestamped tag in case a semantic tag gets # replaced accidentally -VER=0.9.9 +VER=0.9.10 TAGS="${VER} ${VER}-$(date --utc +"%Y%m%dT%H%M%S")" unset VER diff --git a/minoc/src/main/java/org/opencadc/minoc/PutAction.java b/minoc/src/main/java/org/opencadc/minoc/PutAction.java index bd20bc82..4e4aec40 100644 --- a/minoc/src/main/java/org/opencadc/minoc/PutAction.java +++ b/minoc/src/main/java/org/opencadc/minoc/PutAction.java @@ -68,6 +68,7 @@ package org.opencadc.minoc; import ca.nrc.cadc.db.TransactionManager; +import ca.nrc.cadc.io.ByteCountInputStream; import ca.nrc.cadc.io.ByteLimitExceededException; import ca.nrc.cadc.io.ReadException; import ca.nrc.cadc.io.WriteException; @@ -214,14 +215,16 @@ public void doAction() throws Exception { StorageMetadata artifactMetadata = null; long startTime = System.currentTimeMillis(); Long transferTime = null; + if (PUT_TXN_OP_COMMIT.equalsIgnoreCase(txnOP)) { artifactMetadata = storageAdapter.commitTransaction(txnID); txnID = null; profiler.checkpoint("storageAdapter.put.commit.ok"); } else { log.debug("writing new artifact to " + storageAdapter.getClass().getName()); + ByteCountInputStream bcis = new ByteCountInputStream(in); try { - artifactMetadata = storageAdapter.put(newArtifact, in, txnID); + artifactMetadata = storageAdapter.put(newArtifact, bcis, txnID); transferTime = System.currentTimeMillis() - startTime; profiler.checkpoint("storageAdapter.put.write.ok"); } catch (ReadException ex) { @@ -242,6 +245,10 @@ public void doAction() throws Exception { } catch (ByteLimitExceededException | PreconditionFailedException | TransientException ex) { profiler.checkpoint("storageAdapter.put.write.fail"); throw ex; + } finally { + if (bcis.getByteCount() > 0) { + logInfo.setBytes(bcis.getByteCount()); + } } log.debug("writing new artifact to " + storageAdapter.getClass().getName() + " OK"); } @@ -331,8 +338,6 @@ public void doAction() throws Exception { syncOutput.setDigest(artifact.getContentChecksum()); syncOutput.setHeader("content-length", 0); - super.logInfo.setBytes(artifact.getContentLength()); - // this block could be passed off to a thread so request completes?? if (newOSL != null) { log.debug("deleting from storage...");