Skip to content

Fix context cancellation issues with datastore

Patrick Steinhardt requested to merge pks-datastore-test-race into master

One of the datastore tests verifies that if we trigger the health updater twice, that the job lock's timestamp got updated. There are currently two problems, though:

  1. The started Goroutine may leak until after the test has finished. As a result, the test driver would panic in case the Goroutine asserted a failure. A wait group was added to synchronize the shutdown and not leak the Goroutine.
  2. If cancelling the context during execution of a pq statement, then pq wouldn't return a nice "Context canceled" error, but instead a pq.Error with code "query_canceled". This caused the health updater to error out in some cases if its context got canceled. This was fixed by expecting that error code and ignoring it.
Edited by Patrick Steinhardt

Merge request reports