hillpig的个人博客分享 http://blog.sciencenet.cn/u/hillpig 畅想ing,思考ing,前行ing Email:bluevaley@gmail.com

博文

Postmaster 命令 -W 参数使用

已有 5648 次阅读 2010-4-24 03:49 |个人分类:postgresql|系统分类:科研笔记| command, Postmaster, option

postgres@hillpig-desktop:~$ postmaster --help
postmaster is the PostgreSQL server.

Usage:
 postmaster [OPTION]...

Options:
 -A 1|0          enable/disable run-time assert checking
 -B NBUFFERS     number of shared buffers
 -c NAME=VALUE   set run-time parameter
 -d 1-5          debugging level
 -D DATADIR      database directory
 -e              use European date input format (DMY)
 -F              turn fsync off
 -h HOSTNAME     host name or IP address to listen on
 -i              enable TCP/IP connections
 -k DIRECTORY    Unix-domain socket location
 -N MAX-CONNECT  maximum number of allowed connections
 -o OPTIONS      pass "OPTIONS" to each server process (obsolete)
 -p PORT         port number to listen on
 -s              show statistics after each query
 -S WORK-MEM     set amount of memory for sorts (in kB)
 --NAME=VALUE    set run-time parameter
 --describe-config  describe configuration parameters, then exit
 --help          show this help, then exit
 --version       output version information, then exit

Developer options:
 -f s|i|n|m|h    forbid use of some plan types
 -n              do not reinitialize shared memory after abnormal exit
 -O              allow system table structure changes
 -P              disable system indexes
 -t pa|pl|ex     show timings after each query
 -T              send SIGSTOP to all backend servers if one dies
 -W NUM          wait NUM seconds to allow attach from a debugger

Options for single-user mode:
 --single        selects single-user mode (must be first argument)
 DBNAME          database name (defaults to user name)
 -d 0-5          override debugging level
 -E              echo statement before execution
 -j              do not use newline as interactive query delimiter
 -r FILENAME     send stdout and stderr to given file

Options for bootstrapping mode:
 --boot          selects bootstrapping mode (must be first argument)
 DBNAME          database name (mandatory argument in bootstrapping mode)
 -r FILENAME     send stdout and stderr to given file
 -x NUM          internal use

Please read the documentation for the complete list of run-time
configuration settings and how to set them on the command line or in
the configuration file.

这里重点说一下 -W 参数。
我们知道一旦postmaster fork一个postgres,实际上你只能debug postgresmain()里头for()循环里的代码了,如何调试从postgresmain()函数开始到for()循环这段代码呢?这里就用到-W参数。
设置示例如下:
postmaster -D /usr/local/pgsql/data -W 60
然后你在BaseInit()调用处设置一个断点,O(∩_∩)O,是不是断点出来了。
实际上你只能调试从 pg_usleep(PostAuthDelay * 1000000L);到 for()循环之间的代码,好在pg_usleep(PostAuthDelay * 1000000L);之前的代码没有什么真正有价值的东东,故该方法可以解决这段调试的大问题。


加我私人微信,交流技术。




https://blog.sciencenet.cn/blog-419883-315482.html

上一篇:postgresql中query tree内存结构
下一篇:NBA 2010 APR 21 PLAYOFF MAV VS SPUR 2ND
收藏 IP: 223.72.72.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-6-8 17:52

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部