mirror of git://sourceware.org/git/glibc.git
Update.
* db2/btree/bt_cursor.c: Likewise. * db2/common/db_region.db_c: Likewise. * db2/common/db_salloc.db_c: Likewise. * db2/db/db.c: Likewise. * db2/db/db_rec.c: Likewise. * db2/hash/hash.c: Likewise. * db2/hash/hash_page.c: Likewise. * db2/hash/hash_rec.c: Likewise. * db2/log/log_findckp.c: Likewise. * db2/log/log_get.c: Likewise. * db2/log/log_put.c: Likewise. * db2/mp/mp_fget.c: Likewise. * db2/mp/mp_fput.c: Likewise. * db2/mp/mp_region.c: Likewise.
This commit is contained in:
parent
88c9111883
commit
2c874db2dd
14
ChangeLog
14
ChangeLog
|
@ -2,6 +2,20 @@
|
|||
|
||||
* db2/common/db_apprec.c (__db_apprec): Add braces to make gcc
|
||||
quiet.
|
||||
* db2/btree/bt_cursor.c: Likewise.
|
||||
* db2/common/db_region.db_c: Likewise.
|
||||
* db2/common/db_salloc.db_c: Likewise.
|
||||
* db2/db/db.c: Likewise.
|
||||
* db2/db/db_rec.c: Likewise.
|
||||
* db2/hash/hash.c: Likewise.
|
||||
* db2/hash/hash_page.c: Likewise.
|
||||
* db2/hash/hash_rec.c: Likewise.
|
||||
* db2/log/log_findckp.c: Likewise.
|
||||
* db2/log/log_get.c: Likewise.
|
||||
* db2/log/log_put.c: Likewise.
|
||||
* db2/mp/mp_fget.c: Likewise.
|
||||
* db2/mp/mp_fput.c: Likewise.
|
||||
* db2/mp/mp_region.c: Likewise.
|
||||
|
||||
1998-09-07 09:58 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
|
|
|
@ -1070,13 +1070,14 @@ __bam_c_search(dbp, cp, key, flags, isrecno, exactp)
|
|||
|
||||
/* If it's a deleted record, go to the next or previous one. */
|
||||
if (cp->dpgno != PGNO_INVALID &&
|
||||
B_DISSET(GET_BKEYDATA(cp->page, cp->dindx)->type))
|
||||
B_DISSET(GET_BKEYDATA(cp->page, cp->dindx)->type)) {
|
||||
if (flags == S_KEYLAST) {
|
||||
if ((ret = __bam_c_prev(dbp, cp)) != 0)
|
||||
return (ret);
|
||||
} else
|
||||
if ((ret = __bam_c_next(dbp, cp, 0)) != 0)
|
||||
return (ret);
|
||||
}
|
||||
/*
|
||||
* If we don't specify an exact match (the DB_KEYFIRST/DB_KEYLAST or
|
||||
* DB_SET_RANGE flags were set) __bam_search() may return a deleted
|
||||
|
@ -1467,7 +1468,7 @@ __bam_ca_split(dbp, ppgno, lpgno, rpgno, split_indx, cleft)
|
|||
for (dbc = TAILQ_FIRST(&dbp->curs_queue);
|
||||
dbc != NULL; dbc = TAILQ_NEXT(dbc, links)) {
|
||||
cp = (CURSOR *)dbc->internal;
|
||||
if (cp->pgno == ppgno)
|
||||
if (cp->pgno == ppgno) {
|
||||
if (cp->indx < split_indx) {
|
||||
if (cleft)
|
||||
cp->pgno = lpgno;
|
||||
|
@ -1475,7 +1476,8 @@ __bam_ca_split(dbp, ppgno, lpgno, rpgno, split_indx, cleft)
|
|||
cp->pgno = rpgno;
|
||||
cp->indx -= split_indx;
|
||||
}
|
||||
if (cp->dpgno == ppgno)
|
||||
}
|
||||
if (cp->dpgno == ppgno) {
|
||||
if (cp->dindx < split_indx) {
|
||||
if (cleft)
|
||||
cp->dpgno = lpgno;
|
||||
|
@ -1483,6 +1485,7 @@ __bam_ca_split(dbp, ppgno, lpgno, rpgno, split_indx, cleft)
|
|||
cp->dpgno = rpgno;
|
||||
cp->dindx -= split_indx;
|
||||
}
|
||||
}
|
||||
}
|
||||
CURSOR_TEARDOWN(dbp);
|
||||
}
|
||||
|
|
|
@ -272,7 +272,7 @@ loop: infop->addr = NULL;
|
|||
* obvious races in doing this, but it should eventually settle down
|
||||
* to a winner and then things should proceed normally.
|
||||
*/
|
||||
if ((ret = __db_mapregion(infop->name, infop)) != 0)
|
||||
if ((ret = __db_mapregion(infop->name, infop)) != 0) {
|
||||
if (ret == EAGAIN) {
|
||||
/*
|
||||
* Pretend we created the region even if we didn't so
|
||||
|
@ -283,7 +283,7 @@ loop: infop->addr = NULL;
|
|||
goto retry;
|
||||
} else
|
||||
goto err;
|
||||
|
||||
}
|
||||
region_init:
|
||||
/*
|
||||
* Initialize the common region information.
|
||||
|
@ -474,7 +474,7 @@ retry: /* Discard the region. */
|
|||
* REGION_LASTDETACH flag, so that we do all necessary cleanup when
|
||||
* the application closes the region.
|
||||
*/
|
||||
if (F_ISSET(infop, REGION_PRIVATE) && !F_ISSET(infop, REGION_MALLOC))
|
||||
if (F_ISSET(infop, REGION_PRIVATE) && !F_ISSET(infop, REGION_MALLOC)) {
|
||||
if (F_ISSET(infop, REGION_HOLDINGSYS))
|
||||
F_SET(infop, REGION_LASTDETACH);
|
||||
else {
|
||||
|
@ -484,7 +484,7 @@ retry: /* Discard the region. */
|
|||
(void)__db_close(infop->fd);
|
||||
(void)__db_unlink(infop->name);
|
||||
}
|
||||
|
||||
}
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
@ -537,12 +537,13 @@ __db_rdetach(infop)
|
|||
* what happened.
|
||||
*/
|
||||
detach = 0;
|
||||
if (F_ISSET(infop, REGION_LASTDETACH))
|
||||
if (F_ISSET(infop, REGION_LASTDETACH)) {
|
||||
if (rlp->refcnt == 0) {
|
||||
detach = 1;
|
||||
rlp->valid = 0;
|
||||
} else
|
||||
ret = EBUSY;
|
||||
}
|
||||
|
||||
/* Release the lock. */
|
||||
(void)__db_mutex_unlock(&rlp->lock, infop->fd);
|
||||
|
|
|
@ -222,11 +222,12 @@ __db_shalloc_free(regionp, ptr)
|
|||
merged = 1;
|
||||
}
|
||||
|
||||
if (!merged)
|
||||
if (!merged) {
|
||||
if (lastp == NULL)
|
||||
SH_LIST_INSERT_HEAD(hp, newp, links, __data);
|
||||
else
|
||||
SH_LIST_INSERT_AFTER(lastp, newp, links, __data);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -265,7 +265,7 @@ db_open(fname, type, flags, mode, dbenv, dbinfo, dbpp)
|
|||
retry_cnt = 0;
|
||||
open_retry: if (LF_ISSET(DB_CREATE)) {
|
||||
if ((ret = __db_open(real_name, flags | DB_EXCL,
|
||||
OKFLAGS | DB_EXCL, mode, &fd)) != 0)
|
||||
OKFLAGS | DB_EXCL, mode, &fd)) != 0) {
|
||||
if (ret == EEXIST) {
|
||||
LF_CLR(DB_CREATE);
|
||||
goto open_retry;
|
||||
|
@ -274,6 +274,7 @@ open_retry: if (LF_ISSET(DB_CREATE)) {
|
|||
"%s: %s", fname, strerror(ret));
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
} else
|
||||
if ((ret = __db_open(real_name,
|
||||
flags, OKFLAGS, mode, &fd)) != 0) {
|
||||
|
@ -551,7 +552,7 @@ empty: /*
|
|||
* Store the file id in the locker structure -- we can get it from
|
||||
* there as necessary, and it saves having two copies.
|
||||
*/
|
||||
if (need_fileid)
|
||||
if (need_fileid) {
|
||||
if (fname == NULL) {
|
||||
memset(dbp->lock.fileid, 0, DB_FILE_ID_LEN);
|
||||
if (F_ISSET(dbp, DB_AM_LOCKING) &&
|
||||
|
@ -562,6 +563,7 @@ empty: /*
|
|||
if ((ret = __db_fileid(dbenv,
|
||||
real_name, 1, dbp->lock.fileid)) != 0)
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* No further use for the real name. */
|
||||
if (real_name != NULL)
|
||||
|
|
|
@ -89,11 +89,12 @@ __db_addrem_recover(logp, dbtp, lsnp, redo, info)
|
|||
change = DB_MPOOL_DIRTY;
|
||||
}
|
||||
|
||||
if (change)
|
||||
if (change) {
|
||||
if (redo)
|
||||
LSN(pagep) = *lsnp;
|
||||
else
|
||||
LSN(pagep) = argp->pagelsn;
|
||||
}
|
||||
|
||||
if ((ret = memp_fput(mpf, pagep, change)) == 0)
|
||||
*lsnp = argp->prev_lsn;
|
||||
|
@ -249,7 +250,7 @@ __db_big_recover(logp, dbtp, lsnp, redo, info)
|
|||
/* Now check the previous page. */
|
||||
ppage: if (argp->prev_pgno != PGNO_INVALID) {
|
||||
change = 0;
|
||||
if ((ret = memp_fget(mpf, &argp->prev_pgno, 0, &pagep)) != 0)
|
||||
if ((ret = memp_fget(mpf, &argp->prev_pgno, 0, &pagep)) != 0) {
|
||||
if (!redo) {
|
||||
/*
|
||||
* We are undoing and the page doesn't exist.
|
||||
|
@ -264,6 +265,7 @@ ppage: if (argp->prev_pgno != PGNO_INVALID) {
|
|||
if ((ret = memp_fget(mpf, &argp->prev_pgno,
|
||||
DB_MPOOL_CREATE, &pagep)) != 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
cmp_n = log_compare(lsnp, &LSN(pagep));
|
||||
cmp_p = log_compare(&LSN(pagep), &argp->prevlsn);
|
||||
|
@ -289,7 +291,7 @@ ppage: if (argp->prev_pgno != PGNO_INVALID) {
|
|||
/* Now check the next page. Can only be set on a delete. */
|
||||
npage: if (argp->next_pgno != PGNO_INVALID) {
|
||||
change = 0;
|
||||
if ((ret = memp_fget(mpf, &argp->next_pgno, 0, &pagep)) != 0)
|
||||
if ((ret = memp_fget(mpf, &argp->next_pgno, 0, &pagep)) != 0) {
|
||||
if (!redo) {
|
||||
/*
|
||||
* We are undoing and the page doesn't exist.
|
||||
|
@ -304,6 +306,7 @@ npage: if (argp->next_pgno != PGNO_INVALID) {
|
|||
if ((ret = memp_fget(mpf, &argp->next_pgno,
|
||||
DB_MPOOL_CREATE, &pagep)) != 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
cmp_n = log_compare(lsnp, &LSN(pagep));
|
||||
cmp_p = log_compare(&LSN(pagep), &argp->nextlsn);
|
||||
|
@ -530,7 +533,7 @@ __db_addpage_recover(logp, dbtp, lsnp, redo, info)
|
|||
if ((ret = memp_fput(mpf, pagep, change)) != 0)
|
||||
goto out;
|
||||
|
||||
if ((ret = memp_fget(mpf, &argp->nextpgno, 0, &pagep)) != 0)
|
||||
if ((ret = memp_fget(mpf, &argp->nextpgno, 0, &pagep)) != 0) {
|
||||
if (!redo) {
|
||||
/*
|
||||
* We are undoing and the page doesn't exist. That
|
||||
|
@ -544,6 +547,7 @@ __db_addpage_recover(logp, dbtp, lsnp, redo, info)
|
|||
if ((ret = memp_fget(mpf,
|
||||
&argp->nextpgno, DB_MPOOL_CREATE, &pagep)) != 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
change = 0;
|
||||
cmp_n = log_compare(lsnp, &LSN(pagep));
|
||||
|
|
|
@ -359,11 +359,12 @@ __ham_get(dbp, txn, key, data, flags)
|
|||
|
||||
hashp->hash_accesses++;
|
||||
hcp = (HASH_CURSOR *)TAILQ_FIRST(&ldbp->curs_queue)->internal;
|
||||
if ((ret = __ham_lookup(hashp, hcp, key, 0, DB_LOCK_READ)) == 0)
|
||||
if ((ret = __ham_lookup(hashp, hcp, key, 0, DB_LOCK_READ)) == 0) {
|
||||
if (F_ISSET(hcp, H_OK))
|
||||
ret = __ham_dup_return(hashp, hcp, data, DB_FIRST);
|
||||
else /* Key was not found */
|
||||
ret = DB_NOTFOUND;
|
||||
}
|
||||
|
||||
if ((t_ret = __ham_item_done(hashp, hcp, 0)) != 0 && ret == 0)
|
||||
ret = t_ret;
|
||||
|
@ -546,11 +547,12 @@ __ham_delete(dbp, txn, key, flags)
|
|||
hcp = TAILQ_FIRST(&ldbp->curs_queue)->internal;
|
||||
|
||||
hashp->hash_accesses++;
|
||||
if ((ret = __ham_lookup(hashp, hcp, key, 0, DB_LOCK_WRITE)) == 0)
|
||||
if ((ret = __ham_lookup(hashp, hcp, key, 0, DB_LOCK_WRITE)) == 0) {
|
||||
if (F_ISSET(hcp, H_OK))
|
||||
ret = __ham_del_pair(hashp, hcp, 1);
|
||||
else
|
||||
ret = DB_NOTFOUND;
|
||||
}
|
||||
|
||||
if ((t_ret = __ham_item_done(hashp, hcp, ret == 0)) != 0 && ret == 0)
|
||||
ret = t_ret;
|
||||
|
@ -1109,7 +1111,7 @@ __ham_dup_return(hashp, hcp, val, flags)
|
|||
* duplicate. In this case, we do initialization and then
|
||||
* let the normal duplicate code handle it.
|
||||
*/
|
||||
if (!F_ISSET(hcp, H_ISDUP))
|
||||
if (!F_ISSET(hcp, H_ISDUP)) {
|
||||
if (type == H_DUPLICATE) {
|
||||
F_SET(hcp, H_ISDUP);
|
||||
hcp->dup_tlen = LEN_HDATA(hcp->pagep,
|
||||
|
@ -1148,13 +1150,13 @@ __ham_dup_return(hashp, hcp, val, flags)
|
|||
hcp, pgno, 0, H_ISDUP)) != 0)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Now, everything is initialized, grab a duplicate if
|
||||
* necessary.
|
||||
*/
|
||||
if (F_ISSET(hcp, H_ISDUP))
|
||||
if (F_ISSET(hcp, H_ISDUP)) {
|
||||
if (hcp->dpgno != PGNO_INVALID) {
|
||||
pp = hcp->dpagep;
|
||||
ndx = hcp->dndx;
|
||||
|
@ -1170,7 +1172,7 @@ __ham_dup_return(hashp, hcp, val, flags)
|
|||
tmp_val.doff = hcp->dup_off + sizeof(db_indx_t);
|
||||
myval = &tmp_val;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Finally, if we had a duplicate, pp, ndx, and myval should be
|
||||
|
@ -1425,7 +1427,7 @@ __ham_c_update(hcp, chg_pgno, len, add, is_dup)
|
|||
F_SET(lcp, H_DELETED);
|
||||
|
||||
/* Now adjust on-page information. */
|
||||
if (lcp->dpgno == PGNO_INVALID)
|
||||
if (lcp->dpgno == PGNO_INVALID) {
|
||||
if (add) {
|
||||
lcp->dup_tlen += len;
|
||||
if (lcp->dndx > hcp->dndx)
|
||||
|
@ -1435,6 +1437,7 @@ __ham_c_update(hcp, chg_pgno, len, add, is_dup)
|
|||
if (lcp->dndx > hcp->dndx)
|
||||
lcp->dup_off -= len;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
DB_THREAD_UNLOCK(hp->dbp);
|
||||
|
|
|
@ -317,7 +317,7 @@ __ham_item_prev(hashp, cursorp, mode)
|
|||
if (F_ISSET(cursorp, H_ISDUP)) {
|
||||
if (cursorp->dpgno == PGNO_INVALID) {
|
||||
/* Duplicates are on-page. */
|
||||
if (cursorp->dup_off != 0)
|
||||
if (cursorp->dup_off != 0) {
|
||||
if ((ret = __ham_get_cpage(hashp,
|
||||
cursorp, mode)) != 0)
|
||||
return (ret);
|
||||
|
@ -334,6 +334,7 @@ __ham_item_prev(hashp, cursorp, mode)
|
|||
return (__ham_item(hashp,
|
||||
cursorp, mode));
|
||||
}
|
||||
}
|
||||
} else if (cursorp->dndx > 0) { /* Duplicates are off-page. */
|
||||
cursorp->dndx--;
|
||||
return (__ham_item(hashp, cursorp, mode));
|
||||
|
|
|
@ -93,7 +93,7 @@ __ham_insdel_recover(logp, dbtp, lsnp, redo, info)
|
|||
REC_INTRO(__ham_insdel_read);
|
||||
|
||||
ret = memp_fget(mpf, &argp->pgno, 0, &pagep);
|
||||
if (ret != 0)
|
||||
if (ret != 0) {
|
||||
if (!redo) {
|
||||
/*
|
||||
* We are undoing and the page doesn't exist. That
|
||||
|
@ -107,7 +107,7 @@ __ham_insdel_recover(logp, dbtp, lsnp, redo, info)
|
|||
} else if ((ret = memp_fget(mpf, &argp->pgno,
|
||||
DB_MPOOL_CREATE, &pagep)) != 0)
|
||||
goto out;
|
||||
|
||||
}
|
||||
|
||||
hashp = (HTAB *)file_dbp->internal;
|
||||
GET_META(file_dbp, hashp);
|
||||
|
@ -199,7 +199,7 @@ __ham_newpage_recover(logp, dbtp, lsnp, redo, info)
|
|||
REC_INTRO(__ham_newpage_read);
|
||||
|
||||
ret = memp_fget(mpf, &argp->new_pgno, 0, &pagep);
|
||||
if (ret != 0)
|
||||
if (ret != 0) {
|
||||
if (!redo) {
|
||||
/*
|
||||
* We are undoing and the page doesn't exist. That
|
||||
|
@ -212,6 +212,7 @@ __ham_newpage_recover(logp, dbtp, lsnp, redo, info)
|
|||
} else if ((ret = memp_fget(mpf, &argp->new_pgno,
|
||||
DB_MPOOL_CREATE, &pagep)) != 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
hashp = (HTAB *)file_dbp->internal;
|
||||
GET_META(file_dbp, hashp);
|
||||
|
@ -255,7 +256,7 @@ __ham_newpage_recover(logp, dbtp, lsnp, redo, info)
|
|||
ppage: if (argp->prev_pgno != PGNO_INVALID) {
|
||||
ret = memp_fget(mpf, &argp->prev_pgno, 0, &pagep);
|
||||
|
||||
if (ret != 0)
|
||||
if (ret != 0) {
|
||||
if (!redo) {
|
||||
/*
|
||||
* We are undoing and the page doesn't exist.
|
||||
|
@ -269,6 +270,7 @@ ppage: if (argp->prev_pgno != PGNO_INVALID) {
|
|||
memp_fget(mpf, &argp->prev_pgno,
|
||||
DB_MPOOL_CREATE, &pagep)) != 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
cmp_n = log_compare(lsnp, &LSN(pagep));
|
||||
cmp_p = log_compare(&LSN(pagep), &argp->prevlsn);
|
||||
|
@ -300,7 +302,7 @@ ppage: if (argp->prev_pgno != PGNO_INVALID) {
|
|||
npage: if (argp->next_pgno != PGNO_INVALID) {
|
||||
ret = memp_fget(mpf, &argp->next_pgno, 0, &pagep);
|
||||
|
||||
if (ret != 0)
|
||||
if (ret != 0) {
|
||||
if (!redo) {
|
||||
/*
|
||||
* We are undoing and the page doesn't exist.
|
||||
|
@ -315,6 +317,7 @@ npage: if (argp->next_pgno != PGNO_INVALID) {
|
|||
memp_fget(mpf, &argp->next_pgno,
|
||||
DB_MPOOL_CREATE, &pagep)) != 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
cmp_n = log_compare(lsnp, &LSN(pagep));
|
||||
cmp_p = log_compare(&LSN(pagep), &argp->nextlsn);
|
||||
|
@ -384,7 +387,7 @@ __ham_replace_recover(logp, dbtp, lsnp, redo, info)
|
|||
REC_INTRO(__ham_replace_read);
|
||||
|
||||
ret = memp_fget(mpf, &argp->pgno, 0, &pagep);
|
||||
if (ret != 0)
|
||||
if (ret != 0) {
|
||||
if (!redo) {
|
||||
/*
|
||||
* We are undoing and the page doesn't exist. That
|
||||
|
@ -398,6 +401,7 @@ __ham_replace_recover(logp, dbtp, lsnp, redo, info)
|
|||
} else if ((ret = memp_fget(mpf, &argp->pgno,
|
||||
DB_MPOOL_CREATE, &pagep)) != 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
hashp = (HTAB *)file_dbp->internal;
|
||||
GET_META(file_dbp, hashp);
|
||||
|
@ -518,7 +522,7 @@ __ham_newpgno_recover(logp, dbtp, lsnp, redo, info)
|
|||
/* Now check the newly allocated/freed page. */
|
||||
ret = memp_fget(mpf, &argp->pgno, 0, &pagep);
|
||||
|
||||
if (ret != 0)
|
||||
if (ret != 0) {
|
||||
if (!redo) {
|
||||
/*
|
||||
* We are undoing and the page doesn't exist. That
|
||||
|
@ -532,6 +536,7 @@ __ham_newpgno_recover(logp, dbtp, lsnp, redo, info)
|
|||
} else if ((ret = memp_fget(mpf, &argp->pgno,
|
||||
DB_MPOOL_CREATE, &pagep)) != 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
cmp_n = log_compare(lsnp, &LSN(pagep));
|
||||
cmp_p = log_compare(&LSN(pagep), &argp->pagelsn);
|
||||
|
@ -672,7 +677,7 @@ __ham_splitdata_recover(logp, dbtp, lsnp, redo, info)
|
|||
REC_INTRO(__ham_splitdata_read);
|
||||
|
||||
ret = memp_fget(mpf, &argp->pgno, 0, &pagep);
|
||||
if (ret != 0)
|
||||
if (ret != 0) {
|
||||
if (!redo) {
|
||||
/*
|
||||
* We are undoing and the page doesn't exist. That
|
||||
|
@ -686,6 +691,7 @@ __ham_splitdata_recover(logp, dbtp, lsnp, redo, info)
|
|||
} else if ((ret = memp_fget(mpf, &argp->pgno,
|
||||
DB_MPOOL_CREATE, &pagep)) != 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
hashp = (HTAB *)file_dbp->internal;
|
||||
GET_META(file_dbp, hashp);
|
||||
|
@ -850,7 +856,7 @@ __ham_copypage_recover(logp, dbtp, lsnp, redo, info)
|
|||
|
||||
/* This is the bucket page. */
|
||||
ret = memp_fget(mpf, &argp->pgno, 0, &pagep);
|
||||
if (ret != 0)
|
||||
if (ret != 0) {
|
||||
if (!redo) {
|
||||
/*
|
||||
* We are undoing and the page doesn't exist. That
|
||||
|
@ -863,6 +869,7 @@ __ham_copypage_recover(logp, dbtp, lsnp, redo, info)
|
|||
} else if ((ret = memp_fget(mpf, &argp->pgno,
|
||||
DB_MPOOL_CREATE, &pagep)) != 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
cmp_n = log_compare(lsnp, &LSN(pagep));
|
||||
cmp_p = log_compare(&LSN(pagep), &argp->pagelsn);
|
||||
|
@ -884,7 +891,7 @@ __ham_copypage_recover(logp, dbtp, lsnp, redo, info)
|
|||
|
||||
/* Now fix up the "next" page. */
|
||||
donext: ret = memp_fget(mpf, &argp->next_pgno, 0, &pagep);
|
||||
if (ret != 0)
|
||||
if (ret != 0) {
|
||||
if (!redo) {
|
||||
/*
|
||||
* We are undoing and the page doesn't exist. That
|
||||
|
@ -897,6 +904,7 @@ donext: ret = memp_fget(mpf, &argp->next_pgno, 0, &pagep);
|
|||
} else if ((ret = memp_fget(mpf, &argp->next_pgno,
|
||||
DB_MPOOL_CREATE, &pagep)) != 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* There is nothing to do in the REDO case; only UNDO. */
|
||||
|
||||
|
@ -916,7 +924,7 @@ do_nn: if (argp->nnext_pgno == PGNO_INVALID) {
|
|||
}
|
||||
|
||||
ret = memp_fget(mpf, &argp->nnext_pgno, 0, &pagep);
|
||||
if (ret != 0)
|
||||
if (ret != 0) {
|
||||
if (!redo) {
|
||||
/*
|
||||
* We are undoing and the page doesn't exist. That
|
||||
|
@ -930,6 +938,7 @@ do_nn: if (argp->nnext_pgno == PGNO_INVALID) {
|
|||
} else if ((ret = memp_fget(mpf, &argp->nnext_pgno,
|
||||
DB_MPOOL_CREATE, &pagep)) != 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
cmp_n = log_compare(lsnp, &LSN(pagep));
|
||||
cmp_p = log_compare(&LSN(pagep), &argp->nnextlsn);
|
||||
|
|
|
@ -70,11 +70,12 @@ __log_findckp(lp, lsnp)
|
|||
if (F_ISSET(lp, DB_AM_THREAD))
|
||||
F_SET(&data, DB_DBT_MALLOC);
|
||||
ZERO_LSN(ckp_lsn);
|
||||
if ((ret = log_get(lp, &last_ckp, &data, DB_CHECKPOINT)) != 0)
|
||||
if ((ret = log_get(lp, &last_ckp, &data, DB_CHECKPOINT)) != 0) {
|
||||
if (ret == ENOENT)
|
||||
goto get_first;
|
||||
else
|
||||
return (ret);
|
||||
}
|
||||
|
||||
next_lsn = last_ckp;
|
||||
do {
|
||||
|
|
|
@ -329,12 +329,13 @@ corrupt:/*
|
|||
ret = EIO;
|
||||
fail = "read";
|
||||
|
||||
err1: if (!silent)
|
||||
err1: if (!silent) {
|
||||
if (fail == NULL)
|
||||
__db_err(dblp->dbenv, "log_get: %s", strerror(ret));
|
||||
else
|
||||
__db_err(dblp->dbenv,
|
||||
"log_get: %s: %s", fail, strerror(ret));
|
||||
}
|
||||
err2: if (np != NULL)
|
||||
__db_free(np);
|
||||
if (tbuf != NULL)
|
||||
|
|
|
@ -333,12 +333,13 @@ __log_flush(dblp, lsn)
|
|||
* the record before the one beginning the current buffer is on disk.
|
||||
*/
|
||||
lp->s_lsn = lp->f_lsn;
|
||||
if (!current)
|
||||
if (!current) {
|
||||
if (lp->s_lsn.offset == 0) {
|
||||
--lp->s_lsn.file;
|
||||
lp->s_lsn.offset = lp->persist.lg_max;
|
||||
} else
|
||||
--lp->s_lsn.offset;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ memp_fget(dbmfp, pgnoaddr, flags, addrp)
|
|||
* It would be possible to do so by reference counting the open
|
||||
* pages from the mmap, but it's unclear to me that it's worth it.
|
||||
*/
|
||||
if (dbmfp->addr != NULL && F_ISSET(mfp, MP_CAN_MMAP))
|
||||
if (dbmfp->addr != NULL && F_ISSET(mfp, MP_CAN_MMAP)) {
|
||||
if (*pgnoaddr > mfp->orig_last_pgno) {
|
||||
/*
|
||||
* !!!
|
||||
|
@ -160,6 +160,7 @@ memp_fget(dbmfp, pgnoaddr, flags, addrp)
|
|||
++mfp->stat.st_map;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
/* Search the hash chain for the page. */
|
||||
for (bhp = SH_TAILQ_FIRST(&dbmp->htab[bucket], __bh);
|
||||
|
|
|
@ -125,7 +125,7 @@ memp_fput(dbmfp, pgaddr, flags)
|
|||
* next time the memp_sync function runs we try writing it there, as
|
||||
* the checkpoint application better be able to write all of the files.
|
||||
*/
|
||||
if (F_ISSET(bhp, BH_WRITE))
|
||||
if (F_ISSET(bhp, BH_WRITE)) {
|
||||
if (F_ISSET(bhp, BH_DIRTY)) {
|
||||
if (__memp_bhwrite(dbmp,
|
||||
dbmfp->mfp, bhp, NULL, &wrote) != 0 || !wrote)
|
||||
|
@ -136,6 +136,7 @@ memp_fput(dbmfp, pgaddr, flags)
|
|||
--dbmfp->mfp->lsn_cnt;
|
||||
--mp->lsn_cnt;
|
||||
}
|
||||
}
|
||||
|
||||
/* Move the buffer to the head/tail of the LRU chain. */
|
||||
SH_TAILQ_REMOVE(&mp->bhq, bhp, q, __bh);
|
||||
|
|
|
@ -202,12 +202,13 @@ __memp_ropen(dbmp, path, cachesize, mode, is_private, flags)
|
|||
* Up the user's cachesize by 25% to account for our overhead.
|
||||
*/
|
||||
defcache = 0;
|
||||
if (cachesize < DB_CACHESIZE_MIN)
|
||||
if (cachesize < DB_CACHESIZE_MIN) {
|
||||
if (cachesize == 0) {
|
||||
defcache = 1;
|
||||
cachesize = DB_CACHESIZE_DEF;
|
||||
} else
|
||||
cachesize = DB_CACHESIZE_MIN;
|
||||
}
|
||||
rlen = cachesize + cachesize / 4;
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue