- バックアップ一覧
- 差分 を表示
- 現在との差分 を表示
- ソース を表示
- PostgreSQL/解析/Postmasterプロセス へ行く。
- 1 (2017-12-31 (日) 08:19:59)
- 2 (2017-12-31 (日) 22:45:06)
- 3 (2018-01-01 (月) 08:48:13)
- 4 (2018-01-02 (火) 09:33:03)
Postmasterプロセスの処理 †
以下は、PostmasterMain関数(postmaster/postmaster.c)の処理概要である。
- PostmasterContextの生成&メモリコンテキストのスイッチ
- シグナルの設定
- GUCオプションの初期化
- コマンドラインオプション解析
- 設定ファイルの読み込み
- postgresql.conf
- postgresql.auto.conf
- pg_hba.conf
- pg_ident.conf
-C
指定があれば出力して終了- Ex:
postgres -C work_mem
- Ex:
- Data directoryの検証
- WorkingDirectoryの変更(
chdir(DataDir)
) - GUCオプションの組み合わせのチェック、以下であること
superuser_reserved_connection
<max_connections
max_wal_senders
<max_connections
archive_mode
が有効時、wal_level
!=minimal
max_wal_senders
> 0 &&wal_level
!=minimal
- Date token tableのチェック(文字列長、順序)参考 CheckDateTokenTables() - https://git.postgresql.org/gitweb/
- Lockfile(postmaster.pid)の作成、以下が記録される
- Postmaster pid
- Date directory path
- MyStartTime(起動時刻)
- Port番号
- Unix socket directory
- First listen_address
- Shared memory key
- Postmaster status(starting / stopping / ready / standby)
- SSL有効の場合、SSLライブラリの初期化
- Logical replication launcherの登録(バックグラウンドワーカ)
- shared_preload_librariesのプレロード
- バックエンドプロセス数の初期値設定
max_connections + autovacuum_max_workers + 1 + max_worker_processes
- Serverソケット作成
- Unixドメインソケット作成
- 共有メモリとセマフォのセットアップ
- File Descriptor数の利用可能な最大値を計算
- 関連パラメータ
max_files_per_process
- 最大数 =
Min(利用可能なFD数, max_files_per_process - オープン済FD数) - NUM_RESERVED_FDS(予約FD数))
- 関連パラメータ
- スタック深さチェックで使用するベースとなるポインタをセット
- 深い再帰となる関数呼び出しでスタック深さのチェックが行われる
- 関連パラメータ
max_stack_depth
- postmaster監視用のpipeを初期化
- postmaster.optsファイルの作成
- ファイルには実行ファイルのパスが書き込まれる。ex: /path/to/postgres
external_pid_file
指定があれば、postmasterのプロセスIDを書き込む- 一時ファイルを削除
- base/pgsql_tmp
- スタンバイ昇格リクエストのシグナルファイルを削除
- &color(foreground[,background]){text};
- &color(foreground[,background]){text};
- ログファイルを記録しているデータファイルを削除
current_logfiles
- 参考 update_metainfo_datafile() -