postgres 之 initdb 源码分析 七
发布时间:2020-12-13 17:28:37 所属栏目:百科 来源:网络整理
导读: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 suitabl
2.17 函数setup_text_searchvoid setup_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 unknownn"),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"),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 是否指定-kif (data_checksums) printf(_("Data page checksums are enabled.n")); else printf(_("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()void initialize_data_directory(void) { int i; 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 ... ok creating subdirectories ... ok selecting default max_connections ... 100 selecting default shared_buffers ... 128MB creating configuration files ... ok creating template1 database in ./data/base/1 ... ok initializing pg_authid ... ok initializing dependencies ... ok creating system views ... ok loading system objects' descriptions ... ok creating collations ... ok creating conversions ... ok creating dictionaries ... ok setting privileges on built-in objects ... ok creating information schema ... ok loading PL/pgSQL server-side language ... ok vacuuming database template1 ... ok copying template1 to template0 ... ok copying 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 connections You 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:nn" " %s%s%spostgres%s -D %s%s%sn" "orn" " %s%s%spg_ctl%s -D %s%s%s -l logfile startnn"),QUOTE_PATH,bin_dir,(strlen(bin_dir) > 0) ? DIR_SEP : "",pgdata_native,QUOTE_PATH); Success. You can now start the database server using: postgres -D ./data or pg_ctl -D ./data -l logfile start
--initdb分析结束
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |