Repository navigation
Enhancement: failing concurrent transactions - #193
Conversation
|
Your Render PR Server URL is https://chproxy-pr-193.onrender.com. Follow its progress at https://dashboard.render.com/static/srv-cbbrasuhb05o535lvq0g. |
| } | ||
| } | ||
|
|
||
| var clickhouseNonRecoverableStatusCodes = map[int]struct{}{400: {}, 404: {}, 500: {}} |
There was a problem hiding this comment.
cf our discussion on slack. There is at least the 408 code that is missing and is very important. And maybe doing a list of clickhouseRecoverableStatusCodes instead of clickhouseNonRecoverableStatusCodes might be safer
4f746b8 to
662477d
Compare
…specific status codes
662477d to
594358d
Compare
594358d to
9cb316e
Compare
|
|
||
| // clickhouseRecoverableStatusCodes set of recoverable http responses' status codes from Clickhouse. | ||
| // When such happens we mark transaction as completed and let concurrent query to hit another Clickhouse shard. | ||
| var clickhouseRecoverableStatusCodes = map[int]struct{}{503: {}} |
There was a problem hiding this comment.
A bit opinionated but instead of 503 you should create a const variable with a meaningFull name like httpServiceUnavailable and put this variable in your map (maybe such a constant already exist in the net.http package)
open questions:
- should we also put the HTTP 408?
- should we add in the comments a link to all the possible http error codes in clickhouse (i.e: https://github.com/ClickHouse/ClickHouse/blob/master/src/Server/HTTPHandler.cpp)
There was a problem hiding this comment.
http.StatusServiceUnavailable used, thanks!
Regarding open questions:
- let's follow up on this if such need will raise. I'm unsure about it
- enriched the doc 👌
|
|
||
| go func() { | ||
| defer wg.Done() | ||
| time.Sleep(20 * time.Millisecond) |
There was a problem hiding this comment.
why do we need to sleep for 20 msec. Our logic of conccurence query should work even if we don't sleep
There was a problem hiding this comment.
in case the start up of the first go routine (the one that's supposed to be launched first) takes longer than the 2nd. In an unstable/slow environment, such as CI we use, it's very likely to happen
| // scenario: 1st query fails before grace_time elapsed. 2nd query fails as well. | ||
|
|
||
| q := "SELECT RECOVERABLE-ERROR" | ||
| executeTwoConcurrentRequests(t, q, http.StatusServiceUnavailable, http.StatusServiceUnavailable, "DB::Unavailable\n", "DB::Unavailable\n") |
Description
Mark transaction registry record as failed, upon query failure, only for non-recoverable status codes.
Created to trigger discussion.
Pull request type
Please check the type of change your PR introduces:
Checklist
Does this introduce a breaking change?
Further comments