<div dir="ltr"><div><div><div><div>Hi,<br><br></div>From my intial reading of the source code,<br><br></div>1. For every query cached memcached writes the cache-key on oidir/<db_oid>/<table_oid><br></div>2. If there is an update on a table, read each hash from <Table_oid> file and delete in memcache.<br><br></div><div>If this is what pgpool uses to invalidate cache - two pgpools, using same memcache will not invalidate cache properly. Please correct me if there are more to this logic.<br><br></div><div><br><br><br></div><div><div><div><div><br><br><br></div></div></div></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><b style="font-size:small;font-family:tahoma,sans-serif">DHANANJAY </b><font style="font-size:small;font-family:tahoma,sans-serif" color="#666666">| Infrastructure Engineer</font><br></div><div dir="ltr"><div style="font-size:small;font-family:arial"><div><span style="color:rgb(102,102,102);font-family:tahoma,sans-serif;font-size:13px;line-height:16.1200008392334px">Plivo, Inc. 340 Pine St, San Francisco - 94104, USA</span><font face="tahoma, sans-serif"><font color="#666666"><br></font></font></div><div><font face="tahoma, sans-serif"><font color="#666666">Web:</font> <a href="http://www.plivo.com/" style="color:rgb(17,85,204)" target="_blank">www.plivo.com</a> <font color="#666666">| Twitter:</font> <a href="http://twitter.com/plivo" style="color:rgb(17,85,204)" target="_blank">@plivo</a>, <a href="https://twitter.com/notmycommit" target="_blank">@notmycommit</a></font></div><div><br><a href="https://www.plivo.com/sms-short-code/?utm=emailsig" target="_blank">Free Incoming SMS for All US Short Codes – Get One Today!</a><br></div><div><br></div></div></div><div><br></div></div></div></div></div></div>
<br><div class="gmail_quote">On Wed, Apr 29, 2015 at 4:10 AM, Tatsuo Ishii <span dir="ltr"><<a href="mailto:ishii@postgresql.org" target="_blank">ishii@postgresql.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Probably pgpool log with -d (debugging option) turned on will provide<br>
more useful information.<br>
<span class=""><br>
Best regards,<br>
--<br>
Tatsuo Ishii<br>
SRA OSS, Inc. Japan<br>
English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
Japanese:<a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
<br>
</span><div><div class="h5">> Message got clipped again. Resending<br>
><br>
> Hi,<br>
><br>
> This commit seems to have fixed the issue. However cache invalidation when<br>
> multiple pgpools are used (connecting to same memcache server) is (?)<br>
> broken even with 3.3.5. Here are the logs from 3.3.5<br>
><br>
> <a href="https://gist.github.com/dbalan/c5a93458d5c091c28c71" target="_blank">https://gist.github.com/dbalan/c5a93458d5c091c28c71</a><br>
><br>
> My test setup is two instances of 3.3.5 running on 9999 and 9988 of same<br>
> machine with memcache running in localhost.<br>
><br>
> Logs:<br>
><br>
>>From first pgpool,<br>
> # First, read and update data - invalidates cache - this works fine.<br>
> psql -U ruser -d mydb -h 127.0.0.1 -p 9999<br>
> Password for user ruser:<br>
> psql (9.4.1)<br>
> Type "help" for help.<br>
><br>
> mydb=> select comments from users where id=1;<br>
> comments<br>
> ----------------<br>
> boot me please<br>
> (1 row)<br>
><br>
> mydb=> update users set comments='hello' where id=1;<br>
> UPDATE 1<br>
> mydb=> select comments from users where id=1;<br>
> comments<br>
> ----------<br>
> hello<br>
> (1 row)<br>
><br>
> mydb=><br>
><br>
><br>
> Second pgpool:<br>
> # Connects via second deamon, reads stale data, i/e updates from this<br>
> pgpool instance never invalidate cache.<br>
> λ ~/ psql -U ruser -d mydb -h 127.0.0.1 -p 9988<br>
> Password for user ruser:<br>
> psql (9.4.1)<br>
> Type "help" for help.<br>
><br>
> mydb=> select comments from users where id=1;<br>
> comments<br>
> ----------<br>
> hello<br>
> (1 row)<br>
><br>
> mydb=> update users set comments='hello world' where id=1;<br>
> UPDATE 1<br>
> mydb=> select comments from users where id=1;<br>
> comments<br>
> ----------<br>
> hello<br>
> (1 row)<br>
><br>
> mydb=><br>
><br>
><br>
> The configs and full logs are attached in the link, They both are same<br>
> except for the directory paths and ports - not sure whats going wrong here.<br>
><br>
><br>
</div></div>> *DHANANJAY *| Infrastructure Engineer<br>
<span class="">> Plivo, Inc. 340 Pine St, San Francisco - 94104, USA<br>
</span>> Web: <a href="http://www.plivo.com" target="_blank">www.plivo.com</a> | Twitter: @plivo <<a href="http://twitter.com/plivo" target="_blank">http://twitter.com/plivo</a>>,<br>
> @notmycommit <<a href="https://twitter.com/notmycommit" target="_blank">https://twitter.com/notmycommit</a>><br>
<span class="">><br>
> Free Incoming SMS for All US Short Codes – Get One Today!<br>
</span>> <<a href="https://www.plivo.com/sms-short-code/?utm=emailsig" target="_blank">https://www.plivo.com/sms-short-code/?utm=emailsig</a>><br>
<div><div class="h5">><br>
> On Mon, Apr 27, 2015 at 5:29 PM, Dhananjay Balan <<a href="mailto:dhananjay@plivo.com">dhananjay@plivo.com</a>><br>
> wrote:<br>
><br>
>> Hi,<br>
>><br>
>> This commit seems to have fixed the issue. However cache invalidation when<br>
>> multiple pgpools are used (connecting to same memcache server) is (?)<br>
>> broken even with 3.3.5. Here are the logs from 3.3.5<br>
>><br>
>> <a href="https://gist.github.com/dbalan/c5a93458d5c091c28c71" target="_blank">https://gist.github.com/dbalan/c5a93458d5c091c28c71</a><br>
>><br>
>> My test setup is two instances of 3.3.5 running on 9999 and 9988 of same<br>
>> machine with memcache running in localhost.<br>
>><br>
>> From first pgpool,<br>
>><br>
>> # First, read and update data - invalidates cache - this works fine.<br>
>> psql -U ruser -d mydb -h 127.0.0.1 -p 9999<br>
>> Password for user ruser:<br>
>> psql (9.4.1)<br>
>> Type "help" for help.<br>
>><br>
>> mydb=> select comments from users where id=1;<br>
>> comments<br>
>> ----------------<br>
>> boot me please<br>
>> (1 row)<br>
>><br>
>> mydb=> update users set comments='hello' where id=1;<br>
>> UPDATE 1<br>
>> mydb=> select comments from users where id=1;<br>
>> comments<br>
>> ----------<br>
>> hello<br>
>> (1 row)<br>
>><br>
>> mydb=><br>
>><br>
>><br>
>> Second pgpool:<br>
>> # Connects via second deamon, reads stale data, i/e updates from this<br>
>> pgpool instance never invalidate cache.<br>
>> λ ~/ psql -U ruser -d mydb -h 127.0.0.1 -p 9988<br>
>> Password for user ruser:<br>
>> psql (9.4.1)<br>
>> Type "help" for help.<br>
>><br>
>> mydb=> select comments from users where id=1;<br>
>> comments<br>
>> ----------<br>
>> hello<br>
>> (1 row)<br>
>><br>
>> mydb=> update users set comments='hello world' where id=1;<br>
>> UPDATE 1<br>
>> mydb=> select comments from users where id=1;<br>
>> comments<br>
>> ----------<br>
>> hello<br>
>> (1 row)<br>
>><br>
>> mydb=><br>
>><br>
>><br>
>> The configs and full logs are attached in the link, They both are same<br>
>> except for the directory paths and ports - not sure whats going wrong here.<br>
>><br>
>> <a href="https://gist.github.com/dbalan/c5a93458d5c091c28c71" target="_blank">https://gist.github.com/dbalan/c5a93458d5c091c28c71</a><br>
>><br>
>><br>
>><br>
>><br>
</div></div>>> *DHANANJAY *| Infrastructure Engineer<br>
<span class="">>> Plivo, Inc. 340 Pine St, San Francisco - 94104, USA<br>
</span>>> Web: <a href="http://www.plivo.com" target="_blank">www.plivo.com</a> | Twitter: @plivo <<a href="http://twitter.com/plivo" target="_blank">http://twitter.com/plivo</a>>,<br>
>> @notmycommit <<a href="https://twitter.com/notmycommit" target="_blank">https://twitter.com/notmycommit</a>><br>
<span class="">>><br>
>> Free Incoming SMS for All US Short Codes – Get One Today!<br>
</span>>> <<a href="https://www.plivo.com/sms-short-code/?utm=emailsig" target="_blank">https://www.plivo.com/sms-short-code/?utm=emailsig</a>><br>
<div class="HOEnZb"><div class="h5">>><br>
>><br>
>><br>
>> On Thu, Apr 23, 2015 at 5:11 PM, Muhammad Usama <<a href="mailto:m.usama@gmail.com">m.usama@gmail.com</a>> wrote:<br>
>><br>
>>> Hi<br>
>>><br>
>>> I have found the problem, It was because of the buffer for storing table<br>
>>> oids was created in wrong memory context.<br>
>>> I have pushed the fix for it in master and 3_4 stable branches.<br>
>>><br>
>>> Thanks<br>
>>> Best regards<br>
>>> Muhammad Usama<br>
>>><br>
>>><br>
>>> On Wed, Apr 22, 2015 at 2:09 PM, Tatsuo Ishii <<a href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>><br>
>>> wrote:<br>
>>><br>
>>>> Thanks for the report.<br>
>>>><br>
>>>> I confirm this with pgpool-II 3.4.1. I also found that this does not<br>
>>>> happen with 3.3.5 (I tested with shmem).<br>
>>>><br>
>>>> Here is the test script.<br>
>>>> -------------------------------------<br>
>>>> drop table t1;<br>
>>>> create table t1(i int, j text);<br>
>>>> insert into t1 values(1, 'aaa');<br>
>>>> select * from t1;<br>
>>>> select * from t1;<br>
>>>> update t1 set j = 'bbb' where i = 1;<br>
>>>> select * from t1;<br>
>>>> -------------------------------------<br>
>>>><br>
>>>> Will look into this...<br>
>>>><br>
>>>> Best regards,<br>
>>>> --<br>
>>>> Tatsuo Ishii<br>
>>>> SRA OSS, Inc. Japan<br>
>>>> English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
>>>> Japanese:<a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
>>>><br>
>>>> > Looks like only part of this email ended up in the mailing list , not<br>
>>>> > sure how. Resending again - hope it works this time.<br>
>>>> ><br>
>>>> > pgpool doesn't seem to be invalidating caches properly. See the<br>
>>>> > example test case below<br>
>>>> ><br>
>>>> > psql -U ruser -d mydb -h 127.0.0.1 -p 9999<br>
>>>> > Password for user ruser:<br>
>>>> > psql (9.4.1)<br>
>>>> > Type "help" for help.<br>
>>>> ><br>
>>>> > mydb=> select comments from users where id=1;<br>
>>>> > comments<br>
>>>> > ----------<br>
>>>> > boooo<br>
>>>> > (1 row)<br>
>>>> ><br>
>>>> > # comes from cache<br>
>>>> > mydb=> select comments from users where id=1;<br>
>>>> > comments<br>
>>>> > ----------<br>
>>>> > boooo<br>
>>>> > (1 row)<br>
>>>> ><br>
>>>> > # works<br>
>>>> > mydb=> update users set comments='hello' where id=1;<br>
>>>> > UPDATE 1<br>
>>>> > mydb=> select comments from users where id=1;<br>
>>>> > comments<br>
>>>> > ----------<br>
>>>> > hello<br>
>>>> > (1 row)<br>
>>>> ><br>
>>>> > # stale<br>
>>>> > mydb=> update users set comments='hello world' where id=1;<br>
>>>> > UPDATE 1<br>
>>>> > mydb=> select comments from users where id=1;<br>
>>>> > comments<br>
>>>> > ----------<br>
>>>> > hello<br>
>>>> > (1 row)<br>
>>>> ><br>
>>>> > # also stale<br>
>>>> > mydb=> update users set comments='booo' where id=1;<br>
>>>> > UPDATE 1<br>
>>>> > mydb=> select comments from users where id=1;<br>
>>>> > comments<br>
>>>> > ----------<br>
>>>> > hello<br>
>>>> > (1 row)<br>
>>>> ><br>
>>>> ><br>
>>>> > From the second write onwards, the cache is not invalidated and stale<br>
>>>> > value is being served. Is it a bug or am I doing something wrong? This<br>
>>>> > happens with both cache backends (memcache and shmem but test logs are<br>
>>>> > from memcache backend)<br>
>>>> ><br>
>>>> > Test setup is postgresql-9.4 and memcached 1.4.21 and pgpool-3.4.2. my<br>
>>>> > configs and logs from test are here<br>
>>>> ><br>
>>>> > <a href="https://gist.github.com/dbalan/d635993a3e532a083751" target="_blank">https://gist.github.com/dbalan/d635993a3e532a083751</a><br>
>>>> ><br>
>>>> > Regards,<br>
>>>> > --------<br>
>>>> > DHANANJAY | Infrastructure Engineer<br>
>>>> > Plivo, Inc. 340 Pine St, San Francisco - 94104, USA<br>
>>>> > Web: <a href="http://www.plivo.com" target="_blank">www.plivo.com</a> | Twitter: @plivo, @notmycommit<br>
>>>> > DHANANJAY | Infrastructure Engineer<br>
>>>> > Plivo, Inc. 340 Pine St, San Francisco - 94104, USA<br>
>>>> > Web: <a href="http://www.plivo.com" target="_blank">www.plivo.com</a> | Twitter: @plivo, @notmycommit<br>
>>>> ><br>
>>>> > Free Incoming SMS for All US Short Codes – Get One Today!<br>
>>>> ><br>
>>>> ><br>
>>>> ><br>
>>>> ><br>
>>>> > On Tue, Apr 21, 2015 at 12:33 PM, Dhananjay Balan <<a href="mailto:dhananjay@plivo.com">dhananjay@plivo.com</a>><br>
>>>> wrote:<br>
>>>> >> pgpool doesn't seem to be invalidating caches properly. See the<br>
>>>> >> example test case below<br>
>>>> >><br>
>>>> >> psql -U ruser -d mydb -h 127.0.0.1 -p 9999<br>
>>>> >> Password for user ruser:<br>
>>>> >> psql (9.4.1)<br>
>>>> >> Type "help" for help.<br>
>>>> >><br>
>>>> >> mydb=> select comments from users where id=1;<br>
>>>> >> comments<br>
>>>> >> ----------<br>
>>>> >> boooo<br>
>>>> >> (1 row)<br>
>>>> >><br>
>>>> >> # comes from cache<br>
>>>> >> mydb=> select comments from users where id=1;<br>
>>>> >> comments<br>
>>>> >> ----------<br>
>>>> >> boooo<br>
>>>> >> (1 row)<br>
>>>> >><br>
>>>> >> # works<br>
>>>> >> mydb=> update users set comments='hello' where id=1;<br>
>>>> >> UPDATE 1<br>
>>>> >> mydb=> select comments from users where id=1;<br>
>>>> >> comments<br>
>>>> >> ----------<br>
>>>> >> hello<br>
>>>> >> (1 row)<br>
>>>> >><br>
>>>> >> # stale<br>
>>>> >> mydb=> update users set comments='hello world' where id=1;<br>
>>>> >> UPDATE 1<br>
>>>> >> mydb=> select comments from users where id=1;<br>
>>>> >> comments<br>
>>>> >> ----------<br>
>>>> >> hello<br>
>>>> >> (1 row)<br>
>>>> >><br>
>>>> >> # also stale<br>
>>>> >> mydb=> update users set comments='booo' where id=1;<br>
>>>> >> UPDATE 1<br>
>>>> >> mydb=> select comments from users where id=1;<br>
>>>> >> comments<br>
>>>> >> ----------<br>
>>>> >> hello<br>
>>>> >> (1 row)<br>
>>>> >><br>
>>>> >><br>
>>>> >> From the second write onwards, the cache is not invalidated and stale<br>
>>>> >> value is being served. Is it a bug or am I doing something wrong? This<br>
>>>> >> happens with both cache backends (memcache and shmem but test logs are<br>
>>>> >> from memcache backend)<br>
>>>> >><br>
>>>> >> Test setup is postgresql-9.4 and memcached 1.4.21 and pgpool-3.4.2. my<br>
>>>> >> configs and logs from test are here<br>
>>>> >><br>
>>>> >> <a href="https://gist.github.com/dbalan/d635993a3e532a083751" target="_blank">https://gist.github.com/dbalan/d635993a3e532a083751</a><br>
>>>> >><br>
>>>> >> Regards,<br>
>>>> >> --------<br>
>>>> >> DHANANJAY | Infrastructure Engineer<br>
>>>> >> Plivo, Inc. 340 Pine St, San Francisco - 94104, USA<br>
>>>> >> Web: <a href="http://www.plivo.com" target="_blank">www.plivo.com</a> | Twitter: @plivo, @notmycommit<br>
>>>> > _______________________________________________<br>
>>>> > pgpool-general mailing list<br>
>>>> > <a href="mailto:pgpool-general@pgpool.net">pgpool-general@pgpool.net</a><br>
>>>> > <a href="http://www.pgpool.net/mailman/listinfo/pgpool-general" target="_blank">http://www.pgpool.net/mailman/listinfo/pgpool-general</a><br>
>>>> _______________________________________________<br>
>>>> pgpool-general mailing list<br>
>>>> <a href="mailto:pgpool-general@pgpool.net">pgpool-general@pgpool.net</a><br>
>>>> <a href="http://www.pgpool.net/mailman/listinfo/pgpool-general" target="_blank">http://www.pgpool.net/mailman/listinfo/pgpool-general</a><br>
>>>><br>
>>><br>
>>><br>
>><br>
</div></div></blockquote></div><br></div>