Fixed #76: must create a new chunk for uploading in the copy operation

This commit is contained in:
Gilbert Chen
2017-06-15 10:48:24 -04:00
parent 112d5b22e5
commit 28da4d15e2
3 changed files with 27 additions and 3 deletions

View File

@@ -1337,6 +1337,7 @@ func (manager *BackupManager) CopySnapshots(otherManager *BackupManager, snapsho
} else {
LOG_INFO("SNAPSHOT_COPY", "Copied chunk %s (%d/%d)", chunk.GetID(), chunkIndex, len(chunks))
}
otherManager.config.PutChunk(chunk)
})
chunkUploader.Start()
@@ -1350,7 +1351,10 @@ func (manager *BackupManager) CopySnapshots(otherManager *BackupManager, snapsho
i := chunkDownloader.AddChunk(chunkHash)
chunk := chunkDownloader.WaitForChunk(i)
chunkUploader.StartChunk(chunk, chunkIndex)
newChunk := otherManager.config.GetChunk()
newChunk.Reset(true)
newChunk.Write(chunk.GetBytes())
chunkUploader.StartChunk(newChunk, chunkIndex)
}
chunkDownloader.Stop()