[pgpool-general-jp: 1566] Re: Solarisでregression test 006のテストに失敗

Tatsuo Ishii ishii @ sraoss.co.jp
2018年 8月 8日 (水) 11:56:12 JST


石井です。

> 大野です。
> お世話になっております。
> 
>> > 以下確認させて頂けないでしょうか。
>> > ・アライメントの問題という推測は合っているでしょうか
>> 
>> たぶんあっていると思います。
> 承知致しました。ご回答ありがとうございます。
> 
>> 対応するにはソースコードに手を入れる必要があります。
> 「cih->total_length」を「memcpy(&w, cih, 4);」に変更する対処と考えています。
> 上記修正で本テストは通っているようです。
> 
> 以下を確認させていただけないでしょうか。
> ・修正内容の妥当性

そこだけを見ればこれでも動くと思いますが、あまり推奨できません。

> ・本テスト以外でも類似の障害(アライメントの問題)が発生する可能性
>  # あればその機能

コードパスによっては、cih->total_lengthを見ているところが他にもあるからです。
(コード上でgrepで確認しただけで、どの機能で問題が発生するかを確認はしていません)

ちょっと考えたのですが、cih->total_lengthが4バイトバウンダリになってし
まうのは、POOL_CACHE_BLOCK_HEADER構造体の大きさが12バイトであるからだ
と思います。少なくとも手元のamd64/Linuxではそうでした(Solarisでどうな
るかは、確認していません)。

この構造体は、クエリキャッシュを格納するのに使われる共有メモリ上のブロッ
クの先頭に配置され、そのあとに他の管理データが配置されます。ですから、
POOL_CACHE_BLOCK_HEADERが4バイトの倍数のサイズだと、以後ぜんぶアライン
メントが4バイトになってしまいます。そこで添付のようなパッチを作ってみ
ました。この構造体の先頭にダミーでunsigned intを挿入することにより、サ
イズが12から16バイトになります。

よろしければ、このパッチをお試しください。

もうひとつ、ここで言及した構造体の配置アドレスや、サイズを印字するテス
トプログラムも添付しています。Soalrisでどのような結果になるか、見せて
いただけると助かります。
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp

> 以上です。よろしくお願いします。
>> -----Original Message-----
>> From: Tatsuo Ishii [mailto:ishii @ sraoss.co.jp]
>> Sent: Tuesday, August 07, 2018 4:10 PM
>> To: pgpool-general-jp @ sraoss.jp; Ono, Kyohei/大野 恭平
>> Subject: Re: [pgpool-general-jp: 1563] Re: Solarisでregression test 006
>> のテストに失敗
>> 
>> 石井です。
>> 
>> > 大野です。
>> > お世話になっております。
>> >
>> > 本エラーについて、こちらで調査を進めたところ
>> > 共有メモリからキャッシュを取得している箇所でバスエラーとなっているよ
>> うでした。
>> >
>> > [対象ソース]
>> >  src/query_cache/pool_memqcache.c
>> >
>> > [エラー発生箇所]
>> >  pool_get_item_shmem_cache関数の以下の★印の箇所
>> > ――――
>> > :
>> > 	cih = pool_cache_item_header(cacheid);
>> >
>> > 	*size = cih->total_length - sizeof(POOL_CACHE_ITEM_HEADER); ★
>> > 	return (char *)cih + sizeof(POOL_CACHE_ITEM_HEADER);
>> > }
>> > ――――
>> >
>> > 共有メモリ(shmem)のベースアドレス:0x7ffffffffb400000
>> > 共有メモリのサイズ        :4000000
>> > 共有メモリの最終アドレス     :0x7fffffffff400000
>> >
>> > cihのアドレスは0x7ffffffffb4fffc
>> > なので共有メモリ範囲内で特に問題なし
>> >
>> > cih->total_lengthでバスエラーが発生していますが
>> > memcpy(&w_uint, cih, 4) では問題なくアクセスできています。
>> >
>> > 今回の環境は64bit CPUなのでデータのアライメントの問題と推測してます。
>> > # Solaris 11.3 SPARC
>> >
>> > 以下確認させて頂けないでしょうか。
>> > ・アライメントの問題という推測は合っているでしょうか
>> 
>> たぶんあっていると思います。
>> 
>> > cihのアドレスは0x7ffffffffb4fffc
>> 
>> ということなので、アドレスは4の倍数ではあるものの、8の倍数ではないので、
>> もしもSparcが8バイトのアライメントを要求しているとすると、エラーが発
>>>> すると思います。
>> 
>> >  合っている場合、回避策はあるでしょうか
>> 
>> 対応するにはソースコードに手を入れる必要があります。
>> 
>> あとは、クエリキャッシュのストレージとして、memcachedを使うくらいですね。
>> --
>> Tatsuo Ishii
>> SRA OSS, Inc. Japan
>> English: http://www.sraoss.co.jp/index_en.php
>> Japanese:http://www.sraoss.co.jp
>> 
>> > 以上です。よろしくお願いします。
>> >> -----Original Message-----
>> >> From: pgpool-general-jp-bounces @ sraoss.jp
>> >> [mailto:pgpool-general-jp-bounces @ sraoss.jp] On Behalf Of Ono, Kyohei
>> >> Sent: Tuesday, July 17, 2018 1:10 PM
>> >> To: pgpool-general-jp @ sraoss.jp
>> >> Subject: [pgpool-general-jp: 1554] Solarisでregression test 006のテ
>>>> >> トに失敗
>> >>
>> >> 大野と申します。
>> >> お世話になります。
>> >>
>> >> 以下の環境でregression testを実行したところ、
>> >> 006.memqcacheのテストに必ず失敗しております。
>> >> 006.memqcacheのログを見る限り
>> >> テスト途中でコネクションが閉じられているようですが原因が思い当りま
>> せん。
>> >>
>> >> [環境]
>> >>  Solaris 11.3 SPARC
>> >>  Postgres10.3
>> >>  pgpool-II-3.7.4
>> >>
>> >> [006.memqcache]
>> >> ----
>> >> :
>> >> server closed the connection unexpectedly
>> >>         This probably means the server terminated abnormally
>> >>         before or while processing the request.
>> >> connection to server was lost
>> >> ----
>> >>
>> >> 原因・対処方法をご教示頂けないでしょうか。
>> >> テスト時に出力されるログ(006.memqcache)
>> >> 各DBが出力するログ(data0_Tuesday.log、data1_Tuesday.log)
>> >> pgpool2が出力するログ(pgpool.log)を添付致します。
>> >>
>> >> また、テスト失敗後に以下のプロセスが残ったままになります。
>> >>
>> >> user @ b14se03g027:/mnt/work/pgpool-II-3.7.4/src/test/regression$ ps
>> -ef |
>> >> grep regress
>> >>     user 24374 24369   0 11:52:18 ?           0:00
>> >> /mnt/postgres/bin/postgres -D
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/data1
>> >>     user 24404 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24393 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24371 24369   0 11:52:18 ?           0:00
>> >> /mnt/postgres/bin/postgres -D
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/data1
>> >>     user 24410 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24386 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24403 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24401 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24389 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24362 24357   0 11:52:18 ?           0:00
>> >> /mnt/postgres/bin/postgres -D
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/data0
>> >>     user 24373 24369   0 11:52:18 ?           0:00
>> >> /mnt/postgres/bin/postgres -D
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/data1
>> >>     user 24618 24377   0 11:57:19 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24364 24357   0 11:52:18 ?           0:00
>> >> /mnt/postgres/bin/postgres -D
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/data0
>> >>     user 24419 24377   0 11:52:19 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24392 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24407 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24413 24377   0 11:52:19 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24408 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24402 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24383 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24418 24377   0 11:52:19 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24385 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24395 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24360 24357   0 11:52:18 ?           0:00
>> >> /mnt/postgres/bin/postgres -D
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/data0
>> >>     user 24375 24357   0 11:52:18 ?           0:00
>> >> /mnt/postgres/bin/postgres -D
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/data0
>> >>     user 24396 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24399 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24405 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24394 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24694  2014   0 11:59:05 pts/3       0:00 grep regress
>> >>     user 24409 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24411 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24361 24357   0 11:52:18 ?           0:00
>> >> /mnt/postgres/bin/postgres -D
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/data0
>> >>     user 24432 24377   0 11:52:22 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24398 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24412 24377   0 11:52:19 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24406 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24358 24357   0 11:52:18 ?           0:00
>> >> /mnt/postgres/bin/postgres -D
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/data0
>> >>     user 24390 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24400 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24416 24377   0 11:52:19 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24397 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24370 24369   0 11:52:18 ?           0:00
>> >> /mnt/postgres/bin/postgres -D
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/data1
>> >>     user 24387 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24417 24377   0 11:52:19 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24363 24357   0 11:52:18 ?           0:00
>> >> /mnt/postgres/bin/postgres -D
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/data0
>> >>     user 24365 24357   0 11:52:18 ?           0:00
>> >> /mnt/postgres/bin/postgres -D
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/data0
>> >>     user 24377     1   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24372 24369   0 11:52:18 ?           0:00
>> >> /mnt/postgres/bin/postgres -D
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/data1
>> >>     user 24366 24357   0 11:52:18 ?           0:00
>> >> /mnt/postgres/bin/postgres -D
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/data0
>> >>     user 24388 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24369     1   0 11:52:18 pts/3       0:00
>> >> /mnt/postgres/bin/postgres -D
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/data1
>> >>     user 24391 24377   0 11:52:18 pts/3       0:00
>> >> /mnt/pgpool2//bin/pgpool -d -D -n -f
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pgpool.conf -F
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pcp.conf -a
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/etc/pool_hba.conf
>> >>     user 24357     1   0 11:52:18 pts/3       0:00
>> >> /mnt/postgres/bin/postgres -D
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/data0
>> >>     user 24376 24369   0 11:52:18 ?           0:00
>> >> /mnt/postgres/bin/postgres -D
>> >>
>> /mnt/work/pgpool-II-3.7.4/src/test/regression/tests/006.memqcache/test
>> >> dir/data1
>> >> user @ b14se03g027:/mnt/work/pgpool-II-3.7.4/src/test/regression$
>> >>
>> >> 以上です。よろしくお願いします。
>> >
>> > _______________________________________________
>> > pgpool-general-jp mailing list
>> > pgpool-general-jp @ sraoss.jp
>> > http://www.sraoss.jp/mailman/listinfo/pgpool-general-jp
> 
> 
-------------- next part --------------
#include <time.h>
#include <stdio.h>

#define POOL_MD5_HASHKEYLEN		32		/* MD5 hash key length */

typedef char *POOL_CACH_BLOCK;		/* pointer to cache block */
typedef unsigned int POOL_CACHE_BLOCKID;		/* cache block id */
typedef unsigned int POOL_CACHE_ITEMID;		/* cache item id */

/*
 * "Cache id" represents "absolute address" of a cache item.
 */
typedef struct {
	POOL_CACHE_BLOCKID	blockid;
	POOL_CACHE_ITEMID	itemid;
} POOL_CACHEID;	/* cache id */

/*
 * Each block has management space called "cache block header" at the
 * very beginning of the cache block.
 */

#define POOL_BLOCK_USED	0x0001		/* is this block used? */

typedef struct {
	unsigned int dummy;
	unsigned char flags;		/* flags. see above */
	unsigned int num_items;		/* number of items */
	unsigned int free_bytes;		/* total free space in bytes */
} POOL_CACHE_BLOCK_HEADER;

typedef struct {
	char query_hash[POOL_MD5_HASHKEYLEN];
} POOL_QUERY_HASH;

#define POOL_ITEM_USED	0x0001		/* is this item used? */
#define POOL_ITEM_HAS_NEXT	0x0002		/* is this item has "next" item? */
#define POOL_ITEM_DELETED	0x0004		/* is this item deleted? */

typedef struct {
	POOL_QUERY_HASH query_hash;	/* md5 hashed query signature */
	POOL_CACHEID next;			/* next cache item if any */
	unsigned int offset;		/* item offset in this block */
	unsigned char flags;		/* flags. see above */
} POOL_CACHE_ITEM_POINTER;

/*
 * Each block holds several "cache item", which consists of variable
 * length of Data(header plus RowDescription packet and DataRow
 * packet).  Each cache item is assigned "cache item id", which
 * represents the cache item order in a block.
 */

/*
 * "Cache Item" structure holds a SELECT result having several row
 * data in memory cache.  Cache item can be used with either shmem or
 * memcached.
 */

/*
 * "Cache Item header" structure is used to manage each cache item.
 */
typedef struct {
	unsigned int total_length;	/* total length in bytes including myself */
	time_t timestamp;	/* cache creation time */
} POOL_CACHE_ITEM_HEADER;

typedef struct {
	POOL_CACHE_ITEM_HEADER header;		/* cache item header */
	char data[1];	/* variable length data follows */
} POOL_CACHE_ITEM;

int main()
{
	char ppp;
	POOL_CACHE_BLOCK_HEADER b;
	POOL_CACHE_ITEM_HEADER h;
	POOL_CACHE_ITEM_HEADER h1;
	POOL_CACHE_ITEM_POINTER p;
	printf("POOL_CACHE_BLOCK_HEADER: %ld\n", sizeof(POOL_CACHE_BLOCK_HEADER));
	printf("POOL_CACHE_BLOCK_HEADER address: %p\n", &b);
	printf("POOL_QUERY_HASH: %ld\n", sizeof(POOL_QUERY_HASH));
	printf("POOL_CACHE_ITEM_POINTER: %ld\n", sizeof(POOL_CACHE_ITEM_POINTER));
	printf("POOL_CACHE_ITEM_POINTER address: %p\n", &p);
	printf("POOL_CACHE_ITEM_HEADER: %ld\n", sizeof(POOL_CACHE_ITEM_HEADER));
	printf("POOL_CACHE_ITEM_HEADER address: %p %p\n", &h, &h1);
}


pgpool-general-jp メーリングリストの案内