google-cloud-bigtable 2.9.1 → 2.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/google/cloud/bigtable/chunk_processor.rb +5 -5
- data/lib/google/cloud/bigtable/column_family_map.rb +3 -6
- data/lib/google/cloud/bigtable/read_operations.rb +9 -2
- data/lib/google/cloud/bigtable/rows_reader.rb +77 -32
- data/lib/google/cloud/bigtable/service.rb +5 -7
- data/lib/google/cloud/bigtable/version.rb +1 -1
- data/lib/google-cloud-bigtable.rb +4 -2
- metadata +4 -116
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb8ed222ed2c24d4b39856180ede2faa2f861759a8166bcd86f1c76a969d8c24
|
4
|
+
data.tar.gz: 6a3575d2c69f0820899d14727a76bdeeeb89d05fde99abe90ff1b068ced220b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1cd0db63088866f0aaf1ee4829b5d6af9a7f9b30ae0b2315cba9e3f6a2ccfb6171820970fb6bc8a2f3c8628c946a7dc37df5665c58b1eb0614337118b94831b
|
7
|
+
data.tar.gz: c56bd73b38d3f8b031200f78228c018d9c59d81e170067755204983b8f51c162f31c7183e09cde5be27be89b69cfef3d1c221db31d0247343bf68d03d6bde5e9
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 2.10.1 (2024-03-19)
|
4
|
+
|
5
|
+
#### Bug Fixes
|
6
|
+
|
7
|
+
* fix read rows retry so it doesn't trigger a full table scan in t… ([#25391](https://github.com/googleapis/google-cloud-ruby/issues/25391))
|
8
|
+
|
9
|
+
### 2.10.0 (2024-03-07)
|
10
|
+
|
11
|
+
#### Features
|
12
|
+
|
13
|
+
* Update minimum supported Ruby version to 2.7 ([#25298](https://github.com/googleapis/google-cloud-ruby/issues/25298))
|
14
|
+
|
3
15
|
### 2.9.1 (2024-02-09)
|
4
16
|
|
5
17
|
#### Documentation
|
@@ -76,11 +76,11 @@ module Google
|
|
76
76
|
def validate_reset_row
|
77
77
|
return unless chunk.reset_row
|
78
78
|
|
79
|
-
value =
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
79
|
+
value = !chunk.row_key.empty? ||
|
80
|
+
chunk.family_name ||
|
81
|
+
chunk.qualifier ||
|
82
|
+
!chunk.value.empty? ||
|
83
|
+
chunk.timestamp_micros.positive?
|
84
84
|
|
85
85
|
raise_if value, "A reset should have no data"
|
86
86
|
end
|
@@ -370,8 +370,7 @@ module Google
|
|
370
370
|
added_keys = @column_families.keys - comparison_map.keys
|
371
371
|
|
372
372
|
added_keys.map do |name|
|
373
|
-
Google::Cloud::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::
|
374
|
-
Modification.new(
|
373
|
+
Google::Cloud::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification.new(
|
375
374
|
id: name,
|
376
375
|
create: @column_families[name]
|
377
376
|
)
|
@@ -394,8 +393,7 @@ module Google
|
|
394
393
|
end
|
395
394
|
|
396
395
|
updated_keys.map do |name|
|
397
|
-
Google::Cloud::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::
|
398
|
-
Modification.new(
|
396
|
+
Google::Cloud::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification.new(
|
399
397
|
id: name,
|
400
398
|
update: @column_families[name]
|
401
399
|
)
|
@@ -415,8 +413,7 @@ module Google
|
|
415
413
|
dropped_keys = comparison_map.keys - @column_families.keys
|
416
414
|
|
417
415
|
dropped_keys.map do |name|
|
418
|
-
Google::Cloud::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::
|
419
|
-
Modification.new(
|
416
|
+
Google::Cloud::Bigtable::Admin::V2::ModifyColumnFamiliesRequest::Modification.new(
|
420
417
|
id: name,
|
421
418
|
drop: true
|
422
419
|
)
|
@@ -159,8 +159,10 @@ module Google
|
|
159
159
|
rescue *RowsReader::RETRYABLE_ERRORS => e
|
160
160
|
rows_reader.retry_count += 1
|
161
161
|
raise Google::Cloud::Error.from_error(e) unless rows_reader.retryable?
|
162
|
-
|
163
|
-
|
162
|
+
resumption_option = rows_reader.retry_options limit, row_set
|
163
|
+
rows_limit = resumption_option.rows_limit
|
164
|
+
row_set = resumption_option.row_set
|
165
|
+
retry unless resumption_option.complete?
|
164
166
|
end
|
165
167
|
end
|
166
168
|
|
@@ -320,6 +322,11 @@ module Google
|
|
320
322
|
row_set[:row_ranges] = row_ranges.map(&:to_grpc)
|
321
323
|
end
|
322
324
|
|
325
|
+
# Set the row range to full table scan if the row set is empty
|
326
|
+
if row_set.empty?
|
327
|
+
row_set[:row_ranges] = [Google::Cloud::Bigtable::V2::RowRange.new]
|
328
|
+
end
|
329
|
+
|
323
330
|
Google::Cloud::Bigtable::V2::RowSet.new row_set
|
324
331
|
end
|
325
332
|
end
|
@@ -75,6 +75,7 @@ module Google
|
|
75
75
|
# Array of row or yield block for each processed row.
|
76
76
|
#
|
77
77
|
def read rows: nil, filter: nil, rows_limit: nil
|
78
|
+
@rows_count = 0
|
78
79
|
response = @table.service.read_rows(
|
79
80
|
@table.instance_id,
|
80
81
|
@table.table_id,
|
@@ -116,40 +117,54 @@ module Google
|
|
116
117
|
# If not specified, reads from all rows.
|
117
118
|
# A hash of the same form as `Google::Cloud::Bigtable::V2::RowSet`
|
118
119
|
# can also be provided.
|
119
|
-
# @return
|
120
|
+
# @return ResumptionOption
|
120
121
|
#
|
121
122
|
def retry_options rows_limit, row_set
|
122
|
-
return
|
123
|
+
return ResumptionOption.new false, rows_limit, row_set unless last_key
|
124
|
+
|
125
|
+
# Check if we've already read read rows_limit number of rows.
|
126
|
+
# If true, mark ResumptionOption is_complete to true.
|
127
|
+
return ResumptionOption.new true, nil, nil if rows_limit && rows_limit == @rows_count
|
123
128
|
|
124
|
-
#
|
129
|
+
# Reduce the limit by the number of already returned responses.
|
125
130
|
rows_limit -= @rows_count if rows_limit
|
126
131
|
|
127
|
-
|
132
|
+
reset_row_set rows_limit, row_set
|
133
|
+
end
|
134
|
+
|
135
|
+
##
|
136
|
+
# Calculate the new row_set for the retry request
|
137
|
+
# @param rows_limit [Integer]
|
138
|
+
# the updated rows_limit
|
139
|
+
# @param row_set [Google::Cloud::Bigtable::V2::RowSet]
|
140
|
+
# original row_set
|
141
|
+
# @return ResumptionOption
|
142
|
+
def reset_row_set rows_limit, row_set
|
143
|
+
# 1. Remove ranges that have already been read, and reduce ranges that
|
128
144
|
# include the last read rows
|
129
145
|
if last_key
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
if end_key_read? range
|
134
|
-
delete_indexes << i
|
135
|
-
elsif start_key_read? range
|
146
|
+
row_set.row_ranges.reject! { |r| end_key_read? r }
|
147
|
+
row_set.row_ranges.each do |range|
|
148
|
+
if start_key_read? range
|
136
149
|
range.start_key_open = last_key
|
137
150
|
end
|
138
151
|
end
|
139
|
-
|
140
|
-
delete_indexes.each { |i| row_set.row_ranges.delete_at i }
|
141
|
-
end
|
142
|
-
|
143
|
-
if row_set.row_ranges.empty?
|
144
|
-
row_set.row_ranges <<
|
145
|
-
Google::Cloud::Bigtable::V2::RowRange.new(start_key_open: last_key)
|
146
152
|
end
|
147
153
|
|
148
|
-
#
|
154
|
+
# 2. Remove all individual keys before and up to the last read key
|
149
155
|
row_set.row_keys.select! { |k| k > last_key }
|
150
156
|
|
157
|
+
# 3. In read_operations, we always add an empty row_range if row_ranges and
|
158
|
+
# row_keys are not defined. So if both row_ranges and row_keys are empty,
|
159
|
+
# it means that we've already read all the ranges and keys, set ResumptionOption
|
160
|
+
# is_complete to true to indicate that this read is successful.
|
161
|
+
if last_key && row_set.row_ranges.empty? && row_set.row_keys.empty?
|
162
|
+
return ResumptionOption.new true, nil, nil
|
163
|
+
end
|
164
|
+
|
151
165
|
@chunk_processor.reset_to_new_row
|
152
|
-
|
166
|
+
|
167
|
+
ResumptionOption.new false, rows_limit, row_set
|
153
168
|
end
|
154
169
|
|
155
170
|
##
|
@@ -170,13 +185,14 @@ module Google
|
|
170
185
|
# @return [Boolean]
|
171
186
|
#
|
172
187
|
def start_key_read? range
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
188
|
+
if !range.start_key_closed.empty?
|
189
|
+
last_key >= range.start_key_closed
|
190
|
+
elsif !range.start_key_open.empty?
|
191
|
+
last_key > range.start_key_closed
|
192
|
+
else
|
193
|
+
# start is unbounded
|
194
|
+
true
|
195
|
+
end
|
180
196
|
end
|
181
197
|
|
182
198
|
##
|
@@ -186,13 +202,42 @@ module Google
|
|
186
202
|
# @return [Boolean]
|
187
203
|
#
|
188
204
|
def end_key_read? range
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
205
|
+
if !range.end_key_closed.empty?
|
206
|
+
range.end_key_closed <= last_key
|
207
|
+
elsif !range.end_key_open.empty?
|
208
|
+
range.end_key_open <= last_key
|
209
|
+
else
|
210
|
+
# end is unbounded
|
211
|
+
false
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
194
215
|
|
195
|
-
|
216
|
+
# @private
|
217
|
+
# ResumptionOption
|
218
|
+
# Helper class returned by retry_options
|
219
|
+
class ResumptionOption
|
220
|
+
# @private
|
221
|
+
# Creates a ResumptionOption instance
|
222
|
+
# @param is_complete [Boolean]
|
223
|
+
# marks if the current read is complete
|
224
|
+
# @param rows_limit [Integer]
|
225
|
+
# limit of the retry request
|
226
|
+
# @param row_set [Google::Cloud::Bigtable::V2::RowSet]
|
227
|
+
# row_set of the retry request
|
228
|
+
def initialize is_complete, rows_limit, row_set
|
229
|
+
@is_complete = is_complete
|
230
|
+
@rows_limit = rows_limit
|
231
|
+
@row_set = row_set
|
232
|
+
end
|
233
|
+
|
234
|
+
attr_reader :rows_limit
|
235
|
+
attr_reader :row_set
|
236
|
+
|
237
|
+
##
|
238
|
+
# returns if this operation should be retried
|
239
|
+
def complete?
|
240
|
+
@is_complete
|
196
241
|
end
|
197
242
|
end
|
198
243
|
end
|
@@ -658,13 +658,11 @@ module Google
|
|
658
658
|
|
659
659
|
def read_rows instance_id, table_id, app_profile_id: nil, rows: nil, filter: nil, rows_limit: nil
|
660
660
|
client(table_path(instance_id, table_id), app_profile_id).read_rows(
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
app_profile_id: app_profile_id
|
667
|
-
}
|
661
|
+
table_name: table_path(instance_id, table_id),
|
662
|
+
rows: rows,
|
663
|
+
filter: filter,
|
664
|
+
rows_limit: rows_limit,
|
665
|
+
app_profile_id: app_profile_id
|
668
666
|
)
|
669
667
|
end
|
670
668
|
|
@@ -65,11 +65,13 @@ module Google
|
|
65
65
|
# bigtable = gcloud.bigtable
|
66
66
|
#
|
67
67
|
def bigtable scope: nil, timeout: nil, credentials: nil
|
68
|
+
credentials ||= @keyfile
|
69
|
+
timeout ||= @timeout
|
68
70
|
Google::Cloud.bigtable(
|
69
71
|
project_id: @project,
|
70
|
-
credentials:
|
72
|
+
credentials: credentials,
|
71
73
|
scope: scope,
|
72
|
-
timeout:
|
74
|
+
timeout: timeout
|
73
75
|
)
|
74
76
|
end
|
75
77
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-bigtable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -66,118 +66,6 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.5'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: google-style
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 1.26.1
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 1.26.1
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: minitest
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '5.16'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '5.16'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: minitest-focus
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '1.1'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '1.1'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: minitest-rg
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '5.2'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '5.2'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: redcarpet
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - "~>"
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '3.0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - "~>"
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '3.0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: simplecov
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - "~>"
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '0.9'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - "~>"
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '0.9'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: yard
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - "~>"
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '0.9'
|
160
|
-
type: :development
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - "~>"
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '0.9'
|
167
|
-
- !ruby/object:Gem::Dependency
|
168
|
-
name: yard-doctest
|
169
|
-
requirement: !ruby/object:Gem::Requirement
|
170
|
-
requirements:
|
171
|
-
- - "~>"
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: 0.1.13
|
174
|
-
type: :development
|
175
|
-
prerelease: false
|
176
|
-
version_requirements: !ruby/object:Gem::Requirement
|
177
|
-
requirements:
|
178
|
-
- - "~>"
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
version: 0.1.13
|
181
69
|
description: google-cloud-bigtable is the official library for Cloud Bigtable API.
|
182
70
|
email: googleapis-packages@google.com
|
183
71
|
executables: []
|
@@ -256,14 +144,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
256
144
|
requirements:
|
257
145
|
- - ">="
|
258
146
|
- !ruby/object:Gem::Version
|
259
|
-
version: '2.
|
147
|
+
version: '2.7'
|
260
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
261
149
|
requirements:
|
262
150
|
- - ">="
|
263
151
|
- !ruby/object:Gem::Version
|
264
152
|
version: '0'
|
265
153
|
requirements: []
|
266
|
-
rubygems_version: 3.5.
|
154
|
+
rubygems_version: 3.5.6
|
267
155
|
signing_key:
|
268
156
|
specification_version: 4
|
269
157
|
summary: API Client library for Cloud Bigtable API
|