clickhouse-native 0.7.0-x86_64-linux-gnu → 0.9.0-x86_64-linux-gnu

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93377ea0aaf000966a0d2cd44ca301579a9361d7f22861fadccf87fb17caccd4
4
- data.tar.gz: c6b68ce930a9664ce75d1e64847da6cac68ba6d7a7a32dd426d64ae008c0eb2d
3
+ metadata.gz: f66b71a3034e49226aafecf9e4c12ee571a643ffc19827f77a5549abc3fe600b
4
+ data.tar.gz: 8f30a42df4757392a7ce4c0b24660aec4e9c5a3e69ee6314345c5bdf5fbe29d8
5
5
  SHA512:
6
- metadata.gz: a60885585d68c13cf913e5a72c13f31978f8f01f954b74598803adc3d1ae76be2077baa215008ed2ca9c42ebed682524c9331528792e0ce66f64a03535687716
7
- data.tar.gz: 1668463c11cf7ecf7ee7054b6914b4274bef03769bcbc2d3474ab76e72d2bfc84a46c63dd012f070f7ceca4dfc6ac19022eb0ef54a08e7bb4fa57c36e35dfe65
6
+ metadata.gz: 8aa3187dc90195da1962128ca6a820fa2788eb7ed3702c9f3ce3797e0a2c86ebd1760a4d046351a6a1fe19cd7c5df0edb52070d3b1f498dbf409a9758fec4d5f
7
+ data.tar.gz: 917df6bcadff415f21b4ce9420e031af08e421e8b51b4ad0e4837bb21460c65bdd6fa914c4b03a3329198f82c302dc76ec75a45844be8be6649b96c60c04c969
@@ -12,19 +12,19 @@ module ClickhouseNative
12
12
  module Logging
13
13
  LEVEL = :debug
14
14
 
15
- def execute(sql)
15
+ def execute(sql, **opts)
16
16
  log_sql(sql) { super }
17
17
  end
18
18
 
19
- def query(sql)
19
+ def query(sql, **opts)
20
20
  log_sql(sql) { super }
21
21
  end
22
22
 
23
- def query_value(sql)
23
+ def query_value(sql, **opts)
24
24
  log_sql(sql) { super }
25
25
  end
26
26
 
27
- def query_each(sql, &)
27
+ def query_each(sql, **opts, &)
28
28
  log_sql(sql) { super }
29
29
  end
30
30
 
@@ -29,29 +29,44 @@ 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
- @pool.with do |client|
34
- yield client
35
- rescue
36
- @pool.discard_current_connection(&:close)
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
40
55
 
41
- def execute(sql)
42
- with { |c| c.execute(sql) }
56
+ def execute(sql, **opts)
57
+ with { |c| c.execute(sql, **opts) }
43
58
  end
44
59
 
45
- def query(sql)
46
- with { |c| c.query(sql) }
60
+ def query(sql, **opts)
61
+ with { |c| c.query(sql, **opts) }
47
62
  end
48
63
 
49
- def query_each(sql, &block)
50
- with { |c| c.query_each(sql, &block) }
64
+ def query_each(sql, **opts, &block)
65
+ with { |c| c.query_each(sql, **opts, &block) }
51
66
  end
52
67
 
53
- def query_value(sql)
54
- with { |c| c.query_value(sql) }
68
+ def query_value(sql, **opts)
69
+ with { |c| c.query_value(sql, **opts) }
55
70
  end
56
71
 
57
72
  def insert(table, rows, **opts)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ClickhouseNative
4
- VERSION = "0.7.0"
4
+ VERSION = "0.9.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clickhouse-native
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.9.0
5
5
  platform: x86_64-linux-gnu
6
6
  authors:
7
7
  - Yuri Smirnov