postgres 之 initdb 源码分析 四

前端之家收集整理的这篇文章主要介绍了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();
}
原文链接:https://www.f2er.com/postgresql/195712.html

猜你在找的Postgre SQL相关文章