Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
fix a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
glorv committed May 6, 2021
1 parent 29b593e commit 74089ac
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions pkg/lightning/restore/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -1689,15 +1689,18 @@ func (tr *TableRestore) restoreEngine(
if err == nil {
metric.ChunkCounter.WithLabelValues(metric.ChunkStateFinished).Add(remainChunkCnt)
metric.BytesCounter.WithLabelValues(metric.TableStateWritten).Add(float64(cr.chunk.Checksum.SumSize()))
if dataFlushStatus != nil && !dataFlushStatus.Flushed() &&
indexFlushStaus != nil && !indexFlushStaus.Flushed() {
checkFlushLock.Lock()
flushPendingChunks = append(flushPendingChunks, chunkFlushStatus{
dataStatus: dataFlushStatus,
indexStatus: indexFlushStaus,
chunkCp: cr.chunk,
})
checkFlushLock.Unlock()
if dataFlushStatus != nil && indexFlushStaus != nil && !indexFlushStaus.Flushed() {
if dataFlushStatus.Flushed() && indexFlushStaus.Flushed() {
saveCheckpoint(rc, tr, engineID, cr.chunk)
} else {
checkFlushLock.Lock()
flushPendingChunks = append(flushPendingChunks, chunkFlushStatus{
dataStatus: dataFlushStatus,
indexStatus: indexFlushStaus,
chunkCp: cr.chunk,
})
checkFlushLock.Unlock()
}
}
} else {
metric.ChunkCounter.WithLabelValues(metric.ChunkStateFailed).Add(remainChunkCnt)
Expand Down

0 comments on commit 74089ac

Please sign in to comment.