#author("2017-12-30T14:19:59+00:00","default:haikikyou","haikikyou")
[[PostgreSQL/解析]]

* Postmasterプロセスの処理 [#z2586f99]

以下は、[[PostmasterMain関数>https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/postmaster/postmaster.c;h=a8e19c92381dc0de643b1837149ff148026ce175;hb=refs/heads/REL_10_STABLE#l575]]([[postmaster/postmaster.c>https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/postmaster/postmaster.c;h=a8e19c92381dc0de643b1837149ff148026ce175;hb=refs/heads/REL_10_STABLE]])の処理概要である。

+ PostmasterContextの生成&メモリコンテキストのスイッチ
+ シグナルの設定
+ GUCオプションの初期化
+ コマンドラインオプション解析
+ 設定ファイルの読み込み
++ postgresql.conf
++ postgresql.auto.conf
++ pg_hba.conf
++ pg_ident.conf
+ &code(-C <gucname>);指定があれば出力して終了
-- Ex: &code(postgres -C work_mem);
+ Data directoryの検証
+ WorkingDirectoryの変更( &code(chdir(DataDir) );)
+ GUCオプションの組み合わせのチェック、以下であること
-- &code(superuser_reserved_connection); < &code(max_connections);
-- &code(max_wal_senders); < &code(max_connections);
-- &code(archive_mode);が有効時、&code(wal_level); != &code(minimal);
-- &code(max_wal_senders); > 0 && &code(wal_level); != &code(minimal); 
+ Date token tableのチェック(文字列長、順序)&label(warn){参考}; [[CheckDateTokenTables()>https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/utils/adt/datetime.c;h=a3d7dc3697a85563397c0ed9a0b296cbf912f775;hb=refs/heads/REL_10_STABLE#l4463]] - &size(11){&color(gray){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のプレロード
+ バックエンドプロセス数の初期値設定
-- &code(max_connections + autovacuum_max_workers + 1 + max_worker_processes);
+ Serverソケット作成
+ Unixドメインソケット作成
+ 共有メモリとセマフォのセットアップ
+ File Descriptor数の利用可能な最大値を計算
-- &label(rel){関連パラメータ};&code(max_files_per_process);
-- 最大数 = &code(){Min(利用可能なFD数, max_files_per_process - オープン済FD数) - NUM_RESERVED_FDS(予約FD数))};
+ スタック深さチェックで使用するベースとなるポインタをセット
-- 深い再帰となる関数呼び出しでスタック深さのチェックが行われる
-- &label(rel){関連パラメータ};&code(max_stack_depth);
+ postmaster監視用のpipeを初期化
+ postmaster.optsファイルの作成
-- ファイルには実行ファイルのパスが書き込まれる。ex: /path/to/postgres
+ &code(){external_pid_file};指定があれば、postmasterのプロセスIDを書き込む
+ 一時ファイルを削除
-- base/pgsql_tmp
+ スタンバイ昇格リクエストのシグナルファイルを削除
-- &color(){promote};
-- &color(){fallback_promote};
+ ログファイルを記録しているデータファイルを削除
-- &code(){current_logfiles};
-- &size(12){&color(white,orange){ 参考 };}; [[update_metainfo_datafile()>https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/postmaster/syslogger.c;h=3255b42c7d23ef67ee17f7d71c9ecf9e11f4b4d0;hb=refs/heads/REL_10_STABLE#l1353]] - 

* 参考リンク [#d19a863b]

- [[postmaster/postmaster.c>https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/postmaster/postmaster.c;h=a8e19c92381dc0de643b1837149ff148026ce175;hb=refs/heads/REL_10_STABLE]] - &size(11){&color(gray){https://git.postgresql.org/gitweb/};};


トップ   一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
目次
ダブルクリックで閉じるTOP | 閉じる
GO TO TOP