session: Close data session file when migrating (#2126)

Cleanup needed before removing the data file
This commit is contained in:
Anis Elleuch
2017-04-18 12:37:54 -07:00
committed by Harshavardhana
parent 9eb967cabf
commit 656f4f13d0
2 changed files with 5 additions and 2 deletions
+2 -2
View File
@@ -134,7 +134,7 @@ func clearSession(sid string) {
session, err := loadSessionV8(sid)
fatalIf(err.Trace(sid), "Unable to load session `"+sid+"`.")
fatalIf(session.Delete().Trace(sid), "Unable to load session `"+sid+"`.")
fatalIf(session.Delete().Trace(sid), "Unable to remove session `"+sid+"`.")
printMsg(clearSessionMessage{Status: "success", SessionID: sid})
}
@@ -156,7 +156,7 @@ func clearSession(sid string) {
}
if session != nil {
fatalIf(session.Delete().Trace(sid), "Unable to load session `"+sid+"`.")
fatalIf(session.Delete().Trace(sid), "Unable to remove session `"+sid+"`.")
printMsg(clearSessionMessage{Status: "success", SessionID: sid})
}
}
+3
View File
@@ -37,6 +37,9 @@ func migrateSessionV7ToV8() {
fatalIf(err.Trace(sid), "Unable to load version `7`. Migration failed please report this issue at https://github.com/minio/mc/issues.")
}
// Close underlying session data file.
sV7.DataFP.Close()
sessionVersion, e := strconv.Atoi(sV7.Header.Version)
fatalIf(probe.NewError(e), "Unable to load version `7`. Migration failed please report this issue at https://github.com/minio/mc/issues.")
if sessionVersion > 7 { // It is new format.