Skip to content

Commit

Permalink
Fixes issue #3558 Initialize cache after DCP start (#3607) (#3780)
Browse files Browse the repository at this point in the history
* Add experimental dockerfile

* Fix attempt for build err

* Trying to figure out how to get source commit/branch

* Revert "Trying to figure out how to get source commit/branch"

This reverts commit bd5e502.

* Add artificial delay after getting last seq, but before starting dcp feed

* Reload c.initialSequence in DocChanged() as long as c.initialSequenceLazyLoaded == false

* Notes from call w/ Adam

* Add c.getInitialSequence() + _getNextSequence()

* Fixes

* Add comments

* Notes from call w/ Adam

* Sketch out changes and test

* Change the changeindex iface

* Fix data race

WARNING: DATA RACE
Write at 0x00c4201fa2e0 by goroutine 9:
  github.com/couchbase/sync_gateway/db.(*changeCache)._addToCache()
      /drone/godeps/src/github.com/couchbase/sync_gateway/db/change_cache.go:689 +0x4ff
  github.com/couchbase/sync_gateway/db.(*changeCache).processEntry()
      /drone/godeps/src/github.com/couchbase/sync_gateway/db/change_cache.go:650 +0x1f6
  github.com/couchbase/sync_gateway/db.(*changeCache).DocChangedSynchronous()
      /drone/godeps/src/github.com/couchbase/sync_gateway/db/change_cache.go:549 +0x20a4

Previous read at 0x00c4201fa2e0 by goroutine 42:
  github.com/couchbase/sync_gateway/db.(*changeCache).waitForSequence()
      /drone/godeps/src/github.com/couchbase/sync_gateway/db/util_testing.go:25 +0xbd
  github.com/couchbase/sync_gateway/db.TestDocDeletionFromChannelCoalesced()
      /drone/godeps/src/github.com/couchbase/sync_gateway/db/changes_test.go:233 +0x5fe
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:746 +0x16c

* Use getNextSequence() in a few more places

* Fix another race

https://gist.github.com/tleyden/dccaa3cf2be85160051a793333c24467

* Remove dockerfile, moved to a separate PR

* Gofmt

* PR cleanup

* PR cleanup

* Remove check that’s leftover from first attempt

* Add comments

* First round of PR feedback

* Address PR feedback about avoiding external locking
  • Loading branch information
adamcfraser authored Oct 4, 2018
1 parent f998748 commit fea9947
Show file tree
Hide file tree
Showing 6 changed files with 203 additions and 138 deletions.
Loading

0 comments on commit fea9947

Please sign in to comment.