From 1f5b2711e0f96f6f60b9473df38fd2ca25f9ca52 Mon Sep 17 00:00:00 2001 From: Eric Cano <Eric.Cano@cern.ch> Date: Tue, 14 Aug 2018 09:21:59 +0200 Subject: [PATCH] Added support for zero-length file in tape write tasks. We now leave a placeholder on the tape and carry on in this case. The errors will eventually clear the archive request. --- .../tape/tapeserver/daemon/TapeWriteTask.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tapeserver/castor/tape/tapeserver/daemon/TapeWriteTask.cpp b/tapeserver/castor/tape/tapeserver/daemon/TapeWriteTask.cpp index 061c398efc..8ea2812993 100644 --- a/tapeserver/castor/tape/tapeserver/daemon/TapeWriteTask.cpp +++ b/tapeserver/castor/tape/tapeserver/daemon/TapeWriteTask.cpp @@ -135,6 +135,21 @@ namespace daemon { ++memBlockId; } + // If, after the FIFO is finished, we are still in the first block, we are in the presence of a 0-length file. + // This also requires a placeholder. + if (firstBlock) { + currentErrorToCount = "Error_tapeWriteData"; + const char blank[]="This file intentionally left blank: zero-length file cannot be recorded to tape."; + output->write(blank, sizeof(blank)); + m_taskStats.readWriteTime += timer.secs(cta::utils::Timer::resetCounter); + watchdog.notify(sizeof(blank)); + currentErrorToCount = "Error_tapeWriteTrailer"; + output->close(); + currentErrorToCount = ""; + // Possibly failing writes are finished. We can continue this in catch for skip. outside of the loop. + throw Skip("In TapeWriteTask::execute(): inserted a placeholder for zero length file."); + } + //finish the writing of the file on tape //put the trailer currentErrorToCount = "Error_tapeWriteTrailer"; -- GitLab