Skip to content
This repository has been archived by the owner on Aug 28, 2021. It is now read-only.

Commit

Permalink
Fix sync bug when all chunks are already present in the sink (#3032)
Browse files Browse the repository at this point in the history
In the edge case where all source chunks are already present in the
sink AND the sink dataset does not yet exist, the httpBatchStore code
was sending chunks in reverse order.  This patch ensures that,
regardless of how few chunks are sent, any operation that sends chunks
to the server also resets chunk write order.

Fixes #3101
  • Loading branch information
cmasone-attic authored Jan 5, 2017
1 parent ce5c747 commit 5447216
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions go/datas/http_batch_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,10 @@ func (bhcs *httpBatchStore) sendWriteRequests() {
defer func() { <-bhcs.rateLimit }()

bhcs.cacheMu.Lock()
defer bhcs.cacheMu.Unlock()
defer func() {
bhcs.flushOrder = nbs.InsertOrder // This needs to happen even if no chunks get written.
bhcs.cacheMu.Unlock()
}()

count := bhcs.unwrittenPuts.Count()
if count == 0 {
Expand All @@ -366,7 +369,6 @@ func (bhcs *httpBatchStore) sendWriteRequests() {
bhcs.unwrittenPuts.Destroy()
bhcs.unwrittenPuts = nbs.NewCache()
bhcs.hints = types.Hints{}
bhcs.flushOrder = nbs.InsertOrder
}()

var res *http.Response
Expand Down

0 comments on commit 5447216

Please sign in to comment.