summaryrefslogtreecommitdiff
path: root/db/dist/template/rec_hash
diff options
context:
space:
mode:
Diffstat (limited to 'db/dist/template/rec_hash')
-rw-r--r--db/dist/template/rec_hash310
1 files changed, 59 insertions, 251 deletions
diff --git a/db/dist/template/rec_hash b/db/dist/template/rec_hash
index bcee2131c..dc0303139 100644
--- a/db/dist/template/rec_hash
+++ b/db/dist/template/rec_hash
@@ -1,15 +1,9 @@
#include "db_config.h"
-#ifndef NO_SYSTEM_INCLUDES
-#include <sys/types.h>
-
-#include <string.h>
-#endif
-
#include "db_int.h"
-#include "db_page.h"
-#include "ham.h"
-#include "log.h"
+#include "dbinc/db_page.h"
+#include "dbinc/__ham.h"
+#include "dbinc/log.h"
/*
* __ham_insdel_recover --
@@ -34,11 +28,11 @@ __ham_insdel_recover(dbenv, dbtp, lsnp, op, info)
int cmp_n, cmp_p, modified, ret;
REC_PRINT(__ham_insdel_print);
- REC_INTRO(__ham_insdel_read);
+ REC_INTRO(__ham_insdel_read, 1);
- if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0)
+ if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0)
if (DB_REDO(op)) {
- if ((ret = memp_fget(mpf,
+ if ((ret = mpf->get(mpf,
&argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0)
goto out;
} else {
@@ -64,7 +58,7 @@ __ham_insdel_recover(dbenv, dbtp, lsnp, op, info)
/* Need to undo update described. */
modified = 1;
}
- if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
+ if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
goto out;
*lsnp = argp->prev_lsn;
@@ -96,11 +90,11 @@ __ham_newpage_recover(dbenv, dbtp, lsnp, op, info)
int cmp_n, cmp_p, modified, ret;
REC_PRINT(__ham_newpage_print);
- REC_INTRO(__ham_newpage_read);
+ REC_INTRO(__ham_newpage_read, 1);
- if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0)
+ if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0)
if (DB_REDO(op)) {
- if ((ret = memp_fget(mpf,
+ if ((ret = mpf->get(mpf,
&argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0)
goto out;
} else {
@@ -126,69 +120,7 @@ __ham_newpage_recover(dbenv, dbtp, lsnp, op, info)
/* Need to undo update described. */
modified = 1;
}
- if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
- goto out;
-
- *lsnp = argp->prev_lsn;
- ret = 0;
-
-out: REC_CLOSE;
-}
-
-/*
- * __ham_splitmeta_recover --
- * Recovery function for splitmeta.
- *
- * PUBLIC: int __ham_splitmeta_recover
- * PUBLIC: __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
- */
-int
-__ham_splitmeta_recover(dbenv, dbtp, lsnp, op, info)
- DB_ENV *dbenv;
- DBT *dbtp;
- DB_LSN *lsnp;
- db_recops op;
- void *info;
-{
- __ham_splitmeta_args *argp;
- DB *file_dbp;
- DBC *dbc;
- DB_MPOOLFILE *mpf;
- PAGE *pagep;
- int cmp_n, cmp_p, modified, ret;
-
- REC_PRINT(__ham_splitmeta_print);
- REC_INTRO(__ham_splitmeta_read);
-
- if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0)
- if (DB_REDO(op)) {
- if ((ret = memp_fget(mpf,
- &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0)
- goto out;
- } else {
- *lsnp = argp->prev_lsn;
- ret = 0;
- goto out;
- }
-
- modified = 0;
- cmp_n = log_compare(lsnp, &LSN(pagep));
-
- /*
- * Use this when there is something like "pagelsn" in the argp
- * structure. Sometimes, you might need to compare meta-data
- * lsn's instead.
- *
- * cmp_p = log_compare(&LSN(pagep), argp->pagelsn);
- */
- if (cmp_p == 0 && DB_REDO(op)) {
- /* Need to redo update described. */
- modified = 1;
- } else if (cmp_n == 0 && !DB_REDO(op)) {
- /* Need to undo update described. */
- modified = 1;
- }
- if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
+ if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
goto out;
*lsnp = argp->prev_lsn;
@@ -220,11 +152,11 @@ __ham_splitdata_recover(dbenv, dbtp, lsnp, op, info)
int cmp_n, cmp_p, modified, ret;
REC_PRINT(__ham_splitdata_print);
- REC_INTRO(__ham_splitdata_read);
+ REC_INTRO(__ham_splitdata_read, 1);
- if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0)
+ if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0)
if (DB_REDO(op)) {
- if ((ret = memp_fget(mpf,
+ if ((ret = mpf->get(mpf,
&argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0)
goto out;
} else {
@@ -250,7 +182,7 @@ __ham_splitdata_recover(dbenv, dbtp, lsnp, op, info)
/* Need to undo update described. */
modified = 1;
}
- if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
+ if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
goto out;
*lsnp = argp->prev_lsn;
@@ -282,73 +214,11 @@ __ham_replace_recover(dbenv, dbtp, lsnp, op, info)
int cmp_n, cmp_p, modified, ret;
REC_PRINT(__ham_replace_print);
- REC_INTRO(__ham_replace_read);
-
- if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0)
- if (DB_REDO(op)) {
- if ((ret = memp_fget(mpf,
- &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0)
- goto out;
- } else {
- *lsnp = argp->prev_lsn;
- ret = 0;
- goto out;
- }
-
- modified = 0;
- cmp_n = log_compare(lsnp, &LSN(pagep));
-
- /*
- * Use this when there is something like "pagelsn" in the argp
- * structure. Sometimes, you might need to compare meta-data
- * lsn's instead.
- *
- * cmp_p = log_compare(&LSN(pagep), argp->pagelsn);
- */
- if (cmp_p == 0 && DB_REDO(op)) {
- /* Need to redo update described. */
- modified = 1;
- } else if (cmp_n == 0 && !DB_REDO(op)) {
- /* Need to undo update described. */
- modified = 1;
- }
- if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
- goto out;
-
- *lsnp = argp->prev_lsn;
- ret = 0;
+ REC_INTRO(__ham_replace_read, 1);
-out: REC_CLOSE;
-}
-
-/*
- * __ham_newpgno_recover --
- * Recovery function for newpgno.
- *
- * PUBLIC: int __ham_newpgno_recover
- * PUBLIC: __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
- */
-int
-__ham_newpgno_recover(dbenv, dbtp, lsnp, op, info)
- DB_ENV *dbenv;
- DBT *dbtp;
- DB_LSN *lsnp;
- db_recops op;
- void *info;
-{
- __ham_newpgno_args *argp;
- DB *file_dbp;
- DBC *dbc;
- DB_MPOOLFILE *mpf;
- PAGE *pagep;
- int cmp_n, cmp_p, modified, ret;
-
- REC_PRINT(__ham_newpgno_print);
- REC_INTRO(__ham_newpgno_read);
-
- if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0)
+ if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0)
if (DB_REDO(op)) {
- if ((ret = memp_fget(mpf,
+ if ((ret = mpf->get(mpf,
&argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0)
goto out;
} else {
@@ -374,69 +244,7 @@ __ham_newpgno_recover(dbenv, dbtp, lsnp, op, info)
/* Need to undo update described. */
modified = 1;
}
- if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
- goto out;
-
- *lsnp = argp->prev_lsn;
- ret = 0;
-
-out: REC_CLOSE;
-}
-
-/*
- * __ham_ovfl_recover --
- * Recovery function for ovfl.
- *
- * PUBLIC: int __ham_ovfl_recover
- * PUBLIC: __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
- */
-int
-__ham_ovfl_recover(dbenv, dbtp, lsnp, op, info)
- DB_ENV *dbenv;
- DBT *dbtp;
- DB_LSN *lsnp;
- db_recops op;
- void *info;
-{
- __ham_ovfl_args *argp;
- DB *file_dbp;
- DBC *dbc;
- DB_MPOOLFILE *mpf;
- PAGE *pagep;
- int cmp_n, cmp_p, modified, ret;
-
- REC_PRINT(__ham_ovfl_print);
- REC_INTRO(__ham_ovfl_read);
-
- if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0)
- if (DB_REDO(op)) {
- if ((ret = memp_fget(mpf,
- &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0)
- goto out;
- } else {
- *lsnp = argp->prev_lsn;
- ret = 0;
- goto out;
- }
-
- modified = 0;
- cmp_n = log_compare(lsnp, &LSN(pagep));
-
- /*
- * Use this when there is something like "pagelsn" in the argp
- * structure. Sometimes, you might need to compare meta-data
- * lsn's instead.
- *
- * cmp_p = log_compare(&LSN(pagep), argp->pagelsn);
- */
- if (cmp_p == 0 && DB_REDO(op)) {
- /* Need to redo update described. */
- modified = 1;
- } else if (cmp_n == 0 && !DB_REDO(op)) {
- /* Need to undo update described. */
- modified = 1;
- }
- if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
+ if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
goto out;
*lsnp = argp->prev_lsn;
@@ -468,11 +276,11 @@ __ham_copypage_recover(dbenv, dbtp, lsnp, op, info)
int cmp_n, cmp_p, modified, ret;
REC_PRINT(__ham_copypage_print);
- REC_INTRO(__ham_copypage_read);
+ REC_INTRO(__ham_copypage_read, 1);
- if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0)
+ if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0)
if (DB_REDO(op)) {
- if ((ret = memp_fget(mpf,
+ if ((ret = mpf->get(mpf,
&argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0)
goto out;
} else {
@@ -498,7 +306,7 @@ __ham_copypage_recover(dbenv, dbtp, lsnp, op, info)
/* Need to undo update described. */
modified = 1;
}
- if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
+ if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
goto out;
*lsnp = argp->prev_lsn;
@@ -530,11 +338,11 @@ __ham_metagroup_recover(dbenv, dbtp, lsnp, op, info)
int cmp_n, cmp_p, modified, ret;
REC_PRINT(__ham_metagroup_print);
- REC_INTRO(__ham_metagroup_read);
+ REC_INTRO(__ham_metagroup_read, 1);
- if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0)
+ if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0)
if (DB_REDO(op)) {
- if ((ret = memp_fget(mpf,
+ if ((ret = mpf->get(mpf,
&argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0)
goto out;
} else {
@@ -560,7 +368,7 @@ __ham_metagroup_recover(dbenv, dbtp, lsnp, op, info)
/* Need to undo update described. */
modified = 1;
}
- if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
+ if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
goto out;
*lsnp = argp->prev_lsn;
@@ -570,33 +378,33 @@ out: REC_CLOSE;
}
/*
- * __ham_groupalloc1_recover --
- * Recovery function for groupalloc1.
+ * __ham_metagroup_recover --
+ * Recovery function for metagroup.
*
- * PUBLIC: int __ham_groupalloc1_recover
+ * PUBLIC: int __ham_metagroup_recover
* PUBLIC: __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
*/
int
-__ham_groupalloc1_recover(dbenv, dbtp, lsnp, op, info)
+__ham_metagroup_recover(dbenv, dbtp, lsnp, op, info)
DB_ENV *dbenv;
DBT *dbtp;
DB_LSN *lsnp;
db_recops op;
void *info;
{
- __ham_groupalloc1_args *argp;
+ __ham_metagroup_args *argp;
DB *file_dbp;
DBC *dbc;
DB_MPOOLFILE *mpf;
PAGE *pagep;
int cmp_n, cmp_p, modified, ret;
- REC_PRINT(__ham_groupalloc1_print);
- REC_INTRO(__ham_groupalloc1_read);
+ REC_PRINT(__ham_metagroup_print);
+ REC_INTRO(__ham_metagroup_read, 1);
- if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0)
+ if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0)
if (DB_REDO(op)) {
- if ((ret = memp_fget(mpf,
+ if ((ret = mpf->get(mpf,
&argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0)
goto out;
} else {
@@ -622,7 +430,7 @@ __ham_groupalloc1_recover(dbenv, dbtp, lsnp, op, info)
/* Need to undo update described. */
modified = 1;
}
- if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
+ if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
goto out;
*lsnp = argp->prev_lsn;
@@ -632,33 +440,33 @@ out: REC_CLOSE;
}
/*
- * __ham_groupalloc2_recover --
- * Recovery function for groupalloc2.
+ * __ham_groupalloc_recover --
+ * Recovery function for groupalloc.
*
- * PUBLIC: int __ham_groupalloc2_recover
+ * PUBLIC: int __ham_groupalloc_recover
* PUBLIC: __P((DB_ENV *, DBT *, DB_LSN *, db_recops, void *));
*/
int
-__ham_groupalloc2_recover(dbenv, dbtp, lsnp, op, info)
+__ham_groupalloc_recover(dbenv, dbtp, lsnp, op, info)
DB_ENV *dbenv;
DBT *dbtp;
DB_LSN *lsnp;
db_recops op;
void *info;
{
- __ham_groupalloc2_args *argp;
+ __ham_groupalloc_args *argp;
DB *file_dbp;
DBC *dbc;
DB_MPOOLFILE *mpf;
PAGE *pagep;
int cmp_n, cmp_p, modified, ret;
- REC_PRINT(__ham_groupalloc2_print);
- REC_INTRO(__ham_groupalloc2_read);
+ REC_PRINT(__ham_groupalloc_print);
+ REC_INTRO(__ham_groupalloc_read, 1);
- if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0)
+ if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0)
if (DB_REDO(op)) {
- if ((ret = memp_fget(mpf,
+ if ((ret = mpf->get(mpf,
&argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0)
goto out;
} else {
@@ -684,7 +492,7 @@ __ham_groupalloc2_recover(dbenv, dbtp, lsnp, op, info)
/* Need to undo update described. */
modified = 1;
}
- if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
+ if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
goto out;
*lsnp = argp->prev_lsn;
@@ -716,11 +524,11 @@ __ham_groupalloc_recover(dbenv, dbtp, lsnp, op, info)
int cmp_n, cmp_p, modified, ret;
REC_PRINT(__ham_groupalloc_print);
- REC_INTRO(__ham_groupalloc_read);
+ REC_INTRO(__ham_groupalloc_read, 1);
- if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0)
+ if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0)
if (DB_REDO(op)) {
- if ((ret = memp_fget(mpf,
+ if ((ret = mpf->get(mpf,
&argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0)
goto out;
} else {
@@ -746,7 +554,7 @@ __ham_groupalloc_recover(dbenv, dbtp, lsnp, op, info)
/* Need to undo update described. */
modified = 1;
}
- if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
+ if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
goto out;
*lsnp = argp->prev_lsn;
@@ -778,11 +586,11 @@ __ham_curadj_recover(dbenv, dbtp, lsnp, op, info)
int cmp_n, cmp_p, modified, ret;
REC_PRINT(__ham_curadj_print);
- REC_INTRO(__ham_curadj_read);
+ REC_INTRO(__ham_curadj_read, 1);
- if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0)
+ if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0)
if (DB_REDO(op)) {
- if ((ret = memp_fget(mpf,
+ if ((ret = mpf->get(mpf,
&argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0)
goto out;
} else {
@@ -808,7 +616,7 @@ __ham_curadj_recover(dbenv, dbtp, lsnp, op, info)
/* Need to undo update described. */
modified = 1;
}
- if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
+ if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
goto out;
*lsnp = argp->prev_lsn;
@@ -840,11 +648,11 @@ __ham_chgpg_recover(dbenv, dbtp, lsnp, op, info)
int cmp_n, cmp_p, modified, ret;
REC_PRINT(__ham_chgpg_print);
- REC_INTRO(__ham_chgpg_read);
+ REC_INTRO(__ham_chgpg_read, 1);
- if ((ret = memp_fget(mpf, &argp->pgno, 0, &pagep)) != 0)
+ if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0)
if (DB_REDO(op)) {
- if ((ret = memp_fget(mpf,
+ if ((ret = mpf->get(mpf,
&argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0)
goto out;
} else {
@@ -870,7 +678,7 @@ __ham_chgpg_recover(dbenv, dbtp, lsnp, op, info)
/* Need to undo update described. */
modified = 1;
}
- if (ret = memp_fput(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
+ if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0))
goto out;
*lsnp = argp->prev_lsn;