As also described at
http://drupal.stackexchange.com/questions/59188/error-duplicate-key-valu...

I am using PostgresSQL 8.4.13 (with pgbouncer, using Russian UTF8) and the database log file (attached) is often spammed with the error messages:

ERROR:  duplicate key value violates unique constraint "drupal_cache_block_pkey"
STATEMENT:  INSERT INTO drupal_cache_block (cid, serialized, created, expire, data) VALUES ('user:new:bartik:ru:r.1', '1', '1359635697', '-1', 'a:2:{s:7:"subject";s:35:"\\320\\235\\320\\276\\320\\262\\321\\213\\320\\265 \\320\\277\\320\\276\\320\\273\\321\\214\\320\\267\\320\\276\\320\\262\\320\\260\\321\\202\\320\\265\\320\\273\\320\\270";s:7:"content";s:1264:"<div class="item-list"><ul><li class="first"><a href="/user/24331" title="\\320\\230\\320\\275\\321\\204\\320\\276\\321\\200\\320\\274\\320\\260\\321\\206\\320\\270\\321\\217 \\320\\276 \\320\\277\\320\\276\\320\\273\\321\\214\\320\\267\\320\\276\\320\\262\\320\\260\\321\\202\\320\\265\\320\\273\\320\\265." class="username">\\320\\241\\320\\260\\320\\275\\320\\265\\320\\272141</a></li>\\012<li><a href="/user/24330" title="\\320\\230\\320\\275\\321\\204\\320\\276\\321\\200\\320\\274\\320\\260\\321\\206\\320\\270\\321\\217 \\320\\276 \\320\\277\\320\\276\\320\\273\\321\\214\\320\\267\\320\\276\\320\\262\\320\\260\\321\\202\\320\\265\\320\\273\\320\\265." class="username">vetall</a></li>\\012<li><a href="/user/24329" title="\\320\\230\\320\\275\\321\\204\\320\\276\\321\\200\\320\\274\\320\\260\\321\\206\\320\\270\\321\\217 \\320\\276 \\320\\277\\320\\276\\320\\273\\321\\214\\320\\267\\320\\276\\320\\262\\320\\260\\321\\202\\320\\265\\320\\273\\320\\265." class="username">Karina</a></li>\\012<li><a href="/user/24327" title="\\320\\230\\320\\275\\321\\204\\320\\276\\321\\200\\320\\274\\320\\260\\321\\206\\320\\270\\321\\217 \\320\\276 \\320\\277\\320\\276\\320\\273\\321\\214\\320\\267\\320\\276\\320\\262\\320\\260\\321\\202\\320\\265\\320\\273\\320\\265." class="username">sosoia47</a></li>\\012<li><a href="/user/24326" title="\\320\\230\\320\\275\\321\\204\\320\\276\\321\\200\\320\\274\\320\\260\\321\\206\\320\\270\\321\\217 \\320\\276 \\320\\277\\320\\276\\320\\273\\321\\214\\320\\267\\320\\276\\320\\262\\320\\260\\321\\202\\320\\265\\320\\273\\320\\265." class="username">DD</a></li>\\012<li><a href="/user/24324" title="\\320\\230\\320\\275\\321\\204\\320\\276\\321\\200\\320\\274\\320\\260\\321\\206\\320\\270\\321\\217 \\320\\276 \\320\\277\\320\\276\\320\\273\\321\\214\\320\\267\\320\\276\\320\\262\\320\\260\\321\\202\\320\\265\\320\\273\\320\\265." class="username">altabay</a></li>\\012<li><a href="/user/24323" title="\\320\\230\\320\\275\\321\\204\\320\\276\\321\\200\\320\\274\\320\\260\\321\\206\\320\\270\\321\\217 \\320\\276 \\320\\277\\320\\276\\320\\273\\321\\214\\320\\267\\320\\276\\320\\262\\320\\260\\321\\202\\320\\265\\320\\273\\320\\265." class="username">\\320\\235\\320\\265\\321\\200\\320\\262</a></li>\\012<li><a href="/user/24318" title="\\320\\230\\320\\275\\321\\204\\320\\276\\321\\200\\320\\274\\320\\260\\321\\206\\320\\270\\321\\217 \\320\\276 \\320\\277\\320\\276\\320\\273\\321\\214\\320\\267\\320\\276\\320\\262\\320\\260\\321\\202\\320\\265\\320\\273\\320\\265." class="username">\\320\\220\\320\\271\\320\\261\\320\\276\\320\\273</a></li>\\012<li><a href="/user/24317" title="\\320\\230\\320\\275\\321\\204\\320\\276\\321\\200\\320\\274\\320\\260\\321\\206\\320\\270\\321\\217 \\320\\276 \\320\\277\\320\\276\\320\\273\\321\\214\\320\\267\\320\\276\\320\\262\\320\\260\\321\\202\\320\\265\\320\\273\\320\\265." class="username">\\320\\220\\320\\273\\320\\265\\320\\272\\321\\201\\320\\265\\320\\271</a></li>\\012<li class="last"><a href="/user/24316" title="\\320\\230\\320\\275\\321\\204\\320\\276\\321\\200\\320\\274\\320\\260\\321\\206\\320\\270\\321\\217 \\320\\276 \\320\\277\\320\\276\\320\\273\\321\\214\\320\\267\\320\\276\\320\\262\\320\\260\\321\\202\\320\\265\\320\\273\\320\\265." class="username">dejwitxyzsdaweq</a></li>\\012</ul></div>";}')

My postgresql.conf:

shared_buffers = 4096MB # I've got 32 GB of RAM to burn
work_mem = 32MB
wal_buffers = 4MB
checkpoint_segments = 32
escape_string_warning = off # otherwise Drupal spams me with warnings

My pgbouncer.ini:

pool_mode = session
server_reset_query = DISCARD ALL;
server_check_delay = 10
max_client_conn = 600
default_pool_size = 50

Please reply if more information is required.

CommentFileSizeAuthor
postgresql-Mon.txt35.56 KBafarber
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dddave’s picture

Version: 7.19 » 7.x-dev
steinmb’s picture

steinmb’s picture

Title: PostgreSQL 8.4.13: duplicate key value violates unique constraint “drupal_cache_block_pkey” » PostgreSQL - duplicate key value violates unique constraint “drupal_cache_block_pkey”

Prob. not only related to pg. 8.4.13, changing title

steinmb’s picture

Damien closed (1019260) as, work as designed, and told people to ignore them. If so, perhaps we should close all related issues to this and move on?
#1019260: Postgres cache race condition violates "cache_pkey"