From ba76e278753bcb696b0ff0d35e9e703f52e65d6a Mon Sep 17 00:00:00 2001 From: Hitoshi Mitake Date: Wed, 5 Aug 2015 11:09:08 +0900 Subject: [PATCH] wal: log errors in wal.Close() This patch adds error logging in wal.Close() if unlocking and destroying fail. Though it is hard to handling the errors, logging would be helpful for trouble shooting. --- wal/wal.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/wal/wal.go b/wal/wal.go index fe853fca2..22d3f9b90 100644 --- a/wal/wal.go +++ b/wal/wal.go @@ -449,9 +449,14 @@ func (w *WAL) Close() error { } } for _, l := range w.locks { - // TODO: log the error - l.Unlock() - l.Destroy() + err := l.Unlock() + if err != nil { + plog.Errorf("failed to unlock during closing wal: %s", err) + } + err = l.Destroy() + if err != nil { + plog.Errorf("failed to destroy lock during closing wal: %s", err) + } } return nil }