Skip to content

Commit

Permalink
Workaround for missing column in pghero.pg_stat_activity view.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffdoering committed May 15, 2019
1 parent 62c1f35 commit 23070db
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/pghero/methods/query_blockers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def add_blockee(blockee_pid, blocker_pid, session_cache)
(blocker_session[:blocking] ||= []).push(blockee_pid)
end

def self.build_blocker_sample_sql_const(backed_type_col_available)
def self.build_blocker_sample_sql_const(backend_type_col_available)
# Include inline SQL comments to document nuances of the query
# here (they execute fine); but they break internal quoting logic
# (that removes newlines) so strip them out for runtime use
Expand Down Expand Up @@ -147,7 +147,7 @@ def self.build_blocker_sample_sql_const(backed_type_col_available)
backend_xid,
backend_xmin,
query,
#{backed_type_col_available ? '' : 'null::text '}backend_type,
#{backend_type_col_available ? '' : 'null::text '}backend_type,
bp.blocked_by
FROM
pg_stat_activity psa
Expand Down Expand Up @@ -219,7 +219,9 @@ def self.build_blocker_sample_sql_const(backed_type_col_available)

def self.blocker_sample_set_sql(pg_version)
if (pg_version >= PgConst::VERSION_10)
@BLOCKER_SAMPLE_SET_SQL ||= build_blocker_sample_sql_const(true)
# TODO: Bug in pghero.pg_stat_activity view @ Instacart where backend_type column is missing
#@BLOCKER_SAMPLE_SET_SQL ||= build_blocker_sample_sql_const(true)
@BLOCKER_SAMPLE_SET_SQL ||= build_blocker_sample_sql_const(false)
else
@BLOCKER_SAMPLE_SET_SQL_PRE10 ||= build_blocker_sample_sql_const(false)
end
Expand All @@ -242,4 +244,7 @@ def supports_pg_blocking_pids?
end
end
end
# wait_event_type
# wait_event

end

0 comments on commit 23070db

Please sign in to comment.