pinot-client 1.16.0 → 1.18.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/pinot/connection.rb +0 -2
- data/lib/pinot/grpc_transport.rb +10 -3
- data/lib/pinot/simple_broker_selector.rb +7 -1
- data/lib/pinot/transport.rb +10 -0
- data/lib/pinot/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 22de970391b9faa4d6f889e1891e84e69c2d045b4f22132d5d892a619b85659d
|
|
4
|
+
data.tar.gz: 64d0af1ca75e2a1ac9b074d8958d1a8b9df4599fdaf1f0570d95a1395f2faeb0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4654c1ca25d89bea2e4b1723153e079f016b15af06b736f7c3577475c34eb728ba2e19e8889273a6bf2f39742e9fb243460bb64fae7a9fe701cb7c9b8e4ecbd5
|
|
7
|
+
data.tar.gz: 52c5de1088080bba980bca3914b2e626c57e8d0e965b0127043ded49e3a165fbc6273e1f485e57111260d191086b0e35937ca5d40a950a46d47f9701a3913545
|
data/lib/pinot/connection.rb
CHANGED
|
@@ -32,8 +32,6 @@ module Pinot
|
|
|
32
32
|
effective_timeout = query_timeout_ms || @query_timeout_ms
|
|
33
33
|
@transport.execute(broker, build_request(query, timeout_ms: effective_timeout))
|
|
34
34
|
end
|
|
35
|
-
rescue => e
|
|
36
|
-
raise "unable to execute SQL on table #{table}: #{e.message}"
|
|
37
35
|
end
|
|
38
36
|
|
|
39
37
|
def execute_sql_with_timeout(table, query, timeout_ms)
|
data/lib/pinot/grpc_transport.rb
CHANGED
|
@@ -18,7 +18,7 @@ module Pinot
|
|
|
18
18
|
def execute(broker_address, request)
|
|
19
19
|
stub = build_stub(broker_address)
|
|
20
20
|
grpc_request = build_request(request)
|
|
21
|
-
call_opts = build_call_opts
|
|
21
|
+
call_opts = build_call_opts(request)
|
|
22
22
|
|
|
23
23
|
grpc_response = stub.submit(grpc_request, **call_opts)
|
|
24
24
|
BrokerResponse.from_json(grpc_response.payload)
|
|
@@ -55,12 +55,19 @@ module Pinot
|
|
|
55
55
|
def build_query_options(request)
|
|
56
56
|
parts = ["groupByMode=sql", "responseFormat=sql"]
|
|
57
57
|
parts << "useMultistageEngine=true" if request.use_multistage_engine
|
|
58
|
+
parts << "timeoutMs=#{request.query_timeout_ms}" if request.query_timeout_ms
|
|
58
59
|
parts.join(";")
|
|
59
60
|
end
|
|
60
61
|
|
|
61
|
-
def build_call_opts
|
|
62
|
+
def build_call_opts(request)
|
|
62
63
|
opts = {}
|
|
63
|
-
|
|
64
|
+
# Per-request timeout takes precedence over config-level timeout
|
|
65
|
+
timeout_s = if request.query_timeout_ms
|
|
66
|
+
request.query_timeout_ms / 1000.0
|
|
67
|
+
elsif @config.timeout
|
|
68
|
+
@config.timeout
|
|
69
|
+
end
|
|
70
|
+
opts[:deadline] = Time.now + timeout_s if timeout_s
|
|
64
71
|
opts[:metadata] = @config.extra_metadata unless @config.extra_metadata.empty?
|
|
65
72
|
opts
|
|
66
73
|
end
|
|
@@ -4,6 +4,8 @@ module Pinot
|
|
|
4
4
|
|
|
5
5
|
def initialize(broker_list)
|
|
6
6
|
@broker_list = broker_list.dup.freeze
|
|
7
|
+
@mutex = Mutex.new
|
|
8
|
+
@index = 0
|
|
7
9
|
end
|
|
8
10
|
|
|
9
11
|
def init
|
|
@@ -12,7 +14,11 @@ module Pinot
|
|
|
12
14
|
|
|
13
15
|
def select_broker(_table)
|
|
14
16
|
raise BrokerNotFoundError, "no pre-configured broker lists" if @broker_list.empty?
|
|
15
|
-
@
|
|
17
|
+
@mutex.synchronize do
|
|
18
|
+
broker = @broker_list[@index % @broker_list.size]
|
|
19
|
+
@index += 1
|
|
20
|
+
broker
|
|
21
|
+
end
|
|
16
22
|
end
|
|
17
23
|
end
|
|
18
24
|
end
|
data/lib/pinot/transport.rb
CHANGED
|
@@ -38,6 +38,16 @@ module Pinot
|
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
+
def close
|
|
42
|
+
@reaper.kill rescue nil
|
|
43
|
+
@pool_mutex.synchronize do
|
|
44
|
+
@pool.each_value do |entries|
|
|
45
|
+
entries.each { |entry| entry.http.finish rescue nil }
|
|
46
|
+
end
|
|
47
|
+
@pool.clear
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
41
51
|
private
|
|
42
52
|
|
|
43
53
|
def with_connection(url)
|
data/lib/pinot/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pinot-client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.18.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Xiang Fu
|
|
@@ -115,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
115
115
|
requirements:
|
|
116
116
|
- - ">="
|
|
117
117
|
- !ruby/object:Gem::Version
|
|
118
|
-
version: '2
|
|
118
|
+
version: '3.2'
|
|
119
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
requirements:
|
|
121
121
|
- - ">="
|