diff options
author | Ulrich Drepper <drepper@redhat.com> | 1997-12-01 17:16:22 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1997-12-01 17:16:22 +0000 |
commit | 04be94a87d0a74c022490db7f4f926253f0d69d3 (patch) | |
tree | aed47130338b81c2af8e92849ed1429596adeca3 /db2/log/log_put.c | |
parent | f4017d205738b913f1002433cde5d4b4e93fbd81 (diff) | |
download | glibc-04be94a87d0a74c022490db7f4f926253f0d69d3.tar.gz glibc-04be94a87d0a74c022490db7f4f926253f0d69d3.tar.xz glibc-04be94a87d0a74c022490db7f4f926253f0d69d3.zip |
Update. cvs/libc-ud-971201
1997-12-01 17:27 Ulrich Drepper <drepper@cygnus.com> * Makefile (subdirs): Add iconvdata and localedata. * iconv/gconv.h: Define UNKNOWN_10646_CHAR as error value. * iconv/gconv_conf.c (read_conf_file): Little optimization. * iconvdata/8bit-gap.c: New file. * iconvdata/8bit-generic.c: Renamed from ... * iconvdata/iso8859-generic.c: ...this. * iconvdata/configure: Removed. * iconvdata/Makefile: Add new modules and better rules. * iconvdata/iso6937.c: Minor bug fixes. * iconvdata/iso8859-1.c: Likewise. * iconvdata/t61.c: Likewise. * iconvdata/iso8859-2.c: Change to use 8bit-generic.c. Minor bug fixes. * iconvdata/iso8859-3.c: Likewise. * iconvdata/iso8859-4.c: Likewise. * iconvdata/iso8859-5.c: Likewise. * iconvdata/iso8859-6.c: Likewise. * iconvdata/iso8859-7.c: Likewise. * iconvdata/iso8859-8.c: Likewise. * iconvdata/iso8859-9.c: Likewise. * iconvdata/iso8859-10.c: Likewise. * iconvdata/ebcdic-at-de-a.c: New file. * iconvdata/ebcdic-at-de.c: New file. * iconvdata/ebcdic-ca-fr.c: New file. * iconvdata/hp-roman8.c: New file. * iconvdata/koi-8.c: New file. * iconvdata/koi8-r.c: New file. * iconvdata/koi8-h.c: New file. * iconvdata/latin-greek-1.c: New file. * iconvdata/latin-greek-1.h: New file. * iconvdata/latin-greek.c: New file. * iconvdata/latin-greek.h: New file. * iconvdata/jis0201.c: New file. * iconvdata/jis0201.h: New file. * iconvdata/jis0208.c: New file. * iconvdata/jis0208.h: New file. * iconvdata/jis0212.c: New file. * iconvdata/jis0212.h: New file. * iconvdata/sjis.c: New file. * iconvdata/gap.pl: New file. Script to generate table header. * iconvdata/gaptab.pl: New file. * iconvdata/gconv-modules: Add info about new modules. * locale/programs/charmap.c: Also examine alias names given in charmap files. * localedata/*: Add to here from add-on. We need the information to generate tables for iconv. Update from db-2.3.14. * db2/Makefile: Updated. * db2/config.h: Likewise. * db2/db.h: Likewise. * db2/db_int.h: Likewise. * db2/btree/bt_cursor.c: Likewise. * db2/btree/bt_delete.c: Likewise. * db2/btree/bt_put.c: Likewise. * db2/btree/bt_search.c: Likewise. * db2/btree/bt_split.c: Likewise. * db2/btree/btree_auto.c: Likewise. * db2/common/db_appinit.c: Likewise. * db2/common/db_apprec.c: Likewise. * db2/common/db_err.c: Likewise. * db2/common/db_region.c: Likewise. * db2/db/db_auto.c: Likewise. * db2/db/db_dispatch.c: Likewise. * db2/db/db_ret.c: Likewise. * db2/dbm/dbm.c: Likewise. * db2/hash/hash_auto.c: Likewise. * db2/include/btree_ext.h: Likewise. * db2/include/common_ext.h: Likewise. * db2/include/db.h.src: Likewise. * db2/include/db_cxx.h: Likewise. * db2/include/db_ext.h: Likewise. * db2/include/db_int.h.src: Likewise. * db2/include/lock.h: Likewise. * db2/include/log.h: Likewise. * db2/include/mp.h: Likewise. * db2/include/mp_ext.h: Likewise. * db2/include/os_ext.h: Likewise. * db2/include/os_func.h: Likewise. * db2/lock/lock.c: Likewise. * db2/lock/lock_deadlock.c: Likewise. * db2/log/log.c: Likewise. * db2/log/log_archive.c: Likewise. * db2/log/log_auto.c: Likewise. * db2/log/log_get.c: Likewise. * db2/log/log_put.c: Likewise. * db2/mp/mp_bh.c: Likewise. * db2/mp/mp_fget.c: Likewise. * db2/mp/mp_fopen.c: Likewise. * db2/mp/mp_fput.c: Likewise. * db2/mp/mp_fset.c: Likewise. * db2/mp/mp_open.c: Likewise. * db2/mp/mp_pr.c: Likewise. * db2/mp/mp_region.c: Likewise. * db2/mp/mp_sync.c: Likewise. * db2/mutex/README: Likewise. * db2/mutex/mutex.c: Likewise. * db2/os/os_open.c: Likewise. * db2/os/os_func.c: Removed. * db2/os/os_config.c: New file. * db2/os/os_spin.c: New file. * db2/txn/txn.c: Likewise. * db2/txn/txn_auto.c: Likewise. 1997-11-30 06:01 Ulrich Drepper <drepper@cygnus.com> * posix/sys/wait.h (__WAIT_INT): Don't use complex version with __typeof for C++ since this fails for class members. Reported by Neal Becker <neal@ctd.comsat.com>. 1997-11-28 11:21 Zack Weinberg <zack@rabi.phys.columbia.edu> * configure.in: Check for a working makeinfo (3.11 or better). * config.make.in: Add MAKEINFO to be substituted. * manual/Makefile: Don't update info if makeinfo is too old. 1997-11-30 05:21 Ulrich Drepper <drepper@cygnus.com> * sysdeps/alpha/setjmp.S: Define _ASM and _SETJMP_H to get definitions. * sysdeps/alpha/__longjmp.S: Likewise. * sysdeps/unix/sysv/linux/alpha/kernel_termios.h: Include <termios.h> not <bits/termios.h>. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Define syscall as __llseek and make llseek and lseek64 weak aliases. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise. Patches by a sun <asun@zoology.washington.edu>. 1997-11-29 19:19 Zack Weinberg <zack@rabi.phys.columbia.edu> * misc/sys/syslog.h: Delete KERNEL preprocessor conditional. * sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise. * misc/sys/syslog.h: Clean up BSD header. 1997-11-29 Andreas Jaeger <aj@arthur.rhein-neckar.de> * sysdeps/unix/sysv/linux/bits/in.h: Add changes from Linux 2.1.67. * sysdeps/libm-ieee754/s_ctan.c (__ctan): Raise invalid exception for ctan(+-inf,x). * sysdeps/libm-ieee754/s_ctanl.c (__ctanl): Likewise. * sysdeps/libm-ieee754/s_ctanf.c (__ctanf): Likewise. * math/libm-test.c (csqrt_test): Add tests for cabs, carg, ctan, csqrt (-1), ctanh(i*pi/4). 1997-11-26 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/generic/bits/confname.h: Fix comma in enumerator. 1997-11-28 13:28 Philip Blundell <Philip.Blundell@pobox.com> * sysdeps/unix/sysv/linux/net/if_arp.h: Add more ARPHRD_ constants. 1997-11-26 Andreas Jaeger <aj@arthur.rhein-neckar.de> * wcsmbs/wcrtomb.c (__wcrtomb): Remove unused variable fake. 1997-11-26 21:28 Ulrich Drepper <drepper@cygnus.com> * sysdeps/posix/getcwd.c (GETCWD_STORYGE_CLASS): Remove definition and use. Define GETCWD_RETURN_TYPE instead and use it. * sysdeps/unix/sysv/linux/getcwd.c: Define GETCWD_RETURN_TYPE instead of GETCWD_STORYGE_CLASS and put the return type and the `internal_function' in the right order for gcc 2.7.2. 1997-11-26 Andreas Jaeger <aj@arthur.rhein-neckar.de> * sysdeps/unix/sysv/linux/sys/module.h: Remove file. It's incompatible with Linux 2.1.x. Packages using modules (e.g. modutils) should/do provide their own version. Suggested by Richard Henderson. * sysdeps/unix/sysv/linux/Dist: Remove sys/module.h. * sysdeps/unix/sysv/linux/Makefile (sysdep_headers) [$(subdir)=socket]: Remove sys/module.h. * libio/stdio.h: Correct comment of sys_nerr/sys_errlist.
Diffstat (limited to 'db2/log/log_put.c')
-rw-r--r-- | db2/log/log_put.c | 106 |
1 files changed, 55 insertions, 51 deletions
diff --git a/db2/log/log_put.c b/db2/log/log_put.c index 92d9563301..42fec88a7d 100644 --- a/db2/log/log_put.c +++ b/db2/log/log_put.c @@ -7,7 +7,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "@(#)log_put.c 10.20 (Sleepycat) 11/2/97"; +static const char sccsid[] = "@(#)log_put.c 10.22 (Sleepycat) 11/12/97"; #endif /* not lint */ #ifndef NO_SYSTEM_INCLUDES @@ -28,10 +28,10 @@ static const char sccsid[] = "@(#)log_put.c 10.20 (Sleepycat) 11/2/97"; #include "hash.h" #include "common_ext.h" -static int __log_fill __P((DB_LOG *, void *, u_int32_t)); +static int __log_fill __P((DB_LOG *, DB_LSN *, void *, u_int32_t)); static int __log_flush __P((DB_LOG *, const DB_LSN *)); static int __log_newfd __P((DB_LOG *)); -static int __log_putr __P((DB_LOG *, const DBT *, u_int32_t)); +static int __log_putr __P((DB_LOG *, DB_LSN *, const DBT *, u_int32_t)); static int __log_write __P((DB_LOG *, void *, u_int32_t)); /* @@ -117,12 +117,13 @@ __log_put(dblp, lsn, dbt, flags) /* Reset the file write offset. */ lp->w_off = 0; - - /* Reset the first-unwritten LSN for the buffer. */ - lp->uw_lsn = lp->lsn; } else lastoff = 0; + /* Initialize the LSN information returned to the user. */ + lsn->file = lp->lsn.file; + lsn->offset = lp->lsn.offset; + /* * Insert persistent information as the first record in every file. * Note that the previous length is wrong for the very first record @@ -131,17 +132,17 @@ __log_put(dblp, lsn, dbt, flags) if (lp->lsn.offset == 0) { t.data = &lp->persist; t.size = sizeof(LOGP); - if ((ret = __log_putr(dblp, + if ((ret = __log_putr(dblp, lsn, &t, lastoff == 0 ? 0 : lastoff - lp->len)) != 0) return (ret); - } - /* Initialize the LSN information returned to the user. */ - lsn->file = lp->lsn.file; - lsn->offset = lp->lsn.offset; + /* Update the LSN information returned to the user. */ + lsn->file = lp->lsn.file; + lsn->offset = lp->lsn.offset; + } - /* Put out the user's record. */ - if ((ret = __log_putr(dblp, dbt, lp->lsn.offset - lp->len)) != 0) + /* Write the application's log record. */ + if ((ret = __log_putr(dblp, lsn, dbt, lp->lsn.offset - lp->len)) != 0) return (ret); /* @@ -184,19 +185,6 @@ __log_put(dblp, lsn, dbt, flags) (void)time(&lp->chkpt); lp->stat.st_wc_bytes = lp->stat.st_wc_mbytes = 0; } - - /* - * When an application calls the log_flush routine, we need to figure - * out if the current buffer needs to be flushed. The problem is that - * if a record spans buffers, it's possible for the record continued - * in the current buffer to have begun in a previous buffer. Each time - * we write a buffer, we update the first-unwritten LSN to point to the - * first LSN after that written buffer. If we have a spanning record, - * correct that value to be the LSN that started it all, here. - */ - if (lsn->offset < lp->w_off && lsn->offset + lp->len > lp->w_off) - lp->uw_lsn = *lsn; - return (0); } @@ -205,8 +193,9 @@ __log_put(dblp, lsn, dbt, flags) * Actually put a record into the log. */ static int -__log_putr(dblp, dbt, prev) +__log_putr(dblp, lsn, dbt, prev) DB_LOG *dblp; + DB_LSN *lsn; const DBT *dbt; u_int32_t prev; { @@ -225,15 +214,15 @@ __log_putr(dblp, dbt, prev) hdr.len = sizeof(HDR) + dbt->size; hdr.cksum = __ham_func4(dbt->data, dbt->size); - if ((ret = __log_fill(dblp, &hdr, sizeof(HDR))) != 0) + if ((ret = __log_fill(dblp, lsn, &hdr, sizeof(HDR))) != 0) return (ret); + lp->len = sizeof(HDR); lp->lsn.offset += sizeof(HDR); - if ((ret = __log_fill(dblp, dbt->data, dbt->size)) != 0) + if ((ret = __log_fill(dblp, lsn, dbt->data, dbt->size)) != 0) return (ret); + lp->len += dbt->size; lp->lsn.offset += dbt->size; - - lp->len = sizeof(HDR) + dbt->size; return (0); } @@ -266,7 +255,7 @@ __log_flush(dblp, lsn) { DB_LSN t_lsn; LOG *lp; - int ret; + int current, ret; ret = 0; lp = dblp->lp; @@ -292,23 +281,27 @@ __log_flush(dblp, lsn) /* * If the LSN is less than the last-sync'd LSN, we're done. Note, * the last-sync LSN saved in s_lsn is the LSN of the first byte - * that has not yet been written to disk, so the test is <, not <=. + * we absolutely know has been written to disk, so the test is <=. */ if (lsn->file < lp->s_lsn.file || - (lsn->file == lp->s_lsn.file && lsn->offset < lp->s_lsn.offset)) + (lsn->file == lp->s_lsn.file && lsn->offset <= lp->s_lsn.offset)) return (0); /* * We may need to write the current buffer. We have to write the * current buffer if the flush LSN is greater than or equal to the - * first-unwritten LSN (uw_lsn). If we write the buffer, then we - * update the first-unwritten LSN. + * buffer's starting LSN. */ + current = 0; if (lp->b_off != 0 && - lsn->file >= lp->uw_lsn.file && lsn->offset >= lp->uw_lsn.offset) + lsn->file >= lp->f_lsn.file && lsn->offset >= lp->f_lsn.offset) { if ((ret = __log_write(dblp, lp->buf, lp->b_off)) != 0) return (ret); + lp->b_off = 0; + current = 1; + } + /* * It's possible that this thread may never have written to this log * file. Acquire a file descriptor if we don't already have one. @@ -323,10 +316,14 @@ __log_flush(dblp, lsn) ++lp->stat.st_scount; /* - * Set the last-synced LSN, the first LSN after the last record - * that we know is on disk. + * Set the last-synced LSN, using the LSN of the current buffer. If + * the current buffer was flushed, we know the LSN of the first byte + * of the buffer is on disk, otherwise, we only know that the LSN of + * the record before the one beginning the current buffer is on disk. */ - lp->s_lsn = lp->uw_lsn; + lp->s_lsn = lp->f_lsn; + if (!current) + --lp->s_lsn.offset; return (0); } @@ -336,8 +333,9 @@ __log_flush(dblp, lsn) * Write information into the log. */ static int -__log_fill(dblp, addr, len) +__log_fill(dblp, lsn, addr, len) DB_LOG *dblp; + DB_LSN *lsn; void *addr; u_int32_t len; { @@ -349,6 +347,15 @@ __log_fill(dblp, addr, len) /* Copy out the data. */ for (lp = dblp->lp; len > 0;) { /* + * If we're beginning a new buffer, note the user LSN to which + * the first byte of the buffer belongs. We have to know this + * when flushing the buffer so that we know if the in-memory + * buffer needs to be flushed. + */ + if (lp->b_off == 0) + lp->f_lsn = *lsn; + + /* * If we're on a buffer boundary and the data is big enough, * copy as many records as we can directly from the data. */ @@ -371,9 +378,12 @@ __log_fill(dblp, addr, len) lp->b_off += nw; /* If we fill the buffer, flush it. */ - if (lp->b_off == sizeof(lp->buf) && - (ret = __log_write(dblp, lp->buf, sizeof(lp->buf))) != 0) - return (ret); + if (lp->b_off == sizeof(lp->buf)) { + if ((ret = + __log_write(dblp, lp->buf, sizeof(lp->buf))) != 0) + return (ret); + lp->b_off = 0; + } } return (0); } @@ -412,14 +422,8 @@ __log_write(dblp, addr, len) if (nw != (int32_t)len) return (EIO); - /* - * Reset the buffer offset, update the seek offset, and update the - * first-unwritten LSN. - */ - lp->b_off = 0; + /* Reset the buffer offset and update the seek offset. */ lp->w_off += len; - lp->uw_lsn.file = lp->lsn.file; - lp->uw_lsn.offset = lp->w_off; /* Update written statistics. */ if ((lp->stat.st_w_bytes += len) >= MEGABYTE) { |