Fix embarrassing bug in crash recovery.

(And yes, we always knew we need tests for that. I have added a TODO now.)

Change-Id: I9cf52bbf98e263e0b79404bda4c442beba9696a8
This commit is contained in:
Bjoern Rabenstein 2014-12-17 17:18:04 +01:00
parent d72d49f1b3
commit ff24070a03
1 changed files with 2 additions and 1 deletions

View File

@ -263,11 +263,12 @@ func (p *persistence) setDirty(dirty bool) {
// safe. Only call before anything else is running (except index processing // safe. Only call before anything else is running (except index processing
// queue as started by newPersistence). // queue as started by newPersistence).
func (p *persistence) recoverFromCrash(fingerprintToSeries map[clientmodel.Fingerprint]*memorySeries) error { func (p *persistence) recoverFromCrash(fingerprintToSeries map[clientmodel.Fingerprint]*memorySeries) error {
// TODO(beorn): We need proper tests for the crash recovery.
glog.Warning("Starting crash recovery. Prometheus is inoperational until complete.") glog.Warning("Starting crash recovery. Prometheus is inoperational until complete.")
fpsSeen := map[clientmodel.Fingerprint]struct{}{} fpsSeen := map[clientmodel.Fingerprint]struct{}{}
count := 0 count := 0
seriesDirNameFmt := fmt.Sprintf("0%dx", seriesDirNameLen) seriesDirNameFmt := fmt.Sprintf("%%0%dx", seriesDirNameLen)
glog.Info("Scanning files.") glog.Info("Scanning files.")
for i := 0; i < 1<<(seriesDirNameLen*4); i++ { for i := 0; i < 1<<(seriesDirNameLen*4); i++ {