Class: Sequent::DryRun::ReadOnlyReplayOptimizedPostgresPersistor

Inherits:
Core::Persistors::ReplayOptimizedPostgresPersistor show all
Defined in:
lib/sequent/dry_run/read_only_replay_optimized_postgres_persistor.rb

Overview

Subclass of ReplayOptimizedPostgresPersistor This persistor does not persist anything. Mainly usefull for performance testing migrations.

Constant Summary

Constants inherited from Core::Persistors::ReplayOptimizedPostgresPersistor

Core::Persistors::ReplayOptimizedPostgresPersistor::CHUNK_SIZE

Instance Attribute Summary

Attributes inherited from Core::Persistors::ReplayOptimizedPostgresPersistor

#insert_with_csv_size, #record_store

Instance Method Summary collapse

Methods inherited from Core::Persistors::ReplayOptimizedPostgresPersistor

#clear, #create_or_update_record, #create_record, #create_records, #delete_all_records, #delete_record, #do_with_record, #do_with_records, #find_records, #get_record, #get_record!, #initialize, #last_record, #struct_cache, #update_all_records, #update_record

Methods included from Core::Persistors::Persistor

#create_or_update_record, #create_record, #create_records, #delete_all_records, #delete_record, #do_with_record, #do_with_records, #find_records, #get_record, #get_record!, #last_record, #update_all_records, #update_record

Constructor Details

This class inherits a constructor from Sequent::Core::Persistors::ReplayOptimizedPostgresPersistor

Instance Method Details

#commitObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/sequent/dry_run/read_only_replay_optimized_postgres_persistor.rb', line 14

def commit
  # Running in dryrun mode, not committing anything.
  ending = Process.clock_gettime(Process::CLOCK_MONOTONIC)
  elapsed = ending - @starting
  count = @record_store.values.sum(&:size)
  Sequent.logger.info(
    "dryrun: processed #{count} records in #{elapsed.round(2)} s (#{(count / elapsed).round(2)} records/s)",
  )
  clear
end

#prepareObject



10
11
12
# File 'lib/sequent/dry_run/read_only_replay_optimized_postgres_persistor.rb', line 10

def prepare
  @starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)
end