From 11d0fc86340531ff210b7e42ef5fcc0afd7c5d3e Mon Sep 17 00:00:00 2001 From: Gavin Halliday Date: Thu, 28 Nov 2024 11:33:05 +0000 Subject: [PATCH] HPCC-33045 Add an option to check size consistency within the write sync margin Signed-off-by: Gavin Halliday --- dali/base/dadfs.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/dali/base/dadfs.cpp b/dali/base/dadfs.cpp index 005767ac263..968b096075b 100644 --- a/dali/base/dadfs.cpp +++ b/dali/base/dadfs.cpp @@ -3813,13 +3813,31 @@ protected: friend class CDistributedFilePart; if (unlikely(elapsedMs < marginMs)) { LOG(MCuserProgress, "Delaying access to %s on %s for %ums to ensure write sync", queryLogicalName(), name, (unsigned)(marginMs - elapsedMs)); + checkSizeConsistency("Before write sync delay"); MilliSleep(marginMs - elapsedMs); + checkSizeConsistency("After write sync delay"); now = 0; // re-evaluate now - unlikely to actually happen } } } } + void checkSizeConsistency(const char * when) + { + auto checkPartSize = [this,when](unsigned idx) -> void + { + IDistributedFilePart &part = queryPart(idx); + offset_t size = part.getDiskSize(false, false); + if (size != (offset_t)-1) + { + offset_t physicalSize = part.getDiskSize(true, true); + if (size != physicalSize) + OWARNLOG("%s: Part %d of file %s is inconsistent: logical size = %" I64F "d, physical size = %" I64F "d", when, idx, queryLogicalName(), size, physicalSize); + } + }; + asyncFor(numParts(), checkPartSize); + } + bool hasDirPerPart() const { return FileDescriptorFlags::none != (fileFlags & FileDescriptorFlags::dirperpart);