From 0522785ad3c83307f4043a953c0bc016ebe75526 Mon Sep 17 00:00:00 2001 From: Luke Chen Date: Mon, 25 Mar 2019 17:06:59 +1100 Subject: Import wiredtiger: 3291c2cbf682f52c88f1b3394c9a94bd80d6a4d6 from branch mongodb-3.6 ref: f441a501ba..3291c2cbf6 for: 3.6.12 WT-4615 Sync backup file before returning backup cursor --- src/third_party/wiredtiger/import.data | 2 +- src/third_party/wiredtiger/src/cursor/cur_backup.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index b243bf2de39..bff3212b557 100644 --- a/src/third_party/wiredtiger/import.data +++ b/src/third_party/wiredtiger/import.data @@ -1,5 +1,5 @@ { - "commit": "f441a501ba71c5c34ecbfc534e9c476155b151d1", + "commit": "3291c2cbf682f52c88f1b3394c9a94bd80d6a4d6", "github": "wiredtiger/wiredtiger.git", "vendor": "wiredtiger", "branch": "mongodb-3.6" diff --git a/src/third_party/wiredtiger/src/cursor/cur_backup.c b/src/third_party/wiredtiger/src/cursor/cur_backup.c index 4b1dfbcb1c8..acb1a8351af 100644 --- a/src/third_party/wiredtiger/src/cursor/cur_backup.c +++ b/src/third_party/wiredtiger/src/cursor/cur_backup.c @@ -306,16 +306,24 @@ __backup_start( } err: /* Close the hot backup file. */ - WT_TRET(__wt_fclose(session, &cb->bfs)); if (srcfs != NULL) WT_TRET(__wt_fclose(session, &srcfs)); + /* + * Sync and rename the temp file into place. + */ + if (ret == 0) + ret = __wt_sync_and_rename(session, + &cb->bfs, WT_BACKUP_TMP, dest); if (ret == 0) { - WT_ASSERT(session, dest != NULL); - WT_TRET(__wt_fs_rename(session, WT_BACKUP_TMP, dest, false)); __wt_writelock(session, &conn->hot_backup_lock); conn->hot_backup_list = cb->list; __wt_writeunlock(session, &conn->hot_backup_lock); } + /* + * If the file hasn't been closed, do it now. + */ + if (cb->bfs != NULL) + WT_TRET(__wt_fclose(session, &cb->bfs)); return (ret); } -- cgit v1.2.1