Commit 193cea95 authored by Jakob Borg's avatar Jakob Borg

Revert "Add temporary debug logging for #344 (revert later)"

This reverts commit 5353659f.
parent 3c4002e1
...@@ -49,7 +49,6 @@ func (m *Set) Replace(id uint, fs []scanner.File) { ...@@ -49,7 +49,6 @@ func (m *Set) Replace(id uint, fs []scanner.File) {
} }
m.Lock() m.Lock()
log("Replace", id, len(fs))
if len(fs) == 0 || !m.equals(id, fs) { if len(fs) == 0 || !m.equals(id, fs) {
m.changes[id]++ m.changes[id]++
m.replace(id, fs) m.replace(id, fs)
...@@ -66,7 +65,6 @@ func (m *Set) ReplaceWithDelete(id uint, fs []scanner.File) { ...@@ -66,7 +65,6 @@ func (m *Set) ReplaceWithDelete(id uint, fs []scanner.File) {
} }
m.Lock() m.Lock()
log("ReplaceWithDelete", id, len(fs))
if len(fs) == 0 || !m.equals(id, fs) { if len(fs) == 0 || !m.equals(id, fs) {
m.changes[id]++ m.changes[id]++
...@@ -104,9 +102,7 @@ func (m *Set) Update(id uint, fs []scanner.File) { ...@@ -104,9 +102,7 @@ func (m *Set) Update(id uint, fs []scanner.File) {
if debug { if debug {
l.Debugf("Update(%d, [%d])", id, len(fs)) l.Debugf("Update(%d, [%d])", id, len(fs))
} }
m.Lock() m.Lock()
log("Update", id, len(fs))
m.update(id, fs) m.update(id, fs)
m.changes[id]++ m.changes[id]++
m.Unlock() m.Unlock()
...@@ -224,7 +220,6 @@ func (m *Set) equals(id uint, fs []scanner.File) bool { ...@@ -224,7 +220,6 @@ func (m *Set) equals(id uint, fs []scanner.File) bool {
func (m *Set) update(cid uint, fs []scanner.File) { func (m *Set) update(cid uint, fs []scanner.File) {
remFiles := m.remoteKey[cid] remFiles := m.remoteKey[cid]
if remFiles == nil { if remFiles == nil {
printLog()
l.Fatalln("update before replace for cid", cid) l.Fatalln("update before replace for cid", cid)
} }
for _, f := range fs { for _, f := range fs {
......
package files
import (
"fmt"
"time"
"github.com/calmh/syncthing/cid"
)
type logEntry struct {
time time.Time
method string
cid uint
node string
nfiles int
}
func (l logEntry) String() string {
return fmt.Sprintf("%v: %s cid:%d node:%s nfiles:%d", l.time, l.method, l.cid, l.node, l.nfiles)
}
var (
debugLog [10]logEntry
debugNext int
cm *cid.Map
)
func SetCM(m *cid.Map) {
cm = m
}
func log(method string, id uint, nfiles int) {
e := logEntry{
time: time.Now(),
method: method,
cid: id,
nfiles: nfiles,
}
if cm != nil {
e.node = cm.Name(id)
}
debugLog[debugNext] = e
debugNext = (debugNext + 1) % len(debugLog)
}
func printLog() {
l.Debugln("--- Consistency error ---")
for _, e := range debugLog {
l.Debugln(e)
}
}
...@@ -98,9 +98,6 @@ func NewModel(indexDir string, cfg *config.Configuration, clientName, clientVers ...@@ -98,9 +98,6 @@ func NewModel(indexDir string, cfg *config.Configuration, clientName, clientVers
sup: suppressor{threshold: int64(cfg.Options.MaxChangeKbps)}, sup: suppressor{threshold: int64(cfg.Options.MaxChangeKbps)},
} }
// TEMP: #344
files.SetCM(m.cm)
var timeout = 20 * 60 // seconds var timeout = 20 * 60 // seconds
if t := os.Getenv("STDEADLOCKTIMEOUT"); len(t) > 0 { if t := os.Getenv("STDEADLOCKTIMEOUT"); len(t) > 0 {
it, err := strconv.Atoi(t) it, err := strconv.Atoi(t)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment