NotifyMyFrontEnd 函数背后的数据缓冲区(三)

为了验证对数据缓冲区 PqSendBuffer写入数据未满时,也要进行flush。对代码进行如下修改:

pqcomm.c 的 internal_putbytes 函数:

头部加入:

fprintf(stderr,"len is: %d",len);                    
fprintf(stderr,"  ,   PqSendPointer is: %d\n", PqSendPointer);

pqcomm.c 的pq_flush 函数:
头部加入:

fprintf(stderr,"  pq_flush is called\n.");

重新编译后,启动Postgresql(非后台方式,为了看到信息),然后启动一个psql。

此时看到一大堆的 

len is:xx
PqSendPointer is: yy
...
len is:xx
PqSendPointer is: yy  

然后是 pq_flush is called。最后一个PqSendPointer 远小于 PQSendBuffer大小(8092)。

再开一个psql,也是如此。如果发listen 和notify ,也是如此。

posted @ 2012-07-17 14:27  健哥的数据花园  阅读(251)  评论(0编辑  收藏  举报