00001
00002
00003 #include "db_config.h"
00004
00005 #ifdef HAVE_HASH
00006 #ifndef NO_SYSTEM_INCLUDES
00007 #include <sys/types.h>
00008
00009 #include <ctype.h>
00010 #include <string.h>
00011 #endif
00012
00013 #include "db_int.h"
00014 #include "dbinc/crypto.h"
00015 #include "dbinc/db_page.h"
00016 #include "dbinc/db_dispatch.h"
00017 #include "dbinc/db_am.h"
00018 #include "dbinc/hash.h"
00019 #include "dbinc/log.h"
00020 #include "dbinc/txn.h"
00021
00022
00023
00024
00025
00026 int
00027 __ham_insdel_print(dbenv, dbtp, lsnp, notused2, notused3)
00028 DB_ENV *dbenv;
00029 DBT *dbtp;
00030 DB_LSN *lsnp;
00031 db_recops notused2;
00032 void *notused3;
00033 {
00034 __ham_insdel_args *argp;
00035 u_int32_t i;
00036 int ch;
00037 int ret;
00038
00039 notused2 = DB_TXN_PRINT;
00040 notused3 = NULL;
00041
00042 if ((ret = __ham_insdel_read(dbenv, dbtp->data, &argp)) != 0)
00043 return (ret);
00044 (void)printf(
00045 "[%lu][%lu]__ham_insdel%s: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
00046 (u_long)lsnp->file,
00047 (u_long)lsnp->offset,
00048 (argp->type & DB_debug_FLAG) ? "_debug" : "",
00049 (u_long)argp->type,
00050 (u_long)argp->txnid->txnid,
00051 (u_long)argp->prev_lsn.file,
00052 (u_long)argp->prev_lsn.offset);
00053 (void)printf("\topcode: %lu\n", (u_long)argp->opcode);
00054 (void)printf("\tfileid: %ld\n", (long)argp->fileid);
00055 (void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
00056 (void)printf("\tndx: %lu\n", (u_long)argp->ndx);
00057 (void)printf("\tpagelsn: [%lu][%lu]\n",
00058 (u_long)argp->pagelsn.file, (u_long)argp->pagelsn.offset);
00059 (void)printf("\tkey: ");
00060 for (i = 0; i < argp->key.size; i++) {
00061 ch = ((u_int8_t *)argp->key.data)[i];
00062 printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
00063 }
00064 (void)printf("\n");
00065 (void)printf("\tdata: ");
00066 for (i = 0; i < argp->data.size; i++) {
00067 ch = ((u_int8_t *)argp->data.data)[i];
00068 printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
00069 }
00070 (void)printf("\n");
00071 (void)printf("\n");
00072 __os_free(dbenv, argp);
00073 return (0);
00074 }
00075
00076
00077
00078
00079
00080 int
00081 __ham_newpage_print(dbenv, dbtp, lsnp, notused2, notused3)
00082 DB_ENV *dbenv;
00083 DBT *dbtp;
00084 DB_LSN *lsnp;
00085 db_recops notused2;
00086 void *notused3;
00087 {
00088 __ham_newpage_args *argp;
00089 int ret;
00090
00091 notused2 = DB_TXN_PRINT;
00092 notused3 = NULL;
00093
00094 if ((ret = __ham_newpage_read(dbenv, dbtp->data, &argp)) != 0)
00095 return (ret);
00096 (void)printf(
00097 "[%lu][%lu]__ham_newpage%s: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
00098 (u_long)lsnp->file,
00099 (u_long)lsnp->offset,
00100 (argp->type & DB_debug_FLAG) ? "_debug" : "",
00101 (u_long)argp->type,
00102 (u_long)argp->txnid->txnid,
00103 (u_long)argp->prev_lsn.file,
00104 (u_long)argp->prev_lsn.offset);
00105 (void)printf("\topcode: %lu\n", (u_long)argp->opcode);
00106 (void)printf("\tfileid: %ld\n", (long)argp->fileid);
00107 (void)printf("\tprev_pgno: %lu\n", (u_long)argp->prev_pgno);
00108 (void)printf("\tprevlsn: [%lu][%lu]\n",
00109 (u_long)argp->prevlsn.file, (u_long)argp->prevlsn.offset);
00110 (void)printf("\tnew_pgno: %lu\n", (u_long)argp->new_pgno);
00111 (void)printf("\tpagelsn: [%lu][%lu]\n",
00112 (u_long)argp->pagelsn.file, (u_long)argp->pagelsn.offset);
00113 (void)printf("\tnext_pgno: %lu\n", (u_long)argp->next_pgno);
00114 (void)printf("\tnextlsn: [%lu][%lu]\n",
00115 (u_long)argp->nextlsn.file, (u_long)argp->nextlsn.offset);
00116 (void)printf("\n");
00117 __os_free(dbenv, argp);
00118 return (0);
00119 }
00120
00121
00122
00123
00124
00125 int
00126 __ham_splitdata_print(dbenv, dbtp, lsnp, notused2, notused3)
00127 DB_ENV *dbenv;
00128 DBT *dbtp;
00129 DB_LSN *lsnp;
00130 db_recops notused2;
00131 void *notused3;
00132 {
00133 __ham_splitdata_args *argp;
00134 u_int32_t i;
00135 int ch;
00136 int ret;
00137
00138 notused2 = DB_TXN_PRINT;
00139 notused3 = NULL;
00140
00141 if ((ret = __ham_splitdata_read(dbenv, dbtp->data, &argp)) != 0)
00142 return (ret);
00143 (void)printf(
00144 "[%lu][%lu]__ham_splitdata%s: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
00145 (u_long)lsnp->file,
00146 (u_long)lsnp->offset,
00147 (argp->type & DB_debug_FLAG) ? "_debug" : "",
00148 (u_long)argp->type,
00149 (u_long)argp->txnid->txnid,
00150 (u_long)argp->prev_lsn.file,
00151 (u_long)argp->prev_lsn.offset);
00152 (void)printf("\tfileid: %ld\n", (long)argp->fileid);
00153 (void)printf("\topcode: %lu\n", (u_long)argp->opcode);
00154 (void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
00155 (void)printf("\tpageimage: ");
00156 for (i = 0; i < argp->pageimage.size; i++) {
00157 ch = ((u_int8_t *)argp->pageimage.data)[i];
00158 printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
00159 }
00160 (void)printf("\n");
00161 (void)printf("\tpagelsn: [%lu][%lu]\n",
00162 (u_long)argp->pagelsn.file, (u_long)argp->pagelsn.offset);
00163 (void)printf("\n");
00164 __os_free(dbenv, argp);
00165 return (0);
00166 }
00167
00168
00169
00170
00171
00172 int
00173 __ham_replace_print(dbenv, dbtp, lsnp, notused2, notused3)
00174 DB_ENV *dbenv;
00175 DBT *dbtp;
00176 DB_LSN *lsnp;
00177 db_recops notused2;
00178 void *notused3;
00179 {
00180 __ham_replace_args *argp;
00181 u_int32_t i;
00182 int ch;
00183 int ret;
00184
00185 notused2 = DB_TXN_PRINT;
00186 notused3 = NULL;
00187
00188 if ((ret = __ham_replace_read(dbenv, dbtp->data, &argp)) != 0)
00189 return (ret);
00190 (void)printf(
00191 "[%lu][%lu]__ham_replace%s: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
00192 (u_long)lsnp->file,
00193 (u_long)lsnp->offset,
00194 (argp->type & DB_debug_FLAG) ? "_debug" : "",
00195 (u_long)argp->type,
00196 (u_long)argp->txnid->txnid,
00197 (u_long)argp->prev_lsn.file,
00198 (u_long)argp->prev_lsn.offset);
00199 (void)printf("\tfileid: %ld\n", (long)argp->fileid);
00200 (void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
00201 (void)printf("\tndx: %lu\n", (u_long)argp->ndx);
00202 (void)printf("\tpagelsn: [%lu][%lu]\n",
00203 (u_long)argp->pagelsn.file, (u_long)argp->pagelsn.offset);
00204 (void)printf("\toff: %ld\n", (long)argp->off);
00205 (void)printf("\tolditem: ");
00206 for (i = 0; i < argp->olditem.size; i++) {
00207 ch = ((u_int8_t *)argp->olditem.data)[i];
00208 printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
00209 }
00210 (void)printf("\n");
00211 (void)printf("\tnewitem: ");
00212 for (i = 0; i < argp->newitem.size; i++) {
00213 ch = ((u_int8_t *)argp->newitem.data)[i];
00214 printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
00215 }
00216 (void)printf("\n");
00217 (void)printf("\tmakedup: %lu\n", (u_long)argp->makedup);
00218 (void)printf("\n");
00219 __os_free(dbenv, argp);
00220 return (0);
00221 }
00222
00223
00224
00225
00226
00227 int
00228 __ham_copypage_print(dbenv, dbtp, lsnp, notused2, notused3)
00229 DB_ENV *dbenv;
00230 DBT *dbtp;
00231 DB_LSN *lsnp;
00232 db_recops notused2;
00233 void *notused3;
00234 {
00235 __ham_copypage_args *argp;
00236 u_int32_t i;
00237 int ch;
00238 int ret;
00239
00240 notused2 = DB_TXN_PRINT;
00241 notused3 = NULL;
00242
00243 if ((ret = __ham_copypage_read(dbenv, dbtp->data, &argp)) != 0)
00244 return (ret);
00245 (void)printf(
00246 "[%lu][%lu]__ham_copypage%s: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
00247 (u_long)lsnp->file,
00248 (u_long)lsnp->offset,
00249 (argp->type & DB_debug_FLAG) ? "_debug" : "",
00250 (u_long)argp->type,
00251 (u_long)argp->txnid->txnid,
00252 (u_long)argp->prev_lsn.file,
00253 (u_long)argp->prev_lsn.offset);
00254 (void)printf("\tfileid: %ld\n", (long)argp->fileid);
00255 (void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
00256 (void)printf("\tpagelsn: [%lu][%lu]\n",
00257 (u_long)argp->pagelsn.file, (u_long)argp->pagelsn.offset);
00258 (void)printf("\tnext_pgno: %lu\n", (u_long)argp->next_pgno);
00259 (void)printf("\tnextlsn: [%lu][%lu]\n",
00260 (u_long)argp->nextlsn.file, (u_long)argp->nextlsn.offset);
00261 (void)printf("\tnnext_pgno: %lu\n", (u_long)argp->nnext_pgno);
00262 (void)printf("\tnnextlsn: [%lu][%lu]\n",
00263 (u_long)argp->nnextlsn.file, (u_long)argp->nnextlsn.offset);
00264 (void)printf("\tpage: ");
00265 for (i = 0; i < argp->page.size; i++) {
00266 ch = ((u_int8_t *)argp->page.data)[i];
00267 printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
00268 }
00269 (void)printf("\n");
00270 (void)printf("\n");
00271 __os_free(dbenv, argp);
00272 return (0);
00273 }
00274
00275
00276
00277
00278
00279 int
00280 __ham_metagroup_print(dbenv, dbtp, lsnp, notused2, notused3)
00281 DB_ENV *dbenv;
00282 DBT *dbtp;
00283 DB_LSN *lsnp;
00284 db_recops notused2;
00285 void *notused3;
00286 {
00287 __ham_metagroup_args *argp;
00288 int ret;
00289
00290 notused2 = DB_TXN_PRINT;
00291 notused3 = NULL;
00292
00293 if ((ret = __ham_metagroup_read(dbenv, dbtp->data, &argp)) != 0)
00294 return (ret);
00295 (void)printf(
00296 "[%lu][%lu]__ham_metagroup%s: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
00297 (u_long)lsnp->file,
00298 (u_long)lsnp->offset,
00299 (argp->type & DB_debug_FLAG) ? "_debug" : "",
00300 (u_long)argp->type,
00301 (u_long)argp->txnid->txnid,
00302 (u_long)argp->prev_lsn.file,
00303 (u_long)argp->prev_lsn.offset);
00304 (void)printf("\tfileid: %ld\n", (long)argp->fileid);
00305 (void)printf("\tbucket: %lu\n", (u_long)argp->bucket);
00306 (void)printf("\tmmpgno: %lu\n", (u_long)argp->mmpgno);
00307 (void)printf("\tmmetalsn: [%lu][%lu]\n",
00308 (u_long)argp->mmetalsn.file, (u_long)argp->mmetalsn.offset);
00309 (void)printf("\tmpgno: %lu\n", (u_long)argp->mpgno);
00310 (void)printf("\tmetalsn: [%lu][%lu]\n",
00311 (u_long)argp->metalsn.file, (u_long)argp->metalsn.offset);
00312 (void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
00313 (void)printf("\tpagelsn: [%lu][%lu]\n",
00314 (u_long)argp->pagelsn.file, (u_long)argp->pagelsn.offset);
00315 (void)printf("\tnewalloc: %lu\n", (u_long)argp->newalloc);
00316 (void)printf("\tlast_pgno: %lu\n", (u_long)argp->last_pgno);
00317 (void)printf("\n");
00318 __os_free(dbenv, argp);
00319 return (0);
00320 }
00321
00322
00323
00324
00325
00326 int
00327 __ham_groupalloc_print(dbenv, dbtp, lsnp, notused2, notused3)
00328 DB_ENV *dbenv;
00329 DBT *dbtp;
00330 DB_LSN *lsnp;
00331 db_recops notused2;
00332 void *notused3;
00333 {
00334 __ham_groupalloc_args *argp;
00335 int ret;
00336
00337 notused2 = DB_TXN_PRINT;
00338 notused3 = NULL;
00339
00340 if ((ret = __ham_groupalloc_read(dbenv, dbtp->data, &argp)) != 0)
00341 return (ret);
00342 (void)printf(
00343 "[%lu][%lu]__ham_groupalloc%s: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
00344 (u_long)lsnp->file,
00345 (u_long)lsnp->offset,
00346 (argp->type & DB_debug_FLAG) ? "_debug" : "",
00347 (u_long)argp->type,
00348 (u_long)argp->txnid->txnid,
00349 (u_long)argp->prev_lsn.file,
00350 (u_long)argp->prev_lsn.offset);
00351 (void)printf("\tfileid: %ld\n", (long)argp->fileid);
00352 (void)printf("\tmeta_lsn: [%lu][%lu]\n",
00353 (u_long)argp->meta_lsn.file, (u_long)argp->meta_lsn.offset);
00354 (void)printf("\tstart_pgno: %lu\n", (u_long)argp->start_pgno);
00355 (void)printf("\tnum: %lu\n", (u_long)argp->num);
00356 (void)printf("\tfree: %lu\n", (u_long)argp->free);
00357 (void)printf("\tlast_pgno: %lu\n", (u_long)argp->last_pgno);
00358 (void)printf("\n");
00359 __os_free(dbenv, argp);
00360 return (0);
00361 }
00362
00363
00364
00365
00366
00367 int
00368 __ham_curadj_print(dbenv, dbtp, lsnp, notused2, notused3)
00369 DB_ENV *dbenv;
00370 DBT *dbtp;
00371 DB_LSN *lsnp;
00372 db_recops notused2;
00373 void *notused3;
00374 {
00375 __ham_curadj_args *argp;
00376 int ret;
00377
00378 notused2 = DB_TXN_PRINT;
00379 notused3 = NULL;
00380
00381 if ((ret = __ham_curadj_read(dbenv, dbtp->data, &argp)) != 0)
00382 return (ret);
00383 (void)printf(
00384 "[%lu][%lu]__ham_curadj%s: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
00385 (u_long)lsnp->file,
00386 (u_long)lsnp->offset,
00387 (argp->type & DB_debug_FLAG) ? "_debug" : "",
00388 (u_long)argp->type,
00389 (u_long)argp->txnid->txnid,
00390 (u_long)argp->prev_lsn.file,
00391 (u_long)argp->prev_lsn.offset);
00392 (void)printf("\tfileid: %ld\n", (long)argp->fileid);
00393 (void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
00394 (void)printf("\tindx: %lu\n", (u_long)argp->indx);
00395 (void)printf("\tlen: %lu\n", (u_long)argp->len);
00396 (void)printf("\tdup_off: %lu\n", (u_long)argp->dup_off);
00397 (void)printf("\tadd: %ld\n", (long)argp->add);
00398 (void)printf("\tis_dup: %ld\n", (long)argp->is_dup);
00399 (void)printf("\torder: %lu\n", (u_long)argp->order);
00400 (void)printf("\n");
00401 __os_free(dbenv, argp);
00402 return (0);
00403 }
00404
00405
00406
00407
00408
00409 int
00410 __ham_chgpg_print(dbenv, dbtp, lsnp, notused2, notused3)
00411 DB_ENV *dbenv;
00412 DBT *dbtp;
00413 DB_LSN *lsnp;
00414 db_recops notused2;
00415 void *notused3;
00416 {
00417 __ham_chgpg_args *argp;
00418 int ret;
00419
00420 notused2 = DB_TXN_PRINT;
00421 notused3 = NULL;
00422
00423 if ((ret = __ham_chgpg_read(dbenv, dbtp->data, &argp)) != 0)
00424 return (ret);
00425 (void)printf(
00426 "[%lu][%lu]__ham_chgpg%s: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
00427 (u_long)lsnp->file,
00428 (u_long)lsnp->offset,
00429 (argp->type & DB_debug_FLAG) ? "_debug" : "",
00430 (u_long)argp->type,
00431 (u_long)argp->txnid->txnid,
00432 (u_long)argp->prev_lsn.file,
00433 (u_long)argp->prev_lsn.offset);
00434 (void)printf("\tfileid: %ld\n", (long)argp->fileid);
00435 (void)printf("\tmode: %ld\n", (long)argp->mode);
00436 (void)printf("\told_pgno: %lu\n", (u_long)argp->old_pgno);
00437 (void)printf("\tnew_pgno: %lu\n", (u_long)argp->new_pgno);
00438 (void)printf("\told_indx: %lu\n", (u_long)argp->old_indx);
00439 (void)printf("\tnew_indx: %lu\n", (u_long)argp->new_indx);
00440 (void)printf("\n");
00441 __os_free(dbenv, argp);
00442 return (0);
00443 }
00444
00445
00446
00447
00448
00449 int
00450 __ham_init_print(dbenv, dtabp, dtabsizep)
00451 DB_ENV *dbenv;
00452 int (***dtabp)__P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
00453 size_t *dtabsizep;
00454 {
00455 int ret;
00456
00457 if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
00458 __ham_insdel_print, DB___ham_insdel)) != 0)
00459 return (ret);
00460 if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
00461 __ham_newpage_print, DB___ham_newpage)) != 0)
00462 return (ret);
00463 if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
00464 __ham_splitdata_print, DB___ham_splitdata)) != 0)
00465 return (ret);
00466 if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
00467 __ham_replace_print, DB___ham_replace)) != 0)
00468 return (ret);
00469 if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
00470 __ham_copypage_print, DB___ham_copypage)) != 0)
00471 return (ret);
00472 if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
00473 __ham_metagroup_print, DB___ham_metagroup)) != 0)
00474 return (ret);
00475 if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
00476 __ham_groupalloc_print, DB___ham_groupalloc)) != 0)
00477 return (ret);
00478 if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
00479 __ham_curadj_print, DB___ham_curadj)) != 0)
00480 return (ret);
00481 if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
00482 __ham_chgpg_print, DB___ham_chgpg)) != 0)
00483 return (ret);
00484 return (0);
00485 }
00486 #endif