table_sync 4.2.1 → 4.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73b565f881f6ae36dd659dd4d99d04bf0a739aa0456410c5b730eb7f0b107492
4
- data.tar.gz: 95dee1cf9f11e6a05c04f3edd4cb5845e3819ea5aab694b3939b5b6e7e4b114d
3
+ metadata.gz: 1d5af530003a4144653d1866fda0a581a5ecf021cbcd8e7c2a29028c0e838eb2
4
+ data.tar.gz: 836de51df89dc99294bd8be65eeaf4e00cba6bdb22071170bef42372c4984a70
5
5
  SHA512:
6
- metadata.gz: a5af5e1a66865f69ff220151e64649813c99af9a32323d7c3d246ae08a6e5962314bb911041b648898b02c6fc684f6312ce187647d5e0c0db8cbf9bef52cc435
7
- data.tar.gz: 45b02a9f461b7cd406084bfe6fe2cd643bb43045f560cd06f2d4521e44067b1795a6ce231fbe6095a81d4ecfbf7bb678c8d05a61e4c369affd71a0abc6dd0d1c
6
+ metadata.gz: 2558335ef49a853d8d0d12878cdb42cfb91d4bf7dc7838f22c4853dbf09a22aa60569c420eaee0f5a667f21ea55c02b4a62d3c9d7a4299128d2a6d4b47d7b76a
7
+ data.tar.gz: d24f3e8e2cab9f946a37296261d531a44b3ea6e660aa1a9424e0685c9ba2ffff73130e6b9661f3ff76a0636eab9c877e4f7b18ce2c1b7b65326bfb5d2434df48
@@ -1,6 +1,10 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [4.2.2] - 2020-11-20
5
+ ### Fixed
6
+ - potential data corruption with batches
7
+
4
8
  ## [4.2.1] - 2020-11-20
5
9
  ### Fixed
6
10
  - bug with sorting data in handler, it was bad idea to use `.hash` replaced to `.to_s`
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- table_sync (4.2.1)
4
+ table_sync (4.2.2)
5
5
  memery
6
6
  rabbit_messaging (~> 0.3)
7
7
  rails
@@ -107,6 +107,17 @@ class TableSync::Receiving::Handler < Rabbit::EventHandler
107
107
  if data.uniq { |row| row.slice(*target_keys) }.size != data.size
108
108
  raise TableSync::DataError.new(data, target_keys, "Duplicate rows found!")
109
109
  end
110
+
111
+ keys_sample = data[0].keys
112
+ keys_diff = data.each_with_object(Set.new) do |row, set|
113
+ (row.keys - keys_sample | keys_sample - row.keys).each(&set.method(:add))
114
+ end
115
+
116
+ unless keys_diff.empty?
117
+ raise TableSync::DataError.new(data, target_keys, <<~MESSAGE)
118
+ Bad batch structure, check keys: #{keys_diff.to_a}
119
+ MESSAGE
120
+ end
110
121
  end
111
122
 
112
123
  def perform(config, params)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TableSync
4
- VERSION = "4.2.1"
4
+ VERSION = "4.2.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: table_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.1
4
+ version: 4.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Umbrellio