Skip to content

Commit

Permalink
Add debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
lucklove committed Nov 6, 2020
1 parent 29e547b commit 64eba50
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 0 additions & 5 deletions pkg/repository/store/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
package store

import (
"fmt"
"io/ioutil"
"os"
"testing"
Expand Down Expand Up @@ -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()
Expand Down
5 changes: 5 additions & 0 deletions pkg/repository/store/txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
Expand Down

0 comments on commit 64eba50

Please sign in to comment.