1
/* Do not edit: automatically built by gen_rec.awk. */
4
#ifndef NO_SYSTEM_INCLUDES
12
#include "dbinc/crypto.h"
13
#include "dbinc/db_page.h"
14
#include "dbinc/db_dispatch.h"
15
#include "dbinc/db_am.h"
16
#include "dbinc/log.h"
17
#include "dbinc/rep.h"
18
#include "dbinc/txn.h"
21
* PUBLIC: int __crdel_metasub_log __P((DB *, DB_TXN *, DB_LSN *,
22
* PUBLIC: u_int32_t, db_pgno_t, const DBT *, DB_LSN *));
25
__crdel_metasub_log(dbp, txnid, ret_lsnp, flags, pgno, page, lsn)
36
DB_LSN *lsnp, null_lsn;
39
u_int32_t npad, rectype, txn_num;
44
rectype = DB___crdel_metasub;
53
if (TAILQ_FIRST(&txnid->kids) != NULL &&
54
(ret = __txn_activekids(dbenv, rectype, txnid)) != 0)
56
txn_num = txnid->txnid;
57
lsnp = &txnid->last_lsn;
60
logrec.size = sizeof(rectype) + sizeof(txn_num) + sizeof(DB_LSN)
63
+ sizeof(u_int32_t) + (page == NULL ? 0 : page->size)
65
if (CRYPTO_ON(dbenv)) {
67
((DB_CIPHER *)dbenv->crypto_handle)->adj_size(logrec.size);
71
if ((ret = __os_malloc(dbenv,
72
logrec.size, &logrec.data)) != 0)
76
memset((u_int8_t *)logrec.data + logrec.size - npad, 0, npad);
80
memcpy(bp, &rectype, sizeof(rectype));
81
bp += sizeof(rectype);
83
memcpy(bp, &txn_num, sizeof(txn_num));
84
bp += sizeof(txn_num);
86
memcpy(bp, lsnp, sizeof(DB_LSN));
89
DB_ASSERT(dbp->log_filename != NULL);
90
if (dbp->log_filename->id == DB_LOGFILEID_INVALID &&
91
(ret = __dbreg_lazy_id(dbp)) != 0)
94
uinttmp = (u_int32_t)dbp->log_filename->id;
95
memcpy(bp, &uinttmp, sizeof(uinttmp));
96
bp += sizeof(uinttmp);
98
uinttmp = (u_int32_t)pgno;
99
memcpy(bp, &uinttmp, sizeof(uinttmp));
100
bp += sizeof(uinttmp);
104
memcpy(bp, &zero, sizeof(u_int32_t));
105
bp += sizeof(u_int32_t);
107
memcpy(bp, &page->size, sizeof(page->size));
108
bp += sizeof(page->size);
109
memcpy(bp, page->data, page->size);
114
memcpy(bp, lsn, sizeof(*lsn));
116
memset(bp, 0, sizeof(*lsn));
119
DB_ASSERT((u_int32_t)(bp - (u_int8_t *)logrec.data) <= logrec.size);
120
ret = dbenv->log_put(dbenv,
121
ret_lsnp, (DBT *)&logrec, flags | DB_NOCOPY);
122
if (txnid != NULL && ret == 0)
123
txnid->last_lsn = *ret_lsnp;
124
#ifdef LOG_DIAGNOSTIC
126
(void)__crdel_metasub_print(dbenv,
127
(DBT *)&logrec, ret_lsnp, NULL, NULL);
129
__os_free(dbenv, logrec.data);
134
* PUBLIC: int __crdel_metasub_getpgnos __P((DB_ENV *, DBT *,
135
* PUBLIC: DB_LSN *, db_recops, void *));
138
__crdel_metasub_getpgnos(dbenv, rec, lsnp, notused1, summary)
147
__crdel_metasub_args *argp;
150
COMPQUIET(notused1, DB_TXN_ABORT);
153
t = (TXN_RECS *)summary;
155
if ((ret = __crdel_metasub_read(dbenv, rec->data, &argp)) != 0)
158
if ((ret = __dbreg_id_to_db(dbenv,
159
argp->txnid, &dbp, argp->fileid, 0)) != 0)
162
if ((ret = __rep_check_alloc(dbenv, t, 1)) != 0)
165
t->array[t->npages].flags = 0;
166
t->array[t->npages].fid = argp->fileid;
167
t->array[t->npages].lsn = *lsnp;
168
t->array[t->npages].pgdesc.pgno = argp->pgno;
169
t->array[t->npages].pgdesc.type = DB_PAGE_LOCK;
170
memcpy(t->array[t->npages].pgdesc.fileid, dbp->fileid,
174
err: if (argp != NULL)
175
__os_free(dbenv, argp);
180
* PUBLIC: int __crdel_metasub_print __P((DB_ENV *, DBT *, DB_LSN *,
181
* PUBLIC: db_recops, void *));
184
__crdel_metasub_print(dbenv, dbtp, lsnp, notused2, notused3)
191
__crdel_metasub_args *argp;
196
notused2 = DB_TXN_ABORT;
199
if ((ret = __crdel_metasub_read(dbenv, dbtp->data, &argp)) != 0)
202
"[%lu][%lu]__crdel_metasub: rec: %lu txnid %lx prevlsn [%lu][%lu]\n",
204
(u_long)lsnp->offset,
206
(u_long)argp->txnid->txnid,
207
(u_long)argp->prev_lsn.file,
208
(u_long)argp->prev_lsn.offset);
209
(void)printf("\tfileid: %ld\n", (long)argp->fileid);
210
(void)printf("\tpgno: %lu\n", (u_long)argp->pgno);
211
(void)printf("\tpage: ");
212
for (i = 0; i < argp->page.size; i++) {
213
ch = ((u_int8_t *)argp->page.data)[i];
214
printf(isprint(ch) || ch == 0x0a ? "%c" : "%#x ", ch);
217
(void)printf("\tlsn: [%lu][%lu]\n",
218
(u_long)argp->lsn.file, (u_long)argp->lsn.offset);
220
__os_free(dbenv, argp);
225
* PUBLIC: int __crdel_metasub_read __P((DB_ENV *, void *,
226
* PUBLIC: __crdel_metasub_args **));
229
__crdel_metasub_read(dbenv, recbuf, argpp)
232
__crdel_metasub_args **argpp;
234
__crdel_metasub_args *argp;
239
if ((ret = __os_malloc(dbenv,
240
sizeof(__crdel_metasub_args) + sizeof(DB_TXN), &argp)) != 0)
243
argp->txnid = (DB_TXN *)&argp[1];
246
memcpy(&argp->type, bp, sizeof(argp->type));
247
bp += sizeof(argp->type);
249
memcpy(&argp->txnid->txnid, bp, sizeof(argp->txnid->txnid));
250
bp += sizeof(argp->txnid->txnid);
252
memcpy(&argp->prev_lsn, bp, sizeof(DB_LSN));
253
bp += sizeof(DB_LSN);
255
memcpy(&uinttmp, bp, sizeof(uinttmp));
256
argp->fileid = (int32_t)uinttmp;
257
bp += sizeof(uinttmp);
259
memcpy(&uinttmp, bp, sizeof(uinttmp));
260
argp->pgno = (db_pgno_t)uinttmp;
261
bp += sizeof(uinttmp);
263
memset(&argp->page, 0, sizeof(argp->page));
264
memcpy(&argp->page.size, bp, sizeof(u_int32_t));
265
bp += sizeof(u_int32_t);
266
argp->page.data = bp;
267
bp += argp->page.size;
269
memcpy(&argp->lsn, bp, sizeof(argp->lsn));
270
bp += sizeof(argp->lsn);
277
* PUBLIC: int __crdel_init_print __P((DB_ENV *, int (***)(DB_ENV *,
278
* PUBLIC: DBT *, DB_LSN *, db_recops, void *), size_t *));
281
__crdel_init_print(dbenv, dtabp, dtabsizep)
283
int (***dtabp)__P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
288
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
289
__crdel_metasub_print, DB___crdel_metasub)) != 0)
295
* PUBLIC: int __crdel_init_getpgnos __P((DB_ENV *,
296
* PUBLIC: int (***)(DB_ENV *, DBT *, DB_LSN *, db_recops, void *),
297
* PUBLIC: size_t *));
300
__crdel_init_getpgnos(dbenv, dtabp, dtabsizep)
302
int (***dtabp)__P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
307
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
308
__crdel_metasub_getpgnos, DB___crdel_metasub)) != 0)
314
* PUBLIC: int __crdel_init_recover __P((DB_ENV *, int (***)(DB_ENV *,
315
* PUBLIC: DBT *, DB_LSN *, db_recops, void *), size_t *));
318
__crdel_init_recover(dbenv, dtabp, dtabsizep)
320
int (***dtabp)__P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
325
if ((ret = __db_add_recovery(dbenv, dtabp, dtabsizep,
326
__crdel_metasub_recover, DB___crdel_metasub)) != 0)