postgres 之 initdb 源码分析 四

2.7 函数perform_fsync

/*
 * fsync everything down to disk
 */
static void
perform_fsync(void)
{
	char		pdir[MAXPGPATH];

	fputs(_("syncing data to disk ... "),stdout);
	fflush(stdout);

	/*
	 * We need to name the parent of PGDATA.  get_parent_directory() isn't
	 * enough here,because it can result in an empty string.
	 */
	snprintf(pdir,MAXPGPATH,"%s/..",pg_data);
	canonicalize_path(pdir);

	/*
	 * Hint to the OS so that we're going to fsync each of these files soon.
	 */

	/* first the parent of the PGDATA directory */
	pre_sync_fname(pdir,true);

	/* then recursively through the directory */
	walkdir(pg_data,pre_sync_fname);

	/*
	 * Now,do the fsync()s in the same order.
	 */

	/* first the parent of the PGDATA directory */
	fsync_fname(pdir,fsync_fname);

	check_ok();
}

相关文章

项目需要,有个数据需要导入,拿到手一开始以为是mysql,结果...
本文小编为大家详细介绍“怎么查看PostgreSQL数据库中所有表...
错误现象问题原因这是在远程连接时pg_hba.conf文件没有配置正...
因本地资源有限,在公共测试环境搭建了PGsql环境,从数据库本...
wamp 环境 这个提示就是说你的版本低于10了。 先打印ph...
psycopg2.OperationalError: SSL SYSCALL error: EOF detect...