Skip to content

Commit

Permalink
Fix PFSAgent ExtentMap overlapping chunked PUTs and truncates
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed McClanahan committed Dec 26, 2019
1 parent c75c8f8 commit aebbbd6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pfsagentd/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit aebbbd6

Please sign in to comment.