Saturday, April 20, 2013

pg_dump: Error message from server: ERROR: canceling statement due to conflict with recovery

I ran to this error the other day when I tried to export a dump file from a slave Postgres database.

cpg_dump: Dumping the contents of table "[table_name]" failed: PQgetResult() failed.
pg_dump: Error message from server: ERROR:  canceling statement due to conflict with recovery
DETAIL:  User query might have needed to see row versions that must be removed.
pg_dump: The command was: COPY public.[table_name] ([comma-separated column names]) TO stdout;
I turns out that we can't execute long query on Hot Standby mode server. Right now, there's no perfect solution to this problem but there are some couples of workarounds.

Mailing list related to this issue: Hot Standby - ERROR: canceling statement due to conflict with recovery

Thursday, April 18, 2013

[RSpec] Refer to let value that has the same name in outer scope

There is a situation in RSpec when you want to redefine let value in the inner scope base on value from the outer scope. In RSpec 2.13, you can do that by referring outer scope value with super() (parens are required)

Credit: RSpec 2.13 is released!

Tuesday, April 16, 2013

[Watched] Go at Google

http://www.infoq.com/presentations/Go-Google

Interesting points in Go that I learned from this presentation

  • You can not have unused import statement. Makes code cleaner and faster compilation time.
  • Favor small duplication over including big dependency to use only small part of it
  • No implements declaration required for implementing an interface. Safety from static typing and flexibility from ad-hoc type.
  • Gofix - Cool tool for changing the code to fix language version incompatibility issue.

Collectd PostgreSQL Plugin

I couldn't find this link when searching with google https://www.collectd.org/documentation/manpages/collectd.conf.html#plugin-postgresql