pgsync 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pgsync might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6bb82b59d50e88dd20c969af273b2a0caeee6764
4
- data.tar.gz: 291db7c3a69dcb341c9079f13635bbd057d5ea06
3
+ metadata.gz: 5965c8b07a78e8b6a7366c82f62a671c5132680f
4
+ data.tar.gz: fd0eb3f98cb80da49994b432a16da3b502f1e7e1
5
5
  SHA512:
6
- metadata.gz: bd3ad5d52e94b6ed1466ee49ebb843ea74cc9ec1397d56587972c4d1388b707bb98d1921ee26f96393a27cd6b254973cf804770ab4514a325b8621797c58ff36
7
- data.tar.gz: 06ab1eab6b466d21f9d641b3aaeb5134caaa372db806efcd860dd3cf6a28cf4b22c7a417d88af8bc2463e2fee1f2a83dd447711547298e0fe29aa7a45ff92f31
6
+ metadata.gz: 5de08c4e8f0bb3d9375c2b29a13f7e9acfc9d1e123ce132f9563a78dc770b92c0f19a5b25f63c8c2c3862c3efbaa59eeea6f4988e79ff9670040667e90ab181e
7
+ data.tar.gz: 7a751f528cfc295a71e2dc3123d4c17fe635dfff5b451baa76ec24d6343578afe2921caa28b15f576bd867ce73a1fad8b3c0d294361eeb272edc711c115cff8b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 0.2.0
2
+
3
+ - Fixed idle transaction timeout errors - respects `statement_timeout` as a result
4
+ - Raise error when command exits with non-zero status
5
+
1
6
  # 0.1.1
2
7
 
3
8
  - Better support for multiple databases
data/bin/pgsync CHANGED
@@ -5,4 +5,6 @@ begin
5
5
  PgSync::Client.new(ARGV).perform
6
6
  rescue PgSync::Error => e
7
7
  abort e.message
8
+ rescue Interrupt => e
9
+ # do nothing
8
10
  end
data/lib/pgsync.rb CHANGED
@@ -150,25 +150,16 @@ module PgSync
150
150
  seq_values[seq] = from_connection.exec("select last_value from #{seq}").to_a[0]["last_value"]
151
151
  end
152
152
 
153
- # use transaction to revert statement timeout
154
- begin
155
- from_connection.transaction do |fconn|
156
- fconn.exec("SET statement_timeout = 0")
157
- to_connection.exec("TRUNCATE #{table} CASCADE")
158
- to_connection.copy_data "COPY #{table} (#{fields}) FROM STDIN" do
159
- fconn.copy_data "COPY (SELECT #{copy_fields} FROM #{table}#{where}) TO STDOUT" do
160
- while row = fconn.get_copy_data
161
- to_connection.put_copy_data(row)
162
- end
163
- end
153
+ to_connection.exec("TRUNCATE #{table} CASCADE")
154
+ to_connection.copy_data "COPY #{table} (#{fields}) FROM STDIN" do
155
+ from_connection.copy_data "COPY (SELECT #{copy_fields} FROM #{table}#{where}) TO STDOUT" do
156
+ while row = from_connection.get_copy_data
157
+ to_connection.put_copy_data(row)
164
158
  end
165
- seq_values.each do |seq, value|
166
- to_connection.exec("SELECT setval(#{escape(seq)}, #{escape(value)})")
167
- end
168
- raise PgSync::Rollback
169
159
  end
170
- rescue PgSync::Rollback
171
- # success
160
+ end
161
+ seq_values.each do |seq, value|
162
+ to_connection.exec("SELECT setval(#{escape(seq)}, #{escape(value)})")
172
163
  end
173
164
  end
174
165
  end
@@ -228,6 +219,9 @@ module PgSync
228
219
  command = source[2..-2]
229
220
  # puts "Running #{command}"
230
221
  source = `#{command}`.chomp
222
+ unless $?.success?
223
+ abort "Command exited with non-zero status:\n#{command}"
224
+ end
231
225
  end
232
226
  source
233
227
  end
@@ -1,3 +1,3 @@
1
1
  module PgSync
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgsync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-24 00:00:00.000000000 Z
11
+ date: 2016-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slop