-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
There is a demo here to show how hot backup should be done.
http://source.wiredtiger.com/2.5.0/backup.html
WT_CURSOR *cursor; const char *filename; int ret; /* Create the backup directory. */ ret = mkdir("/path/database.backup", 077); /* Open the backup data source. */ ret = session->open_cursor(session, "backup:", NULL, NULL, &cursor); /* Copy the list of files. */ while ( (ret = cursor->next(cursor)) == 0 && (ret = cursor->get_key(cursor, &filename)) == 0) { (void)snprintf(buf, sizeof(buf), "cp /path/database/%s /path/database.backup/%s", filename, filename); ret = system(buf); } if (ret == WT_NOTFOUND) ret = 0; if (ret != 0) fprintf(stderr, "%s: cursor next(backup:) failed: %s\n", progname, wiredtiger_strerror(ret)); ret = cursor->close(cursor);
Unfortunately, there is a bug here, it is quite simple, not may be a little unfriendly to greenhands. I will show how it happens.
If a wt connection is configured with log path, like below:
{{
log=(enabled=true,archive=true,path=journal,compressor=)}} which is mongod's standard configuration.
and if we do a hot backup, the filenames provided above will be like below:
WiredTigerLog.0000000069 WiredTigerLog.0000000068 WiredTigerLog.0000000067 _mdb_catalog.wt admin/collection-11-4891678305923693412.wt admin/collection-9-4891678305923693412.wt local/collection-0-4891678305923693412.wt
You may find that all files are relative to root dir of the database except the wiredTigerLog files. So if the log path is set, the demo code list above will fail when copying wiredTigerLog files(aka journal in mongod).
How it happens:
the code path that get the files is like below, I did not see the code to add relate path from wt's home to the dir logfiles exists as a prefix of the return value, however I did not do an experiment to ensure this but I believe that's the point.
__backup_start->
__backup_log_append->
__wt_log_get_all_files->
__log_get_files->
__wt_fs_directory_list->
- is related to
-
WT-1559 backup log URIs need to use log path
- Backlog
- related to
-
SERVER-30267 Mongod layer's hot backup
- Closed