Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions lib/fluent/plugin/out_mysql_bulk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,16 @@ def write(chunk)
sql = "INSERT INTO #{table} (#{@column_names.map{|x| "`#{x.to_s.gsub('`', '``')}`"}.join(',')}) VALUES #{values.join(',')}"
sql += @on_duplicate_key_update_sql if @on_duplicate_key_update

log.info "bulk insert values size (table: #{table}) => #{values.size}"
@handler.query("SET SESSION TRANSACTION ISOLATION LEVEL #{transaction_isolation_level}") if @transaction_isolation_level
@handler.xquery(sql)
@handler.close
begin
log.info "bulk insert values size (table: #{table}) => #{values.size}"
@handler.query("SET SESSION TRANSACTION ISOLATION LEVEL #{transaction_isolation_level}") if @transaction_isolation_level
@handler.xquery(sql)
rescue Exception
log.warn "an unexpected error occurred while query"
ensure
@handler.close
end

end

private
Expand Down