ankane / distribute_reads

Scale database reads to replicas in Rails

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support recent versions of Aurora Postgres

v-kumar opened this issue · comments

While using the latest version of the gem (0.3.4) we ran into this error:

ActiveRecord::StatementInvalid: PG::FeatureNotSupported: ERROR:  Function pg_last_xlog_receive_location() is currently not supported for Aurora

Looking into it further, support for Aurora Postgres was added by checking for the presence of a particular type backend in pg_stat_activity per https://github.com/ankane/distribute_reads/blob/master/lib/distribute_reads.rb#L50. The current version of Aurora Postgres (13.4), does not have the exact aurora runtime matching backend_type, but has aurora runtime process.

production=> SELECT distinct backend_type FROM pg_stat_activity ;
       backend_type
---------------------------
 client backend
 aurora wal replay process
 startup
 aurora runtime process
(4 rows)