From aebbbd6976ee4942923acffa63379beb8dbd15c6 Mon Sep 17 00:00:00 2001 From: Ed McClanahan Date: Thu, 26 Dec 2019 14:03:16 -0800 Subject: [PATCH] Fix PFSAgent ExtentMap overlapping chunked PUTs and truncates --- pfsagentd/io.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pfsagentd/io.go b/pfsagentd/io.go index 230000437..b5fef3d1b 100644 --- a/pfsagentd/io.go +++ b/pfsagentd/io.go @@ -1282,7 +1282,7 @@ func (chunkedPutContext *chunkedPutContextStruct) getReadPlanHelper(fileOffset u fileOffset: curFileOffset, objectOffset: inReadPlanStepAsSingleObjectExtent.objectOffset + (curFileOffset - inReadPlanStepAsSingleObjectExtent.fileOffset), length: overlapExtentWithLink.fileOffset - curFileOffset, - chunkedPutContext: chunkedPutContext, + chunkedPutContext: inReadPlanStepAsSingleObjectExtent.chunkedPutContext, } outReadPlan = append(outReadPlan, outReadPlanStepAsSingleObjectExtent) @@ -1318,7 +1318,7 @@ func (chunkedPutContext *chunkedPutContextStruct) getReadPlanHelper(fileOffset u fileOffset: curFileOffset, objectOffset: inReadPlanStepAsSingleObjectExtent.objectOffset + (curFileOffset - inReadPlanStepAsSingleObjectExtent.fileOffset), length: remainingLength, - chunkedPutContext: chunkedPutContext, + chunkedPutContext: inReadPlanStepAsSingleObjectExtent.chunkedPutContext, } outReadPlan = append(outReadPlan, outReadPlanStepAsSingleObjectExtent) @@ -1864,6 +1864,12 @@ func pruneExtentMap(extentMap sortedmap.LLRBTree, newSize uint64) { ok bool ) + // Nothing to do if extentMap hasn't been populated yet + + if nil == extentMap { + return + } + // First, destroy any extents starting at or beyond newSize index, _, err = extentMap.BisectRight(newSize)