summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/db_archive.c6
-rw-r--r--util/db_checkpoint.c6
-rw-r--r--util/db_deadlock.c4
-rw-r--r--util/db_dump.c82
-rw-r--r--util/db_dump185.c4
-rw-r--r--util/db_hotbackup.c127
-rw-r--r--util/db_load.c207
-rw-r--r--util/db_log_verify.c2
-rw-r--r--util/db_printlog.c122
-rw-r--r--util/db_recover.c21
-rw-r--r--util/db_replicate.c22
-rw-r--r--util/db_sql_codegen/buildpt.c2
-rw-r--r--util/db_sql_codegen/db_sql_codegen.c2
-rw-r--r--util/db_sql_codegen/db_sql_codegen.h2
-rw-r--r--util/db_sql_codegen/generate.c10
-rw-r--r--util/db_sql_codegen/generate_test.c2
-rw-r--r--util/db_sql_codegen/generate_verification.c2
-rw-r--r--util/db_sql_codegen/generation.h2
-rw-r--r--util/db_sql_codegen/generation_utils.c2
-rw-r--r--util/db_sql_codegen/hint_comment.c2
-rw-r--r--util/db_sql_codegen/parsefuncs.c2
-rw-r--r--util/db_sql_codegen/preparser.c2
-rw-r--r--util/db_sql_codegen/tokenize.c2
-rw-r--r--util/db_sql_codegen/utils.c2
-rw-r--r--util/db_stat.c6
-rw-r--r--util/db_stat/dd.sh2
-rw-r--r--util/db_tuner.c20
-rw-r--r--util/db_upgrade.c6
-rw-r--r--util/db_verify.c39
-rwxr-xr-xutil/dtrace/apicalls.d2
-rwxr-xr-xutil/dtrace/apitimes.d2
-rwxr-xr-xutil/dtrace/apitrace.d2
-rwxr-xr-xutil/dtrace/cache.d2
-rwxr-xr-xutil/dtrace/dbdefs.d2
-rwxr-xr-xutil/dtrace/locktimes.d2
-rwxr-xr-xutil/dtrace/locktimesid.d2
-rwxr-xr-xutil/dtrace/mutex.d2
-rwxr-xr-xutil/dtrace/showerror.d2
-rwxr-xr-xutil/systemtap/apicalls.stp2
-rwxr-xr-xutil/systemtap/apitimes.stp2
-rwxr-xr-xutil/systemtap/apitrace.stp2
-rwxr-xr-xutil/systemtap/cache.stp2
-rwxr-xr-xutil/systemtap/locktimes.stp2
-rwxr-xr-xutil/systemtap/locktimesid.stp2
-rwxr-xr-xutil/systemtap/mutex.stp2
-rwxr-xr-xutil/systemtap/showerror.stp2
46 files changed, 566 insertions, 178 deletions
diff --git a/util/db_archive.c b/util/db_archive.c
index 5ce651e6..4d482052 100644
--- a/util/db_archive.c
+++ b/util/db_archive.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
@@ -12,7 +12,7 @@
#ifndef lint
static const char copyright[] =
- "Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.\n";
+ "Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.\n";
#endif
int main __P((int, char *[]));
@@ -127,7 +127,7 @@ main(argc, argv)
* private one and try again.
*/
if ((ret = dbenv->open(dbenv, home, DB_USE_ENVIRON, 0)) != 0 &&
- (ret == DB_VERSION_MISMATCH ||
+ (ret == DB_VERSION_MISMATCH || ret == DB_REP_LOCKOUT ||
(ret = dbenv->open(dbenv, home, DB_CREATE |
DB_INIT_LOG | DB_PRIVATE | DB_USE_ENVIRON, 0)) != 0)) {
dbenv->err(dbenv, ret, "DB_ENV->open");
diff --git a/util/db_checkpoint.c b/util/db_checkpoint.c
index e7ba4c83..3e9ff9dc 100644
--- a/util/db_checkpoint.c
+++ b/util/db_checkpoint.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
@@ -12,7 +12,7 @@
#ifndef lint
static const char copyright[] =
- "Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.\n";
+ "Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.\n";
#endif
int main __P((int, char *[]));
@@ -156,7 +156,7 @@ main(argc, argv)
#define ENV_FLAGS DB_USE_ENVIRON
#endif
if ((ret = dbenv->open(dbenv, home, ENV_FLAGS, 0)) != 0 &&
- (!once || ret == DB_VERSION_MISMATCH ||
+ (!once || ret == DB_VERSION_MISMATCH || ret == DB_REP_LOCKOUT ||
(ret = dbenv->open(dbenv, home,
DB_CREATE | DB_INIT_TXN | DB_PRIVATE | DB_USE_ENVIRON, 0)) != 0)) {
dbenv->err(dbenv, ret, "DB_ENV->open");
diff --git a/util/db_deadlock.c b/util/db_deadlock.c
index 52c59178..0aeb7540 100644
--- a/util/db_deadlock.c
+++ b/util/db_deadlock.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
@@ -12,7 +12,7 @@
#ifndef lint
static const char copyright[] =
- "Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.\n";
+ "Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.\n";
#endif
int main __P((int, char *[]));
diff --git a/util/db_dump.c b/util/db_dump.c
index 8c90d087..9b1fbb1c 100644
--- a/util/db_dump.c
+++ b/util/db_dump.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
@@ -14,7 +14,7 @@
#ifndef lint
static const char copyright[] =
- "Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.\n";
+ "Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.\n";
#endif
int db_init __P((DB_ENV *, char *, int, u_int32_t, int *));
@@ -40,7 +40,7 @@ main(argc, argv)
int ch;
int exitval, keyflag, lflag, mflag, nflag, pflag, sflag, private;
int ret, Rflag, rflag, resize;
- char *data_len, *dbname, *dopt, *filename, *home, *passwd;
+ char *blob_dir, *data_len, *dbname, *dopt, *filename, *home, *passwd;
if ((progname = __db_rpath(argv[0])) == NULL)
progname = argv[0];
@@ -57,9 +57,18 @@ main(argc, argv)
keyflag = 0;
cache = MEGABYTE;
private = 0;
- data_len = dbname = dopt = filename = home = passwd = NULL;
- while ((ch = getopt(argc, argv, "d:D:f:F:h:klL:m:NpP:rRs:V")) != EOF)
+ blob_dir = data_len = dbname = dopt = filename = home = passwd = NULL;
+ while ((ch = getopt(argc, argv, "b:d:D:f:F:h:klL:m:NpP:rRs:V")) != EOF)
switch (ch) {
+ case 'b':
+ if (blob_dir!= NULL) {
+ fprintf(stderr, DB_STR("5144",
+ "Blob directory may not be specified twice"));
+ goto err;
+ }
+ blob_dir = strdup(optarg);
+ memset(optarg, 0, strlen(optarg));
+ break;
case 'd':
dopt = optarg;
break;
@@ -71,7 +80,7 @@ main(argc, argv)
fprintf(stderr, DB_STR_A("5108",
"%s: %s: reopen: %s\n", "%s %s %s\n"),
progname, optarg, strerror(errno));
- return (EXIT_FAILURE);
+ goto err;
}
break;
case 'F':
@@ -100,8 +109,7 @@ main(argc, argv)
if (passwd != NULL) {
fprintf(stderr, DB_STR("5130",
"Password may not be specified twice"));
- free(passwd);
- return (EXIT_FAILURE);
+ goto err;
}
passwd = strdup(optarg);
memset(optarg, 0, strlen(optarg));
@@ -109,7 +117,7 @@ main(argc, argv)
fprintf(stderr, DB_STR_A("5109",
"%s: strdup: %s\n", "%s %s\n"),
progname, strerror(errno));
- return (EXIT_FAILURE);
+ goto err;
}
break;
case 'p':
@@ -128,10 +136,11 @@ main(argc, argv)
break;
case 'V':
printf("%s\n", db_version(NULL, NULL, NULL));
- return (EXIT_SUCCESS);
+ goto done;
case '?':
default:
- return (usage());
+ (void)usage();
+ goto err;
}
argc -= optind;
argv += optind;
@@ -144,40 +153,42 @@ main(argc, argv)
filename = NULL;
else if (argc == 1 && !mflag)
filename = argv[0];
- else
- return (usage());
+ else {
+ (void)usage();
+ goto err;
+ }
if (dopt != NULL && pflag) {
fprintf(stderr, DB_STR_A("5110",
"%s: the -d and -p options may not both be specified\n",
"%s\n"), progname);
- return (EXIT_FAILURE);
+ goto err;
}
if (lflag && sflag) {
fprintf(stderr, DB_STR_A("5111",
"%s: the -l and -s options may not both be specified\n",
"%s\n"), progname);
- return (EXIT_FAILURE);
+ goto err;
}
if ((lflag || sflag) && mflag) {
fprintf(stderr, DB_STR_A("5112",
"%s: the -m option may not be specified with -l or -s\n",
"%s\n"), progname);
- return (EXIT_FAILURE);
+ goto err;
}
if (keyflag && rflag) {
fprintf(stderr, DB_STR_A("5113",
"%s: the -k and -r or -R options may not both be specified\n",
"%s\n"), progname);
- return (EXIT_FAILURE);
+ goto err;
}
if (sflag && rflag) {
fprintf(stderr, DB_STR_A("5114",
"%s: the -r or R options may not be specified with -s\n",
"%s\n"), progname);
- return (EXIT_FAILURE);
+ goto err;
}
/* Handle possible interruptions. */
@@ -195,8 +206,6 @@ retry: if ((ret = db_env_create(&dbenv, 0)) != 0) {
dbenv->set_errfile(dbenv, stderr);
dbenv->set_errpfx(dbenv, progname);
- if (data_len != NULL)
- (void)dbenv->set_data_len(dbenv, (u_int32_t)atol(data_len));
if (nflag) {
if ((ret = dbenv->set_flags(dbenv, DB_NOLOCKING, 1)) != 0) {
@@ -214,10 +223,28 @@ retry: if ((ret = db_env_create(&dbenv, 0)) != 0) {
goto err;
}
+ /* Set the directory in which blob files are stored. */
+ if (blob_dir != NULL) {
+ if ((ret = dbenv->set_blob_dir(dbenv, blob_dir)) != 0) {
+ dbenv->err(dbenv, ret, "set_blob_dir");
+ goto err;
+ }
+ }
+
/* Initialize the environment. */
if (db_init(dbenv, home, rflag, cache, &private) != 0)
goto err;
+ /*
+ * Set data_len after environment opens. The value passed
+ * by -D takes priority.
+ */
+ if (data_len != NULL && (ret = dbenv->set_data_len(dbenv,
+ (u_int32_t)atol(data_len))) != 0) {
+ dbenv->err(dbenv, ret, "set_data_len");
+ goto err;
+ }
+
/* Create the DB object and open the file. */
if ((ret = db_create(&dbp, dbenv, 0)) != 0) {
dbenv->err(dbenv, ret, "db_create");
@@ -310,6 +337,9 @@ done: if (dbp != NULL && (ret = dbp->close(dbp, 0)) != 0) {
if (passwd != NULL)
free(passwd);
+ if (blob_dir != NULL)
+ free(blob_dir);
+
/* Resend any caught signal. */
__db_util_sigresend();
@@ -352,7 +382,7 @@ db_init(dbenv, home, is_salvage, cache, is_privatep)
if ((ret = dbenv->open(dbenv, home,
DB_USE_ENVIRON | (is_salvage ? DB_INIT_MPOOL : 0), 0)) == 0)
return (0);
- if (ret == DB_VERSION_MISMATCH)
+ if (ret == DB_VERSION_MISMATCH || ret == DB_REP_LOCKOUT)
goto err;
/*
@@ -483,7 +513,7 @@ show_subs(dbp)
while ((ret = dbcp->get(dbcp, &key, &data,
DB_IGNORE_LEASE | DB_NEXT)) == 0) {
if ((ret = dbp->dbenv->prdbt(
- &key, 1, NULL, stdout, __db_pr_callback, 0, 0)) != 0) {
+ &key, 1, NULL, stdout, __db_pr_callback, 0, 0, 0)) != 0) {
dbp->errx(dbp, NULL);
return (1);
}
@@ -507,11 +537,13 @@ show_subs(dbp)
int
usage()
{
- (void)fprintf(stderr, "usage: %s [-klNprRV]\n\t%s\n",
+ (void)fprintf(stderr, "usage: %s [-bklNprRV]\n\t%s%s\n",
progname,
- "[-d ahr] [-f output] [-h home] [-P password] [-s database] db_file");
+ "[-b blob_dir] [-d ahr] [-f output] [-h home] ",
+ "[-P password] [-s database] db_file");
(void)fprintf(stderr, "usage: %s [-kNpV] %s\n",
- progname, "[-d ahr] [-f output] [-h home] -m database");
+ progname,
+ "[-d ahr] [-D data_len] [-f output] [-h home] -m database");
return (EXIT_FAILURE);
}
diff --git a/util/db_dump185.c b/util/db_dump185.c
index b2689e5f..60fe395d 100644
--- a/util/db_dump185.c
+++ b/util/db_dump185.c
@@ -1,14 +1,14 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
#ifndef lint
static const char copyright[] =
- "Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.\n";
+ "Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.\n";
#endif
#include <sys/types.h>
diff --git a/util/db_hotbackup.c b/util/db_hotbackup.c
index d11909cc..fb4137fe 100644
--- a/util/db_hotbackup.c
+++ b/util/db_hotbackup.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
@@ -15,19 +15,27 @@
#ifndef lint
static const char copyright[] =
- "Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.\n";
+ "Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.\n";
#endif
enum which_open { OPEN_ORIGINAL, OPEN_HOT_BACKUP };
int env_init __P((DB_ENV **,
- char *, char **, char ***, char *, enum which_open, int));
+ char *, char *, char **, char ***, char *, enum which_open, int));
int main __P((int, char *[]));
int usage __P((void));
int version_check __P((void));
void __db_util_msg __P((const DB_ENV *, const char *));
+void handle_event __P((DB_ENV *, u_int32_t, void *));
const char *progname;
+/*
+ * Hot backup returns DB_EXIT_FAILCHK (3) if it detects that a panic was due to
+ * another process having crashed or exited from the environment uncleanly. That
+ * value can be used to indicate that the error is "expected", or at least, not
+ * due to a problem with db_hotbackup itself.
+ */
+int failchk_count;
void __db_util_msg(dbenv, msgstr)
const DB_ENV *dbenv;
@@ -37,6 +45,35 @@ void __db_util_msg(dbenv, msgstr)
printf("%s: %s\n", progname, msgstr);
}
+void handle_event(dbenv, event, info)
+ DB_ENV *dbenv;
+ u_int32_t event;
+ void *info;
+{
+ DB_EVENT_MUTEX_DIED_INFO *mtxdied;
+ DB_EVENT_FAILCHK_INFO *crash;
+
+ switch (event) {
+ case DB_EVENT_MUTEX_DIED:
+ mtxdied = info;
+ dbenv->errx(dbenv, "DB_EVENT_MUTEX_DIED %.*s",
+ sizeof(mtxdied->desc), mtxdied->desc);
+ failchk_count++;
+ break;
+
+ case DB_EVENT_FAILCHK_PANIC:
+ crash = info;
+ dbenv->errx(dbenv, "DB_EVENT_FAILCHK_PANIC %s %.*s",
+ db_strerror(crash->error),
+ sizeof(crash->symptom), crash->symptom);
+ failchk_count++;
+ break;
+ default:
+ break;
+ }
+ COMPQUIET(dbenv, NULL);
+}
+
int
main(argc, argv)
int argc;
@@ -49,7 +86,8 @@ main(argc, argv)
u_int data_cnt, data_next;
int ch, checkpoint, db_config, debug, env_copy, exitval;
int ret, update, verbose;
- char *backup_dir, **data_dir, *home, *log_dir, *passwd;
+ char *backup_dir, **data_dir;
+ char *home, *home_blob_dir, *log_dir, *passwd;
char home_buf[DB_MAXPATHLEN], time_buf[CTIME_BUFLEN];
u_int32_t flags;
@@ -63,12 +101,13 @@ main(argc, argv)
* don't want to care about. There isn't enough output for the calls
* to matter.
*/
- setbuf(stdout, NULL);
+ (void)setvbuf(stdout, NULL, _IONBF, 0);
if ((progname = __db_rpath(argv[0])) == NULL)
progname = argv[0];
else
++progname;
+ failchk_count = 0;
if ((ret = version_check()) != 0)
return (ret);
@@ -79,9 +118,9 @@ main(argc, argv)
checkpoint = db_config = data_cnt = data_next = debug =
exitval = update = verbose = 0;
data_dir = NULL;
- backup_dir = home = passwd = NULL;
+ backup_dir = home = home_blob_dir = passwd = NULL;
log_dir = NULL;
- while ((ch = getopt(argc, argv, "b:cDd:Fgh:l:P:uVv")) != EOF)
+ while ((ch = getopt(argc, argv, "b:cDd:Fgh:i:l:P:uVv")) != EOF)
switch (ch) {
case 'b':
backup_dir = optarg;
@@ -119,6 +158,9 @@ main(argc, argv)
case 'h':
home = optarg;
break;
+ case 'i':
+ home_blob_dir = optarg;
+ break;
case 'l':
log_dir = optarg;
break;
@@ -220,8 +262,7 @@ main(argc, argv)
}
if (backup_dir == NULL) {
fprintf(stderr, "%s: %s", DB_STR("5031",
- "no target backup directory specified\n"),
- progname);
+ "no target backup directory specified\n"), progname);
exitval = usage();
goto clean;
}
@@ -234,7 +275,7 @@ main(argc, argv)
}
/* Open the source environment. */
- if (env_init(&dbenv, home,
+ if (env_init(&dbenv, home, home_blob_dir,
(db_config || log_dir != NULL) ? &log_dir : NULL,
&data_dir, passwd, OPEN_ORIGINAL, verbose) != 0)
goto err;
@@ -243,8 +284,8 @@ main(argc, argv)
if ((ret = dbenv->get_open_flags(dbenv, &flags)) != 0)
goto err;
if (flags & DB_PRIVATE) {
- fprintf(stderr, "%s: %s", progname, DB_STR("5129",
- "Cannot copy data from a PRIVATE environment\n"));
+ fprintf(stderr, "%s: %s", progname, DB_STR("5140",
+"The environment does not exist or cannot be opened. \"-F\" is required.\n"));
goto err;
}
}
@@ -252,8 +293,7 @@ main(argc, argv)
if (log_dir != NULL) {
if (db_config && __os_abspath(log_dir)) {
fprintf(stderr, "%s: %s", progname, DB_STR("5033",
- "DB_CONFIG must not contain an absolute "
- "path for the log directory\n"));
+ "DB_CONFIG must not contain an absolute path for the log directory\n"));
goto err;
}
}
@@ -310,8 +350,8 @@ main(argc, argv)
printf(DB_STR_A("5040", "%s: run catastrophic recovery\n",
"%s"), backup_dir);
}
- if (env_init(&dbenv,
- backup_dir, NULL, NULL, passwd, OPEN_HOT_BACKUP, verbose) != 0)
+ if (env_init(&dbenv, backup_dir, NULL,
+ NULL, NULL, passwd, OPEN_HOT_BACKUP, verbose) != 0)
goto err;
/*
@@ -337,7 +377,7 @@ main(argc, argv)
err: exitval = 1;
}
- if (dbenv != NULL && (ret = dbenv->close(dbenv, 0)) != 0) {
+ if (dbenv != NULL && ret == 0 && (ret = dbenv->close(dbenv, 0)) != 0) {
exitval = 1;
fprintf(stderr,
"%s: dbenv->close: %s\n", progname, db_strerror(ret));
@@ -365,7 +405,8 @@ clean:
if (passwd != NULL)
free(passwd);
- return (exitval == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
+ return (failchk_count != 0 ? DB_EXIT_FAILCHK :
+ exitval == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
/*
@@ -373,9 +414,9 @@ clean:
* Open a database environment.
*/
int
-env_init(dbenvp, home, log_dirp, data_dirp, passwd, which, verbose)
+env_init(dbenvp, home, blob_dir, log_dirp, data_dirp, passwd, which, verbose)
DB_ENV **dbenvp;
- char *home, **log_dirp, ***data_dirp, *passwd;
+ char *home, *blob_dir, **log_dirp, ***data_dirp, *passwd;
enum which_open which;
int verbose;
{
@@ -395,20 +436,38 @@ env_init(dbenvp, home, log_dirp, data_dirp, passwd, which, verbose)
return (1);
}
+ if ((ret = dbenv->set_event_notify(dbenv, handle_event)) != 0) {
+ fprintf(stderr, "%s: DB_ENV->set_event_notify: %s\n",
+ progname, db_strerror(ret));
+ return (1);
+ }
if (verbose) {
(void)dbenv->set_verbose(dbenv, DB_VERB_BACKUP, 1);
dbenv->set_msgcall(dbenv, __db_util_msg);
}
dbenv->set_errfile(dbenv, stderr);
- setbuf(stderr, NULL);
+ (void)setvbuf(stderr, NULL, _IONBF, 0);
dbenv->set_errpfx(dbenv, progname);
+ /* Always enable logging blobs. */
+ if ((ret = dbenv->log_set_config(dbenv, DB_LOG_BLOB, 1)) != 0) {
+ dbenv->err(dbenv, ret, "DB_ENV->log_set_config");
+ return (1);
+ }
+
/* Any created intermediate directories are created private. */
if ((ret = dbenv->set_intermediate_dir_mode(dbenv, "rwx------")) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->set_intermediate_dir_mode");
return (1);
}
+ /* Set the blob directory. */
+ if (blob_dir != NULL &&
+ (ret = dbenv->set_blob_dir(dbenv, blob_dir)) != 0) {
+ dbenv->err(dbenv, ret, "DB_ENV->set_blob-dir");
+ return (1);
+ }
+
/*
* If a log directory has been specified, and it's not the same as the
* home directory, set it for the environment.
@@ -437,7 +496,8 @@ env_init(dbenvp, home, log_dirp, data_dirp, passwd, which, verbose)
* trim the home directory from the data directory
* passed in.
*/
- (void) sprintf(buf, "%s/%s", home, home);
+ (void) snprintf(buf, sizeof(buf), "%s/%s",
+ home, home);
homehome = 0;
(void)__os_exists(dbenv->env, buf, &homehome);
@@ -469,9 +529,9 @@ env_init(dbenvp, home, log_dirp, data_dirp, passwd, which, verbose)
* fails, we create a private environment and try again.
*/
if ((ret = dbenv->open(dbenv, home, DB_USE_ENVIRON, 0)) != 0 &&
- (ret == DB_VERSION_MISMATCH ||
- (ret = dbenv->open(dbenv, home, DB_CREATE |
- DB_INIT_LOG | DB_INIT_TXN | DB_PRIVATE | DB_USE_ENVIRON,
+ (ret == DB_VERSION_MISMATCH || ret == DB_REP_LOCKOUT ||
+ (ret = dbenv->open(dbenv, home, DB_CREATE | DB_INIT_LOG |
+ DB_INIT_MPOOL | DB_INIT_TXN | DB_PRIVATE | DB_USE_ENVIRON,
0)) != 0)) {
dbenv->err(dbenv, ret, "DB_ENV->open: %s", home);
return (1);
@@ -486,9 +546,19 @@ env_init(dbenvp, home, log_dirp, data_dirp, passwd, which, verbose)
"%s\n"), progname);
return (usage());
} else {
- fprintf(stderr, "%s: %s", DB_STR("5058",
+ /*
+ * Do we have -l and an existing DB_CONFIG?
+ * That is a usage problem, but for backward
+ * compatibility, keep going if log_dir happens
+ * to be the same as the DB_CONFIG path.
+ */
+ (void)snprintf(buf, sizeof(buf), "%s%c%s",
+ home, PATH_SEPARATOR[0], "DB_CONFIG");
+ if (__os_exists(dbenv->env, buf, NULL) == 0)
+ fprintf(stderr,
+ "%s: %s", DB_STR("5141",
"use of -l with DB_CONFIG file is deprecated\n"),
- progname);
+ progname);
}
}
if (data_dirp != NULL && *data_dirp == NULL)
@@ -527,7 +597,8 @@ int
usage()
{
(void)fprintf(stderr, "usage: %s [-cDuVv]\n\t%s\n", progname,
- "[-d data_dir ...] [-h home] [-l log_dir] [-P password] -b backup_dir");
+ "[-d data_dir ...] [-i home_blob_dir] [-h home] [-l log_dir] "
+ "[-P password] -b backup_dir");
return (EXIT_FAILURE);
}
diff --git a/util/db_load.c b/util/db_load.c
index af4c7800..aac774fc 100644
--- a/util/db_load.c
+++ b/util/db_load.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
@@ -14,7 +14,7 @@
#ifndef lint
static const char copyright[] =
- "Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.\n";
+ "Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.\n";
#endif
typedef struct { /* XXX: Globals. */
@@ -25,10 +25,12 @@ typedef struct { /* XXX: Globals. */
int endodata; /* Reached the end of a database. */
int endofile; /* Reached the end of the input. */
int version; /* Input version. */
+ char *blob_dir; /* Blob directory. */
char *home; /* Env home. */
char *passwd; /* Env passwd. */
int private; /* Private env. */
u_int32_t cache; /* Env cache size. */
+ u_int32_t blob_threshold; /* Blob threshold. */
} LDG;
int badend __P((DB_ENV *));
@@ -36,7 +38,7 @@ void badnum __P((DB_ENV *));
int configure __P((DB_ENV *, DB *, char **, char **, int *));
int convprintable __P((DB_ENV *, char *, char **));
int db_init __P((DB_ENV *, char *, u_int32_t, int *));
-int dbt_rdump __P((DB_ENV *, DBT *));
+int dbt_rdump __P((DB_ENV *, DBT *, u_int32_t, int *));
int dbt_rprint __P((DB_ENV *, DBT *));
int dbt_rrecno __P((DB_ENV *, DBT *, int));
int dbt_to_recno __P((DB_ENV *, DBT *, db_recno_t *));
@@ -44,6 +46,7 @@ int env_create __P((DB_ENV **, LDG *));
void free_keys __P((DBT *part_keys));
int load __P((DB_ENV *, char *, DBTYPE, char **, u_int, LDG *, int *));
int main __P((int, char *[]));
+int putdata __P((DB *, DBC *, DB_TXN *, DBT *, DBT *, u_int32_t, int));
int rheader __P((DB_ENV *, DB *, DBTYPE *, char **, int *, int *, DBT **));
int usage __P((void));
int version_check __P((void));
@@ -56,6 +59,7 @@ const char *progname;
#define LDF_NOHEADER 0x01 /* No dump header. */
#define LDF_NOOVERWRITE 0x02 /* Don't overwrite existing rows. */
#define LDF_PASSWORD 0x04 /* Encrypt created databases. */
+#define BLOB_LOADING_SIZE 1048576 /* Load blob files X bytes at a time.*/
int
main(argc, argv)
@@ -86,6 +90,8 @@ main(argc, argv)
ldg.hdrbuf = NULL;
ldg.home = NULL;
ldg.passwd = NULL;
+ ldg.blob_dir = NULL;
+ ldg.blob_threshold = 0;
if ((exitval = version_check()) != 0)
goto done;
@@ -95,6 +101,17 @@ main(argc, argv)
exitval = existed = 0;
dbtype = DB_UNKNOWN;
+ /*
+ * We will allocate (argc + 1) bytes memory.
+ * Check if (argc + 1) will introduce interger overflow error.
+ */
+ if (argc == INT_MAX) {
+ fprintf(stderr, "%s: %s\n", ldg.progname, "The number of\
+ arguments exceeds the maximum unsigned integer value");
+ exitval = 1;
+ goto done;
+ }
+
/* Allocate enough room for configuration arguments. */
if ((clp = clist =
(char **)calloc((size_t)argc + 1, sizeof(char *))) == NULL) {
@@ -110,8 +127,11 @@ main(argc, argv)
* db_load because we don't have a better place to put it, and we
* don't want to create a new utility for just that functionality.
*/
- while ((ch = getopt(argc, argv, "c:f:h:nP:r:Tt:V")) != EOF)
+ while ((ch = getopt(argc, argv, "b:c:f:h:o:nP:r:Tt:V")) != EOF)
switch (ch) {
+ case 'b':
+ ldg.blob_dir = optarg;
+ break;
case 'c':
if (mode != NOTSET && mode != STANDARD_LOAD) {
exitval = usage();
@@ -148,6 +168,9 @@ main(argc, argv)
ldf |= LDF_NOOVERWRITE;
break;
+ case 'o':
+ ldg.blob_threshold = (u_int32_t)atoi(optarg);
+ break;
case 'P':
ldg.passwd = strdup(optarg);
memset(optarg, 0, strlen(optarg));
@@ -303,7 +326,8 @@ load(dbenv, name, argtype, clist, flags, ldg, existedp)
DB_TXN *ctxn, *txn;
db_recno_t recno, datarecno;
u_int32_t put_flags;
- int ascii_recno, checkprint, hexkeys, keyflag, keys, resize, ret, rval;
+ int ascii_recno, checkprint, hexkeys;
+ int keyflag, keys, resize, ret, rval, streaming;
char *subdb;
put_flags = LF_ISSET(LDF_NOOVERWRITE) ? DB_NOOVERWRITE : 0;
@@ -313,6 +337,7 @@ load(dbenv, name, argtype, clist, flags, ldg, existedp)
subdb = NULL;
ctxn = txn = NULL;
part_keys = NULL;
+ streaming = 0;
memset(&key, 0, sizeof(DBT));
memset(&data, 0, sizeof(DBT));
memset(&rkey, 0, sizeof(DBT));
@@ -386,13 +411,19 @@ retry_db:
goto err;
}
- if (dbtype == DB_RECNO || dbtype == DB_QUEUE)
+ if (dbtype == DB_RECNO || dbtype == DB_QUEUE) {
if (keyflag != 1 && argtype != DB_RECNO &&
argtype != DB_QUEUE) {
dbenv->errx(dbenv, DB_STR("5077",
"improper database type conversion specified"));
goto err;
}
+ if (ldg->blob_threshold != 0) {
+ dbenv->errx(dbenv, DB_STR("5142",
+ "Queue and recno databases cannot support blobs"));
+ goto err;
+ }
+ }
dbtype = argtype;
}
@@ -506,12 +537,14 @@ key_data: if ((readp->data = malloc(readp->ulen = 1024)) == NULL) {
/* Get each key/data pair and add them to the database. */
for (recno = 1; !__db_util_interrupted(); ++recno) {
+ streaming = 0;
if (!keyflag) {
if (checkprint) {
if (dbt_rprint(dbenv, &data))
goto err;
} else {
- if (dbt_rdump(dbenv, &data))
+ if (dbt_rdump(dbenv,
+ &data, ldg->blob_threshold, &streaming))
goto err;
}
} else {
@@ -529,10 +562,12 @@ key_data: if ((readp->data = malloc(readp->ulen = 1024)) == NULL) {
if (dbt_rrecno(dbenv, readp, hexkeys))
goto err;
} else
- if (dbt_rdump(dbenv, readp))
+ if (dbt_rdump(
+ dbenv, readp, 0, &streaming))
goto err;
- if (!G(endodata) && dbt_rdump(dbenv, &data)) {
+ if (!G(endodata) && dbt_rdump(dbenv,
+ &data, ldg->blob_threshold, &streaming)) {
odd_count: dbenv->errx(dbenv, DB_STR("5079",
"odd number of key/data pairs"));
goto err;
@@ -545,9 +580,9 @@ retry:
if (put_flags != 0 && txn != NULL)
if ((ret = dbenv->txn_begin(dbenv, txn, &ctxn, 0)) != 0)
goto err;
- switch (ret = ((put_flags == 0) ?
- dbc->put(dbc, writep, &data, DB_KEYLAST) :
- dbp->put(dbp, ctxn, writep, &data, put_flags))) {
+ ret = putdata(dbp,
+ dbc, ctxn, writep, &data, put_flags, streaming);
+ switch (ret) {
case 0:
if (ctxn != NULL) {
if ((ret =
@@ -564,7 +599,7 @@ retry:
!keyflag ? recno : recno * 2 - 1);
(void)dbenv->prdbt(&key,
- checkprint, 0, stderr, __db_pr_callback, 0, 0);
+ checkprint, 0, stderr, __db_pr_callback, 0, 0, 0);
break;
case DB_LOCK_DEADLOCK:
/* If we have a child txn, retry--else it's fatal. */
@@ -630,6 +665,94 @@ err: rval = 1;
}
/*
+ * putdata --
+ * Put data read from the load file into the database.
+ */
+int
+putdata(dbp, dbc, txn, writep, data, put_flags, streaming)
+ DB *dbp;
+ DBC *dbc;
+ DB_TXN *txn;
+ DBT *writep;
+ DBT *data;
+ u_int32_t put_flags;
+ int streaming;
+{
+ DBC *local;
+ DBT partial;
+ DB_ENV *dbenv;
+ DB_STREAM *dbs;
+ db_off_t offset;
+ int ret, t_ret;
+ u_int32_t flags;
+
+ local = NULL;
+ dbenv = dbp->dbenv;
+ dbs = NULL;
+ offset = data->size;
+ flags = 0;
+ ret = t_ret = 0;
+ memset(&partial, 0, sizeof(DBT));
+ partial.flags |= DB_DBT_PARTIAL;
+
+ if (streaming != 0)
+ data->flags |= DB_DBT_BLOB;
+
+ ret = ((put_flags == 0) ?
+ dbc->put(dbc, writep, data, DB_KEYLAST | flags) :
+ dbp->put(dbp, txn, writep, data, put_flags | flags));
+
+ if (ret != 0 || streaming == 0)
+ return (ret);
+
+ /* Stream the rest of the data into the data item. */
+ F_CLR(data, DB_DBT_BLOB);
+ if (dbc != NULL)
+ local = dbc;
+ else {
+ if ((ret = dbp->cursor(dbp, txn, &local, 0)) != 0)
+ goto err;
+ if ((ret = local->get(local, writep, &partial, DB_SET)) != 0)
+ goto err;
+ }
+
+ if (data->ulen < MEGABYTE) {
+ if ((data->data = realloc(
+ data->data, data->ulen = MEGABYTE)) == NULL) {
+ dbp->dbenv->err(dbp->dbenv, ENOMEM, NULL);
+ goto err;
+ }
+ }
+
+ if ((ret = local->db_stream(local, &dbs, DB_STREAM_WRITE)) != 0)
+ goto err;
+
+ /* Load the blob piecemeal into the database. */
+ while (streaming != 0 && !G(endodata)) {
+ if (dbt_rdump(dbenv, data, data->ulen, &streaming)) {
+ ret = EIO;
+ goto err;
+ }
+
+ if ((ret = dbs->write(dbs, data, offset, 0)) != 0)
+ goto err;
+
+ offset += data->size;
+ }
+
+err: if (dbs != NULL){
+ if ((t_ret = dbs->close(dbs, 0)) != 0 && ret == 0)
+ ret = t_ret;
+ }
+ if (local != NULL && local != dbc) {
+ if ((t_ret = local->close(local)) != 0 && ret == 0)
+ ret = t_ret;
+ }
+
+ return (ret);
+}
+
+/*
* env_create --
* Create the environment and initialize it for error reporting.
*/
@@ -654,6 +777,20 @@ env_create(dbenvp, ldg)
dbenv->err(dbenv, ret, "set_passwd");
return (ret);
}
+
+ /* Configure blobs. */
+ if (ldg->blob_threshold != 0 &&
+ (ret = dbenv->set_blob_threshold(
+ dbenv, ldg->blob_threshold, 0)) != 0) {
+ dbenv->err(dbenv, ret, "set_blob_threshold");
+ return (ret);
+ }
+ if (ldg->blob_dir != NULL &&
+ (ret = dbenv->set_blob_dir(dbenv, ldg->blob_dir)) != 0) {
+ dbenv->err(dbenv, ret, "set_blob_dir");
+ return (ret);
+ }
+
if ((ret = db_init(dbenv, ldg->home, ldg->cache, &ldg->private)) != 0)
return (ret);
dbenv->app_private = ldg;
@@ -681,7 +818,7 @@ db_init(dbenv, home, cache, is_private)
DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN;
if ((ret = dbenv->open(dbenv, home, flags, 0)) == 0)
return (0);
- if (ret == DB_VERSION_MISMATCH)
+ if (ret == DB_VERSION_MISMATCH || ret == DB_REP_LOCKOUT)
goto err;
/*
@@ -881,7 +1018,7 @@ rheader(dbenv, dbp, dbtypep, subdbp, checkprintp, keysp, part_keyp)
DBT *keys, *kp;
size_t buflen, linelen, start;
long val;
- int ch, first, hdr, ret;
+ int ch, first, hdr, ret, streaming;
char *buf, *name, *p, *value;
u_int32_t heap_bytes, heap_gbytes, i, nparts;
@@ -1057,13 +1194,14 @@ rheader(dbenv, dbp, dbtypep, subdbp, checkprintp, keysp, part_keyp)
}
nparts = (u_int32_t) val;
if ((keys =
- malloc(nparts * sizeof(DBT))) == NULL) {
+ calloc(nparts, sizeof(DBT))) == NULL) {
dbenv->err(dbenv, ENOMEM, NULL);
goto err;
}
keys[nparts - 1].data = NULL;
kp = keys;
for (i = 1; i < nparts; kp++, i++) {
+ streaming = 0;
if ((kp->data =
malloc(kp->ulen = 1024)) == NULL) {
dbenv->err(dbenv, ENOMEM, NULL);
@@ -1073,7 +1211,7 @@ rheader(dbenv, dbp, dbtypep, subdbp, checkprintp, keysp, part_keyp)
if (dbt_rprint(dbenv, kp))
goto err;
} else {
- if (dbt_rdump(dbenv, kp))
+ if (dbt_rdump(dbenv, kp, 0, &streaming))
goto err;
}
}
@@ -1094,12 +1232,14 @@ rheader(dbenv, dbp, dbtypep, subdbp, checkprintp, keysp, part_keyp)
NULL, value, 0, LONG_MAX, &val)) != 0)
goto nameerr;
heap_bytes = (u_int32_t)val;
+ continue;
}
if (strcmp(name, "heap_gbytes") == 0) {
if ((ret = __db_getlong(dbenv,
NULL, value, 0, LONG_MAX, &val)) != 0)
goto nameerr;
heap_gbytes = (u_int32_t)val;
+ continue;
}
dbp->errx(dbp, DB_STR_A("5086",
@@ -1135,10 +1275,8 @@ err: ret = 1;
}
if (name != NULL)
free(name);
- if (ret != 0) {
- *part_keyp = NULL;
- free_keys(keys);
- }
+ *part_keyp = NULL;
+ free_keys(keys);
return (ret);
}
@@ -1321,9 +1459,11 @@ dbt_rprint(dbenv, dbtp)
* Read a byte dump line into a DBT structure.
*/
int
-dbt_rdump(dbenv, dbtp)
+dbt_rdump(dbenv, dbtp, blob_threshold, streaming)
DB_ENV *dbenv;
DBT *dbtp;
+ u_int32_t blob_threshold;
+ int *streaming;
{
u_int32_t len;
u_int8_t *p;
@@ -1332,7 +1472,11 @@ dbt_rdump(dbenv, dbtp)
++G(lineno);
- first = 1;
+ if (*streaming != 0)
+ first = 0;
+ else
+ first = 1;
+ *streaming = 0;
for (p = dbtp->data, len = 0; (c1 = getchar()) != '\n';) {
if (c1 == EOF) {
if (len == 0) {
@@ -1359,7 +1503,16 @@ dbt_rdump(dbenv, dbtp)
if ((c2 = getchar()) == EOF)
return (badend(dbenv));
if (len >= dbtp->ulen - 10) {
- dbtp->ulen *= 2;
+ if (dbtp->ulen == UINT32_MAX) {
+ dbenv->errx(dbenv, DB_STR("5143",
+ "Encountered a data item too large to store in the database. "
+ "Enable blob_threshold to store it."));
+ return (DB_BUFFER_SMALL);
+ }
+ if (dbtp->ulen > UINT32_MAX/2)
+ dbtp->ulen = UINT32_MAX;
+ else
+ dbtp->ulen *= 2;
if ((dbtp->data =
realloc(dbtp->data, dbtp->ulen)) == NULL) {
dbenv->err(dbenv, ENOMEM, NULL);
@@ -1369,6 +1522,10 @@ dbt_rdump(dbenv, dbtp)
}
++len;
DIGITIZE(*p++, c1, c2);
+ if (blob_threshold != 0 && len > BLOB_LOADING_SIZE) {
+ *streaming = 1;
+ break;
+ }
}
dbtp->size = len;
@@ -1486,6 +1643,8 @@ usage()
"[-h home] [-P password] [-t btree | hash | recno | queue] db_file");
(void)fprintf(stderr, "usage: %s %s\n",
progname, "-r lsn | fileid [-h home] [-P password] db_file");
+ (void)fprintf(stderr, "usage: %s %s\n",
+ progname, "-b [blob_dir] -o [blob_threshold] db_file");
return (EXIT_FAILURE);
}
diff --git a/util/db_log_verify.c b/util/db_log_verify.c
index be4dd1de..976206d8 100644
--- a/util/db_log_verify.c
+++ b/util/db_log_verify.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id: db_log_verify.c,v 0f73af5ae3da 2010/05/10 05:38:40 alexander $
*/
diff --git a/util/db_printlog.c b/util/db_printlog.c
index 03a8f375..fa10de88 100644
--- a/util/db_printlog.c
+++ b/util/db_printlog.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
@@ -21,7 +21,7 @@
#ifndef lint
static const char copyright[] =
- "Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.\n";
+ "Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.\n";
#endif
int db_printlog_print_app_record __P((DB_ENV *, DBT *, DB_LSN *, db_recops));
@@ -30,6 +30,9 @@ int env_init_print_42 __P((ENV *, DB_DISTAB *));
int env_init_print_43 __P((ENV *, DB_DISTAB *));
int env_init_print_47 __P((ENV *, DB_DISTAB *));
int env_init_print_48 __P((ENV *, DB_DISTAB *));
+int env_init_print_53 __P((ENV *, DB_DISTAB *));
+int env_init_print_60 __P((ENV *, DB_DISTAB *));
+int env_init_print_61 __P((ENV *, DB_DISTAB *));
int lsn_arg __P((char *, DB_LSN *));
int main __P((int, char *[]));
int open_rep_db __P((DB_ENV *, DB **, DBC **));
@@ -152,9 +155,6 @@ main(argc, argv)
dbenv->set_errpfx(dbenv, progname);
dbenv->set_msgfile(dbenv, stdout);
- if (data_len != NULL)
- (void)dbenv->set_data_len(dbenv, (u_int32_t)atol(data_len));
-
if (nflag) {
if ((ret = dbenv->set_flags(dbenv, DB_NOLOCKING, 1)) != 0) {
dbenv->err(dbenv, ret, "set_flags: DB_NOLOCKING");
@@ -192,7 +192,7 @@ main(argc, argv)
if (repflag) {
if ((ret = dbenv->open(dbenv, home,
DB_INIT_MPOOL | DB_USE_ENVIRON, 0)) != 0 &&
- (ret == DB_VERSION_MISMATCH ||
+ (ret == DB_VERSION_MISMATCH || ret == DB_REP_LOCKOUT ||
(ret = dbenv->open(dbenv, home,
DB_CREATE | DB_INIT_MPOOL | DB_PRIVATE | DB_USE_ENVIRON, 0))
!= 0)) {
@@ -200,12 +200,23 @@ main(argc, argv)
goto err;
}
} else if ((ret = dbenv->open(dbenv, home, DB_USE_ENVIRON, 0)) != 0 &&
- (ret == DB_VERSION_MISMATCH ||
+ (ret == DB_VERSION_MISMATCH || ret == DB_REP_LOCKOUT ||
(ret = dbenv->open(dbenv, home,
DB_CREATE | DB_INIT_LOG | DB_PRIVATE | DB_USE_ENVIRON, 0)) != 0)) {
dbenv->err(dbenv, ret, "DB_ENV->open");
goto err;
}
+
+ /*
+ * Set data_len after environment opens. The value passed
+ * by -D takes priority.
+ */
+ if (data_len != NULL && (ret = dbenv->set_data_len(dbenv,
+ (u_int32_t)atol(data_len))) != 0) {
+ dbenv->err(dbenv, ret, "set_data_len");
+ goto err;
+ }
+
env = dbenv->env;
/* Allocate a log cursor. */
@@ -348,6 +359,8 @@ err: exitval = 1;
/*
* env_init_print --
+ *
+ * Fill the dispatch table for printing this log version's records.
*/
int
env_init_print(env, version, dtabp)
@@ -391,11 +404,25 @@ env_init_print(env, version, dtabp)
if ((ret = __txn_init_print(env, dtabp)) != 0)
goto err;
+ if (version == DB_LOGVERSION)
+ goto done;
+
+ /* DB_LOGVERSION_60p1 changed the fop_write_file log. */
+ if (version > DB_LOGVERSION_60)
+ goto done;
+ if ((ret = env_init_print_60(env, dtabp)) != 0)
+ goto err;
+
+ /* DB_LOGVERSION_53 changed the heap addrem log record. */
+ if (version > DB_LOGVERSION_53)
+ goto done;
+ if ((ret = env_init_print_53(env, dtabp)) != 0)
+ goto err;
/*
- * There are no log differences between 5.0 and 5.2, but 5.2
- * is a superset of 5.0. Patch 2 of 4.8 added __db_pg_trunc
- * but didn't alter any log records so we want the same
- * override as 4.8
+ * Since DB_LOGVERSION_53 is a strict superset of DB_LOGVERSION_50,
+ * there is no need to check for log version between them; so only
+ * check > DB_LOGVERSION_48p2. Patch 2 of 4.8 added __db_pg_trunc but
+ * didn't alter any log records so we want the same override as 4.8.
*/
if (version > DB_LOGVERSION_48p2)
goto done;
@@ -557,10 +584,79 @@ err:
}
int
+env_init_print_53(env, dtabp)
+ ENV *env;
+ DB_DISTAB *dtabp;
+{
+ int ret;
+#ifdef HAVE_HEAP
+ ret = __db_add_recovery_int(env,
+ dtabp,__heap_addrem_50_print, DB___heap_addrem_50);
+#else
+ COMPQUIET(env, NULL);
+ COMPQUIET(dtabp, NULL);
+ COMPQUIET(ret, 0);
+#endif
+ return (ret);
+}
+
+int
+env_init_print_60(env, dtabp)
+ ENV *env;
+ DB_DISTAB *dtabp;
+{
+ int ret;
+
+ if ((ret = __db_add_recovery_int(env, &env->recover_dtab,
+ __fop_create_60_print, DB___fop_create_60)) != 0)
+ goto err;
+
+ if ((ret = __db_add_recovery_int(env, dtabp,
+ __fop_remove_60_print, DB___fop_remove_60)) != 0)
+ goto err;
+
+ if ((ret = __db_add_recovery_int(env, dtabp,
+ __fop_rename_60_print, DB___fop_rename_60)) != 0)
+ goto err;
+
+ if ((ret = __db_add_recovery_int(env, dtabp,
+ __fop_rename_60_print, DB___fop_rename_noundo_60)) != 0)
+ goto err;
+
+ if ((ret = __db_add_recovery_int(env, dtabp,
+ __fop_file_remove_60_print, DB___fop_file_remove_60)) != 0)
+ goto err;
+
+ if ((ret = __db_add_recovery_int(env, dtabp,
+ __fop_write_60_print, DB___fop_write_60)) != 0)
+ goto err;
+
+ if ((ret = __db_add_recovery_int(env, dtabp,
+ __fop_write_file_60_print, DB___fop_write_file_60)) != 0)
+ goto err;
+
+err: return (ret);
+}
+
+int
+env_init_print_61(env, dtabp)
+ ENV *env;
+ DB_DISTAB *dtabp;
+{
+ int ret;
+
+ ret = __db_add_recovery_int(env,
+ dtabp,__dbreg_register_42_print, DB___dbreg_register_42);
+
+ return (ret);
+}
+
+int
usage()
{
- fprintf(stderr, "usage: %s %s\n", progname,
- "[-NrV] [-b file/offset] [-e file/offset] [-h home] [-P password]");
+ fprintf(stderr, "usage: %s %s%s\n", progname,
+ "[-NrV] [-b file/offset] [-D data_len] ",
+ "[-e file/offset] [-h home] [-P password]");
return (EXIT_FAILURE);
}
diff --git a/util/db_recover.c b/util/db_recover.c
index 61657afa..be6dd088 100644
--- a/util/db_recover.c
+++ b/util/db_recover.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
@@ -12,7 +12,7 @@
#ifndef lint
static const char copyright[] =
- "Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.\n";
+ "Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.\n";
#endif
void db_recover_feedback __P((DB_ENV *, int, int));
@@ -35,7 +35,7 @@ main(argc, argv)
time_t timestamp;
u_int32_t flags;
int ch, exitval, fatal_recover, ret, retain_env, set_feedback, verbose;
- char *home, *passwd;
+ char *blob_dir, *home, *passwd;
if ((progname = __db_rpath(argv[0])) == NULL)
progname = argv[0];
@@ -45,11 +45,14 @@ main(argc, argv)
if ((ret = version_check()) != 0)
return (ret);
- home = passwd = NULL;
+ blob_dir = home = passwd = NULL;
timestamp = 0;
exitval = fatal_recover = retain_env = set_feedback = verbose = 0;
- while ((ch = getopt(argc, argv, "cefh:P:t:Vv")) != EOF)
+ while ((ch = getopt(argc, argv, "b:cefh:P:t:Vv")) != EOF)
switch (ch) {
+ case 'b':
+ blob_dir = optarg;
+ break;
case 'c':
fatal_recover = 1;
break;
@@ -122,6 +125,12 @@ main(argc, argv)
goto err;
}
+ if (blob_dir != NULL &&
+ (ret = dbenv->set_blob_dir(dbenv, blob_dir)) != 0) {
+ dbenv->err(dbenv, ret, "set_blob_dir");
+ goto err;
+ }
+
if (passwd != NULL && (ret = dbenv->set_encrypt(dbenv,
passwd, DB_ENCRYPT_AES)) != 0) {
dbenv->err(dbenv, ret, "set_passwd");
@@ -299,7 +308,7 @@ int
usage()
{
(void)fprintf(stderr, "usage: %s %s\n", progname,
- "[-cefVv] [-h home] [-P password] [-t [[CC]YY]MMDDhhmm[.SS]]");
+"[-cefVv] [-h home] [-b blob_dir] [-P password] [-t [[CC]YY]MMDDhhmm[.SS]]");
return (EXIT_FAILURE);
}
diff --git a/util/db_replicate.c b/util/db_replicate.c
index bb81dd6e..0b177dba 100644
--- a/util/db_replicate.c
+++ b/util/db_replicate.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
@@ -12,7 +12,7 @@
#ifndef lint
static const char copyright[] =
- "Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved.\n";
+ "Copyright (c) 2010, 2015 Oracle and/or its affiliates. All rights reserved.\n";
#endif
int main __P((int, char *[]));
@@ -60,9 +60,9 @@ main(argc, argv)
time_t now;
long argval;
db_timeout_t max_req;
- u_int32_t flags, repmgr_th, seconds, start_state;
+ u_int32_t repmgr_th, seconds, start_state;
int ch, count, done, exitval, ret, verbose;
- char *home, *passwd, *prog, time_buf[CTIME_BUFLEN];
+ char *blob_dir, *home, *passwd, *prog, time_buf[CTIME_BUFLEN];
dbenv = NULL;
logfp = NULL;
@@ -107,13 +107,15 @@ main(argc, argv)
dbenv->set_errpfx(dbenv, progname);
exitval = verbose = 0;
- flags = 0;
- home = logfile = passwd = NULL;
+ blob_dir = home = logfile = passwd = NULL;
seconds = 30;
start_state = DB_REP_ELECTION;
repmgr_th = REP_NTHREADS;
- while ((ch = getopt(argc, argv, "h:L:MP:T:t:Vv")) != EOF)
+ while ((ch = getopt(argc, argv, "b:h:L:MP:T:t:Vv")) != EOF)
switch (ch) {
+ case 'b':
+ blob_dir = optarg;
+ break;
case 'h':
home = optarg;
break;
@@ -182,6 +184,12 @@ main(argc, argv)
goto err;
}
+ if (blob_dir != NULL &&
+ (ret = dbenv->set_blob_dir(dbenv, blob_dir)) != 0) {
+ dbenv->err(dbenv, ret, "DB_ENV->set_blob_dir");
+ goto err;
+ }
+
/*
* If attaching to a pre-existing environment fails, error.
*/
diff --git a/util/db_sql_codegen/buildpt.c b/util/db_sql_codegen/buildpt.c
index 62b5f76e..7cfeaf81 100644
--- a/util/db_sql_codegen/buildpt.c
+++ b/util/db_sql_codegen/buildpt.c
@@ -1,7 +1,7 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
*/
diff --git a/util/db_sql_codegen/db_sql_codegen.c b/util/db_sql_codegen/db_sql_codegen.c
index bcec7f1b..2308c4fd 100644
--- a/util/db_sql_codegen/db_sql_codegen.c
+++ b/util/db_sql_codegen/db_sql_codegen.c
@@ -1,7 +1,7 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
*/
diff --git a/util/db_sql_codegen/db_sql_codegen.h b/util/db_sql_codegen/db_sql_codegen.h
index 2c31365b..a7bee62e 100644
--- a/util/db_sql_codegen/db_sql_codegen.h
+++ b/util/db_sql_codegen/db_sql_codegen.h
@@ -1,7 +1,7 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
*/
diff --git a/util/db_sql_codegen/generate.c b/util/db_sql_codegen/generate.c
index 91620ef4..220c5c6f 100644
--- a/util/db_sql_codegen/generate.c
+++ b/util/db_sql_codegen/generate.c
@@ -1,7 +1,7 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
*/
@@ -245,20 +245,22 @@ such as x86. cf. discussion of btree comparators in 'Getting Started \n\
with Data Storage' manual.";
static char *comparator_functions =
"static int \n\
-compare_int(DB *dbp, const DBT *a, const DBT *b) \n\
+compare_int(DB *dbp, const DBT *a, const DBT *b, size_t *locp) \n\
{ \n\
int ai, bi; \n\
\n\
+ locp = NULL; \n\
memcpy(&ai, a->data, sizeof(int)); \n\
memcpy(&bi, b->data, sizeof(int)); \n\
return (ai - bi); \n\
} \n\
\n\
int \n\
-compare_long(DB *dbp, const DBT *a, const DBT *b) \n\
+compare_long(DB *dbp, const DBT *a, const DBT *b, size_t *locp) \n\
{ \n\
long ai, bi; \n\
\n\
+ locp = NULL; \n\
memcpy(&ai, a->data, sizeof(long)); \n\
memcpy(&bi, b->data, sizeof(long)); \n\
return (ai - bi); \n\
@@ -277,7 +279,7 @@ create_database(DB_ENV *envp, \n\
int flags, \n\
DBTYPE type, \n\
int moreflags, \n\
- int (*comparator)(DB *, const DBT *, const DBT *)) \n\
+ int (*comparator)(DB *, const DBT *, const DBT *, size_t *)) \n\
{ \n\
int ret; \n\
FILE *errfilep; \n\
diff --git a/util/db_sql_codegen/generate_test.c b/util/db_sql_codegen/generate_test.c
index 079150c6..a63d0dd2 100644
--- a/util/db_sql_codegen/generate_test.c
+++ b/util/db_sql_codegen/generate_test.c
@@ -1,7 +1,7 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
*/
diff --git a/util/db_sql_codegen/generate_verification.c b/util/db_sql_codegen/generate_verification.c
index fe53bc09..2111412e 100644
--- a/util/db_sql_codegen/generate_verification.c
+++ b/util/db_sql_codegen/generate_verification.c
@@ -1,7 +1,7 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
*/
diff --git a/util/db_sql_codegen/generation.h b/util/db_sql_codegen/generation.h
index 932934b0..94081bc0 100644
--- a/util/db_sql_codegen/generation.h
+++ b/util/db_sql_codegen/generation.h
@@ -1,7 +1,7 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
*/
diff --git a/util/db_sql_codegen/generation_utils.c b/util/db_sql_codegen/generation_utils.c
index ed8659ef..22aa7cd3 100644
--- a/util/db_sql_codegen/generation_utils.c
+++ b/util/db_sql_codegen/generation_utils.c
@@ -1,7 +1,7 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
*/
diff --git a/util/db_sql_codegen/hint_comment.c b/util/db_sql_codegen/hint_comment.c
index 1890e702..7b365a90 100644
--- a/util/db_sql_codegen/hint_comment.c
+++ b/util/db_sql_codegen/hint_comment.c
@@ -1,7 +1,7 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
*/
diff --git a/util/db_sql_codegen/parsefuncs.c b/util/db_sql_codegen/parsefuncs.c
index bc43e7c9..35f39496 100644
--- a/util/db_sql_codegen/parsefuncs.c
+++ b/util/db_sql_codegen/parsefuncs.c
@@ -1,7 +1,7 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
*/
diff --git a/util/db_sql_codegen/preparser.c b/util/db_sql_codegen/preparser.c
index f5ffae7b..05a73c11 100644
--- a/util/db_sql_codegen/preparser.c
+++ b/util/db_sql_codegen/preparser.c
@@ -1,7 +1,7 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
*/
diff --git a/util/db_sql_codegen/tokenize.c b/util/db_sql_codegen/tokenize.c
index 920d4bcb..29266eb1 100644
--- a/util/db_sql_codegen/tokenize.c
+++ b/util/db_sql_codegen/tokenize.c
@@ -1,7 +1,7 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
*/
diff --git a/util/db_sql_codegen/utils.c b/util/db_sql_codegen/utils.c
index 3a6ca78c..8fa0dc5d 100644
--- a/util/db_sql_codegen/utils.c
+++ b/util/db_sql_codegen/utils.c
@@ -1,7 +1,7 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
*/
diff --git a/util/db_stat.c b/util/db_stat.c
index a12e1122..3c342d4e 100644
--- a/util/db_stat.c
+++ b/util/db_stat.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
@@ -12,7 +12,7 @@
#ifndef lint
static const char copyright[] =
- "Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.\n";
+ "Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.\n";
#endif
typedef enum { T_NOTSET, T_DB,
@@ -460,7 +460,7 @@ usage()
"-d file [-fN] [-h home] [-P password] [-s database]");
fprintf(stderr, "usage: %s %s\n\t%s\n", progname,
"[-cEelmrtVx] [-C Aclop]",
- "[-h home] [-L A] [-M A] [-P password] [-R A] [-X A] [-aNZ]");
+ "[-h home] [-L A] [-M Ah] [-P password] [-R A] [-X A] [-aNZ]");
return (EXIT_FAILURE);
}
diff --git a/util/db_stat/dd.sh b/util/db_stat/dd.sh
index f069506a..a5e0fe6b 100644
--- a/util/db_stat/dd.sh
+++ b/util/db_stat/dd.sh
@@ -1,6 +1,6 @@
#! /bin/sh
#
-# Copyright (c) 2010,2012 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
#
# Display environment's deadlocks based on "db_stat -Co" output.
diff --git a/util/db_tuner.c b/util/db_tuner.c
index 00fad903..7fbb5929 100644
--- a/util/db_tuner.c
+++ b/util/db_tuner.c
@@ -1,7 +1,7 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*
@@ -54,7 +54,7 @@
#ifndef lint
static const char copyright[] =
- "Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.\n";
+ "Copyright (c) 2011, 2015 Oracle and/or its affiliates. All rights reserved.\n";
#endif
/*
@@ -123,8 +123,8 @@ static int __tuner_record_leaf_pg __P((int, TUNER_FF_STAT *));
static int __tuner_record_ovfl_pg __P((u_int32_t, int, TUNER_FF_STAT *));
static int get_opd_size __P((DBC*, PAGE*, u_int32_t*));
-static int item_size __P((DB *, PAGE *, db_indx_t));
-static int item_space __P((DB *, PAGE *, db_indx_t));
+static int item_size __P((DB *, PAGE *, int));
+static int item_space __P((DB *, PAGE *, int));
int main __P((int, char *[]));
static int open_db __P((DB **, DB_ENV *, char *, char *));
static int sum_opd_page_data_entries __P((DB *, PAGE *));
@@ -139,6 +139,7 @@ main(argc, argv)
char *argv[];
{
extern char *optarg;
+ extern int optind;
DB *dbp;
DB_ENV *dbenv;
DBTYPE dbtype;
@@ -177,6 +178,8 @@ main(argc, argv)
default:
usage();
}
+ argc -= optind;
+ argv += optind;
/* Handle possible interruptions. */
__db_util_siginit();
@@ -204,7 +207,8 @@ main(argc, argv)
* private one and try again.
*/
if ((ret = dbenv->open(dbenv, home, DB_USE_ENVIRON, 0)) != 0 &&
- (ret == DB_VERSION_MISMATCH || (ret = dbenv->open(dbenv, home,
+ (ret == DB_VERSION_MISMATCH || ret == DB_REP_LOCKOUT ||
+ (ret = dbenv->open(dbenv, home,
DB_CREATE | DB_INIT_MPOOL | DB_USE_ENVIRON | DB_PRIVATE,
0)) != 0)) {
dbenv->err(dbenv, ret, "DB_ENV->open:");
@@ -666,7 +670,6 @@ __tuner_opd_data(dbc, h, indx_pgsz, is_opd, cookie)
DB_MPOOLFILE *mpf;
PAGE *p;
db_pgno_t next_pgno;
- u_int32_t pgsize;
int ret;
dbp = dbc->dbp;
@@ -674,7 +677,6 @@ __tuner_opd_data(dbc, h, indx_pgsz, is_opd, cookie)
mpf = dbp->mpf;
p = h;
- pgsize = (1 << indx_pgsz) * DB_MIN_PGSIZE;
/*
* __tuner_leaf_page has inserted one key for each opd already,
@@ -1111,7 +1113,7 @@ static int
item_space(dbp, h, indx)
DB *dbp;
PAGE *h;
- db_indx_t indx;
+ int indx;
{
return (B_TYPE(GET_BKEYDATA(dbp, h, indx)->type) == B_KEYDATA ?
BKEYDATA_PSIZE(GET_BKEYDATA(dbp, h, indx)->len) :
@@ -1123,7 +1125,7 @@ static int
item_size(dbp, h, indx)
DB *dbp;
PAGE *h;
- db_indx_t indx;
+ int indx;
{
return (B_TYPE(GET_BKEYDATA(dbp, h, indx)->type) == B_KEYDATA ?
GET_BKEYDATA(dbp, h, indx)->len : GET_BOVERFLOW(dbp, h,
diff --git a/util/db_upgrade.c b/util/db_upgrade.c
index 8200322b..72ca0050 100644
--- a/util/db_upgrade.c
+++ b/util/db_upgrade.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
@@ -12,7 +12,7 @@
#ifndef lint
static const char copyright[] =
- "Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.\n";
+ "Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.\n";
#endif
int main __P((int, char *[]));
@@ -127,7 +127,7 @@ main(argc, argv)
* private one and try again.
*/
if ((ret = dbenv->open(dbenv, home, DB_USE_ENVIRON, 0)) != 0 &&
- (ret == DB_VERSION_MISMATCH ||
+ (ret == DB_VERSION_MISMATCH || ret == DB_REP_LOCKOUT ||
(ret = dbenv->open(dbenv, home,
DB_CREATE | DB_INIT_MPOOL | DB_PRIVATE | DB_USE_ENVIRON,
0)) != 0)) {
diff --git a/util/db_verify.c b/util/db_verify.c
index 9ec28817..b0a369bd 100644
--- a/util/db_verify.c
+++ b/util/db_verify.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
@@ -12,7 +12,7 @@
#ifndef lint
static const char copyright[] =
- "Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.\n";
+ "Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.\n";
#endif
int main __P((int, char *[]));
@@ -33,7 +33,7 @@ main(argc, argv)
u_int32_t flags, cache;
int ch, exitval, mflag, nflag, private;
int quiet, resize, ret;
- char *dname, *fname, *home, *passwd;
+ char *blob_dir, *dname, *fname, *home, *passwd;
if ((progname = __db_rpath(argv[0])) == NULL)
progname = argv[0];
@@ -48,9 +48,12 @@ main(argc, argv)
cache = MEGABYTE;
exitval = mflag = nflag = quiet = 0;
flags = 0;
- home = passwd = NULL;
- while ((ch = getopt(argc, argv, "h:mNoP:quV")) != EOF)
+ blob_dir = home = passwd = NULL;
+ while ((ch = getopt(argc, argv, "b:h:mNoP:quV")) != EOF)
switch (ch) {
+ case 'b':
+ blob_dir = optarg;
+ break;
case 'h':
home = optarg;
break;
@@ -97,14 +100,6 @@ main(argc, argv)
if (argc <= 0)
return (usage());
- if (mflag) {
- dname = argv[0];
- fname = NULL;
- } else {
- fname = argv[0];
- dname = NULL;
- }
-
/* Handle possible interruptions. */
__db_util_siginit();
@@ -123,6 +118,12 @@ retry: if ((ret = db_env_create(&dbenv, 0)) != 0) {
dbenv->set_errpfx(dbenv, progname);
}
+ if (blob_dir != NULL &&
+ (ret = dbenv->set_blob_dir(dbenv, blob_dir)) != 0) {
+ dbenv->err(dbenv, ret, "set_blob_dir");
+ goto err;
+ }
+
if (nflag) {
if ((ret = dbenv->set_flags(dbenv, DB_NOLOCKING, 1)) != 0) {
dbenv->err(dbenv, ret, "set_flags: DB_NOLOCKING");
@@ -147,7 +148,7 @@ retry: if ((ret = db_env_create(&dbenv, 0)) != 0) {
private = 0;
if ((ret =
dbenv->open(dbenv, home, DB_INIT_MPOOL | DB_USE_ENVIRON, 0)) != 0) {
- if (ret != DB_VERSION_MISMATCH) {
+ if (ret != DB_VERSION_MISMATCH && ret != DB_REP_LOCKOUT) {
if ((ret =
dbenv->set_cachesize(dbenv, 0, cache, 1)) != 0) {
dbenv->err(dbenv, ret, "set_cachesize");
@@ -169,6 +170,14 @@ retry: if ((ret = db_env_create(&dbenv, 0)) != 0) {
* enabled.
*/
for (; !__db_util_interrupted() && argv[0] != NULL; ++argv) {
+ if (mflag) {
+ dname = argv[0];
+ fname = NULL;
+ } else {
+ fname = argv[0];
+ dname = NULL;
+ }
+
if ((ret = db_create(&dbp, dbenv, 0)) != 0) {
dbenv->err(dbenv, ret, "%s: db_create", progname);
goto err;
@@ -267,7 +276,7 @@ int
usage()
{
fprintf(stderr, "usage: %s %s\n", progname,
- "[-NoqV] [-h home] [-P password] db_file ...");
+ "[-mNoqV] [-b blob_dir] [-h home] [-P password] db_file ...");
return (EXIT_FAILURE);
}
diff --git a/util/dtrace/apicalls.d b/util/dtrace/apicalls.d
index 7b6042cf..c90c9cd9 100755
--- a/util/dtrace/apicalls.d
+++ b/util/dtrace/apicalls.d
@@ -1,6 +1,6 @@
#!/usr/sbin/dtrace -qs
/*
- * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
*
* apicalls.d - Summarize DB API function calls
*
diff --git a/util/dtrace/apitimes.d b/util/dtrace/apitimes.d
index bc34617e..bcd6d708 100755
--- a/util/dtrace/apitimes.d
+++ b/util/dtrace/apitimes.d
@@ -1,6 +1,6 @@
#!/usr/sbin/dtrace -qs
/*
- * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
*
* apitimes.d - Summarize time spent in DB API functions
*
diff --git a/util/dtrace/apitrace.d b/util/dtrace/apitrace.d
index 990f157b..11ff6797 100755
--- a/util/dtrace/apitrace.d
+++ b/util/dtrace/apitrace.d
@@ -1,6 +1,6 @@
#!/usr/sbin/dtrace -s
/*
- * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
*
* apitrace.d - Trace the primary BDB API calls
*
diff --git a/util/dtrace/cache.d b/util/dtrace/cache.d
index 04ecaf7c..bbf6a061 100755
--- a/util/dtrace/cache.d
+++ b/util/dtrace/cache.d
@@ -1,6 +1,6 @@
#!/usr/sbin/dtrace -qs
/*
- * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
*
* cache.d - Display DB cache activity
*
diff --git a/util/dtrace/dbdefs.d b/util/dtrace/dbdefs.d
index cc49c323..b88c44d5 100755
--- a/util/dtrace/dbdefs.d
+++ b/util/dtrace/dbdefs.d
@@ -1,7 +1,7 @@
/*
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
*
* dbdefs.d - DTrace declarations of DB data structures.
*/
diff --git a/util/dtrace/locktimes.d b/util/dtrace/locktimes.d
index d89af0f2..0627c3ed 100755
--- a/util/dtrace/locktimes.d
+++ b/util/dtrace/locktimes.d
@@ -1,6 +1,6 @@
#!/usr/sbin/dtrace -qs
/*
- * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
*
* locktimesid.d - Display lock wait times grouped by filename.
*
diff --git a/util/dtrace/locktimesid.d b/util/dtrace/locktimesid.d
index cc9477e5..b8898978 100755
--- a/util/dtrace/locktimesid.d
+++ b/util/dtrace/locktimesid.d
@@ -1,6 +1,6 @@
#!/usr/sbin/dtrace -qs
/*
- * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
*
* lockstimesi.d - Display lock wait times grouped by fileid.
*
diff --git a/util/dtrace/mutex.d b/util/dtrace/mutex.d
index a78b7bc8..1574cc39 100755
--- a/util/dtrace/mutex.d
+++ b/util/dtrace/mutex.d
@@ -1,6 +1,6 @@
#!/usr/sbin/dtrace -qs
/*
- * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
*
* mutex.d - Display DB mutex wait times.
*
diff --git a/util/dtrace/showerror.d b/util/dtrace/showerror.d
index ebcc7f72..6cf96a38 100755
--- a/util/dtrace/showerror.d
+++ b/util/dtrace/showerror.d
@@ -1,6 +1,6 @@
#!/usr/sbin/dtrace -qs
/*
- * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
*
* showerror.d - Capture context about certain DB errors.
*
diff --git a/util/systemtap/apicalls.stp b/util/systemtap/apicalls.stp
index f593433a..e4649224 100755
--- a/util/systemtap/apicalls.stp
+++ b/util/systemtap/apicalls.stp
@@ -1,6 +1,6 @@
#!/usr/bin/stap
/*
- * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
*
* apicalls - Summarize DB API call count grouped by thread.
*
diff --git a/util/systemtap/apitimes.stp b/util/systemtap/apitimes.stp
index f038bb44..076ec256 100755
--- a/util/systemtap/apitimes.stp
+++ b/util/systemtap/apitimes.stp
@@ -1,6 +1,6 @@
#!/usr/bin/stap
/*
- * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
*
* apitimes - Graph the time spent in DB API calls grouped by thread or processid
*
diff --git a/util/systemtap/apitrace.stp b/util/systemtap/apitrace.stp
index ffe66043..9202d80b 100755
--- a/util/systemtap/apitrace.stp
+++ b/util/systemtap/apitrace.stp
@@ -1,6 +1,6 @@
#!/usr/bin/stap
/*
- * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
*
* apitrace - Display DB API calls and return values
*
diff --git a/util/systemtap/cache.stp b/util/systemtap/cache.stp
index 8054f8d7..9ebd6370 100755
--- a/util/systemtap/cache.stp
+++ b/util/systemtap/cache.stp
@@ -1,6 +1,6 @@
#!/usr/bin/stap
/*
- * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
*
* cache.stp - Display DB cache activity groups by file.
*
diff --git a/util/systemtap/locktimes.stp b/util/systemtap/locktimes.stp
index ff23ca21..48d87713 100755
--- a/util/systemtap/locktimes.stp
+++ b/util/systemtap/locktimes.stp
@@ -1,6 +1,6 @@
#!/usr/bin/stap
/*
- * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
*
* lockstimes.d - Display lock wait times grouped by filename
*
diff --git a/util/systemtap/locktimesid.stp b/util/systemtap/locktimesid.stp
index e9ad27f6..1ba8c178 100755
--- a/util/systemtap/locktimesid.stp
+++ b/util/systemtap/locktimesid.stp
@@ -1,6 +1,6 @@
#!/usr/bin/stap
/*
- * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
*
* lockstimesid.d - Display lock wait times grouped by fileid.
*
diff --git a/util/systemtap/mutex.stp b/util/systemtap/mutex.stp
index 5e3d50ee..d898727f 100755
--- a/util/systemtap/mutex.stp
+++ b/util/systemtap/mutex.stp
@@ -1,6 +1,6 @@
#!/usr/bin/stap
/*
- * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
*
* mutex.stp - Display DB mutex wait times.
*
diff --git a/util/systemtap/showerror.stp b/util/systemtap/showerror.stp
index e6886fa2..1951cacd 100755
--- a/util/systemtap/showerror.stp
+++ b/util/systemtap/showerror.stp
@@ -1,6 +1,6 @@
#!/usr/bin/stap
/*
- * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
*
* showerror.stp - Capture context about certain DB errors.
*