Exception: DbBlaster::OneRecordTooLargeError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/db_blaster/one_record_too_large_error.rb

Overview

Custom error representing a serious error. If one individual record is larger than the max bytes allowed, db_blaster “fails fast”. If we ignored this record and moved on, it would never make it to SNS as its ‘updated_at` would end up being less than the last processed record. Possible fixes: 1) if possible ignore the column(s) that are too large 2) manually move the record to the intended destination 3) bug me to provide an S3 workaround

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ OneRecordTooLargeError

Returns a new instance of OneRecordTooLargeError.



17
18
19
20
21
22
# File 'lib/db_blaster/one_record_too_large_error.rb', line 17

def initialize(params)
  super
  params.each_key do |key|
    instance_variable_set("@#{key}", params[key])
  end
end

Instance Attribute Details

#max_kilobytesObject (readonly)

Returns the value of attribute max_kilobytes.



15
16
17
# File 'lib/db_blaster/one_record_too_large_error.rb', line 15

def max_kilobytes
  @max_kilobytes
end

#recordObject (readonly)

Returns the value of attribute record.



15
16
17
# File 'lib/db_blaster/one_record_too_large_error.rb', line 15

def record
  @record
end

#source_tableObject (readonly)

Returns the value of attribute source_table.



15
16
17
# File 'lib/db_blaster/one_record_too_large_error.rb', line 15

def source_table
  @source_table
end

Instance Method Details

#messageObject



24
25
26
27
28
# File 'lib/db_blaster/one_record_too_large_error.rb', line 24

def message
  ["One individual record with ID '#{record[:id]}'",
   " in source-table '#{source_table.name}'",
   " is larger than #{max_kilobytes} KB!"].join(' ')
end