Class: Pcrd::Commands::Verify
- Inherits:
-
Object
- Object
- Pcrd::Commands::Verify
- Defined in:
- lib/pcrd/commands/verify.rb
Overview
Compares row counts and spot-checks random rows between source and target.
Safe to run at any time after backfill completes. Does not modify either cluster.
Defined Under Namespace
Classes: Result, TableResult
Constant Summary collapse
- MismatchError =
Class.new(StandardError)
Instance Method Summary collapse
-
#initialize(config, options = {}) ⇒ Verify
constructor
A new instance of Verify.
- #run ⇒ Object
Constructor Details
Instance Method Details
#run ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/pcrd/commands/verify.rb', line 20 def run validate_config! source_pool = Connection::Client.new(@config.source) target_pool = Connection::Client.new(@config.target) sample_size = @options[:"sample-size"] || @config.verify&.sample_size || 1_000 table_results = (@config.migrate&.tables || []).map do |table_config| verify_table(source_pool, target_pool, table_config, sample_size) end source_pool.close target_pool.close Result.new( passed: table_results.all? { |r| r.mismatches.empty? && r.source_count == r.target_count }, tables: table_results ) end |