summaryrefslogtreecommitdiff
path: root/build_vxworks/util/db_printlog.c
diff options
context:
space:
mode:
Diffstat (limited to 'build_vxworks/util/db_printlog.c')
-rw-r--r--build_vxworks/util/db_printlog.c122
1 files changed, 109 insertions, 13 deletions
diff --git a/build_vxworks/util/db_printlog.c b/build_vxworks/util/db_printlog.c
index 3cd0d673..6d67f4d6 100644
--- a/build_vxworks/util/db_printlog.c
+++ b/build_vxworks/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 db_printlog_env_init_print_42 __P((ENV *, DB_DISTAB *));
int db_printlog_env_init_print_43 __P((ENV *, DB_DISTAB *));
int db_printlog_env_init_print_47 __P((ENV *, DB_DISTAB *));
int db_printlog_env_init_print_48 __P((ENV *, DB_DISTAB *));
+int db_printlog_env_init_print_53 __P((ENV *, DB_DISTAB *));
+int db_printlog_env_init_print_60 __P((ENV *, DB_DISTAB *));
+int db_printlog_env_init_print_61 __P((ENV *, DB_DISTAB *));
int db_printlog_lsn_arg __P((char *, DB_LSN *));
int db_printlog_main __P((int, char *[]));
int db_printlog_open_rep_db __P((DB_ENV *, DB **, DBC **));
@@ -167,9 +170,6 @@ db_printlog_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");
@@ -207,7 +207,7 @@ db_printlog_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)) {
@@ -215,12 +215,23 @@ db_printlog_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. */
@@ -363,6 +374,8 @@ err: exitval = 1;
/*
* env_init_print --
+ *
+ * Fill the dispatch table for printing this log version's records.
*/
int
db_printlog_env_init_print(env, version, dtabp)
@@ -406,11 +419,25 @@ db_printlog_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 = db_printlog_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 = db_printlog_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;
@@ -572,10 +599,79 @@ err:
}
int
+db_printlog_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
+db_printlog_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
+db_printlog_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
db_printlog_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);
}