culturecode_stagehand 1.1.0 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/stagehand/schema/statements.rb +1 -1
- data/lib/stagehand/staging/commit.rb +14 -4
- data/lib/stagehand/version.rb +1 -1
- metadata +3 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fc5e551f7e747ad8fb67d445f787bd47df6059fbe939f65088901445e4ccc5db
|
4
|
+
data.tar.gz: d7d1a28bdac8a210119431075d48fa5cfafaadf311958926e13e10ac5c5dda9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d73461a90dceed0855d2779925174f1ced0b4ba9a2a9b47c0948fa1faef6666eb5ee83af52481114033a99367747baf82b1161617ff73c30721c19dfedf5e28e
|
7
|
+
data.tar.gz: 3a2443903c414b6f87ccb312d77b165428e036ae80bc04a103234a7efc373d5068f9f329d8c87c987a9e1605929237053e5b276de1dedd79860028e3fb9bc5a4
|
@@ -40,7 +40,7 @@ module Stagehand
|
|
40
40
|
stagehand = ':commit_entries' if table_name == Staging::CommitEntry.table_name
|
41
41
|
|
42
42
|
table_stream = StringIO.new
|
43
|
-
|
43
|
+
super(table_name, table_stream)
|
44
44
|
table_stream.rewind
|
45
45
|
table_schema = table_stream.read.gsub(/create_table (.+) do/, 'create_table \1' + ", stagehand: #{stagehand} do")
|
46
46
|
stream.puts table_schema
|
@@ -21,7 +21,7 @@ module Stagehand
|
|
21
21
|
begin
|
22
22
|
block.call(start_operation)
|
23
23
|
rescue => e
|
24
|
-
end_commit(start_operation, except) unless e.is_a?(CommitError)
|
24
|
+
end_commit(start_operation, except) unless e.is_a?(CommitError) || e.is_a?(ActiveRecord::Rollback)
|
25
25
|
raise(e)
|
26
26
|
else
|
27
27
|
return end_commit(start_operation, except)
|
@@ -71,7 +71,17 @@ module Stagehand
|
|
71
71
|
if except.present? && Array(except).collect(&:to_s).exclude?(start_operation.table_name)
|
72
72
|
scope = scope.where('table_name NOT IN (?) OR table_name IS NULL', except)
|
73
73
|
end
|
74
|
-
|
74
|
+
|
75
|
+
# We perform a read to determine the ids that are meant to be part of our Commit in order to avoid acquiring
|
76
|
+
# write locks on commit entries between the start and end entry that don't belong to our session. Otherwise, we
|
77
|
+
# risk a deadlock if another process manipulates entries between our start and end while we have a range lock.
|
78
|
+
updated_count = CommitEntry.where(id: scope.pluck(:id)).update_all(:commit_id => start_operation.id)
|
79
|
+
|
80
|
+
if updated_count < 2 # Unless we found at least 2 entries (start and end), abort the commit
|
81
|
+
CommitEntry.logger.warn "Commit entries not found for Commit #{start_operation.id}. Was the Commit rolled back in a transaction?"
|
82
|
+
end_operation.delete
|
83
|
+
return
|
84
|
+
end
|
75
85
|
|
76
86
|
return new(start_operation.id)
|
77
87
|
end
|
@@ -95,8 +105,8 @@ module Stagehand
|
|
95
105
|
return if @start_id && @end_id
|
96
106
|
|
97
107
|
missing = []
|
98
|
-
missing << CommitEntry::START_OPERATION unless @start_id
|
99
|
-
missing << CommitEntry::END_OPERATION
|
108
|
+
missing << CommitEntry::START_OPERATION unless @start_id == start_id
|
109
|
+
missing << CommitEntry::END_OPERATION if @start_id == start_id
|
100
110
|
|
101
111
|
raise CommitNotFound, "Couldn't find #{missing.join(', ')} entry for Commit #{start_id}"
|
102
112
|
end
|
data/lib/stagehand/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: culturecode_stagehand
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicholas Jakobsen
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-08-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -18,9 +18,6 @@ dependencies:
|
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '4.2'
|
21
|
-
- - "<"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: '5.2'
|
24
21
|
type: :runtime
|
25
22
|
prerelease: false
|
26
23
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -28,9 +25,6 @@ dependencies:
|
|
28
25
|
- - ">="
|
29
26
|
- !ruby/object:Gem::Version
|
30
27
|
version: '4.2'
|
31
|
-
- - "<"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '5.2'
|
34
28
|
- !ruby/object:Gem::Dependency
|
35
29
|
name: mysql2
|
36
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -173,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
167
|
version: '0'
|
174
168
|
requirements: []
|
175
169
|
rubyforge_project:
|
176
|
-
rubygems_version: 2.
|
170
|
+
rubygems_version: 2.7.9
|
177
171
|
signing_key:
|
178
172
|
specification_version: 4
|
179
173
|
summary: Simplify the management of a sandbox database that can sync content to a
|