mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-09 10:38:10 -06:00
Fix sync bug when all chunks are already present in the sink (#3032)
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
This commit is contained in:
@@ -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 {
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user