Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit97322d2

Browse files
author
Sokolov Yura
committed
cfs: move backup verification before gc_active flag set.
1 parent2f7dd69 commit97322d2

File tree

1 file changed

+17
-17
lines changed
  • src/backend/storage/file

1 file changed

+17
-17
lines changed

‎src/backend/storage/file/cfs.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,23 +1109,6 @@ static bool cfs_gc_file(char* map_path, GC_CALL_KIND background)
11091109
}
11101110
md2=-1;
11111111

1112-
/*
1113-
* Persist map with gc_active set:
1114-
* in case of crash we will know that map may be changed by GC
1115-
*/
1116-
pg_atomic_write_u32(&map->gc_active, true);/* Indicate start of GC */
1117-
1118-
if (cfs_msync(map)<0)
1119-
{
1120-
elog(WARNING,"CFS failed to sync map %s: %m",map_path);
1121-
gotoCleanup;
1122-
}
1123-
if (pg_fsync(md)<0)
1124-
{
1125-
elog(WARNING,"CFS failed to sync file %s: %m",map_path);
1126-
gotoCleanup;
1127-
}
1128-
11291112
if (cfs_gc_verify_file)
11301113
{
11311114
fd=open(file_bck_path,O_RDONLY|PG_BINARY,0);
@@ -1160,6 +1143,23 @@ static bool cfs_gc_file(char* map_path, GC_CALL_KIND background)
11601143
close(fd);
11611144
}
11621145

1146+
/*
1147+
* Persist map with gc_active set:
1148+
* in case of crash we will know that map may be changed by GC
1149+
*/
1150+
pg_atomic_write_u32(&map->gc_active, true);/* Indicate start of GC */
1151+
1152+
if (cfs_msync(map)<0)
1153+
{
1154+
elog(WARNING,"CFS failed to sync map %s: %m",map_path);
1155+
gotoCleanup;
1156+
}
1157+
if (pg_fsync(md)<0)
1158+
{
1159+
elog(WARNING,"CFS failed to sync file %s: %m",map_path);
1160+
gotoCleanup;
1161+
}
1162+
11631163
/*
11641164
* Now all information necessary for recovery is stored.
11651165
* We are ready to replace existing file with defragmented one.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp