postgres 之 initdb 源码分析 七

来源:互联网 发布:mba智库百科 知乎 编辑:程序博客网 时间:2024/06/05 03:51

2.17 函数 setup_text_search

voidsetup_text_search(void){if (strlen(default_text_search_config) == 0){default_text_search_config = find_matching_ts_config(lc_ctype);if (default_text_search_config == NULL){printf(_("%s: could not find suitable text search configuration for locale \"%s\"\n"),   progname, lc_ctype);default_text_search_config = "simple";}}else{const char *checkmatch = find_matching_ts_config(lc_ctype);if (checkmatch == NULL){printf(_("%s: warning: suitable text search configuration for locale \"%s\" is unknown\n"),   progname, lc_ctype);}else if (strcmp(checkmatch, default_text_search_config) != 0){printf(_("%s: warning: specified text search configuration \"%s\" might not match locale \"%s\"\n"),   progname, default_text_search_config, lc_ctype);}}printf(_("The default text search configuration will be set to \"%s\".\n"),   default_text_search_config);}

2.17.1 initdb 第三行输出 

initdb: could not find suitable text search configuration for locale "zh_CN.UTF-8"The default text search configuration will be set to "simple".

2.18 initdb 是否指定-k


if (data_checksums)printf(_("Data page checksums are enabled.\n"));elseprintf(_("Data page checksums are disabled.\n"));

-k, --data-checksums      use data page checksums

2.18.1 initdb第四行输出


Data page checksums are disabled.

2.19 函数initialize_data_directory()

voidinitialize_data_directory(void){inti;setup_signals();umask(S_IRWXG | S_IRWXO);create_data_directory();create_xlog_symlink();/* Create required subdirectories */printf(_("creating subdirectories ... "));fflush(stdout);for (i = 0; i < (sizeof(subdirs) / sizeof(char *)); i++){if (!mkdatadir(subdirs[i]))exit_nicely();}check_ok();/* Top level PG_VERSION is checked by bootstrapper, so make it first */write_version_file(NULL);/* Select suitable configuration settings */set_null_conf();test_config_settings();/* Now create all the text config files */setup_config();/* Bootstrap template1 */bootstrap_template1();/* * Make the per-database PG_VERSION for template1 only after init'ing it */write_version_file("base/1");/* Create the stuff we don't need to use bootstrap mode for */setup_auth();if (pwprompt || pwfilename)get_set_pwd();setup_depend();setup_sysviews();setup_description();setup_collation();setup_conversion();setup_dictionary();setup_privileges();setup_schema();load_plpgsql();vacuum_db();make_template0();make_postgres();}

2.19.1 initdb 第五行输出

creating directory ./data ... okcreating subdirectories ... okselecting default max_connections ... 100selecting default shared_buffers ... 128MBcreating configuration files ... okcreating template1 database in ./data/base/1 ... okinitializing pg_authid ... okinitializing dependencies ... okcreating system views ... okloading system objects' descriptions ... okcreating collations ... okcreating conversions ... okcreating dictionaries ... oksetting privileges on built-in objects ... okcreating information schema ... okloading PL/pgSQL server-side language ... okvacuuming database template1 ... okcopying template1 to template0 ... okcopying template1 to postgres ... ok

2.19.2 initdb 第六行输出

执行函数perform_fsync()
syncing data to disk ... ok

2.19.3 initdb第七行输出

若认证方式为trust,则initdb输出
WARNING: enabling "trust" authentication for local connectionsYou can change this by editing pg_hba.conf or using the option -A, or--auth-local and --auth-host, the next time you run initdb.

2.19.3 initdb第八行输出

printf(_("\nSuccess. You can now start the database server using:\n\n" "    %s%s%spostgres%s -D %s%s%s\n" "or\n" "    %s%s%spg_ctl%s -D %s%s%s -l logfile start\n\n"),   QUOTE_PATH, bin_dir, (strlen(bin_dir) > 0) ? DIR_SEP : "", QUOTE_PATH,   QUOTE_PATH, pgdata_native, QUOTE_PATH,   QUOTE_PATH, bin_dir, (strlen(bin_dir) > 0) ? DIR_SEP : "", QUOTE_PATH,   QUOTE_PATH, pgdata_native, QUOTE_PATH);

Success. You can now start the database server using:    postgres -D ./dataor    pg_ctl -D ./data -l logfile start



--initdb分析结束

0 0
原创粉丝点击