diff options
Diffstat (limited to 'src/schema/schema_util.c')
-rw-r--r-- | src/schema/schema_util.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/schema/schema_util.c b/src/schema/schema_util.c index d1c84dc8d85..808a7fc36cf 100644 --- a/src/schema/schema_util.c +++ b/src/schema/schema_util.c @@ -9,6 +9,40 @@ #include "wt_internal.h" /* + * __wt_schema_backup_check -- + * Check if a backup cursor is open and give an error if the schema + * operation will conflict. This is called after the schema operations + * have taken the schema lock so no hot backup cursor can be created until + * this is done. + */ +int +__wt_schema_backup_check(WT_SESSION_IMPL *session, const char *name) +{ + WT_CONNECTION_IMPL *conn; + WT_DECL_RET; + int i; + char **backup_list; + + conn = S2C(session); + if (!conn->hot_backup) + return (0); + __wt_readlock(session, conn->hot_backup_lock); + if (!conn->hot_backup) { + __wt_readunlock(session, conn->hot_backup_lock); + return (0); + } + for (i = 0, backup_list = conn->hot_backup_list; + backup_list[i] != NULL; ++i) { + if (strcmp(backup_list[i], name) == 0) { + ret = EBUSY; + break; + } + } + __wt_readunlock(session, conn->hot_backup_lock); + return (ret); +} + +/* * __wt_schema_get_source -- * Find a matching data source or report an error. */ |