couchbase / sync_gateway

Manages access and synchronization between Couchbase Lite and Couchbase Server
https://www.couchbase.com/products/sync-gateway
Other
447 stars 138 forks source link

Test mode to randomly return 503 temporary errors #3595

Closed tleyden closed 4 years ago

tleyden commented 6 years ago

This should be done at the bucket level, which will cover both BLIP and REST APIs

Originally from https://github.com/couchbase/sync_gateway/issues/3509#issuecomment-388919848:

Should evaluate how to easily test client behaviour without needing to generate significant load.

tleyden commented 6 years ago

Run LiteCore integration tests against SG configured with injected failures, verify that it still works

The initial run is showing an issue (and possibly more):

https://github.com/couchbase/couchbase-lite-core/issues/525

tleyden commented 6 years ago

Run sg-replicate to verify it retries all 503 errors

I can see by inspecting the code that there are places where it will abort the replication if it receives a 503 error. In this case, fetching the remote checkpoint.

https://github.com/couchbaselabs/sg-replicate/blob/cc411eae87827555f492df4c5282fc6684693584/synctube.go#L221-L226

} else if resp.StatusCode >= 400 {
        // we got an error, lets abort
        r.LogTo("Replicate", "4xx error(not 404) getting checkpoint")
        event := NewReplicationEvent(FETCH_CHECKPOINT_FAILED)
        r.sendEventWithTimeout(event)
    } else if ...  {