request-log-analyzer icon indicating copy to clipboard operation
request-log-analyzer copied to clipboard

Table columns for line numbers in the source table are defaulting to limit: 4 instead of limit: 8

Open will3216 opened this issue 9 years ago • 0 comments

First off, this gem is awesome and a great tool! I am running into an issue when parsing a log file that is 3.5gb though, and when DatabaseInserter.new.source_change([..]) gets called, it hits a database column limitation.

/gems/activerecord-4.2.4/lib/active_record/type/integer.rb:45:in `ensure_in_range': 3461277784 is out of range for ActiveRecord::Type::Integer with limit 4 (RangeError)

Maybe you should explicitly set the limit to 8? It seems as though its trying to store it as a 4byte integer, but should really be stored as an 8 byte integer.

in /request-log-analyzer/lib/request_log_analyzer/database/source.rb

class RequestLogAnalyzer::Database::Source < RequestLogAnalyzer::Database::Base
  def self.create_table!
    unless database.connection.table_exists?(:sources)
      database.connection.create_table(:sources) do |t|
        t.column :filename, :string
        t.column :mtime,    :datetime
        t.column :filesize, :integer, limit: 8
      end
    end
  end
end

will3216 avatar Sep 16 '16 02:09 will3216