Skip to content

Commit 34895bf

Browse files
fix: batch write race on commit (backport #983) (#992)
Co-authored-by: corver <[email protected]>
1 parent 6175441 commit 34895bf

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

import.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,17 @@ func (i *Importer) Commit() error {
213213
len(i.stack))
214214
}
215215

216-
err := i.batch.WriteSync()
216+
// Wait for previous batch.
217+
var err error
218+
if i.inflightCommit != nil {
219+
err = <-i.inflightCommit
220+
i.inflightCommit = nil
221+
}
222+
if err != nil {
223+
return err
224+
}
225+
226+
err = i.batch.WriteSync()
217227
if err != nil {
218228
return err
219229
}

0 commit comments

Comments
 (0)