From 64eba507f398aa02135b7fcbc311c90d47134898 Mon Sep 17 00:00:00 2001 From: lucklove Date: Fri, 6 Nov 2020 19:06:36 +0800 Subject: [PATCH] Add debug log --- pkg/repository/store/store_test.go | 5 ----- pkg/repository/store/txn.go | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/repository/store/store_test.go b/pkg/repository/store/store_test.go index ef8b7a9600..9483689ec8 100644 --- a/pkg/repository/store/store_test.go +++ b/pkg/repository/store/store_test.go @@ -14,7 +14,6 @@ package store import ( - "fmt" "io/ioutil" "os" "testing" @@ -65,10 +64,6 @@ func TestConflict(t *testing.T) { store := New(root, "") - fi, err := os.Stat(root) - assert.Nil(t, err) - fmt.Println("begin", fi.ModTime().UnixNano()) - txn1, err := store.Begin() assert.Nil(t, err) txn2, err := store.Begin() diff --git a/pkg/repository/store/txn.go b/pkg/repository/store/txn.go index bc7effaae8..aefd3c9f41 100644 --- a/pkg/repository/store/txn.go +++ b/pkg/repository/store/txn.go @@ -191,6 +191,7 @@ func (t *localTxn) Rollback() error { } func (t *localTxn) checkConflict() error { + fmt.Println("======start of check conflict=======") for file := range t.accessed { mt, err := t.store.last(file) if err != nil { @@ -199,6 +200,10 @@ func (t *localTxn) checkConflict() error { if mt != nil && mt.After(*t.first(file)) { return ErrorFsCommitConflict } + fmt.Printf("first modify time of %s: %d\n", file, t.first(file).UnixNano()) + if mt != nil { + fmt.Printf("last modify time of %s: %d\n", file, mt.UnixNano()) + } } return nil }