clickhouse-native 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/clickhouse_native/pool.rb +19 -4
- data/lib/clickhouse_native/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d1bf3fdd8bd132c0d19937f50055f56b5ab55f4bf383fafc63a74131ff435545
|
|
4
|
+
data.tar.gz: 4e6f233a2e250ee5c2c6c1e46ebf9a961416b69553aee7c2018afea619c1abab
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a79cba4fd6ad33b75ec2eecadf87ec0e9fc163ff46874b2ad687f6d767405f7357fffe04a1af584a6716d0c1dcc3ba7171b201a46b130c327d87e3b5e04c52ad
|
|
7
|
+
data.tar.gz: 7ed472036327f17efceda43eac9f41cf7e6675e267711de5f974b2b75de88fcc5e557e7290ef1b0f00b084573fc4a8a5a88e49875d0b4fb83237302262b418f4
|
|
@@ -29,11 +29,26 @@ module ClickhouseNative
|
|
|
29
29
|
# session settings), producing misleading log lines and re-raises in
|
|
30
30
|
# unrelated code. A fresh socket + handshake is cheap relative to
|
|
31
31
|
# debugging that.
|
|
32
|
+
#
|
|
33
|
+
# ConnectionError gets one automatic retry: pooled connections that
|
|
34
|
+
# have been idle long enough for the server / an LB to FIN them
|
|
35
|
+
# surface as "closed" on the very next recv (errno 0, message
|
|
36
|
+
# "closed: Success"). Discarding and re-checking out lands a fresh
|
|
37
|
+
# socket and the operation succeeds. The retry only triggers when
|
|
38
|
+
# the dead-connection error fired before any data was sent, so
|
|
39
|
+
# write operations don't risk double-execution from this path.
|
|
32
40
|
def with
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
attempts = 0
|
|
42
|
+
begin
|
|
43
|
+
@pool.with do |client|
|
|
44
|
+
yield client
|
|
45
|
+
rescue
|
|
46
|
+
@pool.discard_current_connection(&:close)
|
|
47
|
+
raise
|
|
48
|
+
end
|
|
49
|
+
rescue ConnectionError
|
|
50
|
+
attempts += 1
|
|
51
|
+
retry if attempts == 1
|
|
37
52
|
raise
|
|
38
53
|
end
|
|
39
54
|
end
|