Skip to content

Commit

Permalink
Fix wrong logs in xidmap flush (#7082)
Browse files Browse the repository at this point in the history
Fix the incorrect log about "writing to db" despite no db write being 
done while Flush() in xidmap.
  • Loading branch information
ahsanbarkati authored Dec 7, 2020
1 parent cf4c796 commit 708b3fa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions xidmap/xidmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,19 +276,19 @@ func (m *XidMap) AllocateUid() uint64 {

// Flush must be called if DB is provided to XidMap.
func (m *XidMap) Flush() error {
if m.writer == nil {
return nil
}
glog.Infof("Writing xid map to DB")
defer func() {
glog.Infof("Finished writing xid map to DB")
}()

if m.writer != nil && len(m.kvBuf) > 0 {
if len(m.kvBuf) > 0 {
m.kvChan <- m.kvBuf
}
close(m.kvChan)
m.wg.Wait()

if m.writer == nil {
return nil
}
return m.writer.Flush()
}

0 comments on commit 708b3fa

Please sign in to comment.