fluent-plugin-bigquery-custom 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 29b676254a53a8b69c023230819fdded3f53c8e2
4
- data.tar.gz: 1b26aa639d74be661e5866c1c78a8fe8ec40e232
3
+ metadata.gz: 8fa069b1f44e40c71a9eaaeec2120e239a0dec38
4
+ data.tar.gz: c439e475ec1bd49f3f8b73b5e3d029b99ae521eb
5
5
  SHA512:
6
- metadata.gz: 7f02605f56709c8beb093458050bfbacab13a286b7b3b5e720fbb1768aa20014a5410d29eb0dd98641eac9d17b245b0ce6e91811cf2419a4f9650e00381697ba
7
- data.tar.gz: 7f45d681ade43daf9b5782eff2c87521af72606592f4f456cdce89148cc30ec55adf31ef998460a609a990124ccf4e2fe8666ff5a52892313c4eeef6fbd1f730
6
+ metadata.gz: d9ff3c9c78663f7b323b90ccb0243690d7c8385bca74fc9c360cedbae1c1687fea2f6adecf14077d8ddf2c01e625dbbe61b621682c6811f1871adbe280872ed6
7
+ data.tar.gz: 6494234184b5788b9888a4f99ca9d141aae7dac0a0d6bc10e71b9748f58f92f06ab0ee3d9665fced614f0dca10aa9db6a0c54846ad8910f507aa23191e78361f
@@ -1,6 +1,6 @@
1
1
  module Fluent
2
2
  module BigQueryPlugin
3
- VERSION = "0.3.7"
3
+ VERSION = "0.3.8"
4
4
  end
5
5
  end
6
6
 
@@ -19,6 +19,8 @@ module Fluent
19
19
  # https://developers.google.com/bigquery/browser-tool-quickstart
20
20
  # https://developers.google.com/bigquery/bigquery-api-quickstart
21
21
 
22
+ RETRYABLE_ERROR_REASON = %w(backendError internalError rateLimitExceeded tableUnavailable).freeze
23
+
22
24
  ### default for insert
23
25
  def configure_for_insert(conf)
24
26
  raise ConfigError unless conf["method"] != "load"
@@ -463,7 +465,7 @@ module Fluent
463
465
  end
464
466
  end
465
467
 
466
- raise "failed to insert into bigquery, retry" if reasons.find { |r| r == "backendError" }
468
+ raise "failed to insert into bigquery, retry" if reasons.find { |r| RETRYABLE_ERROR_REASON.include?(r) }
467
469
  return if reasons.all? { |r| r == "invalid" } && @skip_invalid_rows
468
470
  flush_secondary(@secondary) if @secondary
469
471
  end
@@ -480,10 +482,9 @@ module Fluent
480
482
  reason = e.respond_to?(:reason) ? e.reason : nil
481
483
  log.error "tabledata.insertAll API", project_id: @project, dataset: @dataset, table: table_id, code: e.status_code, message: e.message, reason: reason
482
484
 
483
- raise "failed to insert into bigquery, retry" if reason == "backendError" # backendError is retryable. TODO: error class
484
-
485
- # other error handling
486
- if @secondary
485
+ if RETRYABLE_ERROR_REASON.include?(reason) || e.is_a?(Google::Apis::ServerError)
486
+ raise "failed to insert into bigquery, retry" # TODO: error class
487
+ elsif @secondary
487
488
  flush_secondary(@secondary)
488
489
  end
489
490
  end
@@ -536,11 +537,11 @@ module Fluent
536
537
  reason = e.respond_to?(:reason) ? e.reason : nil
537
538
  log.error "job.insert API", project_id: @project, dataset: @dataset, table: table_id, code: e.status_code, message: e.message, reason: reason
538
539
 
539
- raise "failed to insert into bigquery, retry" if reason == "backendError" # backendError is retryable. TODO: error class
540
540
  return wait_load(job_id) if e.status_code == 409 && e.message =~ /Job/ # duplicate load job
541
541
 
542
- # other error handling
543
- if @secondary
542
+ if RETRYABLE_ERROR_REASON.include?(reason) || e.is_a?(Google::Apis::ServerError)
543
+ raise "failed to insert into bigquery, retry" # TODO: error class
544
+ elsif @secondary
544
545
  flush_secondary(@secondary)
545
546
  end
546
547
  end
@@ -607,7 +608,7 @@ module Fluent
607
608
  error_result = _response.status.error_result
608
609
  if error_result
609
610
  log.error "job.insert API (result)", project_id: @project, dataset: @dataset, table: table_id, message: error_result.message, reason: error_result.reason
610
- if _response.status.error_result.reason == "backendError"
611
+ if RETRYABLE_ERROR_REASON.include?(error_result.reason)
611
612
  raise "failed to load into bigquery"
612
613
  elsif @secondary
613
614
  flush_secondary(@secondary)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-bigquery-custom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomohiro Hashidate
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-28 00:00:00.000000000 Z
11
+ date: 2016-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake