| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
| |
* src/datconv.c (f_stringz, f_string): Use unsigned char *.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* src/gdbmload.c (_gdbm_str2fmt): New function.
* src/proto.h (_gdbm_str2fmt): New proto.
* src/gdbmtool.c (open_format): New global variable.
(opendb): Add open_format to gdbm_open flags
* src/gdbmtool.h (open_format): New extern.
* src/var.c: Handle the "format" variable.
* doc/gdbm.texi: Document the changes.
|
|
|
|
|
|
|
| |
* src/gdbmdump.c (_gdbm_dump_ascii): New parameter "format" holds the
format of the original database.
Set version number to 1.1
* src/gdbmload.c (_gdbm_load_file): Handle the "format" parameter.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* doc/gdbm.texi: Document manual crash recovery procedure.
Document the gdbmtool "shell" command.
Fix chapter headings (remove final point).
Replace headings with sections.
* src/gdbmopen.c (gdbm_header_avail): Remove const qualifier from
1st argument
* src/proto.h (gdbm_file_sync): New proto.
* src/gdbmsync.c (gdbm_file_sync): Moved from proto.h.
(gdbm_sync): Call _gdbm_end_update to be sure
all changes are written to disk.
* src/gdbmtool.c: Implement the shell command.
(command_lookup): Fix name prefix comparison.
* src/gram.y: New token T_SHELL.
* src/lex.l: Sub-lexers for shell arguments.
|
|
|
|
|
|
| |
* src/recover.c (_gdbm_finish_transfer): Close snapshot descriptors,
if any.
Restore xheader, avail, and avail_size members.
|
|
|
|
|
| |
* src/gdbmsync.c (gdbm_numsync_cmp): Properly handle unsigned overflow.
* tests/gtload.c: New option -numsync.
|
|
|
|
|
|
|
| |
* src/gdbmtool.c: New command: "snapshot"
* doc/gdbm.texi: Document the snapshot command (gdbmtool).
* doc/gdbmtool.1: Likewise.
* src/gdbmsync.c: Fix a comment.
|
|
|
|
| |
* src/gdbmsync.c (stat_snapshot): Use EACCES instead of EACCESS.
|
|
|
|
|
|
|
|
|
|
| |
* doc/Makefile.am: Export htmlxref.cnf
* doc/htmlxref.cnf: New file.
* doc/gdbm.texi: Improve crash-tolerance descriptions.
* src/gdbmsync.c (stat_snapshot): Set errno = EACCES if access bits
of the snapshot stat are wrong.
(gdbm_latest_snapshot): Don't touch ret if returning
GDBM_SNAPSHOT_SUSPICIOUS.
|
| |
|
|
|
|
| |
* src/gdbmsync.c (gdbm_numsync_cmp): Fix signedness of na, nb
|
|
|
|
|
|
|
| |
* src/gdbmdefs.h (GDBM_HEADER_AVAIL_SIZE): Removed.
(GDBM_HEADER_AVAIL_OFFSET): New macro.
* src/avail.c: Use dbf->avail_size and GDBM_HEADER_AVAIL_OFFSET.
* src/gdbmopen.c: Likewise.
|
|
|
|
|
|
|
|
|
| |
* src/gdbm.magic: Handle extended GDBM format.
* src/gdbmdefs.h (gdbm_file_standard_header)
(gdbm_file_extended_header): New data types.
* src/gdbmopen.c (gdbm_header_avail): Use casts to
gdbm_file_*_header to obtain data offsets.
* src/gdbmtool.c (print_header_handler): Improve formatting.
|
|
|
|
| |
* src/gdbmsync.c (gdbm_latest_snapshot): Restore missing break.
|
| |
|
|
|
|
|
|
| |
* src/gdbmsync.c (_gdbm_snapshot): Before returning, chmod previous
snapshot write-only. Change proposed by Terence Kelly on
July 23, 2021.
|
| |
|
|
|
|
|
|
|
| |
* src/gdbm.h.in (GDBM_SNAPSHOT_SUSPICIOUS): New return code.
* src/gdbmsync.c (gdbm_latest_snapshot): Take into account numsync
when choosing between the two snapshots.
(gdbm_sync): Increase numsync.
|
| |
|
|
|
|
|
|
|
|
|
| |
* src/gdbmdefs.h (gdbm_ext_header): Add new field: version.
Pad to 8 integers.
* tests/gtconv.c: New auxiliary program.
* tests/conv.at: New test.
* tests/Makefile.am: Add new tests.
* tests/testsuite.at: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gdbm.h.in (gdbm_convert): New proto.
* src/gdbmdefs.h: Define GDBM_MAGIC and GDBM_NUMSYNC_MAGIC here.
(gdbm_file_header): Remove the union.
* src/gdbmopen.c (gdbm_header_avail): Return pointer to
gdbm_ext_header in 4th argument.
(validate_header_std,validate_header_numsync): Remove avail size
verification. It will be checked later in gdbm_fd_open.
(gdbm_fd_open): Check avail table size.
(gdbm_convert): New function.
* src/avail.c (gdbm_avail_traverse): Change the avail table offset
calculation.
* src/gdbmtool.c: New commands: upgrade, downgrade and sync.
Fix output of the "header" command.
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gdbm.h.in (GDBM_NUMSYNC): New flag for gdbm_open
* src/gdbmdefs.h (gdbm_ext_header): New struct.
(gdbm_file_header): New member of the union v: gdbm_ext_header.
* src/gdbmopen.c
(gdbm_header_avail): New function.
(validate_header): Use dbf->avail.
(gdbm_fd_open): Read both database types. Create GDBM_NUMSYNC_MAGIC
database if given the GDBM_MAGIC flag.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gdbmconst.h (GDBM_NUMSYNC_MAGIC32)
(GDBM_NUMSYNC_MAGIC64)
(GDBM_NUMSYNC_MAGIC32_SWAP)
(GDBM_NUMSYNC_MAGIC64_SWAP): New constants.
* src/gdbmdefs.h (gdbm_file_header): Move avail to a union in
anticipation of further changes.
(gdbm_file_info) <avail, avail_size>: New members.
(GDBM_HEADER_AVAIL_SIZE): Redefine.
* src/gdbmopen.c (GDBM_NUMSYNC_MAGIC): New define.
(validate_header_std)
(validate_header_numsync): New functions.
(validate_header): Use one of these depending on the magic number.
(gdbm_fd_open): Initialize new members of gdbm_file_info.
* src/avail.c: Use the GDBM_FILE avail pointer.
* src/falloc.c: Likewise.
* src/gdbmtool.c: Likewise.
|
|
|
|
|
|
| |
* src/avail.c (gdbm_avail_traverse): Apply callback to the header
avail block as well.
* src/gdbmtool.c (avail_list_print): Don't print header block separately.
|
|
|
|
|
|
|
|
|
| |
* src/gdbm.h.in (gdbm_latest_status): Rename to
gdbm_latest_snapshot_status.
* src/gdbmsync.c (fsync_to_root): Start synching from the snapshot
itself. Take care to open it write-only.
(gdbm_latest_snapshot): Reorganize to improve readability.
[!GDBM_FAILURE_ATOMIC] gdbm_latest_snapshot: Fix signature.
|
|
|
|
| |
* src/gdbmsync.c (stat_snapshot): Fix typo (missing parentheses).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* doc/gdbm.texi: Document GDBM_SNAPSHOT_BAD
* src/gdbm.h.in (GDBM_SNAPSHOT_BAD): New constant.
* src/gdbmsync.c (fsync_to_root): Rewrite. Use pointer
to traverse the pathname in the reverse direction. Fsync
the root directory as well.
(gdbm_failure_atomic): Create both snapshots in user write-only mode.
(stat_snapshot): Fail if the file is neither readable nor writable.
(gdbm_latest_snapshot): Fail if neither file is readable.
Fix selection of the snapshot by mtime: prefer the latest one.
[!GDBM_FAILURE_ATOMIC]: Provide the placeholder for
gdbm_latest_snapshot.
|
| |
|
| |
|
| |
|
|
|
|
| |
* src/gdbm.h.in: Include sys/types.h
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The commit 4fb2326a4a introduced pre-reading of memory mapped
regions. While speeding up searches, it has a negative impact
on write operatons, since every remapping effectively re-reads
the entire database. See https://github.com/Perl/perl5/issues/18884
for details.
* NEWS: Document changes.
* doc/gdbm.texi: Document the GDBM_PREREAD flag.
* src/gdbm.h.in (GDBM_PREREAD): New flag.
* src/gdbmdefs.h (gdbm_file_info): New member: mmap_preread.
* src/gdbmopen.c (gdbm_fd_open): Set mmap_preread if requested.
* src/gdbmsetopt.c (setopt_gdbm_getflags): Report GDBM_PREREAD
flag, if dbf->mmap_preread is set.
* src/mmap.c (_gdbm_internal_remap): Use pre-fault reading only
if dbf->mmap_preread is set.
|
|
|
|
|
|
|
|
|
|
| |
* src/avail.c (avail_comp): Prevent integer overflow.
(gdbm_avail_table_valid_p): Likewise.
* src/gdbmdefs.h (off_t_sum_ok): Change return type.
Return false if any argument is negative.
* src/gdbmopen.c (compute_directory_size): Prevent integer overflow.
* src/hash.c (_gdbm_hash): Treat dptr elements as unsigned
integers.
|
|
|
|
|
| |
* src/datconv.c (dsegm_list_free): Free name if necessary.
* src/gram.y (defid): Free $1 when no longer needed.
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This provides for the optimal performance.
Additional GDBM_XVERIFY flag can be used when opening the database
to request extended database verification (entire avail stack will be
checked).
* src/bucket.c (cache_lookup): Handle cache_size == GDBM_CACHE_AUTO.
(_gdbm_cache_init): Likewise.
* src/gdbm.h.in (GDBM_XVERIFY): New flag to gdbm_open.
(GDBM_CACHE_AUTO): New constant.
Define error constants within enum.
Fix definition of GDBM_BAD_HASH_ENTRY.
* src/gdbmclose.c: Fix misleading comment.
* src/gdbmconst.h: Define DEFAULT_CACHESIZE to be GDBM_CACHE_AUTO.
* src/gdbmopen.c (gdbm_fd_open): Call gdbm_avail_verify if
the GDBM_XVERIFY flag is set.
* doc/gdbm.texi: Update.
* doc/gdbm.3: Update.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* src/bucket.c (gdbm_dir_entry_valid_p): Inline
(cache_lookup): Keep track of cache hits.
(_gdbm_get_bucket): Check the cache_entry first.
(gdbm_get_cache_stats): Change signature. Return the per-db
number of cache hits as well.
* src/cachetree.c: Inline static functions.
(_gdbm_cache_tree_lookup): Avoid extra level of indirection
(nodeptr) at the expense of one additional comparison.
* src/gdbm.h.in (gdbm_get_cache_stats): Change signature.
* src/gdbmdefs.h (gdbm_file_info) <cache_hits>: New member.
|
| |
| |
| |
| |
| | |
* src/gdbmtool.c (nextkey_handler): Always free the previous key
buffer.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* src/Makefile.am: Add avail.c
* src/avail.c: New file.
* src/gdbm.h.in (gdbm_avail_verify): New proto.
* src/gdbmdefs.h (GDBM_HEADER_AVAIL_SIZE): New macro.
* src/gdbmopen.c (gdbm_avail_table_valid_p)
(gdbm_avail_block_validate)
(gdbm_bucket_avail_table_validate): Move to avail.c
* src/gdbmtool.c (_gdbm_avail_list_size)
(_gdbm_print_avail_list): Rewrite using gdbm_avail_traverse.
* src/proto.h (gdbm_avail_traverse): New proto.
* src/systems.h: Include stddef.h.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
These address https://puszcza.gnu.org.ua/bugs/?503
* src/gdbmdefs.h (gdbm_avail_block_valid_p): Remove.
* src/gdbmopen.c (gdbm_avail_block_validate): Use inline conditional
instead of gdbm_avail_block_valid_p.
(gdbm_fd_open): Revert to reading master avail_block in two passes (as
was before fd5cf245ea).
(validate_header): Add back master avail block consistency check.
* src/gdbmtool.c (_gdbm_avail_list_size): Use _gdbm_avail_block_read.
* src/recover.c (_gdbm_finish_transfer): Reset dbf->file_size.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This fixes https://puszcza.gnu.org.ua/bugs/index.php?502.
* src/findkey.c (gdbm_bucket_element_valid_p): Verify also if the
key/data pair ends at a valid file offset.
(_gdbm_read_entry): Set up the cache data only on success.
* src/gdbmdefs.h (gdbm_bucket_element_valid_p): Remove declaration.
(gdbm_file_info): New member 'file_size' keeps the recently retrieved
value of the file size. It is invalidated wherever data is written to
the database.
* src/fullio.c (_gdbm_full_write,_gdbm_file_extend): Invalidate
dbf->file_size.
* src/gdbmopen.c (gdbm_fd_open): Initialize file_size to -1.
(_gdbm_file_size): New function.
* src/mmap.c (_gdbm_file_size): Remove.
* src/proto.h (_gdbm_file_size): New proto.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Fixes http://puszcza.gnu.org.ua/bugs/?501.
* src/falloc.c (_gdbm_avail_block_read): New function.
(pop_avail_block): Use _gdbm_avail_block_read.
* src/gdbmdefs.h: Fix typo in the comment.
* src/gdbmopen.c (gdbm_avail_block_validate): Take size of the avail
block in bytes as the third argument. All uses changed.
(PARTIAL_HEADER_SIZE)
(HEADER_AVAIL_SIZE): New macros.
(_gdbm_validate_header): Validate the avail block as well.
(validate_header): Don't validate the avail block fields here.
(gdbm_fd_open): Read partial header up to the avail field, then read
entire avail block using _gdbm_avail_block_read.
* src/gdbmtool.c (_gdbm_print_avail_list): Fix avail block calculation
(one extra entry was assumed).
Use _gdbm_avail_block_read to obtain and validate block.
* src/proto.h (_gdbm_avail_block_read): New proto.
(gdbm_avail_block_validate): Change signature.
|
| |
| |
| |
| | |
* src/recover.c (_gdbm_finish_transfer): Free the cache.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
See http://puszcza.gnu.org.ua/bugs/?499
* src/gdbm.h.in (GDBM_BAD_HASH_ENTRY): New error code.
* src/gdbmseq.c (get_next_key): Verify the computed hash and bucket
address for the obtained key.
* src/gdbmerrno.c (gdbm_errlist): Add error message for
GDBM_BAD_HASH_ENTRY.
|
| |\ |
|
| | | |
|