activerecord-cockroachdb-adapter 6.0.0beta1 → 6.0.0beta2
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2d3e8ca47a966406dd46a2516ee8e28d4634109974b012604efa5eeef41661c
|
4
|
+
data.tar.gz: 78f2720ce377db8b5d61c830c2f8819f4a928bceee3121668348293944b459ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7928d308947df985eac1ecf4ac2338d8ed5e079c2436562a822b149699b0bc42e38411e90a73a5623c376613ca610060d68f9040d823b9fa65d2869baa98a6fd
|
7
|
+
data.tar.gz: 5421bb06b3185d331a0a43e700e2475f6ce28ee38d433ba28e3e82c4a0e361a94518dd46fd41b54d1a83f1a217d19e098eef0a251ad7e79803263c08bfd7e3dc
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "activerecord-cockroachdb-adapter"
|
7
|
-
spec.version = "6.0.
|
7
|
+
spec.version = "6.0.0beta2"
|
8
8
|
spec.licenses = ["Apache-2.0"]
|
9
9
|
spec.authors = ["Cockroach Labs"]
|
10
10
|
spec.email = ["cockroach-db@googlegroups.com"]
|
data/build/teamcity-test.sh
CHANGED
@@ -8,16 +8,22 @@ module ActiveRecord
|
|
8
8
|
# transactions that fail due to serialization errors. Failed
|
9
9
|
# transactions will be retried until they pass or the max retry limit is
|
10
10
|
# exceeded.
|
11
|
-
def within_new_transaction(
|
12
|
-
attempts = options.fetch(:attempts, 0)
|
11
|
+
def within_new_transaction(isolation: nil, joinable: true, attempts: 0)
|
13
12
|
super
|
14
|
-
rescue ActiveRecord::
|
13
|
+
rescue ActiveRecord::StatementInvalid => error
|
14
|
+
raise unless retryable? error
|
15
15
|
raise if attempts >= @connection.max_transaction_retries
|
16
16
|
|
17
17
|
attempts += 1
|
18
18
|
sleep_seconds = (2 ** attempts + rand) / 10
|
19
19
|
sleep(sleep_seconds)
|
20
|
-
within_new_transaction(
|
20
|
+
within_new_transaction(isolation: isolation, joinable: joinable, attempts: attempts) { yield }
|
21
|
+
end
|
22
|
+
|
23
|
+
def retryable?(error)
|
24
|
+
return true if error.is_a? ActiveRecord::SerializationFailure
|
25
|
+
return retryable? error.cause if error.cause
|
26
|
+
false
|
21
27
|
end
|
22
28
|
end
|
23
29
|
end
|
@@ -24,12 +24,9 @@ module ActiveRecord
|
|
24
24
|
valid_conn_param_keys = PG::Connection.conndefaults_hash.keys + [:sslmode, :application_name]
|
25
25
|
conn_params.slice!(*valid_conn_param_keys)
|
26
26
|
|
27
|
-
# The postgres drivers don't allow the creation of an unconnected
|
28
|
-
# PG::Connection object, so just pass a nil connection object for the
|
29
|
-
# time being.
|
30
27
|
conn = PG.connect(conn_params)
|
31
28
|
ConnectionAdapters::CockroachDBAdapter.new(conn, logger, conn_params, config)
|
32
|
-
rescue ::PG::Error => error
|
29
|
+
rescue ::PG::Error, ActiveRecord::ActiveRecordError => error
|
33
30
|
if error.message.include?("does not exist")
|
34
31
|
raise ActiveRecord::NoDatabaseError
|
35
32
|
else
|
@@ -154,6 +151,12 @@ module ActiveRecord
|
|
154
151
|
@crdb_version = version_num
|
155
152
|
end
|
156
153
|
|
154
|
+
def self.database_exists?(config)
|
155
|
+
!!ActiveRecord::Base.cockroachdb_connection(config)
|
156
|
+
rescue ActiveRecord::NoDatabaseError
|
157
|
+
false
|
158
|
+
end
|
159
|
+
|
157
160
|
private
|
158
161
|
|
159
162
|
def initialize_type_map(m = type_map)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-cockroachdb-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.
|
4
|
+
version: 6.0.0beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cockroach Labs
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|