Skip to content

Conversation

@timvaillancourt
Copy link
Contributor

Fix for data race:

test_1    | === RUN   TestBasicApplyLog
test_1    | Dumping the oplog into "/tmp/example.bson.739782274"
test_1    | ==================
test_1    | WARNING: DATA RACE
test_1    | Write at 0x00c4202024a0 by goroutine 39:
test_1    |   github.com/percona/mongodb-backup/internal/oplog.(*OplogTail).tail()
test_1    |       /go/src/github.com/percona/mongodb-backup/internal/oplog/oplog_tail.go:149 +0x7aa
test_1    | 
test_1    | Previous read at 0x00c4202024a0 by goroutine 38:
test_1    |   github.com/percona/mongodb-backup/internal/oplog.(*OplogTail).tailQuery()
test_1    |       /go/src/github.com/percona/mongodb-backup/internal/oplog/oplog_tail.go:167 +0x1bb
test_1    |   github.com/percona/mongodb-backup/internal/oplog.(*OplogTail).tail()
test_1    |       /go/src/github.com/percona/mongodb-backup/internal/oplog/oplog_tail.go:160 +0x4cd
test_1    | 
test_1    | Goroutine 39 (running) created at:
test_1    |   github.com/percona/mongodb-backup/internal/oplog.Open()
test_1    |       /go/src/github.com/percona/mongodb-backup/internal/oplog/oplog_tail.go:50 +0xf5
test_1    |   github.com/percona/mongodb-backup/internal/oplog.TestBasicApplyLog()
test_1    |       /go/src/github.com/percona/mongodb-backup/internal/oplog/oplog_apply_test.go:29 +0x1ad
test_1    |   testing.tRunner()
test_1    |       /usr/local/go/src/testing/testing.go:777 +0x16d
test_1    | 
test_1    | Goroutine 38 (running) created at:
test_1    |   github.com/percona/mongodb-backup/internal/oplog.open()
test_1    |       /go/src/github.com/percona/mongodb-backup/internal/oplog/oplog_tail.go:85 +0x2b4
test_1    |   github.com/percona/mongodb-backup/internal/oplog.Open()
test_1    |       /go/src/github.com/percona/mongodb-backup/internal/oplog/oplog_tail.go:46 +0x54
test_1    |   github.com/percona/mongodb-backup/internal/oplog.TestBasicApplyLog()
test_1    |       /go/src/github.com/percona/mongodb-backup/internal/oplog/oplog_apply_test.go:29 +0x1ad
test_1    |   testing.tRunner()
test_1    |       /usr/local/go/src/testing/testing.go:777 +0x16d

@timvaillancourt timvaillancourt changed the title Add lock to fix data race Add lock to fix data race in internal/oplog/oplog_tail.go Jul 18, 2018
@timvaillancourt timvaillancourt merged commit 9e91350 into master Jul 18, 2018
@timvaillancourt timvaillancourt deleted the fix_data_race branch July 18, 2018 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant