<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hi,<br>
    <br>
    <br>
    sorry to bother you again in such a short time. But as I have
    written in "[pgpool-general: 5729] Re: pgpool says its degenerating
    a backend, but it does not..." we have some problems with pgpool
    saying db nodes are not in sync. I could not find any problems in
    our code, so I wrote a little shell script to demonstrate the issue.
    It uses psql to send request in parallel  to pgpool with 2 connected
    db nodes:<br>
    <br>
    <br>
    <i>#!/bin/bash</i><i><br>
    </i><i><br>
    </i><i>NUMBER_OF_PROCESSES=2</i><i><br>
    </i><i>TEST_COUNT=4</i><i><br>
    </i><i><br>
    </i><i>function testDb()</i><i><br>
    </i><i>{</i><i><br>
    </i><i>        for i in $(seq 1
      $(($TEST_COUNT/$NUMBER_OF_PROCESSES)))</i><i><br>
    </i><i>        do</i><i><br>
    </i><i>                echo "$1: $i"</i><i><br>
    </i><i>                psql -U postgres -p 5433 test -c "DELETE FROM
      test; INSERT INTO test VALUES ($RANDOM);"</i><i><br>
      <br>
    </i><i>#               psql -U postgres -p 5433 test -c "INSERT INTO
      test VALUES ($RANDOM); DELETE FROM test;"</i><i><br>
      <br>
    </i><i>#               psql -U postgres -p 5433 test -c "DELETE FROM
      test;"</i><i><br>
    </i><i>#               psql -U postgres -p 5433 test -c "INSERT INTO
      test VALUES ($RANDOM);"</i><i><br>
    </i><i>        done</i><i><br>
    </i><i>}</i><i><br>
    </i><i><br>
    </i><i>for i in $(seq 1 $NUMBER_OF_PROCESSES)</i><i><br>
    </i><i>do</i><i><br>
    </i><i>        testDb $i &amp;</i><i><br>
    </i><i>done</i><i><br>
    </i><i><br>
    </i><i>wait</i><i><br>
    </i><i><br>
    </i><i>echo
      $(($TEST_COUNT/$NUMBER_OF_PROCESSES*$NUMBER_OF_PROCESSES)) entries
      tested.</i><br>
    <br>
    <br>
    Output is always something like this:<br>
    <br>
    <i># ./testDb.sh</i><i><br>
    </i><i>2: 1</i><i><br>
    </i><i>1: 1</i><i><br>
    </i><i>INSERT 0 1</i><i><br>
    </i><i>2: 2</i><i><br>
    </i><i>ERROR:  pgpool detected difference of the number of inserted,
      updated or deleted tuples. Possible last query was: "DELETE FROM
      test; INSERT INTO test VALUES (3469);"</i><i><br>
    </i><i>HINT:  check data consistency between master and other db
      node</i><i><br>
    </i><i>ERROR:  pgpool detected difference of the number of inserted,
      updated or deleted tuples. Possible last query was: "DELETE FROM
      test; INSERT INTO test VALUES (3469);"</i><i><br>
    </i><i>HINT:  check data consistency between master and other db
      node</i><i><br>
    </i><i>1: 2</i><i><br>
    </i><i>INSERT 0 1</i><i><br>
    </i><i>ERROR:  pgpool detected difference of the number of inserted,
      updated or deleted tuples. Possible last query was: "DELETE FROM
      test; INSERT INTO test VALUES (21477);"</i><i><br>
    </i><i>HINT:  check data consistency between master and other db
      node</i><i><br>
    </i><i>ERROR:  pgpool detected difference of the number of inserted,
      updated or deleted tuples. Possible last query was: "DELETE FROM
      test; INSERT INTO test VALUES (21477);"</i><i><br>
    </i><i>HINT:  check data consistency between master and other db
      node</i><i><br>
    </i><i>4 entries tested.</i><br>
    <br>
    <br>
    If I check manually after the script was running, all nodes have the
    same table content. Also if I use one of the other (commented out)
    variants in the script, everything works fine.<br>
    What is the problem here? <br>
    <br>
    <br>
    Thanks in advance<br>
    Benjamin Firl<br>
  </body>
</html>