Skip to main content

TSVZ

tsvz.org: the format, its specification and its implementations.

TSVZ is a small, dependency-free library and CLI that keeps an ordered key-value store in a delimiter-separated text file. The first column of each row is the key; the file behaves like an ordered dictionary that is persisted to disk as you change it.

Version 5.17, Python 3.6+, one self-contained module (TSVZ.py): drop it next to your code and import TSVZ, or install it.

pip install tsvz          # from PyPI
pip install -e .          # editable, from this directory
  • With pip 9, the pip of EL7 and EL8 (pip3 --version), upgrading from 5.5 (5.05) or earlier and pip3 uninstall TSVZ of those releases stop with configparser.DuplicateOptionError: ... option 'tsvz' in section 'console_scripts' already exists, and nothing changes: the installed release keeps working. Run pip3 install -U pip once, then upgrade or uninstall.
  • With --user the same happens, except that pip3 install --user -U TSVZ with no version does not stop: it installs the new release, which works, and leaves the old release's metadata behind. pip3 list then shows the old release after pip3 uninstall TSVZ, and the next uninstall stops with that error. To avoid this, run pip3 install --user -U pip once first. If it has already happened, run that, run pip3 uninstall TSVZ until it says TSVZ is not installed, and install again.
  • With pip 10 or later, in a venv whose path has a space or is too long for the kernel's #! line, the TSVZ spelling does not start (the error varies: "bad interpreter", import: command not found), because pip gives a script file a plain #! line: use tsvz. With pip 9 no spelling starts in such a venv, as in 5.5. uv and system or --user installs are not affected.

Two file dialects, one API

Extension Rules
.tsv .csv .nsv .psv (and any other) The TSVZ 3.39 format, unchanged. A 3.39 host can read every file this version writes.
.tsvz .csvz .nsvz .psvz The tsvz-spec-v1 append-only key-value log.

The delimiter follows the extension: tab, comma, NUL, pipe. A trailing compression suffix (.gz, .bz2, .xz, .zst) is allowed on both; .zst needs Python 3.14. For important or sensitive data, keep the part you write to uncompressed and compress parts once they no longer change: a damaged compressed member can lose every record in it (spec §16.4.2).

TSVZed, TSVZedLite, readTabularFile, appendTabularFile, appendLinesTabularFile, clearTabularFile, scrubTabularFile (and the *TSV aliases) work on both dialects. t.dialect tells you which one a store uses.

Quick start

import TSVZ

t = TSVZ.TSVZed('people.tsvz', header='id\tname\tscore')
t['alice'] = ['alice', 'Alice', '10']
t['bob'] = 'bob\tBob\t20'
t['alice'] = ['alice', 'Alice', '11']   # last write wins
del t['bob']                            # appends a tombstone
print(t['alice'])                       # ['alice', 'Alice', '11']
t.close()
tsvz set people.tsvz carol Carol 5        # add or update a row (append is the same)
tsvz get people.tsvz carol                # one row; exit 3 if carol is missing
tsvz read people.tsvz                     # every row: a table on a terminal, records in a pipe
tsvz delete people.tsvz carol             # tombstone
tsvz read people.tsvz | tsvz set copy.tsvz -   # copy every row
tsvz clear people.tsvz                    # empty it, keeping the header and markers
tsvz scrub people.tsvz                    # compact it (for .tsvz: archival maintenance)
tsvz verify people.tsvz                   # check #_checksum_*_# segments; exit 4 on a mismatch
tsvz parts events.tsvz                    # list the parts of a multi-part store
tsvz has people.tsvz carol                # exit 0 if carol is live, 3 if not
tsvz pop people.tsvz carol                # print carol's row and delete it
tsvz serve people.tsvz &                  # keep the store loaded; tsvz commands then use it
tsvz stop people.tsvz
tsvz people.tsvz append carol Carol 5     # the 3.39 form still works
tsvz -V

What TSVZ does with .tsvz files

  • Reads everything a conformant writer can produce: markers (#_defaults_#, #_strip_trailing_whites_#, #_fill_empty_with_default_#, #_return_defaults_when_missing_#, ...), escapes (<sep>, <LF>, <lt>, <#>), tombstones, #_checksum_<algo>_# segments (crc32 and every fixed-length hashlib algorithm), compressed parts, and multi-part stores (store.tsvz.<hex>, part 0 first, .rotated parts skipped). A read starts at the last snapshot part (one that begins with #_snapshot_#, spec §19.10, and holds the store's whole state) and skips the history before it; verify and parts still read every part. A store whose parts change while they are read (another tool's in-place scrub) is read again, up to three times; a read still changing then is incomplete, as an unreadable part is.
  • Writes one file: the named file, or the highest-numbered part of a multi-part store. Rows are written as given (no padding); a lone key is a tombstone; a row of empty cells (k\t\t) is a live row.
  • Compaction is manual. scrubTabularFile / tsvz scrub f.tsvz rewrites a single-part store in place (same inode). If another writer commits while it runs, it reads the store again; after three tries it writes nothing, with a warning (clearTabularFile does the same). The automatic rewrite options of 3.39 (rewrite_on_load, rewrite_on_exit, rewrite_interval, rewrite(), mapToFile(), hardMapToFile()) are ignored for .tsvz, with a warning.
  • Missing keys: t[key] returns the defaults row while #_return_defaults_when_missing_# is true (its default); in, get, setdefault and pop behave like a dict.
  • # keys are stored (<#>key). Keys of the form #_name_# are marker writes: t['#_defaults_#'] = [...] sets the defaults, and so does setDefaults([...]) once the object is constructed. #_snapshot_# is refused (spec §19.10.2).
  • Other writers: a TSVZed notices another process's change by the active part's inode, size and times and by the list of parts, and reloads. Rows it has queued but not yet written stay in memory across that reload, and a live key is never missing while it runs.

Command line

tsvz follows tsvz-spec-v1 §20: tsvz [OPTION ...] OPERATION STORE [ARG ...], with options anywhere before a lone --. The 3.39 form tsvz STORE [OPERATION] [ARG ...] works too; a store named like an operation then needs a path prefix (./read).

  • One engine. Every operation runs through the engine tsvz serve uses, in its own process when no server runs, so a command prints the same with or without a server.
  • stdout carries only rows. It gets a table on a terminal and records otherwise; --format table|records overrides. Records use the store's delimiter and escaping, so tsvz read A | tsvz set B - copies a store of the same variant.
  • stderr carries every message. -q prints errors only; -v adds detail.
  • Exit status:
    • 0: done.
    • 1: failed or refused. Also a missing store for read, get, scrub, verify and parts, a store that set, append or delete could not create, and a .tsvz part that could not be read (the rows of the other parts are still printed).
    • 2: usage error.
    • 3: get found a missing key.
    • 4: verify found a checksum mismatch.
  • Arguments are literal. tsvz set s.tsvz k 'a<b' stores a<b. Values may begin with - (-5); after -- every argument is positional. set KEY alone deletes KEY, as in 3.39. set KEY '' stores an empty cell in a .tsvz store; in a .tsv file it deletes KEY, as in 3.39.
  • Bulk input. set STORE - and delete STORE - read records or keys from stdin and append them in one write. An unterminated last line is ignored, with a warning.
  • TSVZ extensions:
    • --x-header H and --x-defaults KEY<d>D1<d>... decode backslash escapes such as \t;
    • --x-header H makes line 1 of a .tsv-family file its header for every operation when line 1 is H: the same number of cells, each equal to H's once the whitespace around it is taken off (a trailing empty cell counts: id\tv\t is not id\tv; a UTF-8 byte order mark before line 1, as Excel writes one, is skipped). It is then never a key, row or count, scrub and clear keep it, and read --format table shows it above the rows. When line 1 differs, the file has no header and line 1 is a row, with 3.39's "Header mismatch" warning (--x-strict: an error, exit 1, nothing written). A missing or empty file gets H first. Without --x-header, line 1 is a row, as in 3.39. (The library's own header check, a header= given to readTabularFile, appendTabularFile, clearTabularFile, scrubTabularFile or TSVZed, is 3.39's, looser one: each cell of H within the cell of line 1 under it, so idaho\tvalue passes for id\tv.) A scrub never changes line 1; a TSVZed that writes its memory over a header-less file can put a row equal to H there (limitations).
    • --x-strict / --x-force turn 3.39's column and header checks on or off.

Serving a store

tsvz serve STORE keeps a store loaded in one process and answers requests on a local socket (tsvz-spec-v1 §21). tsvz commands and TSVZ.TSVZClient find it through the pointer file STORE.serve and use it instead of re-reading the store. Their output and exit status stay the same.

  • One appender. The server batches the writes it receives into single appends. Other writers may still append to the files; the server reads what they add before it answers.
  • Acknowledgement. A write is acknowledged once it is queued (#_write_ack_# memory, the default), or after fsync (#_write_ack_# disk, or TSVZClient(..., sync=True)). Reads always see acknowledged writes.
  • Access. Only the user who started the server can connect (socket mode 0600). --x-group G or --x-mode 0660 opens it on purpose. The server listens on a Unix-domain socket only; reaching it from other hosts is left to a separate adapter (for example TCP with TLS) that would relay to the socket.
  • Trust. Clients use STORE.serve only when it is a regular file owned by them or by the store's owner, not writable by anyone else, naming a socket that belongs to that owner. Otherwise they warn and use the files. serve never writes through a symbolic link or into a file it did not create.
  • Lifetime. It runs in the foreground until tsvz stop STORE, SIGINT or SIGTERM, or --x-idle-timeout S seconds without connections. It then writes and fsyncs everything and removes STORE.serve.
  • Bypassing it. --x-direct makes a tsvz command use the files. Command lines with --x-header, --x-defaults or --x-strict, or another delimiter than the server's, use the files too. A server started with --x-header H answers every request by the --x-header rule above, and one started with --x-strict too answers as a direct --x-strict command does: a line 1 that is not H fails the request (status 1, nothing written), and reads and scrubs drop the rows of another width. It does not start when line 1 is not H then. The table of a routed read --format table shows no H line: its first row is set as the table's header, as with no --x-header.
import TSVZ

with TSVZ.TSVZClient('people.tsvz') as people:  # served, or in this process when no server runs
    people['dave'] = ['dave', 'Dave', '41']
    print(people['dave'], len(people), 'alice' in people)
    print(people.pop('dave'))

TSVZClient has TSVZed's semantics for reading and setting keys, del, in, len, iteration, pop, popitem, setdefault, update, clear and setDefaults. Its writes return once they are written (raising OSError if they cannot be), one client may be shared between threads, and without a server it warns once and works on the files in-process, finishing its writes when the program exits. A server of a .tsv-family file names its delimiter in STORE.serve, and TSVZClient splits string values on it.

Fault tolerance

TSVZ keeps your data and keeps going when a file is not what it expects, and says so on stderr (or through teeLogger) with one summarised line per problem:

TSVZ warning: data.tsvz: invalid UTF-8 replaced with U+FFFD (3 occurrences, first at line 17)

Examples: bytes after the last newline (ignored on read; truncated before the next append, and quoted), invalid UTF-8, a byte order mark, a newer #_version_#, a marker with a bad value, a checksum mismatch, a damaged compressed member or a zero-filled line (a member cut short by a crash keeps the whole lines it decoded; a corrupt member or a zero-filled line is recovered, skipped or stops the read, as the store's #_on_corruption_# says, recover by default, spec §4.9, §4.10, §16.6; a scrub that rewrites such a part keeps the original as <part>.damaged-<time>), an unreadable part, and a delimiter or encoding argument that conflicts with the extension.

Writing is stricter than reading: a key, value, header or marker that cannot be encoded as UTF-8, such as the lone surrogate os.fsdecode gives for a non-UTF-8 file name, raises a ValueError (TSVZEncodeError) that names it and writes nothing, instead of storing ?. Pass errors='replace' (or any codec error handler) to the writing functions or to TSVZed, TSVZedLite and TSVZClient to get the old ?. TSVZed and TSVZedLite refuse such a row when it is set. A rewrite that meets such text leaves the file as it is: mapToFile() and hardMapToFile() raise the error, and the rewrites TSVZed makes itself report it once. With a non-UTF-8 encoding=, U+FFFD (what the reader puts for a byte it could not decode) is text that encoding may lack, and it is refused like any other: such a store is not rewritten (rewrite_on_load leaves the file as it is, without failing), appends of rows that can be written still work, and the delete or update of a key that holds U+FFFD raises. Such a key stays until the file is edited, the store cleared, or the store opened with the encoding it was written in; errors='replace' would write ? for U+FFFD, losing the bytes the file holds there. The tsvz command exits 1 with the message.

A TSVZed writes a .tsv, .csv, .nsv or .psv file (compressed or not) from its background thread only: rewrite(), mapToFile(), hardMapToFile(), commitAppendToFile(), clear(), clear_file(), reload(), close() and the constructor's load hand it the job and wait, so a Ctrl-C stops the wait: a write the thread has begun is finished, one it has not begun is not made (its rows stay queued for the next commit), and a load stops, leaving memory as it was (the call still raises KeyboardInterrupt). At exit a write in progress is finished: a Ctrl-C then says so and keeps waiting, and a second one abandons it. A closed store is freed. (get_file_obj() and release_file_obj(), kept from 3.39, hand the locked file to the calling thread; while it holds it, that thread must not wait on another store of the same file, whose thread waits for this lock.) A store with no background thread (after close(), or in a child that fork() made) writes in the thread that asks, one call at a time; a call that a signal handler makes to that store inside such a write is made as soon as the write ends, unless a Ctrl-C ended it (which drops it, and a commit's rows stay queued for the next commit), and returns at once (5.17; it waited for ever before). What the handler does to the store after such a call happens before it: a set after its own clear() is lost when the clear is made, and a read after its reload() sees the old row (deferred to 5.18). A handler that ends the process by os._exit() after such a call loses the call: end by sys.exit(), which makes it first (known), but for a write cut just as it takes its lock: on Python 3.14 a signal that lands just after with self.writeLock: has taken the lock leaves it held, and the call waits for ever (32 of 8,000 real signals in a commit loop; known), and on Python 3.6 to 3.9 one that lands at the end of a try or with block can leave the file locked, or writeLock held (2 of 8,000 on 3.6; known).

A child that fork() made (os.fork(), or multiprocessing's fork children, which its fork start method makes; Python 3.14's default on Linux, forkserver, makes children that inherit no store) drops the rows its parent had queued, which the parent writes, and writes the rows it sets itself at its commitAppendToFile(), its close() and its normal exit. Its store follows the file whatever monitor_external_changes says, since the parent writes the file too (5.16), and takes none of its parent's duties to the file or settings that assume one writer (5.17): the parent's failed writes are the parent's to try again, and rewrite_on_exit and rewrite_interval read False and 0 in the child, so its close and exit only append. To have a child compact the file at its exit, set rewrite_on_exit again in the child, or open the store after the fork. That is also how a child mends a file that the parent's failed rewrite left damaged, where the parent ends without a rewrite getting through (a daemon's fork), if it appended nothing after the damage. By default the child's close no longer makes the file again, as 5.16's did, and a compressed file stays unreadable (known). One that ends by os._exit, as multiprocessing's children do, writes only what it commits or closes. A parent that ends by os._exit (a daemon's fork) does not write what it had queued, so commit before forking a child that outlives its parent. A child forked while its parent holds get_file_obj(), or whose ancestor held it at an earlier fork (5.17), writes nothing at its close or exit, since the parent may be waiting for it, and says so, even once both have let go of the file. Its commitAppendToFile() writes once the parent lets go, so a child that commits while its parent holds the file and waits for it waits for ever. Its move_to_end(), and its checkExternalChanges() then rewrite(), follow a change to the file first (one since the child's store last read or wrote it; from 5.16 with monitor_external_changes off too), and wait for ever there as well where the parent's hold keeps that read or its commit out: a hold in a mode without a ('r+b', 'wb'), any hold where the file lock is a whole-file flock (POSIX systems other than Linux), or rows the child queued itself, which the follow commits. On Linux, a child with nothing queued reads beside the default 'ab' hold, and the call returns. Let go of the file before forking, and the child's close and exit write. A child that a signal handler forks inside a mapToFile(), hardMapToFile() or rewrite() finishes that call with its own memory, as if it had made the call after the fork.

A file another process removed is made again from memory by the store's next write, an append included (a removal in the microseconds as a write starts is followed as a rotation instead); while that rewrite fails or is refused, the rows are appended to a new file there, and memory keeps all of them for the rewrite that gets through. A compressed file is read member by member, and a member's rows are used only once it passes its codec's check (the gzip CRC-32 and length, the bzip2 CRCs, the xz check, the zstd content checksum TSVZ writes): a member after the first cut short, as a writer killed mid-append leaves it, is left out whole and the members after it are read; a first member cut short and any other damage (bytes that do not decode, a member that fails its check) stop the read there (L5). A rewrite of a multi-member file killed inside a later member's write can make a read take its old members back (docs/limitations.md). A compressed file another writer left damaged is made again too: what the read did not get goes, the damaged member and, after damage that stops the read, everything after it (rows appended there would be read by no one). While that rewrite fails, the rows are appended after the damage and memory keeps them for the next rewrite that gets through; while it is refused (a row changed in place to text the encoding cannot hold), they are appended after it as in 4.9, and the next read drops them. Either way close() tries the rewrite once more, whatever rewrite_on_exit says. Appends that do not read the store first (tsvz set, appendTabularFile, TSVZedLite, and a TSVZed with monitor_external_changes=False for damage that lands after it loaded the file) still land after damage that stops the read (docs/limitations.md).

It knows the size and SHA-256 of the bytes it last read or wrote. When another process has changed the file, and it is the same file (device and inode) and still begins with those bytes, nothing this store set is still waiting to be written, and setDefaults() has not changed its defaults since, only what follows is read and applied to memory, as a read of the file applies it: memory keeps an order set by move_to_end, and its # keys. Any other change reloads the file, changing memory in place, so a live key is never missing meanwhile.

A rewrite writes over the file and then cuts it to its new length, so a reader never meets it emptied. One that fails part way (a full disk, an I/O error), or that cannot make again a file that was removed, leaves the file damaged: the new bytes it wrote, then the old ones after them. Memory then holds the only good copy, as it does when the store appends after damage another writer left that it cannot make the file again over yet (that rewrite failed, or waits out a failed one's back-off). Until a rewrite gets through, the file is not reloaded over memory; the background writer still appends the rows set meanwhile, and the next rewrite (the background writer's, rewrite(), close()) makes the file again from memory. A change another process made meanwhile is merged into memory first, as above, when the file is still the one the damage was left in (for a file that was removed, any file made there since) and still begins with exactly the bytes it left; after a damage that left the file empty (or removed it), what follows must also begin with this store's header. Otherwise that change is overwritten, with the warning Overwriting external changes. What cannot be told from an append is merged as one: another process's rewrite of the same file in place that begins with exactly the bytes the damage left, and, for a store with no header (or verifyHeader=False), anything written to a file the damage left empty; the keys it sets or deletes then take its values, and the keys it left out keep memory's. An explicit reload() while the file is damaged replaces memory with the damaged file, as asked, and warns.

Upgrading to 5.17 from 5.16

The file formats are unchanged, and an upgrade needs nothing, except in a program whose forked children should compact the file at their exit, or should mend a file that their parent's failed rewrite left damaged, where the parent ends without mending it (a daemon's fork): set rewrite_on_exit again in the child, or open the store after the fork. The changes to the API are what rewrite_on_exit and rewrite_interval read in a child that fork() made (as monitor_external_changes has since 5.16), the warning a forked child's own child prints, and what a call a signal handler makes inside a store's own write returns where the store has no writer thread (below).

  • A forked child takes none of its parent's duties to the file, and none of the settings that assume one writer. At the fork its copy of each store already dropped the rows the parent had queued (5.15) and followed the file whatever monitor_external_changes said (5.16). It now also drops the parent's failed writes to try again and a refused rewrite's wait, and turns rewrite_on_exit and rewrite_interval off: they read False and 0 in the child, and the parent keeps its own. So the child's close and exit only append.
    • A child forked after its parent's rewrite failed part way (a full disk, an I/O error) no longer loses its row. Its close tried the parent's rewrite again and made the file from its own memory, and the parent, still waiting to make the file again, then took that for a change it could not merge and wrote over it (5.14 to 5.16, with or without rewrite_on_exit; the row is kept in each of the three cases now).
    • But a child no longer mends the file where its parent ends without a rewrite getting through. A daemon's os._exit after the fork, a kill: 5.16's child made the file again from its memory at its close or exit (all 9 rows of the probe read right, in 6 of 6 .tsv.gz cases); 5.17's only appends after the damage, and a .tsv.gz file stays unreadable, the child's own row included (4 of 6 cases; the other 2 are a child that sets rewrite_on_exit again, which mends it as before; a plain .tsv read right in both). Set rewrite_on_exit again in the child, or open the store after the fork. That mends the file only where the parent appended nothing after the damage: with a row the parent appended after it, the child's exit reads the damaged file as empty and makes it again from that read, so the file ends with the child's own row alone (header only, ending by close()), as 5.16's did or worse (known).
    • A forked child no longer compacts the file at its exit: its close on a 100,000-row store with rewrite_on_exit took 0.43 s, and takes 0.1 ms. Set rewrite_on_exit again in the child to have it rewrite.
  • A forked child's own child no longer waits for ever at its exit where an ancestor holds the file. A process that holds get_file_obj() forks a child, which forks a child of its own; each waits for its child. The grandchild now writes nothing at its close or exit and says so, as a direct child does ("an ancestor held the file (get_file_obj) at an earlier fork"); its commitAppendToFile() writes once the ancestor lets go of the file. In 5.15 and 5.16 it took its parent for one that held nothing, and its exit waited for the grandparent's file lock, while the grandparent waited for the child and the child for it (5.14's children wrote nothing at their exit, and ended). Nor does it write where the ancestor let go of the file long before: it cannot tell whether the ancestor still holds the file and waits for it, and 5.16's wrote its row there (let go of the file before forking, as for a child) (known).
  • A signal handler that uses a store inside that store's own write no longer waits for ever, in a forked child or after close(), except where the write is cut as it takes its lock (below). Such a store has no writer thread, so its writes run in the thread that asks, and a handler's commitAppendToFile(), reload(), clear(), clear_file(), rewrite(), mapToFile(), hardMapToFile() or checkExternalChanges() landing inside one took the lock that write holds again, and waited for ever (5.14 to 5.16; a move_to_end() too where it follows the file first, as it does once the write's bytes are in). The call is now made as soon as the write ends, unless a Ctrl-C ended it (which drops it: a put-off commit's rows stay queued for the next commit), after any made before it, and returns at once: self, or True for rewrite(). A move that has to follow the file first waits with its follow, so another writer's change of the row is kept. A handler's set returns at once, as before; one that lands inside such a write's own change of memory (a reload's swap) can leave its row in the file and not in memory until the next reload (deferred to 5.18; 5.16 the same). What the handler does to the store after such a call happens before it: a set after its own clear() is lost when the clear is made, a read after its reload() sees the old row, and a move_to_end() of a key the handler deletes next reports its failure later instead of raising (also deferred to 5.18; 5.16 waited for ever at the first call). A handler that ends the process by os._exit() after such a call loses the call, where sys.exit() makes it first: end by sys.exit() (known), except for a write cut just as it takes its lock: on Python 3.14 a signal landing just after with self.writeLock: has taken the lock leaves it held and the call waits for ever (32 of 8,000 real signals of the README's handler in a commit loop; known), and on Python 3.6 to 3.9 one landing at the end of a try or with block can leave the file locked, or writeLock held (2 of 8,000 on 3.6; known). A process a handler forks inside a closed store's own write, and that sets a row and commits, loses that commit, where a forked child's store keeps it (the closed store has no fork hook; deferred to 5.18; 5.16 waited for ever at the handler's first call). A running store is unchanged: its writes run on its writer thread, and a handler's call waits for the one under way.
  • In a closed TSVZed's or a forked child's own write, a sys.exit() or a Ctrl-C that cuts the write no longer leaves its locked file open, so a commit made while the exception goes up no longer waits for ever, except where the cut leaves a lock held (below). A store's write holds its locked file from the step that takes it, but the try that lets go of it began a few instructions later (a check of the store's own sat in between), and its clean-up closed the file after the unlock, so an exception raised in either left the file open and locked for as long as the exception's traceback lived. In a forked child's or a closed store's own write, where the call a handler made is put off and made as the write ends, the handler's sys.exit() landing there made that commit wait for the lock for ever (the README's handler hung at 161 of 8,000 real signals on 3.14, 170 on 3.11 and 230 on 3.6, in the 5.17 build before this fix; 5.16 at about 3 of 4), and so did a program's own except SystemExit: or except KeyboardInterrupt: clause that commits again (5.16 and the 5.17 build before this fix both: in every run where the signal landed there). The try now begins where the file is taken, and the file is closed whatever the unlock did: that handler hangs at 32 of 8,000 on 3.14 (all at the writeLock below) and 2 on 3.6, in none on 3.11 or 3.12, and the clause's commit returns, except where the cut leaves a lock held. What is left is two known limitations: a lock a cut write leaves held on Python 3.14 (that handler, and two signals inside one commit, where 28 of 8,000 hang and 5.16 ended, and a program's own except clause that commits again, which waits for ever there as in 5.16; known), and Python 3.6 to 3.9, where a signal at the end of a try or with block still leaves the file locked, or writeLock held (known). A TSVZedLite's write of a .tsvz file is not covered: a Ctrl-C it catches can leave the file append-locked until the Lite closes, as in 5.16 (deferred to 5.18).
  • The planned "write lock that knows its holder", which was to tell a call made inside the store's own write from a new one, became a look at the call stack for the store's own job (above): a reentrant write lock still hung at 619 of 1,060 steps of a commit's sweep, since the nested commit opens the file again and waits for the file lock its own write holds.
  • A forked child's commits to a compressed file no longer slow with each commit once its parent has written. A commit looks at what another process appended for damage, which every read stops at; it looked from the bytes the store last read or wrote, and a child, with no writer thread to read the parent's change, looked again at the parent's member and at every member it had appended since. The mark now moves past what a commit looked at and wrote, and a commit looks at nothing when the file kept still since. Per set and commit, a child of a 2,000-row .tsv.gz whose parent wrote once after the fork, over each 1,000 of 4,000 commits: on Python 3.14, 0.71, 2.09, 3.39 and 4.69 ms in 5.16, 0.02 to 0.03 ms in 5.17; on 3.6, 0.97 to 6.45 ms, and 0.04 to 0.05 ms. On a 100,000-row file the first 200 commits took 0.37 ms each, and take 0.03 ms. Damage another writer leaves after them is still found, and the file made again from memory.
  • A second signal handler inside the first one's let-go of the store's lock no longer makes the first one raise. letGo() (between its test of the hold and its release) ignores a release that finds no hold, as a section's exit does; the first handler's commit, set or other use of the store raised RuntimeError: cannot release un-acquired lock (5.14 to 5.16).
  • The suite now also tests what the 5.16 final review checked by hand: a forked child's monitor_external_changes, its rows after damage with monitoring off, the waits of the known limitation above (each bounded by an alarm), and a fork inside a clear()'s write, an interval rewrite and a one-column delete's commit; its stale-move test starts its alarm after the parent's go-ahead.
  • Known (docs/limitations.md): the list under 5.15, below, with 5.16's widening, but for the signal handler inside a forked child's own write (fixed above, with the closed store's case); the forked child that writes nothing at its close or exit where its parent held the file now covers a grandchild too, even where the ancestor let go of the file long before (above); and three new: a forked child no longer mends the file after its parent's failed rewrite, a call a handler puts off is lost when it ends the process by os._exit() (above), and on Python 3.6 to 3.9 a handler's sys.exit() can still hang (above); and two widened: the lock a cut write can leave held now includes a handler's sys.exit() on Python 3.14 (above), and a line can be written twice by a handler's sys.exit() inside a commit too (the file's lines a b c c h; the last copy wins).
  • Planned for 5.18 (docs/limitations.md): the rest of what was planned for 5.17 (the list under 5.15, below), and a signal handler's set inside a forked child's or a closed store's own write, with what a handler does to the store after a put-off call, and the process it forks inside a closed store's write (the handler bullet above), a handler's move_to_end() or set inside the last commit of a close or an exit, and the remake that a forked child keeps from its parent's failed rewrite; a TSVZedLite on a .tsvz file whose caught Ctrl-C leaves its file append-locked until it closes (deferred; 5.16 the same); a program that holds the file with get_file_obj(), lets go of it in a finally and catches a Ctrl-C there, which can leave writeLock held, so that the store's next commit waits for ever (deferred; 5.16 the same); two test gaps (a real-signal test's count of handler calls under load, and the round's test of the rewrite's and clear()'s half of the fix; deferred); and, before the put-off grows to sets, deletes, pops and moves, a design check against a store that stops running its writes on the calling thread. A candidate for 5.18, to be measured: a writeLock that knows its holder, used only to let go of a hold a cut write left (the lock a cut write leaves held on Python 3.14).

Upgrading to 5.16 from 5.15

The file formats are unchanged, and an upgrade needs nothing. In a program that forks with monitor_external_changes off, the children's move_to_end is slower beside a parent that writes: it now follows the file first, as a default child's does, so it waits for the file's lock (12,711 moves in 2 s against 852,835, with the parent appending at 20 Hz to a 100,000-row file). The one change to the API is what monitor_external_changes reads in a child that fork() made (below).

  • A forked child no longer writes over the rows its parent set after the fork when monitor_external_changes is off. In a child that fork() made, the store now follows the file whatever monitor_external_changes says (it reads True there): the parent writes the file too. With monitoring off, a rewrite of the child's wrote its memory as it was at the fork over the file without reading it, and a move wrote its row from that memory, so the parent's later rows and values were lost:

    • in a one-column store, when the child deleted or moved a key (there that is a rewrite, not a line) and then closed, ended normally or committed. 5.15 lost them at each of the three, whatever the rewrite options. 5.14, with neither rewrite_on_exit nor rewrite_interval, lost them only at the child's own commitAppendToFile(): its close and exit wrote nothing, and so left the child's delete or move unwritten. (5.15's notes called this case as in 5.14; for a one-column store it was not.)
    • in any loose store, when the child's store had replaced, deleted or moved a row since the last rewrite (by itself, or from the parent at the fork) and made its rewrite at exit, by rewrite_on_exit or a due rewrite_interval. 5.14 the same, where its child did not wait for ever on a lock it copied at the fork.
    • in a store of two or more columns with no rewrite option, when the child moved a row the parent had changed after the fork (the parent sets a to a new value; the child moves a to the end and exits). A move writes the row again with the value memory holds, and the child's memory held a as it was at the fork: 5.15's file ended with that old a, after the parent's new one. 5.14 kept the parent's value (its child wrote nothing at its exit, so the move stayed unwritten); 5.16 keeps it and writes the move. This one was worse in 5.15 than in 5.14.

    With monitoring on (the default) nothing changes. The parent keeps the setting it was given, so with monitoring off its own rewrites still write over what a child wrote. A monitoring-off child now has what a default child has had since 5.14, which is worse than 5.15 in three cases. Its move_to_end(), or its checkExternalChanges() then rewrite(), waits for ever where its parent holds get_file_obj() and waits for it, when the call follows a change to the file and the hold keeps the follow out (a hold in 'r+b' or 'wb', a whole-file flock outside Linux, or rows the child queued; on Linux, the default 'ab' hold with none queued lets it through) (known). A signal handler's move_to_end() inside its own write waits for ever when the move follows the file, as it does once the write's bytes are in; one landing before the write changed the file, with no other change to follow, returns (known; fixed in 5.17). Its .tsv.gz commits slow with each commit once the parent has written (on a 2,000-row file, 0.02 ms each in 5.15, 0.76 ms for the first 1,000 and 5.02 ms for the fourth in 5.16: fixed in 5.17). No row is lost in any of them.

  • Known and Planned for 5.17: the lists under 5.15, below. What 5.16 does not fix of 5.15's plan moves to 5.17, and one planned fix is a known limitation now: two signal handler calls, the second inside the first one's redo. (5.17 took the fork and signal-handler group; the rest is planned for 5.18.)

Upgrading to 5.15 from 5.14

The file formats are unchanged. An upgrade needs nothing: no file has to be rewritten, and the API is the same.

What changes is what a Ctrl-C, a signal handler that uses a store, and fork() do to a running program. The suite now raises a KeyboardInterrupt at every step of every operation a Ctrl-C can land in (stepped as a real signal lands: by sys.monitoring on Python 3.12 and later), and at every step of each operation a signal handler that uses the store can land in, and checks the locks, memory and the file after each.

  • A caught Ctrl-C no longer leaves a client's, its engine's or a path's lock to the program's other threads. A program that catches a Ctrl-C and goes on: one that landed where a TSVZClient (served, or working on the file in its own process), a tsvz serve handler's store or a one-shot call (appendTabularFile, scrubTabularFile, clearTabularFile) held its lock could leave it held, and another thread that used the same client, store or path then waited for ever. Each lets go of it on the way up now, as a store's sections have since 5.13: with a Ctrl-C at each step of each client and one-shot call on Python 3.14, 5.14 left a lock held at 164 steps, 5.15 at none.
  • A served client answers each request after a caught Ctrl-C. A Ctrl-C that cut a served TSVZClient's request while its reply was on the way left that reply to answer the client's next request: c['b'] could return a's row. The client now drops a cut connection and connects again. And tsvz serve stops on every SIGTERM: one that landed as a connection began was taken for that connection's error, and the handler ran on.
  • A .tsvz commit after close() or in a forked child that a Ctrl-C cuts drops no row. It took the rows from the queue before it wrote them, and a Ctrl-C between lost them (559 of 954 steps of such a commit on 3.14, 97 of 164 line steps on 3.6). They stay queued until they are on disk now, as a loose store's do; a commit cut just after its write writes them again at the next commit (known, below).
  • A Ctrl-C during a load ends the program sooner. A Ctrl-C ends the wait for the store's writer thread, as before; a load under way there (the constructor's, or reload()) now stops at its next read and changes nothing, so the program ends about as soon as one with no load under way: with a 1.5M-row store and a Ctrl-C 1 s into the constructor's load or reload(), it ended 0.06 to 1.02 s after the Ctrl-C (medians of 7, two runs each on Python 3.14 and 3.6; 1.37 s at most), where 5.14 took 0.06 to 1.17 s (2.32 s at most), and the same store with no load under way ends in 0.41 to 1.12 s on that machine. A write the thread has not begun when a Ctrl-C ends the wait for it is taken back (its rows stay queued for the next commit), so a clear() no longer runs after the rows the program sets once it caught the Ctrl-C; one the thread has begun is still finished. A .tsvz clear() empties memory in its job, as it lists the queue, so a Ctrl-C can no longer leave memory empty and the file full. With a Ctrl-C at each step of a clear() and rows set after it, 5.14 lost the rows set after it from memory and file alike at 63 of 199 steps of a loose store's (the two agreed), and at 153 of 219 of a .tsvz one left memory and the file apart or lost them from both (3.14); 5.15 at none.
  • A first Ctrl-C anywhere in the exit's stop of the stores waits for their writes. 5.14 waited only for one that landed inside a store's own stop; one in the steps around it abandoned every store, and the rows still queued were not written (10 of 519 steps of the .tsv exit and 13 of 337 of the .tsvz one on 3.14; 3 of 82 and 2 of 57 line steps on 3.6). 5.15 writes them at every step, says "TSVZ: the writes still to make are being finished; Ctrl-C again to abandon them" where the cut was not in a store's own write, and also catches a first Ctrl-C that lands in the instant before that stop begins. A second Ctrl-C abandons the writes, as before.
  • A child that fork() made writes its own rows, not its parent's. At the fork its copy of each store drops the rows the parent had queued (the parent writes them) and takes new locks (a parent's thread may have held one), and its close() and normal exit write the rows it set. In 5.14 those wrote nothing, and its commitAppendToFile() also wrote the parent's queued rows: twice, and an older row could land after the parent's newer one. A child that ends by os._exit, as multiprocessing's fork children do, writes only what it commits or closes. Commit before forking a child that outlives its parent: a parent that ends by os._exit (a daemon's fork) does not write the rows it queued last (known, below). On Python 3.6 children now drop the TSVZ locks they inherit too, as on 3.7 and later since 5.3, so a child's copy of a get_file_obj() handle fails its writes with EBADF there as well; in 5.14 a 3.6 child wrote through it into the file its parent held locked.
  • A signal handler that uses the store inside a set or delete leaves memory and the file agreeing. The handler runs inside the set or delete it lands in and lets go of its lock (5.13); the writer thread could then read the file into memory or clear it, undoing the change in memory while its line was still written, and a loose store's next rewrite lost the set or brought the deleted row back. A set or delete that finds its lock was let go of makes its change again under the lock now, and queues its line again unless it is still the last one queued. When the handler writes the key the set or delete is writing, the set or delete runs after it, and its value is kept (the handler's write came first, as if the handler had run before the set). (A move_to_end has no value of its own: it makes its move again with the rows and in the order memory holds then, so a handler's change of a row, or its own move of another key, stays.) With the handler (a reload(), clear(), a commit, a sync with another process's line, a set or delete) at each step of each set, delete, pop, popitem, move and defaults change: 5.14 left memory and the file apart at 3,650 of 33,054 landings on 3.14 and 570 of 5,810 line steps on 3.6; 5.15 at none. The line is written twice where the handler wrote or queued something after it (known, below). A loose set looks its key up once, so a handler's clear() between two lookups no longer raises KeyError out of it. The check of the lock costs a .tsvz set, delete or pop 1.1 to 2.4% (30 to 50 ns of a 2 µs set, on Python 3.14 and 3.6); a loose set is 4 to 7% faster, from its single lookup.
  • A Ctrl-C at a loop in move_to_end no longer leaves the store's lock held, and one in the wait for the writer thread no longer skips taking its job back (Python 3.12 to 3.14, which leave a loop's back jump inside a try or with block out of the exception table, so a signal landing there skipped the block's exit and its clean-up). Other loops of that shape are left (planned for 5.18, below).
  • Compactions are unchanged: the plan to drop a strict reader's first line of a key where it takes no row between it and its last moved the view of readers given other arguments than the writer's in the random differential (4 of 20,000 .tsv argument sets), so it is deferred again (docs/limitations.md).
  • Everything else runs at 5.14's speed. Commits, empty commits (most of the writer thread's ticks), loads, reloads, clears, one-shot calls, threads, opens, reads and moves each landed within 5.14's own run-to-run spread on Python 3.14 and 3.6, but for an explicit commitAppendToFile() of a .tsvz store with nothing queued, up to about 5% (0.5 µs) slower in one of two runs of 61 rounds, from its job's bookkeeping (the writer thread's own ticks do not take that path).
  • Known (docs/limitations.md):
    • A line can be written twice: by a signal handler that uses the store inside a set, delete or move and wrote or queued something after its lines (35 to 47 per 1,000 landings of a set or delete on 3.14, 174 where the handler rewrites the file, about 30 of a move to the end), and by a commit after close() or in a forked child that a Ctrl-C (or, from 5.17, a handler's sys.exit()) cuts just after its write. A handler's set or delete of another key inside a move to the beginning has every other key's lines written again, so the file can double until its next rewrite, and a handler's clear() inside a move writes its deletion lines twice. The last copy wins; where another process writes one of those keys between the two copies, the older lands last.
    • A forked child writes nothing at its close or exit where its parent held get_file_obj() at the fork (the parent may be waiting for it), and says so, even once both have let go of the file: where the store has rewrite_on_exit or a sync pending, 5.14 wrote the rows there once both had let go (and on 3.14 waited for ever while the parent held the file). Let go of the file (release_file_obj()) before forking; or commit in the child, which writes once the parent lets go of the file (and waits for ever if the parent holds it while it waits for that child; on Python 3.6, 5.14's child wrote there through a copy of the parent's lock). A commit before forking writes none of the child's rows. A child's move_to_end(), or its checkExternalChanges() then rewrite(), waits there too, with monitoring off as well since 5.16, where it follows a change to the file first (as a default child's always did) and the hold keeps that read or its commit out: a hold in 'r+b' or 'wb', any hold where the file lock is a whole-file flock (POSIX systems other than Linux), or rows the child queued itself. On Linux, with none queued, it reads beside the default 'ab' hold and returns.
    • A signal handler that uses the store, landing inside a forked child's own write, waits for ever on the lock that write holds (a child has no writer thread): a handler's commitAppendToFile() or reload() in any child since 5.14, and move_to_end() where the move follows the file first (in a child with monitoring on, and from 5.16 off too): where the file changed since the store last read or wrote it, as it has once the write's bytes are in, or after the parent's write. One that lands before the write changed the file, with no other change to follow, returns, as a handler's set does. (Fixed in 5.17.)
    • A parent that forks and ends by os._exit does not write the rows it queued last: commit before forking.
    • Two signal handler calls that use the store, microseconds apart, the second landing inside the first one's redo, can make a set, delete, pop or move raise IndexError (5.14 never did there) or, rarely, leave a key apart (memory and the file apart at 220 of 53,873 pairs of handler calls; 5.14: 19,094 of 52,102).
  • Planned for 5.18 (docs/limitations.md; planned for 5.17 until 5.17 took its fork and signal-handler group: a forked child that takes none of its parent's duties or single-writer settings, its compressed commits, a grandchild where an ancestor holds the file, letGo(), and a handler inside a closed store's own write): a Ctrl-C caught inside a set, delete, pop or move still leaves that one key apart (memory changed, the line not queued; a move to the beginning, several keys' order), and so does one that follows a signal handler's reload() inside the set; a Ctrl-C at the back jump of other loops inside a try or with block can skip their clean-up on Python 3.12 to 3.14 (a static check comes first); a .tsvz clear() after close() or in a forked child that a Ctrl-C cuts can leave memory empty and the file full; a handler's change of the store inside popitem() or move_to_end() can make it raise StopIteration, RuntimeError or TypeError; a handler's new key, move or followed line inside a set of a new key can leave that key's place in memory apart from the file's; a handler's clear() inside a delete, pop or move of a store with no header can leave the key in the file as a row of the key alone; a # key can leave memory when the store follows another process's change while rows are queued (these three as in 5.14); a TSVZClient with no server, used in a forked child, waits for ever at its first write; a Ctrl-C while the writer thread itself reloads after another process's change waits for that reload; the compaction above; and, in the suite, the Ctrl-C sweep tests' 120 s limit, sized for parallel runs (one timed out at 120 s with four suites of 32 workers on 32 cores, where it takes 13.6 s alone).

Upgrading to 5.14 from 5.13

The file formats are unchanged. An upgrade needs nothing: no file has to be rewritten, and the API is the same.

Deletes and compactions of loose files (.tsv, .csv, .nsv, .psv): what changes is the bytes some of them write. 5.13 writes the same bytes as 5.12 in each of these.

  • A delete under a header keeps the key order where another key's row comes first after the deleted line. Under a header that line 1 is not, after a line 1 of two cells or more, a reader given the header counts from the first keyed line after line 1, and when a delete takes that line out, a stand-in keeps its place ("Upgrading to 5.8"). Where that line had one cell and another key's row with a value came next, 5.11 to 5.13 took a key whose later line holds no value, which comes first to those readers: d\tX\nc\nb\t1\t2\na\n, delete c under q (tsvz --x-header, a handler, a TSVZed delete and commit, TSVZedLite(strict=False)), wrote d\tX\na\nb\t1\t2\na\n, and a reopened store and every loose reader given the header listed a, b where memory lists b, a. That row's key stands in now: d\tX\nb\nb\t1\t2\na\n, and those readers list b, a too; the readers that count from line 1 read the stand-in as the deletion of a key not yet read. No row or cell changes for any reader given no header, the header, or line 1 for its header. One reader given a count sees the stand-in: 3.39's strict readTabularFile(correctColumnNum=1) given no header (or a header and verifyHeader=False), which takes only the one-cell lines of such a file, shows b as [b], as it shows line 1's key where that stands in ("Upgrading to 5.12", first bullet). So do the strict readers of 4.1 to 5.4 given a count of one, which take lines as 3.39's does; 5.5 and later take a wider line and read these files as before. It gains a key the store has and loses none; in a few files it lists its keys in the store's order instead of its own. This widens the approved "3.39's strict reader of a one-column file sees a new row when its last lone key is deleted", from line 1's key to the stand-in's (docs/limitations.md). With no header, or after a line 1 of one cell, where the readers that count from line 1 would read the stand-in as a row, the stand-in is chosen as in 5.13. A store's rewrite after such a delete can refuse to widen line 1 where 5.13 widened: where the stand-in's key has a later row wider than the header (d\tX\nc\nb\t1\t2\t3\na\na\t1\n, delete c under d\tX\tz, then hardMapToFile()), Q-C refuses the widening, warns once and leaves line 1 as the delete wrote it, and every reader but the one given a count reads the file as before the delete (5.13 widened, and readers given no header saw what a widening shows them). A later compaction can also keep a line 5.13 dropped, where 5.13's stand-in key had collapsed with that key's own later line (2 of 6,000 random files through a delete and a rewrite).

  • Line 1's key stands in past defaults lines that hold a value early, and another key's past a reset. 5.12 and 5.13 let line 1's key stand in only where its row came first after the place: with a defaults line between, a key whose later line holds no value stood in, and came first to the readers given the header: d\tX\nc\n#_defaults_#\t\tQ\nd\t1\na\n, delete c under q, wrote d\tX\na\n#_defaults_#\t\tQ\nd\t1\na\n, and a reopened store listed a, d where memory lists d, a. Where no key could stand in, none did, and the readers given the header took their column count from the defaults line: d\tX\nc\n#_defaults_#\tP\tR\nd\t1\n, delete c under q, wrote d\tX\n#_defaults_#\tP\tR\nd\t1\n, and a reopened store read d as [d, 1, R] where it read [d, 1]. The first row after the place is now looked for past defaults lines whose first value is in their second cell, or in their third where line 1 has two cells: every reader that took line 1 takes a line as wide after such a line. d\tX\nd\n#_defaults_#\t\tQ\nd\t1\na\n, and the readers given the header list d, a; d\tX\nd\n#_defaults_#\tP\tR\nd\t1\n, and they read d as [d, 1] (3.39's strict reader given a count of one shows d, as from 5.12 where line 1's key stands in). The search stops at a defaults line without a value (a reset: a strict reader given wider defaults with a value, which takes line 1, would not take a line as wide after it and would lose the key, d\tX\nc\n#_defaults_#\t\nd\t1\na\n still reorders), and at one whose first value comes later: 3.39 cuts a defaults line to its count, so given a count below that value's cell, and defaults whose values lie beyond the count (which made it take line 1), it holds no value after the line, reads strictly and drops a row of another width than its count. A stand-in d for d\tX\tW\nc\n#_defaults_#\t\tQ\nd\t1\t2\n would lose d for 3.39's strict readTabularFile(correctColumnNum=2, defaults=['#_defaults_#', '', 'Q']), so nothing stands in there, as in 5.13. The bullet above looks past every defaults line, a reset too, as its stand-in deletes another key that no reader that counts from line 1 has read: d\tX\nc\n#_defaults_#\t\nb\t1\t2\na\n, delete c under q, wrote d\tX\na\n#_defaults_#\t\nb\t1\t2\na\n and a reopened store listed a, b where memory lists b, a; it writes d\tX\nb\n#_defaults_#\t\nb\t1\t2\na\n now, and the readers given the header list b, a. This also narrows the approved "After a line 1 of one cell, a delete under a header can change a cell for readers given it" (shape 2): d\tX\na\n#_defaults_#\tP\nd\tY\n, delete a under q, wrote d\tX\n#_defaults_#\tP\nd\tY\n, and 3.39's loose reader given q read d as [d, Y] where it read [d]; 5.14 writes d\tX\nd\n#_defaults_#\tP\nd\tY\n, and it reads [d].

  • A compaction moves a key's last line up past a later deletion of it. A scrub, a TSVZed rewrite and a delete's commit move a key's last line into its first line's place where every reader the compaction plans reads the same; where a reader at two columns or more reads the key deleted in between (a lone key is a row at one column and a deletion at two), 5.13 took the move only when the deletion that ends that reader's life of the key was the line moved. A later deletion of the key, with no row of it between, reads the same to that reader, and the move is taken now (not where that reader keeps the later line, which would stay): id\nb\tX\nb\t\nb\t\na\t1\t\tX\na\t2\t\t2\n#_defaults_#\n scrubbed with header a, defaults [#_defaults_#, P, Q] and count 2 writes id\nb\t\na\t2\t\t2\n#_defaults_#\n (5.12 and 5.13 kept b\tX and both b\t lines), and a TSVZed given q that deletes c from d\tX\nc\nd\t1\na\na\n and commits writes d\tX\nd\nd\t1\na\n (5.13: d\tX\nd\nd\t1\na\na\n). Every reader reads both alike. What shows: such files come out of a compaction smaller than 5.13 left them: 15,708 of 1,638,000 scrubs and rewrites of an exhaustive set of small files, and 800 of 36,000 random ones, none larger and no reader's view changed; compacting the output again never grows it.

  • A one-column compaction given a count equal to the defaults' count plans that reader once. A scrub or a TSVZed rewrite of a file read as one column, given defaults of two cells or more and a count equal to theirs, planned the reader at that count twice (the one-column rule and the counts given each listed it). The bytes are the same; the second plan's time goes: a scrub of a 200,000-line one-column file given [#_defaults_#, P] and a count of two takes 0.88 of 5.12's time, a TSVZed rewrite 0.85 (the median of five alternating runs; 5.13 compacts with 5.12's code).

  • The cost of a compaction and of a delete is otherwise unchanged within measurement: a scrub or a TSVZed rewrite of 200,000 rows took 0.99 to 1.04 of 5.12's time in the 5.12 review's shapes, a TSVZed delete and commit 0.98, with the same bytes but for the stand-in; tsvz --x-header q delete where line 1's key now stands in past a defaults line, 0.75 (it no longer looks through the later lines for a key without a value). The peak memory is unchanged: a scrub of a one-column file of 230,002 lines peaks at 175 to 177 MB of resident memory (5.12: 180 to 182 MB, three runs each) and a TSVZed rewrite at 201 to 203 MB (5.12: 201 to 203 MB); with a bare #_defaults_# on line 1, a scrub peaks at 206 to 207 MB (5.12: 206 to 207 MB).

  • Deferred to 5.15: a compaction can keep a strict reader's first line of a key where no other key competes for its place, once (a\na\tX\na\t2\t\na\t\t2\n scrubbed with header id\tv, defaults [#_defaults_#, '', ''] and count 2 keeps all four lines). Every reader reads it alike (deferred again to 5.18: see Upgrading to 5.15). See docs/limitations.md.

  • Known: a program still running 3.39 to 5.2 can cut a wide row when another writer changes its file. A TSVZed of 3.39 to 5.2 open on a file whose line 1 is not its header reads the file again after another process writes it, cuts a row wider than its header to the header's count, and its next rewrite drops the extra cell. Any writer sets it off, 5.13 too; 5.14's compaction writes in a few more files than 5.13's did. Upgrading that program to 5.4 or later ends it (docs/limitations.md).

Upgrading to 5.13 from 5.12

The file formats are unchanged, and no file has to be rewritten.

A Ctrl-C and the writer threads

  • A Ctrl-C no longer leaves a program hanging at exit. A program that a Ctrl-C ended while it wrote to a store could hang at exit, with or without its last write done, until a second Ctrl-C ended it, abandoning what was still queued. In 5.12 a Ctrl-C that ended a loop of store[k] = v on a TSVZed hung the exit in 70 of 960 runs on Python 3.14 and 4 of 960 on 3.6; a .tsvz TSVZed written and committed in a loop, in 27 of 960 on 3.14; a Ctrl-C at the exit while a write waited for another process's lock, about 1 in 250 on 3.6 (5.11 did the same). 5.13: none in 960 runs of each on 3.6 and 3.14, and none in 6,000 runs of the suite's Ctrl-C test on 3.6 and 4,000 on 3.14. The cause was CPython's: a KeyboardInterrupt can land just after a with statement takes its lock, or where the block's exit never runs (bpo-29988), and inside threading.Event and Condition, whose own code holds their lock. The store's writer thread then waited for a lock the main thread had left held, and the exit for the writer. No thread now waits for a lock that the main thread can be left holding: the store's threads signal each other with flags that hold no lock, and the one lock they share is let go of by its holder when a Ctrl-C has left it held. The same holds for a TSVZClient with no handler, whose exit hung the same way, and for tsvz commands.
  • A program that catches a Ctrl-C and goes on keeps writing, and holds nothing back. In 5.12 its next commit could wait for ever (the writer thread waited for the lock the Ctrl-C left held), and a TSVZClient's exit could. A set, delete, pop, move_to_end or setDefaults that a Ctrl-C goes up through now lets go of the store's lock, so another thread's set and a loose store's background appends are not held off until the program next uses the store (of 320 write loops ended by a caught Ctrl-C, the main thread kept the lock in 15 and 17 on 3.6 and in 12 and 2 on 3.14 in two measurements before; now none in 320 on each). Only a second Ctrl-C landing in the clause that lets go, or a hold left in a section that runs in the caller's thread after close() or in a forked child, can leave it. There a Ctrl-C can also leave the store's writeLock held, which nothing lets go of, and the program's next commit or rewrite of that store then waits for ever (a known limitation; 5.12 the same, and in every .tsvz commit), and a .tsvz commit cut there can drop the rows it had taken from the queue (5.12 the same; planned for 5.15; fixed in 5.15: see Upgrading to 5.15). See docs/limitations.md.
  • A signal handler that uses the store no longer hangs a set. A handler that commits (flush on SIGUSR1) or sets a row, or one that calls close() and exits (SIGTERM), runs inside whatever the main thread was doing, a set included. In 5.12 the program waited for ever in 5 to 11 of 40 runs on 3.14 and in 19 to 40 of 40 on 3.6, whichever of the three the handler did; the store's lock now accepts that a handler let go of it, and the set goes on (none in 40 on each). The set or delete the handler landed in then goes on without the lock. When the writer thread reads the file into memory while the handler waits for it (the handler's own reload() or clear(), another thread's reload(), or the sync with another process's write, which follows each commit), a change that the set or delete had made in memory and not yet queued is undone in memory and written all the same. Memory and the file then differ on that one key until the next reload: a row just set is in the file and not in memory, where a del of it does nothing and a loose store's next rewrite takes it out of the file; a row just deleted is back in memory, and a loose store's next rewrite writes it back. In a loop of sets and deletes with a handler about every millisecond: no key in 13,000 sets by the handler on 3.14 and 23,000 on 3.6, nor in 17,000 and 73,000 commits by it with nothing else reading the file; 3 to 6 keys in 1,400 to 2,100 commits while another process appended to the file (3.14), and 1 to 8 in 120 to 430 reload()s by the handler. A handler that sets the very key the set or delete was changing does the same: memory keeps the handler's row, and the file ends with the section's line. A handler that only sets rows of other keys, or sets a flag the main loop acts on, is not affected. Planned for 5.15 (docs/limitations.md; fixed in 5.15: see Upgrading to 5.15). When the writer thread rewrites a loose store's file meanwhile instead, the change is written twice, by the rewrite and by the line queued after it: the last wins, so readers read the same rows, and the next rewrite drops the extra line (a known limitation).
  • Not covered yet: a TSVZClient's lock, a tsvz serve store's and the lock a one-shot call takes on a path (appendTabularFile, scrubTabularFile, clearTabularFile) are not let go of the same way: a caught Ctrl-C that left one held can make another thread of the program that uses the same client, store or path wait for ever (not the exit, except of a path's writer thread). Planned for 5.15 (docs/limitations.md; fixed in 5.15: see Upgrading to 5.15).
  • Not covered yet either: rows that a child fork() made sets on a store it inherited reach the file only through its own commitAppendToFile(): its close() and its exit write nothing, and that commit also writes the rows the parent had queued at the fork (5.12 the same). Planned for 5.15 (docs/limitations.md; fixed in 5.15: see Upgrading to 5.15).
  • TSVZed.shutdownEvent is no longer a threading.Event. It has the same is_set() (and isSet()), set(), clear() and wait(), which behave as an Event's, but isinstance(store.shutdownEvent, threading.Event) is now false, and an Event's internals (_cond, _flag) are not there. An Event holds its lock across Python code, which a Ctrl-C can leave held: see docs/lessons.md.
  • A .tsvz TSVZed's commitAppendToFile(), clear() and reload() run on its writer thread, as a loose store's always did, so a Ctrl-C stops the wait for them, never the write. Each wakes the writer thread, which then also runs its regular sync, as it does after a loose store's job. At exit a .tsvz store with nothing to write (nothing queued, no write under way: a load is no write) is let go of at once, as a loose store is, so a Ctrl-C during a long load ends the program, where it first waited for the whole load (6.45 s after one Ctrl-C on a 1.5M-row store). It still takes up to a second or two on a big store, while the load thread keeps the interpreter busy (a loose store's does too; 5.12's .tsvz load, in the main thread, ended in 0.1 s): planned for 5.15 (docs/limitations.md; fixed in 5.15: see Upgrading to 5.15).
  • A set costs a little more: a loop of 200,000 store[k] = v (15 alternating runs each, medians, a host at a load of 80 to 115) took 1.53 s in 5.12 and 1.63 s in 5.13 on 3.6 (7% more), 0.96 s and 0.97 s on 3.14 (2% more); the noise between runs is about 4%.
  • A .tsvz store's commitAppendToFile() costs what a loose store's does, a round trip to the writer thread: 3,000 sets each committed at once (on tmpfs, medians of five alternating runs) took 0.069 s in 5.12 and 0.109 s in 5.13 on 3.14 (0.084 s and 0.137 s on 3.6), and a commit with nothing queued about 11 microseconds (13 on 3.6) where 5.12 took 0.2. A loose store's commit is unchanged or a little faster.
  • tsvzconform.py: a part replaced twice in a case can no longer pass for the same file (the runner holds each part open through the case, so its inode number goes to no other file), so 19.4-scrub-twice always catches an implementation that renames over the store.

Upgrading to 5.12 from 5.11

The file formats are unchanged. An upgrade needs nothing: no file has to be rewritten, and the API is the same. What changes is the bytes some deletes and compactions write, in loose files only (.tsv, .csv, .nsv, .psv).

  • A delete under a header keeps the key order where line 1's key comes next, as wide as line 1. Under a header that line 1 is not, a reader given the header counts from the first keyed line after line 1, and when a delete takes that line out and the next line has another cell count, a stand-in takes its place ("Upgrading to 5.8"). 5.10 and 5.11 tried line 1's own key last, after a key whose later line holds no value and a key no row with a value names, and the key they took came first to the readers that count from there: d\tX\nc\nd\t1\na\t1\n, delete c under d\tX\tz (tsvz --x-header, a handler, a TSVZed delete and commit, TSVZedLite(strict=False)), wrote d\tX\na\nd\t1\na\t1\n, and a reopened store and every loose reader given the header (a strict one refuses a line 1 that is not it) listed a, d where memory lists d, a. A store's rewrite widens line 1 and puts the order back, but from 5.11 not where the stand-in key's later line is wider than the header (d\tX\nc\nd\t1\na\t1\t2\t3\n): the widening is refused (Q-C), and the order stayed. Line 1's key is now tried first, when its next line comes first after the place and is as wide as line 1: d\tX\nd\nd\t1\na\t1\n, and every reader lists d, a. The same holds where a key whose later line holds no value stood in (d\tX\nc\nd\t1\na\n, 5.11: d\tX\na\nd\t1\na\n). No row or cell changes for any reader given no header, the header, or line 1 for its header. One reader given a count sees the stand-in: 3.39's strict readTabularFile(correctColumnNum=1) given no header (or a header and verifyHeader=False), which takes only the one-cell lines of such a file, shows d as [d] after the delete. In the first file it showed a the same way under 5.11; in the second 5.11 showed it nothing new. It gains a key the store has and loses none (in a few files it lists its keys in the store's order instead of its own); this widens the approved "3.39's strict reader of a one-column file sees a new row when its last lone key is deleted" (docs/limitations.md). Where another line comes first after the place, the stand-in is chosen as in 5.11 and can still come first to the readers given the header. Another key's row first was deferred; 5.14 builds it (Upgrading to 5.14 from 5.13): d\tX\nc\nb\t1\t2\na\n, delete c under q, writes d\tX\na\nb\t1\t2\na\n, and a reopened store lists a, b where memory lists b, a. A defaults line first was deferred too; 5.14 builds it where the defaults line's first value is in its second cell, or in its third where line 1 has two cells. Line 1's key next at another width (d\tX\nc\nd\t1\t2\na\n, d\tX\tW\nc\nd\t1\na\n) is a known limitation: docs/limitations.md.

  • A TSVZed rewrite after such a delete can widen line 1 where 5.11 refused. d\tX\nc\nd\tY\nb\t1\t2\t3\n under d\tX\tz, delete c (tsvz --x-header, TSVZedLite(strict=False) or a TSVZed delete), then hardMapToFile(): 5.11's stand-in was b, whose later line is wider than the header, so the rewrite refused the widening (Q-C) and wrote d\tX\nb\nd\tY\nb\t1\t2\t3\n, and the loose readers given d\tX\tz listed b, d where memory lists d, b. The stand-in is now d, whose later line d\tY is not wider than the header, so the widening loses no key, Q-C's refusal does not apply, and the rewrite widens, as it does for any file: d\tX\tz\nd\tY\t\nb\t1\t2\t3\n, the bytes 5.11 writes for the same file without the deleted line, and every reader given d\tX\tz lists d, b. Readers given other arguments see what a widening shows them ("Upgrading to 5.6"): a strict reader given the old line 1 (d\tX) raises "Header mismatch"; 3.39's loose reader given no header or the old line 1 reads b as [b, 1, 2] where it read [b, 1] (its count follows line 1); a strict reader given no header and defaults of three cells gains d as [d, Y], the padded d\tY\t being as wide as its count. No reader loses a key (Q-C refuses a widening that would lose one for 3.39's strict reader). This is the approved "Readers given other arguments than the scrub's can see a different file after a scrub or a rewrite" (docs/limitations.md). The mirror goes the other way: in d\tX\t\t\nc\nd\t1\t2\t3\na\t1\n under d\tX\tz, delete c, then hardMapToFile(), 5.11's stand-in a let the rewrite widen (d\tX\tz\nd\t1\t2\t3\na\t1\t\n), and 5.12's stand-in d, whose next line is wider than the header, makes it refuse the widening as Q-C says, warn once and write d\tX\t\t\nd\nd\t1\t2\t3\na\t1\n, which every reader given no header, the header or line 1 reads as it read the file before the delete.

  • A compaction keeps what a reader given no header and the defaults takes after a line 1 of one cell. Under a header line 1 does not hold, with defaults of two cells or more, that reader reads at the defaults' count; 5.11 planned it at line 1's one cell unless the caller's own count was one, and a line it takes could go. A scrub given a count: scrubTabularFile(p, header='id\tv', defaults=['#_defaults_#', 'P', ''], correctColumnNum=2) on a\nc\tX\nc\t2\n#_defaults_#\t\t\t\nc\t2\t\nc\t1\n wrote a\nc\tX\n#_defaults_#\t\t\t\nc\t1\n, and a strict reader given no header and those defaults (every version) read c as [c, X, ''] where it read [c, 2, '']. A bare #_defaults_# on line 1, which resets that reader's defaults: a scrub given header='id\tv' and the same defaults, or a TSVZed given them that rewrites, made #_defaults_#\nc\t1\nc\t2\t\nc\t3\n into #_defaults_#\nc\t3\n (the rewrite then adds its defaults line, as every rewrite does), and c, whose only line that strict reader takes is c\t2\t, was gone for it. The reader is now planned at the defaults' count too: the first file becomes a\nc\tX\n#_defaults_#\t\t\t\nc\t2\t\nc\t1\n, the second keeps its lines. It is not planned where it reads every line as the caller's reader does (at the caller's count: a lone key on line 1, or a bare #_defaults_# where no line with a value has another width or the defaults hold none), so those files get 5.11's bytes. What shows: a file it is planned for can come out of a scrub or a rewrite larger than 5.11 left it, by the lines that reader takes, and in about half of those files by a line no reader needs (the compaction is as cautious for it as for every reader it plans): in a fuzz of such files, 103 of 18,000 scrubs and 104 of 18,000 rewrites wrote more than 5.11, 55 and 54 of them with no reader's view changed (the 5.12 review's deeper fuzz: 0.43% to 0.49% of such compactions). Compacting again does not grow them.

  • The cost of a compaction is unchanged within measurement (a scrub or a TSVZed rewrite of 200,000 rows: 0.94 to 1.04 of 5.11's time, the same bytes), but where the reader above is planned: a scrub given a correctColumnNum other than the defaults' count, after a lone key on line 1 under a header line 1 does not hold, took 1.20 times 5.11's time (the same bytes on that file), and a scrub after a bare #_defaults_# on line 1, with defaults that hold a value and a row of another width, 1.14 times (the 5.12 review, the median of five alternating runs).

  • Deferred, and built in 5.14 (Upgrading to 5.14 from 5.13): a compaction can keep a line no reader needs where it moves a key's last line up into its first line's place only from the deletion that ends the other reader's life of the key. A TSVZed delete and commit of c in d\tX\nc\nd\t1\na\na\n, given q, writes d\tX\nd\nd\t1\na\na\n (5.11: d\tX\na\nd\t1\na\n), and every reader reads both alike.

  • Known, as in 5.11 (no layout serves both readers): after a line 1 of one cell, tsvz --x-header H delete followed by a rewrite of a TSVZed given H can change a cell for every reader, and a delete under a header whose line 1 already names the key (d\tX\na\nd\tY\tZ\n, header q) can change a cell for 3.39's loose reader given it. See docs/limitations.md, "After a line 1 of one cell, a delete under a header can change a cell for readers given it".

Upgrading to 5.11 from 5.10

The file formats are unchanged. An upgrade needs nothing: no file has to be rewritten, and the API is the same. What changes is the bytes some deletes and compactions write, in loose files only (.tsv, .csv, .nsv, .psv).

  • A store's own delete keeps its cells after a line 1 of one cell. Under a header that line 1 is not, a TSVZed and a TSVZedLite(strict=False) count from the line after line 1. When a delete takes out the first keyed line there and the next line has another cell count, 5.08 to 5.10 let no row with a value stand in after a line 1 of one cell, and the store, and every reader given its header, read the next row with the defaults of a later line: TSVZed(p, header='id\tv') on id\na\n#_defaults_#\t\tQ\nb\t1\n, delete a, wrote id\n#_defaults_#\t\tQ\nb\t1\n, and b went from [b, 1] to [b, 1, Q]; the store's next rewrite then widened line 1 and wrote b\t1\tQ for every reader, but only when the delete had been committed first. Now b stands in, as it does after a line 1 of two cells or more: id\nb\n#_defaults_#\t\tQ\nb\t1\n; the store and every reader given id\tv read b as before ([b, 1]; 3.39's loose reader, which cuts to line 2's one column, [b] before and after), and a rewrite writes id\tv\n#_defaults_#\t\tQ\nb\t1\n in either order. This is the user's answer to the 5.09 design's question (A). What shows: 3.39's strict readTabularFile, given no header or line 1, which reads that file at one column and drops b\t1, now shows b as [b] after the delete, a key it did not show before (the kind of change "3.39's strict reader of a one-column file sees a new row when its last lone key is deleted" approved). tsvz --x-header H delete and a handler are unchanged: the command reads line 1 as a row, so nothing with a value stands in there.

  • A widening is refused when it would lose a key for 3.39's strict reader. A store given a header that line 1 begins widens line 1 to it at a rewrite, unless the file holds a key whose last line has no value (it would read as a deletion at the header's count). 5.6 to 5.10 let a later line with a value clear that, even when it was wider than the header, which 3.39's strict reader drops: TSVZed(p, header='id\tv') on id\nb\t\nb\t\t1\n, then hardMapToFile(), wrote id\tv\nb\t\t1\n, and that reader, which showed b as [b, ''], lost it. Now line 1 stays one column, with the warning a lone key gives ("line 1 is not widened to the header given") and "Header mismatch" at each open, until a line as wide as the header or narrower gives b a value (id\nb\t\nb\t1\n still becomes id\tv\nb\t1\n). This is the user's answer to the 5.09 design's question (Q-C). What shows: such a file keeps its one-column line 1 and its lines.

  • A set and a delete of a key in a one-column file under wider defaults leave one line again. In a\nb\nc\t1\n opened with defaults=['#_defaults_#', 'P'], a delete of c and a rewrite wrote a\nb\nc\t1\nc\t\n#_defaults_#\tP\n in 5.10, where 5.9 wrote a\nb\nc\t\n#_defaults_#\tP\n: the compaction kept both lines, because 3.39's strict reader given no defaults takes c\t alone at one column, where 5.5's takes both. That delete, then 1,000 rounds of a set, a commit, a delete and a rewrite of a new key, ended at 2,005 lines. A key's lines now become one line also when each strict reader that takes its first line takes its last, and a strict reader that takes the last alone finds no row of another key before it: the moved line is where that reader read the key, and reads as the last line did. 5.11 writes a\nb\nc\t\n#_defaults_#\tP\n again, and the 1,000 rounds end at 1,004 lines. A key whose lines a strict reader reads apart from another key's row stays as it was (a\nb\nc\t1\nd\nc\t\n, where that reader takes d, then c). The c\t line itself stays, as before ("A row deleted from a one-column file under wider defaults or a wider header stays as its key").

  • A compaction applies a #_defaults_# line wider than a reader's count as 3.39 does. 3.39 cuts such a line to its count, fills its empty cells from the defaults before it, and takes the result; when no value is left, it is strict again, and drops a line that is not as wide as its count. The compaction took 3.39's strict reader to stay lenient after the line: a scrub of id\tv\nb\t1\t\nb\tX\nb\t5\t\n#_defaults_#\t\tP\nb\t9\t\n with header='id\tv' and defaults=['#_defaults_#', '', 'Q'] dropped b\t5\t, and that reader given those defaults went from [b, 5] to [b, X]. The compaction now keeps 3.39's defaults cell by cell and applies each such line the way 3.39 does; the file is left as it is. No key was lost (5.9 wrote other bytes and was right only by chance).

  • A correctColumnNum given to a scrub or a TSVZed is planned as a reader. When the header has another width, a file the header makes one column was compacted at the header's width alone: a\nb\nb\tP\t1\na\t1\tP\nb\t1\t2\t3\n scrubbed with header='a', defaults=['#_defaults_#', 'P'] and correctColumnNum=2 lost b\tP\t1, and every reader given that header and count listed a before b. The count given is now one more reader the compaction keeps the lines of (a scrub leaves that file as it is); a TSVZed given a count keeps the lines for readers given its header, defaults and count, though the store itself reads at the file's own count, whatever correctColumnNum it was given. No cell changed (5.9 wrote the same as 5.10). What shows: such files keep a line more after a scrub or a rewrite.

  • The cost of a compaction is unchanged within measurement on a busy machine (a scrub of 200,000 rows: 0.9 to 1.06 of 5.10's time, the same bytes, also with a count and defaults with a value given).

  • Known, as in 5.10 (no layout serves both readers): after a line 1 of one cell, tsvz --x-header H delete followed by a rewrite of a TSVZed given H can change a cell for every reader, and a delete under a header whose line 1 already names the key (d\tX\na\nd\tY\tZ\n, header q) can change a cell for 3.39's loose reader given it. See docs/limitations.md, "After a line 1 of one cell, a delete under a header can change a cell for readers given it".

Upgrading to 5.10 from 5.9

The file formats are unchanged.

  • A compaction keeps what every reader of line 1 takes, also under a header line 1 does not hold. A TSVZed given a header compacts a loose file when it rewrites it (hardMapToFile(), rewrite(force=True), the automatic ones), and so does a scrub given one. When line 1 is not that header (a row to readers given no header, or another program's widening of it), the file is read at two counts: readers given the header (a scrub, a loose readTabularFile, a store of 5.5 or earlier, and a store of 5.6 or later when line 1 is a row) count from the first keyed line after line 1; readers given no header, readers given line 1, and a store of 5.6 or later whose header line 1 widens (it follows the widening, and counts from line 1) count from line 1. 5.6 to 5.9 compacted at one of them, and strict readers at the other lost rows: TSVZed(p, header='id\tv') on id\tv\tw\nb\t1\nb\t\t1\nb\t1\n (line 1 widened by another program), then a rewrite, wrote id\tv\tw\nb\t1\n, and every strict reader given no header (readTabularFile(p), a strict TSVZed, a TSVZedLite, 3.39's), which reads three columns from line 1 and drops b\t1, lost b. The same followed a delete whose stand-in set the store's count: on a\t\t1\na\nb\t\t1\nb\t1\n, a store given id that deletes a and rewrites, or tsvz --x-header id delete and then such a rewrite, lost b for those readers (5.07 to 5.9). Now every line any of those readers takes stays (the first file is left as it is; the second, by the store, becomes a\t\t1\nb\nb\t\t1\nb\t1\n). A file with no header, or whose line 1 holds the header, is compacted for its one count, as before (but see the fourth item). What shows: such files keep more lines after a rewrite, and a rewrite plans each count (a pass that empties no line is the last, and a line with no escape is split without the regex). Rewriting 200,000 rows (median of 5, interleaved runs on a busy machine, so ratios and not seconds): with no defaults, a file compacted by one plan (line 1 holds the header, or no header) takes about 0.6 of 5.9's time, and one compacted by several (a header that line 1 does not hold) about 0.9; with defaults that have a value, one plan takes about 0.8 and a file under a header that line 1 does not hold about 1.5, because each reader is then planned again given none (the third item).

  • A TSVZed delete's commit compacts again. In a loose file of one column a delete is written by its commit, which rewrites the file. 5.9 took out only the deleted keys' lines there, so a store that updates rows and deletes kept every superseded line, and each delete rewrote all of them: 4,000 rounds of an update and a delete ended at 4,056 lines and took 118 s (quadratic; measured with 5.8 and 5.10 on the same busy machine). The commit now compacts, for every count the file is read at (the item above): 56 lines and 38 s, against 5.8's 61 lines and 36 s, and 5.8's losses are not back (id\tv\na\nb\t1\nb\t\t1\n with TSVZed(p, header='id\tv\tw'), delete a, still writes id\tv\nb\nb\t1\nb\t\t1\n, where 5.8 dropped the b\t1 that 3.39's strict reader takes; the next item for the other). A commit compacts with the store's own defaults, as a rewrite does: a reader given other defaults or another header than the store's can see another file after it (see docs/limitations.md, "Readers given other arguments"; 5.9's commit compacted nothing). What shows: comments, empty lines and superseded lines go at a delete's commit (a\n# n\nb\t1\nb\n, delete a, is b\nb\n, 5.8's bytes; 5.9 wrote b\n# n\nb\t1\nb\n). tsvz delete, a handler and a TSVZedLite still take out only the key's lines. The advice to call hardMapToFile() now and then (5.9) is no longer needed.

  • A file read as one column is compacted for the readers given defaults too, and a reader given none is planned at the count it then reads at. 5.6 to 5.9 compacted a file the one-column rule reads as one column (a lone key is a row) for the readers at one column alone. A reader given defaults of two cells or more reads it at their count, and a scrub or a rewrite could drop the row it takes: a\nc\t1\nc\t5\t6\nc\t3\n with defaults ['#_defaults_#', '', ''] wrote a\nc\t1\nc\t3\n (strict readers given those defaults lost c, which read [c, 5, 6]; with ['#_defaults_#', 'P', 'Q'] it wrote a\nc\t3\n, and no reader lost anything); under a header that line 1 is not (c\na\nb\t1\nb\t5\t6\nb\t3\n, header id\tv) the same followed a scrub or a store's rewrite; and a strict store's rewrite of a\nb\t1\nc\t1\nc\t5\t6\nc\t3\n appended memory's row, so readers given no defaults saw c change from [c, 3] to [c, 5, 6]. Separately, a compaction took every reader to be given the store's or the scrub's defaults, at the count they give (the store's own, or line 1's). A reader given none reads at the file's own count, and a strict one takes only the lines as wide as its count (3.39's) or at least as wide (5.5's), where defaults with a value take every line. Two shapes lost rows or changed cells for it: id\na\t\nb\t\nb\t1\n with TSVZed(header='id', defaults=['#_defaults_#', 'P']), delete a, moved b\t1 into b\t's place at the commit and at a rewrite (a rewrite in 5.4 to 5.9, the commit in 5.5 to 5.8; 5.9's commit compacted nothing), and 3.39's strict reader given no defaults lost b; and, with no header, where the store's count comes from its defaults, id\tv\tw\nb\t\t1\nb\t1\t2\nb\t1\n with defaults ['#_defaults_#', 'P'] and a rewrite (c\t\t2\nc\t3\t2\nc\t1\n and a\t1\t2\nk\t1\nk\t3\t4\t5\nk\t6\n the same, scrubbed) changed b from [b, 1, 2] to [b, '', 1] for every strict reader given no defaults (5.5 to 5.9; 5.4 writes other bytes and changes more). Both are readers of the compaction now, each at the count it reads at. What shows: such files keep more lines after a rewrite, and a rewrite plans those readers where the count or the strictness differs (cost, see the first item). A deleted key's value line stays in a one-column file under wider defaults (c\t1 before the c\t that marks c deleted in a\nb\nc\t1\n with value defaults): one more line per deleted key (docs/limitations.md, deferred to 5.11).

  • A key's lines as wide as each other become one line, whatever the count. A compaction moves a key's last line into its first line's place when nothing between them changes how a row reads. 5.5 to 5.9 did so only when both kinds of strict reader (5.5's, which takes a line at least as wide as the count, and 3.39's, which takes only one exactly as wide) took both lines; now also when the two lines have as many cells as each other and a strict reader that takes neither takes no line of the key between them: every reader, at any count and with any defaults, then takes both lines or neither. What shows: a file whose rows are narrower than its line 1 (id\tv\tw\na\t1\na\t2\n under id\tv\tw) compacts to one line a key (id\tv\tw\na\t2\n); a key with a line between them that a strict reader takes, or with lines of two widths, stays as it was (id\tv\tw\na\t1\na\t2\t3\na\t4\n). This is what keeps the first item's files small.

  • Line 1's own key stands in when its next line is as wide as line 1. Under a header that line 1 is not (tsvz --x-header q delete, a handler, a TSVZedLite or TSVZed given q), a delete of the first keyed line after line 1, which a reader given that header counts from, puts a stand-in in its place when the next line has another cell count (5.8): a key no earlier row with a value names. When line 1's row names the only key that could stand in, 5.8 and 5.9 put none, and 3.39's loose reader given q, which counts from that place, read a cell of it again: d\tX\na\nd\tY\n, delete a, was d\tX\nd\tY\n, and that reader went from [d] to [d, Y]. Now line 1's key stands in when its next line comes first after the place and is as wide as line 1: d\tX\nd\nd\tY\n. Every reader of line 1 reads d deleted at the stand-in and takes d\tY back before any other key, and a rewrite keeps that line for them (the first item). When d's next line is wider or narrower than line 1, or another line comes first, nothing stands in, as before (d\tX\na\nd\tY\tZ\n).

  • Still as in 5.9, each planned for 5.11: after a line 1 of one cell that is not the header given, a delete under that header can change a cell for readers given it, and so can the item above when line 1's key's next line is not as wide as line 1; and a widening can lose, for 3.39's strict reader, a key whose only line it takes holds no value. See docs/limitations.md.

Upgrading to 5.9 from 5.8

The file formats are unchanged.

  • A TSVZed delete's commit takes out only the deleted keys' lines, as tsvz delete does. In a loose file of one column a TSVZed delete is written by its commit (commitAppendToFile(), or the writer thread's), which rewrites the file. 5.8 also compacted the file there, at the store's own column count, and so dropped lines that a reader counting from another line takes: id\tv\na\nb\t1\nb\t\t1\n with TSVZed(p, header='id\tv\tw'), delete a, became id\tv\nb\nb\t\t1\n, and 3.39's strict reader given no header, which reads two columns from line 1 and takes only b\t1, lost b. 5.9 writes id\tv\nb\nb\t1\nb\t\t1\n, the bytes tsvz delete and a TSVZedLite write. What shows: comments, empty lines and superseded lines stay until a rewrite you ask for (hardMapToFile(), rewrite(force=True), the automatic ones) or a scrub compacts the file (a\n# n\nb\t1\nb\n, delete a, is now b\n# n\nb\t1\nb\n; 5.8 wrote b\nb\n), as in a file of two columns or more, where a delete is an appended line. A program that keeps one store open on such a file and updates rows or deletes often should call hardMapToFile() now and then: a one-column file whose lines get superseded keeps them until a rewrite, and each delete rewrites all of it (docs/limitations.md, "A delete's commit compacts nothing").

  • A delete under --x-header reads line 1 once. tsvz --x-header H delete and pop, and a handler's delete, pop and popitem, read line 1 twice at two columns or more: now about 5 ms less per delete on a 200k-row .tsv.gz (15.0 ms to 9.4 to 10.2 ms) and 20 to 60 µs less on a .tsv.

  • Still as in 5.8: after a line 1 of one cell that is not the header given, a delete under that header can change a cell for readers given it, and a rewrite that then widens line 1 makes the cell every reader's; and when line 1 holds a value for the only key that could stand in (d\tX\na\nd\tY\n, delete a under q), nothing stands in, and 3.39's loose reader given q goes from [d] to [d, Y] (deferred to 5.10: a stand-in there needs the two-count compaction). See docs/limitations.md, "After a line 1 of one cell, a delete under a header can change a cell for readers given it".

Upgrading to 5.8 from 5.7

The file formats are unchanged.

  • A delete leaves the other rows as every reader read them: no line moves. In a loose file of one column a delete takes the key's lines out (tsvz delete, pop and popitem, a tsvz serve handler, a TSVZedLite delete, a TSVZed delete with its commit or rewrite). When one of those lines set a reader's column count (the first keyed line, and under --x-header H with line 1 not H also the first keyed line after line 1, which a reader given H counts from) and the next line has another cell count, 5.6 and 5.7 moved a row up into its place, and a cell or a key changed for some readers. Now the key of a later row, with as many empty cells as the line had, takes the place (a stand-in), and every other line stays where it was: a\n#_defaults_#\t\tQ\nb\t1\n, delete a, becomes b\n#_defaults_#\t\tQ\nb\t1\n (5.7: b\t1\n#_defaults_#\t\tQ\n, where a TSVZedLite then read b as [b, 1, Q]). A stand-in reads as nothing to every reader: at two columns or more it is the deletion of a key not yet read, at one a row the key's own later line replaces. Under --x-header id, a\nb\t1\n becomes b\nb\t1\n (a reader given id read b before and still does), id\tv\n# n\n with zz deleted is left as it is (5.7 wrote zz, a row to that reader), and when the next line has the same cell count a bare # keeps line 1's place (a\nb\n becomes #\nb\n).

    What shows: a file can hold a key twice after a delete (the stand-in and the key's own line), so a store that reads it is dirty; readers that keep the file's order list that key earlier; a TSVZed's memory keeps its order (5.7 moved the row to the front), and a one-column store keeps one column (5.7 took the count of the row it moved up); where no stand-in can take the place of the line that set the count (after a line 1 of one cell, below), a TSVZed reads the file again once its delete is written, so its memory holds what a reopen reads (with a header given: x\na\n#_defaults_#\t\tQ\nb\t1\n, delete a: b is [b, 1, Q], as the file now reads it; with no header b stays [b, 1]). Under --x-header H with line 1 not H, the command now rewrites the file where 5.7 appended a line, when a reader given H reads at one column. Two shapes are left where a reader given H can see a cell change: after a line 1 of one cell, and d\tX\na\nd\tY\n with a deleted under header q (every key that could stand in is already named by a valued row before the gap, so only 3.39's loose reader given q changes, from [d] to [d, Y]): see docs/limitations.md, "Readers given other arguments" and "After a line 1 of one cell, a delete under a header can change a cell for readers given it" (deferred to 5.10). A 3.39 strict reader of a one-column file still sees a new row when the last lone key is deleted and only wider rows are left (a\nb\t1\n, delete a: it showed a, then shows b), as with 5.6; upgrading that reader cures it (docs/limitations.md).

  • A store emptied after a rewrite follows another process's append at the count its file says. After a rewrite, a store whose rows were then all deleted read the next append at its header's count where a reopen takes the file's (# n\n under header='id\tv', a row a\t\t1: an appended b\t2 read as [b, 2] at two columns, where a reopen reads three).

  • A rewrite with a queued one-column delete decides on the lines the delete leaves, and a delete's own commit widens nothing. TSVZed(p, header='id\tv') on id\n# n\na\n, del t['a'], then hardMapToFile() or rewrite(force=True) left id\n in some runs and id\tv\n in others, by whether the writer thread's tick had committed the delete first: the widening was decided with a's lone line, a row the widening would lose, still in the lines. A rewrite asked for now decides on the lines as the queued deletes leave them, stand-ins included (the same drop the commit makes), so line 1 widens to the header (id\tv\n, 60 of 60 runs in each order) when nothing that reads as a row with no value is left, and the file reads the same whichever came first, except after the shape in docs/limitations.md, "After a line 1 of one cell, a delete under a header can change a cell for readers given it": TSVZed(p, header='id\tv') on id\na\n#_defaults_#\t\tQ\nb\t1\n, delete a, commit, then a rewrite writes b\t1\tQ, where with the delete still queued when the rewrite runs b reads [b, 1]. (The 31 header-less cases where everything is deleted write '' or \n, and every reader reads them the same.) Under id\tv\tw, id\tv\na\nb\t\n with a deleted was written id\tv\tw\nb\t\n when the delete was still queued, losing b; it is now id\tv\nb\nb\t\n in every order. A delete's own commit (commitAppendToFile(), or the writer thread's) never widens line 1 (5.6 and 5.7 widened it in some files: id\tv\na\na\t1\n under id\tv\tw, delete a, became id\tv\tw\n, which changed what a reader given that header saw), so the file's other readers read line 1 as before; the next rewrite asked for widens it.

  • checkExternalChanges() asks the file every time. It returned at once while the store had already noted a change, and the writer thread could be following the file just as another process's append landed, then mark it seen on the bytes it read: the append showed only after the next change (3 to 9 of 7680 runs of a follow sweep on a disk; 0 of 30,720 now). A call while a change is noted now costs what any call costs (about 30 us, where it returned in 0.1 us).

  • Every writer pads an appended row to the cells line 1 counts. On a file whose line 1 holds the header given or widens it and ends in empty cells (id\tv\tw\t, a spreadsheet export with an unnamed last column), TSVZedLite(strict=False), tsvz --x-header 'id\tv' set, a handler and appendTabularFile(header='id\tv', strict=False) appended c\t4\t5 (with strict=True a header that line 1 only widens raises "Header mismatch" there, in every version), which a strict reader given no header, counting line 1's four cells, dropped. Each writer, TSVZed included, now pads a row that holds a value as wide as line 1 is, empty cells at its end counted (c\t4\t5\t), by one rule. A deletion line is not padded to it: each writer writes the line it wrote in 5.7, which a reader counting cells the spec's way (tsvz-rs) reads as the deletion it is. TSVZed already did this for a widened line 1 in 5.7; it now also does it for a line 1 that is the header with empty cells after it (id\tv\t\t).

Upgrading to 5.7 from 5.6

The file formats are unchanged.

  • A program no longer dies at exit beside a store's writer thread, unless nobody reads its stdout. A TSVZed's writer thread, a daemon, could be inside a print as the interpreter ended, and the program then ended with Fatal Python error: _enter_buffered_busy and exit status 134 (no row was lost). Now the exit waits for a print under way, up to 5 s, and from then to the interpreter's end that thread writes what it has to say straight to file descriptor 2: not to sys.stdout, sys.stderr or a teeLogger. That helps a reader that is slow but still reading. A verbose store whose stdout nobody reads (a full pipe, a stopped reader) either still ends with that error, now after about 7 s (2 s at 5.6), or, when the writer thread is inside a print just as the exit starts, makes the exit wait with no limit until something reads stdout (a second Ctrl-C abandons the write in progress, as on any exit); 5.6 does the same. No row is lost. See docs/limitations.md.

  • On Python 3.6 a Ctrl-C at exit no longer drops a queued row. One that landed as the exit's wait took its lock back came out as "Failed to stop append thread ... release unlocked lock", and the program ended without the row, or hung; it now reads as any Ctrl-C at exit does. The same holds for a Ctrl-C during any other wait for a store's writer thread (a checkExternalChanges(), rewrite(), clear() and the like): a KeyboardInterrupt where 3.6 raised RuntimeError: release unlocked lock. A RuntimeError of another kind is raised as it is.

  • "External changes detected" and "Time anomalies detected" print only with verbose=True. They printed to stdout at every change another process made, whatever verbose said. A program that read them needs verbose=True. Warnings and errors print as before.

  • A strict store follows a widened line 1 with a byte order mark or empty cells at its end. \ufeffid\tv\tw and id\tv\tw\t under header='id\tv' raised "Header mismatch", though a rewrite widens such a line 1 the other way. One rule now answers both, and the line stays as it is in the file. A loose store reads such a file padded, as wide as line 1 counts its cells, empty ones at its end too (id\tv\tw\t is four columns wide), where it took its count from the rows; a row it adds is written that wide, so a strict reader given no header keeps it.

  • A store that holds no row reads what another process appends as a reopen does. The count comes from the first keyed line: id\n under header='id\tv', then another process's a\n, shows a (it read as a deletion, and memory stayed empty). Each change is read whole only while the store holds no row and the last whole read took no column count from the file (no keyed line yet, or a file emptied at one column); with a count or a row, only what follows is read, as before. A store's own whole write that leaves it with no row (clear(), or a rewrite of a store whose rows were all deleted) is followed the same way, and the store then takes the column count and the rows a reopen would from the file it wrote, so a row set after the clear is shaped at that count. This costs a few reads of the file. One visible change: under verifyHeader=False, the header line a clear writes is then held as a row, as a newly opened store holds it, so len(t) is 1 after clear() where 5.6 gave 0.

  • "Header mismatch" is said once for a line 1, across all of a store's reads. A TSVZed whose line 1 is not its header used to say it at every whole read of the file (46 times for 45 appends beside it); it now says it once for that line 1, an explicit reload() included, and again if line 1 becomes another line. A strict store still raises at every read.

  • Deletes write what 5.6 writes. tsvz delete, pop and popitem (with or without --x-header, --x-strict or --x-defaults), a tsvz serve handler, a TSVZedLite delete and a TSVZed delete with its commit or rewrite leave the same bytes as in 5.6, but for a TSVZed on a file whose line 1 starts with a byte order mark (it now writes what 5.6 writes for the same file without the mark) or ends in empty cells (it now writes its deletion lines and padded rows as wide as line 1 counts its cells: see the item above). So what 5.6 gets wrong in a loose one-column file stays for this version: a row moved up to keep a reader's column count can change a cell or a key for some readers. 5.8 moves no line: see Upgrading to 5.8.

Upgrading to 5.6 from 5.5

The file formats are unchanged.

  • The readers take text defaults, and leave the caller's list alone. readTabularFile, readTSV, scrubTabularFile and scrubTSV split defaults= given as text as TSVZed does (they took it as a sequence of characters, one cell each). They read a copy: the file's #_defaults_# lines no longer go into the caller's list, of a .tsv or a .tsvz file, so a second read with that list reads as the first did. To know the file's defaults, open a TSVZed and read .defaults. A list that does not start with #_defaults_# still differs: a reader takes its first cell for the key's column (['', 'X'] fills cell 1), as every reader since 3.39 has, and TSVZed puts #_defaults_# in front of it (['', 'X'] fills cell 2).

  • rewrite(force=True) always writes. On a clean store it returned True and wrote nothing, so a row changed in place (t['a'][1] = 'X', which does not make the store dirty) was gone after close(). It now writes as mapToFile() does, and compacts the file, whatever dirty says. rewrite_on_load=True and rewrite_on_exit=True do the same, each at its one moment, with one exception: over damage in a compressed file that no row was written after, they leave the file as it is, since the bytes past the damage hold rows no read reached (rewrite(force=True), mapToFile() and hardMapToFile() write there too). A program that called rewrite(force=True) only to follow another process's change now pays a whole rewrite for it: rewrite() follows it and writes nothing. rewrite_interval still writes only a dirty store. A .tsvz still ignores all of these. A store that has deleted no key and changed no row it held (setting a new key leaves dirty False: the writer appends it, and it is in the file) takes in another process's change before it writes, also with monitor_external_changes=False (which is for overwriting what the store changed itself: a row another process appended is kept, not deleted), and one given createIfNotExist=False makes no file where there is none (a row set makes it, as before). A writer that takes no lock (a shell >>) can still lose rows to a rewrite (entry): at 10 Hz on 10k rows 229 of 1174 appended rows were lost.

  • A one-column store stays one column when another process empties its file. Its column count was lost, so the next one-cell set acted as a delete and the write was gone. The count now holds until a line in the file says otherwise; a lone key in a store of two columns or more emptied this way stays a delete.

  • tsvz delete and TSVZedLite delete in a one-column file. tsvz delete FILE b on a\nb\nc\n exited 0 and appended b, a row there; TSVZedLite's del did the same, and tsvz serve. delete, pop and popitem of a tsvz command, a handler or a TSVZedLite now take the key's lines out, as TSVZed does: the file keeps its one column (a row that must move up, because it is narrower than the first line left, moves with the cells it read, and the other rows read as before) and only those lines go, the rest copied as they are. Each delete there is a whole rewrite, and TSVZedLite then reads the file again for its offsets, as a fresh open would; at two columns or more a delete is still one appended line, after a look at the file's first lines under the rewrite lock (29 us on a .tsv of 200k rows or 2M, 2.5 ms on a 200k-row .tsv.gz of one member). A file with no keyed line yet and no header of two columns or more takes no line either: a delete used to write the lone key, which then read as a row, and it now writes nothing (a store that did not exist is still created; under --x-header with two columns or more a lone key is a deletion, and id\tv\n becomes id\tv\na\t\n). The file's own lines decide this, never the defaults a command is given: tsvz delete --x-defaults 'K\tP' F b takes b's line out of a\nb\nc\t1\n, and in a file with no keyed line it writes nothing. The delete reads the file under the rewrite lock it writes under, as TSVZed does, so a writer beside it neither makes it fail nor loses its rows (it failed at every try beside an appender at 200 Hz); TSVZedLite changes its memory only once the file is written, so a delete that fails (an OSError) leaves the key where it was. A damaged file that cannot be read gets the line, as before, and a warning on stderr: in a file of one column the line deletes nothing.

  • A rewrite keeps the lone keys of a one-column file under defaults of two cells or more. a\nb\nc\n opened with defaults=['#_defaults_#', 'P'] read as {} and any rewrite left a\n#_defaults_#\tP\n: b and c were deleted as deletion lines at the store's width, with no output. A file is now compacted at its own width: its header's when line 1 holds it, else one column when line 1 is one cell, else its first keyed line's. So it stays one column, keeps every key (a\nb\nc\n#_defaults_#\tP\n) and gets the defaults line; a plain open reads the same keys before and after, on every route (mapToFile(), hardMapToFile(), rewrite(force=True), rewrite_on_load, rewrite_on_exit), and so does a scrub. The same holds under a wider header: id\na\nb\n with header='id\tv' and those defaults keeps a and b, and id\na\t1\nb\n with that header keeps b. The store itself still reads none of the lone keys its width makes deletions, and the file does not widen to the defaults or to a wider header until every row holds a value (entry). A row with a value that such a store deletes stays in the file as its key and an empty cell (entry).

  • TSVZedLite knows a one-column file from its load. So a one-cell row is a row there (it was a delete of a key it did not hold), and a row read at its offset has its cell (t['a'] read as []).

  • A rewrite widens line 1 to the header the program gives. A program that adds a column (line 1 id\tv, header='id\tv\tw') no longer has to edit line 1 by hand: a TSVZed rewrite of any kind (mapToFile(), hardMapToFile(), rewrite(force=True), the automatic ones, and one that makes a removed or damaged file again) writes the header as line 1, pads every narrower row and #_defaults_# line to it, and the store's rows and column count follow at once, so t['a'][2] holds '' (a default the file already holds for the new column, if it has a #_defaults_# line that reaches it, is what a row below that line reads; the rows above it read '') and the "Header mismatch" at each open ends. The padding is the one thing besides dropping lines that a rewrite does to a line: without it a strict reader, which drops a narrower line, would lose the rows. The rule is exact: line 1 must be the header's beginning, the same cells without the whitespace around them, and fewer of them. idaho\tvalue, which the read's looser check takes for id\tv, stays, as does a line 1 that is a row, or one wider than the header (writes never cut), and a header given with verifyHeader=False. A strict TSVZed takes a line 1 that extends its header (the same leading cells, then named ones) for another program's widening, at open and whenever it follows the file, and its column count becomes the wider header's; it used to raise "Header mismatch" and stop following. It reads the rows of such a file loose, padded, what another process appends to it too, and a rewrite leaves the rows and the file's defaults lines as they are, adding only the store's own defaults if it was given others (a strict read dropped every row narrower than the new count, and a rewrite then deleted them). Its sets that are narrower than the file are padded and written, where a strict store that never met a widening still refuses them. Each whole read decides this afresh: once line 1 no longer extends its header, such a set is refused again. A wider row or a header-less file is no widening. Any other line 1 that is not its header is refused as before. A program still on the old header then sees "Header mismatch" in its turn, and a strict reader given it raises; it does not narrow line 1. A one-column file with a row that holds no value is not widened, with a warning, and keeps every row: a lone key is a deletion at two columns or more, so widening would delete it. A key's earlier line with no value does not count when a later line gives the key one; that key then moves after the rows between its two lines, no value lost (id\nd\na\t1\nd\tx\n under header='id\tv' becomes id\tv\na\t1\nd\tx\n). A scrub still never changes line 1.

Upgrading to 5.5 from 5.4

The file formats are unchanged, and a 3.39 host still reads every .tsv-family file 5.5 writes.

  • TSVZed no longer rewrites a .tsv-family file when it opens it. rewrite_on_load now defaults to False, as rewrite_on_exit and rewrite_interval already did; 5.4 rewrote a legacy file at open only when it held a superseded line (a key restated with another row, a deletion of a live key). Compact a file explicitly: call mapToFile() or hardMapToFile(), or scrub it (scrubTabularFile, tsvz scrub), or pass rewrite_on_load=True. A store still makes again a file that is damaged or removed, since its memory is then the only copy. The three automatic-rewrite options (rewrite_on_load, rewrite_on_exit, rewrite_interval) are planned to be removed in a future version in favour of those explicit calls.
  • Nothing else rewrites a file unless the program asks. A store that follows another process's change no longer rewrites the file at its next tick because it holds changes of its own; rewrite() without force=True only follows such a change, and rewrites when rewrite_interval says so. A rewrite happens on mapToFile() and hardMapToFile() (always), on rewrite(force=True) and the options above set explicitly (in 5.5 only when the store is dirty: dirty is True for a key restated with another row or a deletion of a live key; from 5.6 rewrite(force=True), rewrite_on_load and rewrite_on_exit always write, see Upgrading to 5.6), and on its own in two cases: making again a damaged, removed or emptied file, and the next commit after a delete in a one-column store (below).
  • move_to_end appends instead of rewriting. t.move_to_end(k) appends k's deletion line, then its row, so every reader sees the new order at once; it no longer turns on the rewrite at exit or warns "Need to resync", and it refuses a row the encoding cannot hold when called. last=False cannot be an append for one key: it moves every other key to the end instead, two lines for each, until a compaction takes them out. A key whose row holds no value moves in memory only. In a one-column store a move is a delete (below) and an append. A move follows another process's change to the file first, so the rows it appends again do not undo it; a write that lands between the move and its commit (one tick) can still lose, as any queued line can (limits).
  • Rows wider than the file's column count are read whole. readTabularFile (also lastLineOnly), read_last_valid_line, TSVZed, TSVZedLite, tsvz read/get and their table output, and tsvz serve: a row is padded to the column count as before, and only its empty cells past it go (a\t1\t\t at two columns is [a, 1]); 3.39 to 5.4 cut it, and a scrub or rewrite then erased the cells (and a row whose cut left only empty cells became a deletion). len(row) can now exceed the header's width; a correctColumnNum= a caller gives no longer cuts. A program that adds a column sees it. While 5.4 and older processes share the file, they still see such rows cut, and their scrubs and rewrites still erase the cells: upgrade every process that rewrites the file.
  • A shorter #_defaults_# line keeps the defaults before it for the cells it lacks. #_defaults_#\tX\tY then #_defaults_#\tZ leaves Z, Y in effect (5.4: Z and, past the column count, nothing).
  • TSVZed reads a one-column file as readTabularFile does: lone keys are rows (3.39 to 5.4 showed it empty, and the next rewrite erased the keys). A del (or pop, popitem) in a one-column store appends nothing (a lone key would read back as a row there). The next commit (the background writer's next tick, commitAppendToFile(), close()) compacts the file with that key's lines left out: for 100,000 keys about 1 s and 23 MiB (Python 3.14), once per commit however many deletes it holds, so a program deleting in a loop in such a file pays that once per append_check_delay. Until then the key stays deleted for the store: a reload, or following another process's rewrite, leaves it out. A write another process makes after that commit stays; one that lands before it loses to this store's delete, as a queued deletion line does at two columns or more. While that rewrite is refused (a row changed in place to text the encoding cannot hold), the store's later writes wait behind it; close() appends them and reports the delete as not written. The file keeps its one column: when taking a key's line out would leave a wider line first, the next one-cell line moves up into its place, so that key's position changes. With no one-cell line left, the narrowest line moves up and the file now reads at that many columns (a line with no value moves up as the key alone).
  • setDefaults() can change a header-less store's column count. Defaults of two cells or more set the column count a reader takes, so defaults with another cell count change how the file reads: a reader pads the rows narrower than that and fills them with the defaults, and a strict reader's check moves with them. The store itself leaves memory's rows as they are and does not change the file at the commit. In a one-column file the lone keys are deletions at two columns: a store opened with such defaults, or given them by setDefaults() and then reload(), does not hold them, where a plain open does. 5.5 took all but the first lone key out of the file at any rewrite of that store, with no output (defaults=['#_defaults_#', 'P'] on a\nb\nc\t1\n: hardMapToFile() left a\nc\t1\n#_defaults_#\tP\n); from 5.6 the file stays one column and keeps every key (a\nb\nc\t1\n#_defaults_#\tP\n: a rewrite compacts a file at its own width, its first keyed line's, never at the store's). 5.4 did worse: its TSVZed read such a file as {} with no defaults at all, and its rewrite took out the first lone key too. The last setDefaults() wins, and is what a whole reload starts from. A rewrite changes nothing this store's reader reads, except what memory changed; pass the same defaults to every reader of the file, as text or as a list that starts with #_defaults_# (from 5.6 those read alike; a list that does not start with it does not: see Upgrading to 5.6) (entry).
  • A cell that is whitespace once unescaped (<LF>) is still filled with the defaults when a TSVZed loads it (as 5.4): only the cells its right-strip empties; id\tv\n#_defaults_#\tNA\nk\t<LF> loads [k, NA].
  • Writes never cut a row. TSVZed[k] = row, TSVZedLite[k] = row, appendTabularFile, appendLinesTabularFile, tsvz set/append and the handler pad a shorter row and keep a wider one (dropping only empty cells past the count), so every cell written is checked against the encoding.
  • Strict reads and stores take a wider row whole. A strict read (readTabularFile's default, TSVZedLite, a strict TSVZed, --x-strict) drops only a line narrower than the column count (unless defaults with a value are in effect there, as before), and takes a wider one whole; 3.39 to 5.4 dropped every line of another width. A strict TSVZed or TSVZedLite refuses only a row narrower than the column count, judged after its empty cells past the count are dropped (['a', '1', ''] fits two columns), and keeps a wider one.
  • TSVZed.correctColumnNum after a load is the column count the read took (the header's, the defaults', or the first keyed line's), not the first row's length, which a wider row can now exceed.
  • TSVZed(correctColumnNum=N) no longer pads. The store's column count is the one the read takes (above), whatever N says. In 5.4 a loose store padded every row to an N above the file's width (N=5 wrote a\t1 as a\t1\t\t\t), but a strict one refused those rows: memory was empty and a rewrite emptied the file. An N below the file's width cut rows in memory at the open and in the file at a rewrite in a loose store (N=1: a\t1 to a; N=2: a\t1\t2 to a\t1) and emptied the file in a strict one. 5.5 does neither. A program that relied on N to pad its rows gives defaults with N cells, counting the #_defaults_# key (['#_defaults_#', '', '', '', ''] for 5; ['']*5 collapses to no defaults), or pads them itself. A header= that line 1 holds sets the width instead. readTabularFile(correctColumnNum=N, strict=False) still pads to N; a strict read takes N as its column count (strict reads, above).
  • A scrub compacts by dropping lines. scrubTabularFile, tsvz scrub and a handler scrub drop comments, empty lines, superseded lines and dead keys' lines, and keep every other line byte for byte where it was. A #_defaults_# line the same as the one before it, with nothing between them changing the defaults, goes too. The exceptions: a key's last line can move up into its first line's place (the key then is one line: when no defaults line lies between them, or when the last line is exactly as wide as the column count with a value in every cell, so no defaults reach it), a dead key's line that readers take their column count from is kept emptied (a\t for a\t1), and a header you pass with verifyHeader=False is added as line 1 when the file's line 1 is not it. Otherwise line 1 never changes (tsvz scrub --x-header no longer puts an empty line first: no row can move onto line 1), the #_defaults_# lines stay where they are (5.1 to 5.4 moved them and wrote resets), the caller's defaults are never written into rows, a strict scrub writes what a loose one writes and keeps the lines strict drops, and text the encoding cannot hold no longer refuses a scrub (its bytes are copied). A file whose keys were all deleted keeps its line 1, and in a header-less file one emptied line where needed, the same size after every scrub (5.2 to 5.4 shrank it to the bare header). A scrub ends the file's last line with a newline, and writes the file again even when it drops nothing (a compressed one is recompressed), as before.
  • A TSVZed rewrite of a healthy file compacts it the same way and appends what memory adds: the store's defaults when the file does not already end with them (a line as wide as the column count, with a bare #_defaults_# reset in front when one line cannot say them, or the reset alone when the store has none and the file ends with some; neither when the store's own reader would not take it), then rows memory holds that the file does not read the same (changed in place, put in memory directly; a row with an empty cell the defaults in effect would fill goes between a reset and those defaults again; a row narrower than the column count is padded to it, so a strict reader takes it), and deletion lines for keys memory no longer holds. Only a file that is damaged, missing or empty is written from memory, and it keeps its reading: a header-less store writes first the first row memory holds exactly as wide as the column count (moved to the front), or at two columns or more with no such row, a #_defaults_# reset padded to that width; rows with an empty cell the defaults would fill go after a reset, and the store's defaults line goes after the rows (before them, in a one-column file, it read as the file's column count and every key read as a deletion). Every rewrite is written whole: mapToFile() no longer rewrites in place, which padded a shorter line with spaces. It no longer writes its header over a line 1 that is not that header (5.4 did, and a reader given no header lost the row line 1 was); such a file keeps warning "Header mismatch" until it is fixed. It no longer refuses a rewrite for a row it read but cannot encode again; only rows memory must write are checked. Its #_defaults_# lines are kept, so a program that sets t['#_defaults_#'] over and over keeps a line for each change (5.4's rewrite collapsed them). It costs a second parse of the compacted lines (one flag per key, not the rows): for 100,000 two-cell rows with one changed in place, hardMapToFile() peaks at 25 MiB and takes about 0.8 s, where 5.4 peaks at 19 MiB and takes about 0.2 s (Python 3.14). A scrub of that file takes about 0.6 s (5.4: 0.5 s).
  • A whole reload starts from the defaults and column count the program gave. A TSVZed that follows another process's rewrite (any rewrite, not an append) now reads the file as its constructor did (or with the defaults of its last setDefaults()), not with the defaults its last read ended with. Release note: a TSVZed of 3.39 to 5.4 that shares a file with any process that rewrites it (a scrub, another TSVZed's periodic or open-time rewrite) can misread a file whose meaning depends on its defaults (a bare #_defaults_# first line, defaults the program gives): #_defaults_#\na\tX\nb read with defaults ['', 'P'] shows {a: [a, X]}, and 5.2 showed {} after following such a rewrite. Upgrade those processes. A setDefaults() made during such a read stays: the read no longer puts back the defaults it started with.
  • Readers given other arguments than the scrub's can see a different file after a scrub or a TSVZed rewrite: see docs/limitations.md.
  • A file whose first keyed line is a bare #_defaults_# reads as one column without defaults: pass the defaults the file's program uses (docs/limitations.md).
  • A TSVZed given a header that line 1 is not takes its column count as readers do: from the defaults when they have two cells or more, else from the first keyed line; with no keyed line yet, the header's, even with wider defaults (it took the header's, and a delete in a one-column file was written as a row). A .nsv file's compaction keeps the empty cells at the end of a line, which its reader keeps (it took them off and could drop a row).
  • Known limitations of one-column files and moves (each has an entry in docs/limitations.md):
    • a delete in a one-column file can undo another process's write that lands just before it (entry);
    • deleting many keys of a big one-column file rewrites it once per commit, about 1 s at 100,000 keys (entry);
    • a store emptied at one column and then given a wider row first loses the lone keys after it: t['x']=['x','1']; t['y']=['y'] reopens without y (entry);
    • repeated move_to_end of a row read before the defaults grows the file (entry);
    • a wider row that a move writes again is lost to 3.39 to 5.4 strict readers (entry);
    • a one-column delete rewrites the whole file (entry);
    • a file of lone keys does not widen to a wider header or defaults: every key stays, and a store given such defaults reads none of them (entry).
  • A late setDefaults() on a file whose first keyed line has one cell grows it at each rewrite (a bare #_defaults_# or a lone key, and a row with an empty cell the defaults fill): 28 bytes per hardMapToFile() with one default. Reads do not change (entry).
  • A header wider than the file's line 1 is not written into line 1 (5.4 widened it at a rewrite, and from 5.6 a rewrite does again, see Upgrading to 5.6). A program that adds a column to its header finds that 5.5 keeps the file's width: "Header mismatch" prints at every open, and rows already in the file (and rows whose last cell is empty) raise IndexError on the new column. Nothing is lost.
  • move_to_end follows the file first, so it waits while another process holds the file's lock and slows beside a busy writer (100,000 rows and a writer at 20 Hz: 28 moves/s, 5.4: 1.2 million), and it raises KeyError for a key another process has deleted, as its docstring says (5.4 succeeded) (entry).
  • A running TSVZed can miss a same-size change by a writer that takes no lock (another tool, TSVZ before 5.1): memory stays stale until the file changes again. TSVZ's own writers were not exposed where readers take the read lock (entry).

Upgrading to 5.4 from 5.3

The file formats are unchanged.

  • A compressed .tsv-family file is read member by member, each member once its check passes. readTabularFile, scrubTabularFile, clearTabularFile, TSVZed, TSVZedLite, openFileAsCompressed() for reading, get_file_obj('rb'), the CLI and tsvz serve read a .gz, .bz2, .xz or .zst file so. Python's codec readers hand a member's text over before they check it: a member cut short by a writer killed mid-append, once another member was appended after it, could end its last line with a garbage value (gzip, more rarely bz2 or xz), which a TSVZed then wrote back. Now:
    • a member cut short is left out whole, also when it is the last one (5.3 and earlier kept the whole lines it decoded): its writer was never told those rows were saved. A .tsvz part still keeps a cut member's whole lines, as spec §16.6 says, so the two differ there.
    • after a member cut short that is not the first, the members after it are read, where 5.3 and earlier stopped at it, so the appends that followed a killed append are read. A TSVZed that read it makes the file again at its next write, without the cut member.
    • a first member cut short stops the read, as before, and now gives none of its rows (5.3 and earlier handed over the lines gzip decoded of it): a whole rewrite killed in its first member leaves the old file's bytes after it, whose rows are as they were before the rewrite (deleted keys too). Its line 1 is not taken unchecked either: an append that checks the header (tsvz set --x-header, appendTabularFile with a header) raises and writes nothing, and a scrub or clear makes the file again. A rewrite killed inside a later member's write of a multi-member file is not told from a killed append (docs/limitations.md).
    • a member that fails its check gives none of its rows (5.3 and earlier used them, then stopped).
    • other damage stops the read there, as before: bytes that do not decode, also after a complete .bz2 or .xz stream, which 5.3's and earlier versions' readTabularFile (and so a scrub, a clear and tsvz serve's reads) passed over silently, where a TSVZed already reported them; xz stream padding (zero bytes after a stream) is not damage.
    • the damage warning names each member left out and where it begins.
    • a member's text is held until its check passes: TSVZ writes at most 1 MiB of text a member, and a file another tool compressed whole is one member, held whole while it is read (the read builds the rows from it anyway). A read of line 1 alone (an append's header check, a clear, a scrub) decodes the first member in pieces and keeps only that line until the member's check passes. It takes the read lock (5.3), so it waits out another process's rewrite rather than reading a first member it has half written.

Upgrading to 5.3 from 5.2

The file formats are unchanged, and a 3.39 host still reads every .tsv-family file 5.3 writes. What changed is how the file is locked.

  • Readers wait while another process rewrites the file. readTabularFile, tsvz read and tsvz get, a TSVZed's load, reload() and background read, TSVZedLite's load and a tsvz serve handler's reads of a .tsv-family file take a shared lock while they read, so a rewrite another process (or thread) holds the file's lock for (a TSVZed rewrite, a scrub, a clear) is waited out, never met part way. The wait is as long as the rewrite holds the lock, and Ctrl-C ends it; a writer stopped with Ctrl-Z stalls them until it continues. This is what makes a del during another process's rewrite land: 5.2 and earlier could read the file part way, find no key and write nothing, so the key came back once the rewrite ended.
  • Linux: a read also waits for an append by 3.39 to 5.2, which locks the whole file. A 5.3 append does not wait for readers, and readers do not wait for it. A rewrite waits for the reads in flight, and while it waits no new append or read starts (it holds the append lock and a gate first), so reads that overlap without a pause cannot hold it off.
  • macOS and other systems: locks are flock. Reads and appends wait for each other there, and flock has no gate: reads that overlap without a pause (several processes reading the file in a loop) can hold a rewrite off for as long as they go on, and the appends behind it with it (limitations). A read in another thread no longer drops a write's lock, and two threads' writes exclude each other (5.2 could write a new file's header twice).
  • The lock layout changed. Reads lock byte 0 shared, passing through a gate at byte 2 (held shared only until byte 0 is); appends lock byte 1; rewrites lock byte 1, then the gate, then the whole file (Linux open file description locks); flock on other POSIX systems. Older programs' whole-file locks still exclude every 5.3 lock, and 5.3 excludes them, so 5.2 and 5.3 programs can share a file; 3.39 to 5.2 writers do not pass the gate, so 5.3 reads that overlap without a pause can hold them off (limitations). Where only lockf works (a Linux kernel without open file description locks, a file system that refuses them and flock), writers use it and readers take no lock, as in 5.2.
  • A child that fork() made drops the TSVZ locks it inherits (Python 3.7 and later; every Python from 5.15): a copy of a get_file_obj() holder gets EBADF on its writes.
  • A thread holding get_file_obj() reads that file (readTabularFile) without waiting. One that waits on another TSVZ store of the same file (its reload(), close() or a write) can wait for ever: that store's thread waits for this thread's lock (limitations).
  • At exit a TSVZed with nothing to write no longer waits for its writer thread, so one Ctrl-C ends a program whose store waits in its load for another process's rewrite. A store with rows queued, or a write handed to its thread (hardMapToFile(), say), is still finished at exit.
  • Fixed: on Python 3.9 to 3.12 one Ctrl-C at exit could drop a store's queued rows. A Ctrl-C in Thread.join() marks the running thread as stopped there, so 5.2 stopped waiting at once while it printed "is being finished; Ctrl-C again to abandon it". 5.3 waits for its writer thread another way: the first Ctrl-C keeps waiting, the second abandons the write, on every Python.
  • Still not covered: writers that empty the file before or without the lock (3.39's and 4.9's compressed rewrites and clear(), 3.39 to 5.0 scrub and clear, other tools), readers from 5.2 and earlier and tsvz-rs, Python 3.6 forks (covered from 5.15), lockf-only hosts and Windows (limitations).

Upgrading to 5.2 from 5.1

The file formats are unchanged, and a 3.39 host still reads every .tsv-family file 5.2 writes.

  • A scrub of a .tsv whose rows were all deleted shrinks it (5.5: see Upgrading to 5.5; it now keeps line 1). scrubTabularFile, tsvz scrub (also through a tsvz serve handler) of a .tsv-family file (.tsv, .csv, .nsv, .psv and their compressed forms) in which every key has been deleted leaves the file as an empty store: the header line it has, and its #_defaults_# lines as a scrub of a file with rows keeps them (an empty one after the header, the last non-empty one after it, both as wide as the header, or as the column count the read took, which caller defaults set when given). A file with no header line keeps its empty first line, or becomes 0 bytes when its first line was a row; a first line that is no row (a comment, say) becomes an empty line. A defaults line it keeps follows an empty first line, which the scrub then writes. Comment lines go, as a scrub of a file with rows already drops them. A scrub that is given a header (and checks it, the default) keeps the file's first line as its header, an empty one included, with a "Header mismatch" warning when it differs; the header it is given is written only with verifyHeader=False, or when the file's first line cannot be decoded (plain text named .gz); tsvz scrub --x-header follows the --x-header rule below instead. A scrub of a path that is not there makes no file and returns {}, as in 5.1, unless createIfNotExist=True. A compressed file whose read decodes no row (plain text named .gz, a first member cut short) is made again as an empty store, as a scrub of a damaged file with rows already was in 5.1: what the read did not get goes, the bytes after the damage and also the lines of the damaged member before it that the codec never handed over (Python's gzip gives none of a first member cut short, where zcat shows them), and tsvz clear --x-header H --x-strict (clearTabularFile(verifyHeader=True)) now clears such a file, where 5.1 exited 1 with the codec's error. 5.1 and 5.0 left such a file as it was, deletion lines included, so a writer that appended keys, deleted them all and scrubbed, over and over, saw the file grow without limit (205, 405, 605 bytes, ... for 20 keys a cycle); now it is the same size after every scrub. A file with no byte (or a compressed one with only empty streams) is still left alone, and so is a file whose strict scrub (strict=True, --x-strict) read dropped a line for its width and found no row: that line is not a deletion, as 5.1 left it. A scrub that finds the file changed since its read still reads again and writes nothing if it keeps changing, as for a file with rows.
  • get_file_obj('ab') on a compressed store writes its trailer before the lock is let go. A program that calls it on a .tsv.gz, .bz2, .xz or .zst store and writes through the file now has all of it, the gzip trailer and the bz2, xz and zstd data included, in the file when release_file_obj() unlocks it. 5.1 and earlier wrote them after the unlock, where another writer could append in between and corrupt the stream.
  • A TSVZed no longer lets a file grow with every session of sets and deletes (5.5: the open-time rewrite is off by default; see Upgrading to 5.5). It rewrites a .tsv-family file at open when the file holds a key's row and the deletion of it, as 3.39 did only for a key with two values, so a program that sets keys and deletes them in each session (default settings, or rewrite_interval) keeps the file the same size (205, 405, 605 bytes, ... for 20 keys a session before). Every session that opens such a file now rewrites it once. With rewrite_on_load=False the open does not, and the next exit or periodic rewrite does it (rewrite_on_exit=True, rewrite_interval). What such a rewrite does, it now does at a plain open:
    • it cuts a row wider than the header, and the cut stays (5.5: no longer; see Upgrading to 5.5): id\tv\na\t1\t2\nb\t1\nb\t\n becomes id\tv\na\t1 \n, and id\tv\na\t\t7\nb\t1\nb\t\n becomes id\tv\na\t \n, the 7 lost;
    • it writes over the file in place and pads with spaces (a\t1 above; 5.5 writes a compaction whole): TSVZ readers strip them, tools that read the raw bytes (awk, cut) see them;
    • on a file it cannot write (read-only), it prints Failed to open file … Permission denied twice and leaves the file as it is, as 5.1 did for a key with two values.
  • --x-header H makes line 1 the header for every tsvz operation. On a .tsv-family file whose line 1 is H (an exact match: the same cells, each without the whitespace around it, a trailing empty cell included), line 1 is the header: keys, len, read, get, has, pop, popitem and delete never list, count, print, pop or delete it, and scrub and clear keep it. When line 1 differs, the file has no header and line 1 is a row, with 3.39's "Header mismatch" warning, for the reads and the scrub alike, so a scrub keeps the rows a read shows (but for the column-width cases below), and in such a file it never writes a row that is H as line 1: it puts an empty line first (a\t1\nid\tv\na\t\n becomes \nid\tv\n), so the reads still take that row for a row (5.5: a scrub keeps line 1, so it leaves that file as it is). With --x-strict a line 1 that is not H is an error (exit 1, nothing written) for every operation, through a handler too. A missing or empty file gets H first at its first write, as in 5.1. A tsvz serve STORE --x-header H handler applies the rule to every request it answers, routed tsvz commands included; with --x-strict it is strict for them as above (5.1 ignored --x-strict at serve): such a handler refuses to start on a file whose line 1 is not H, its routed .tsv reads and scrubs drop lines of another column count, and its .tsvz reads are strict, as for a direct --x-strict command. The library's own header check (header= to readTabularFile, appendTabularFile, clearTabularFile, scrubTabularFile, TSVZed) is unchanged, 3.39's containment check. The CLI's writes check line 1 more strictly than 5.1's did: 5.1's set, append, delete and clear with --x-header silently took a line 1 that merely held H's cells (id\tvalue for id\tv) for the header and fitted rows to H's width; now they warn and write the row at its own width, and with --x-strict exit 1. A rewrite without --x-header (a scrub without it, scrubTabularFile, a TSVZed rewrite) can still put a row equal to H on line 1 of a header-less file (5.5: only a TSVZed writing its memory; limitations). In 5.1 only set, append, delete and clear used --x-header: the reads and scrub took line 1 as a row (tsvz keys printed id a b for two keys, len said 3, popitem first popped the header), and so did every request to a handler. Without --x-header nothing changed: line 1 is a row, as in 5.1 and 3.39. In a .tsvz store pop, popitem and setdefault now check --x-header as set does; nothing else changed there.
  • Known, mostly as in 5.1: a scrub, a rewrite or a read takes one column count for every row, and can lose cells or keys. A scrub given defaults narrower than the rows, a row wider than the header, and a .tsv that begins with a bare #_defaults_# line (read without defaults) are examples. A strict scrub of a file whose read dropped a line for its width and found no row leaves it, so it grows again over append, delete-all and scrub cycles. Both waited for the column-width design, which 5.5 is: see Upgrading to 5.5.

Upgrading to 5.1 from 5.0

The file formats are unchanged, and a 3.39 host still reads every .tsv-family file 5.1 writes. Most of the changes are in scrub and clear.

  • Scrub and clear of a .tsv write over the file. scrubTabularFile, clearTabularFile, tsvz scrub and tsvz clear (on the command line or through a tsvz serve handler), TSVZClient.clear() and TSVZedLite.clear_file() of a .tsv-family file write the new content over the file and then cut it, as TSVZed's rewrites do, so a reader that takes no lock never meets the file emptied. They take the file's lock, so they wait while another writer holds it. 5.0 emptied the file first, with no lock (TSVZedLite truncated its own descriptor).
  • A scrub keeps another process's rows. A scrub of a .tsv writes only if the file is still what its read saw. Otherwise it reads again, up to three times, and if the file kept changing it writes nothing and warns: tsvz scrub exits 1 (scrub refused; nothing was written), as for a .tsvz (C6), and a handler answers refused. scrubTabularFile still returns the rows it read. 5.0 wrote over a row appended after its read.
  • scrubTabularFile(lastLineOnly=True) is a read. It returns the last row and writes nothing, as for a .tsvz. 5.0 and 3.39 wrote that row back as deletion lines (id\tv\na\t\n3\t\n), and the store was gone.
  • A scrub keeps the file's #_defaults_# lines (5.5: where they are; see Upgrading to 5.5). The defaults in effect at the end of the read are written after the rows: the last non-empty defaults line, its empty cells filled from the line before it as a reader fills them. An empty defaults line that was read (it turns defaults off) is written before the rows, padded to their width. Every row reads as it did to a reader given the scrub's defaults and strict. Defaults a caller passes still fill the rows' empty cells, as in 5.0, but are not written as a defaults line, and the caller's list is not changed. 5.0 and 3.39 dropped the lines, so rows appended later got no defaults.
  • The header stays on line 1. A scrub given no header (tsvz scrub of a .tsv, scrubTabularFile(path)) and a TSVZed given none, of a file that has a header line, keep that line first, with a TSVZed's defaults line right after it. 5.0 and 3.39 put an empty line in front of it, so a reader given the header read the header as a row. A header-less file keeps the empty first line it begins with, and new files and clears given no header still get one, as in 5.0.
  • Interrupts. A scrub or clear of either dialect keeps a copy of only the bytes it overwrites, to put back if it is interrupted before the file is cut to its new length; once the cut is made the rewrite is done and the new content stays. 5.0 kept a copy of the whole .tsvz part and put it all back. (A scrub still reads the whole store, and a .tsvz clear reads it too, to keep its markers.)
  • A compressed store cleared to nothing is one empty stream. A .tsvz.gz (or .bz2, .xz, .zst) cleared or scrubbed to nothing holds one empty compressed stream, which bzcat, xzcat and Python's bz2 and lzma can read; 5.0 left 0 bytes.
  • A header-checking clear of an empty file writes the header it was given. A clear that checks the header (verifyHeader=True, tsvz clear --x-header H --x-strict) of a 0-byte .tsv, or of a compressed file with no byte or only empty streams (another tool's), takes it for an empty store with that header, as every reader does (L9), and writes H without a "Header mismatch" warning. 5.0 wrote an empty line and warned of a mismatch, so a strict TSVZed given H then refused the file, and raised on a 0-byte .bz2, .xz or .zst.
  • tsvz --help says what clear keeps: a .tsvz its header and markers, a .tsv the --x-header it is given. (With --x-strict too, a .tsv clear keeps the file's own header line.) TSVZed's message for a refused rewrite lists hardMapToFile() among the rewrites a program asks for.
  • Known in 5.1, fixed in 5.2: a scrub of a .tsv whose rows were all deleted did not compact it when the scrub was given the file's header (scrubTabularFile(path, header=H)) or the file had no header line: it left the file as it was, deletion lines included; reads were right, as in 3.39 and 5.0. (tsvz scrub of a headed file read the header line as a row, so it did compact it.)
  • Known: a scrub run with other defaults than the store's program can change how early rows read. In a .tsv with an empty #_defaults_# line and rows with empty cells before any defaults line, the reset line the scrub writes before the rows keeps those cells empty for a program that opens the store with its own defaults; run the scrub with the defaults that program uses (5.5: no longer; a scrub writes no reset).
  • Running programs keep 5.0 until they are restarted: long-running programs that import TSVZ, and running tsvz serve handlers.

Upgrading to 5.0 from 4.9

  • Writes refuse text they cannot encode. A key, value, header, defaults line or marker the file's encoding cannot hold (UTF-8 for .tsvz; encoding= for a .tsv), such as the lone surrogate os.fsdecode gives for a non-UTF-8 file name, raises TSVZEncodeError (a ValueError) and writes nothing; 4.9 stored ? (its tsvz stored U+FFFD for a non-UTF-8 argument, and its .tsvz file functions raised UnicodeEncodeError). errors='replace' brings ? back. Under a non-UTF-8 encoding=, a key read as U+FFFD cannot be deleted or updated. tsvz exits 1 with the message. See Fault tolerance.
  • A Ctrl-C no longer cuts a .tsv write. Every write of a .tsv-family file runs on the store's background thread; a call waits for it, a Ctrl-C raises in the caller and the write still finishes, and at exit a write in progress is finished (a second Ctrl-C abandons it). In 4.9 a Ctrl-C while TSVZed() opened a compressed store (its rewrite on load) could leave the file with no readable row. A closed TSVZed or TSVZedLite is freed; 4.9 kept every one until exit.
  • Another process's change is taken in, not reloaded over memory. An append to a .tsv-family file is read from where the store left off, so an order set by move_to_end and # keys survive it; any reload (both dialects) changes memory in place, so another thread never finds a live key missing. After a rewrite of the store's own fails part way, memory is kept and another process's appends are merged into it (Fault tolerance).
  • .tsvz stores see another process's append made right after their load, a commit or a clear (4.9 missed it until the next change), keep the rows set while they reload, and raise a strict header mismatch at the first read.
  • .tsv files: an append to an existing empty file writes the header first, and reading one gives an empty store; see L8 to L14 for the rest.
  • tsvz runs every operation through the engine tsvz serve uses, with the same output. A server of a .tsv (or other tab- or NUL-delimited) file is now found by tsvz commands, TSVZClient and tsvz stop; 4.9's clients rejected its pointer file. The 3.39 warning that a file name does not end in .tsv is printed only when a command creates such a file, and a write that cannot be made reports the operating system's error.
  • Running programs keep 4.9. Long-running programs that import TSVZ, and running tsvz serve handlers, keep 4.9 until they are restarted. 5.0's tsvz stop cannot stop a 4.9 handler of a .tsv (or other tab- or NUL-delimited) file: 4.9 wrote the delimiter into the pointer file's x-delimiter as <sep> (a NUL as <NUL>), which 5.0 decodes to the TAB or NUL itself and refuses as a control character. Send that handler SIGTERM instead: its pid is on the pid line of its pointer file (STORE.serve), and it finishes its writes and exits.
  • macOS and other systems that lock with lockf: as in 4.9, a read in another thread of the process can still drop a write's lock (5.3 locks with flock there: fixed).

Breaking changes from 3.39

.tsv, .csv, .nsv, .psv: the format is unchanged

# Change
L1 Appending after an unterminated last line writes \n first; 3.39 merged the two lines.
L2 Setting a row whose values are all empty deletes it in memory too (it already meant delete on disk), with a warning.
L3 TSVZedLite on a compressed file keeps rows in memory; 3.39 read compressed bytes as text. Rows held in memory (also # keys) are returned directly.
L4 New warnings on stderr (invalid encoding, lines dropped by strict); data unchanged.
L5 A damaged compressed file is read up to the damage instead of raising; from 5.4 a member cut short after the first is left out and the members after it are read (a damaged first member stops the read).
L6 mapToFile no longer glues a row it adds at the end of the file to the next one.
L7 TSVZed's in and get find a key as t[key] does: the live key equal to it, else the key right-stripped. 3.39 matched them exactly, so 'x ' in t was false while t['x '] read x, and t.setdefault('x ', …) overwrote x.
L8 Appending (TSVZed, TSVZedLite, appendTabularFile, appendLinesTabularFile) to an existing empty file (no byte, or a compressed file holding only empty streams) writes the store's header first, as creating the file does; 3.39 wrote the rows alone (a read then took the first one for the header), and appendTabularFile with strict refused the file.
L9 Reading such an empty file with a header (and verifyHeader) gives an empty store with that header: readTabularFile, TSVZed and TSVZedLite with strict no longer refuse it with Header mismatch (a TSVZed restarted after a rewrite that left the file empty failed in its constructor), and without strict no longer print a header mismatch.
L10 Writing text the file's encoding cannot hold (a lone surrogate from os.fsdecode, a character the encoding= lacks) raises TSVZEncodeError, a ValueError, and writes nothing; 3.39 and 4.9 wrote ?, which errors='replace' brings back.
L11 pop() and popitem() of a # key, which lives in memory only, write no tombstone line to the file.
L12 A rewrite of a file whose header line has no newline writes the rows on lines of their own; 3.39 wrote the first one onto the header line.
L13 A compressed file is rewritten in members of at most 1 MiB, as appends already were: the bytes differ, the rows read are the same, and 3.39 reads them.
L14 TSVZed opening a compressed file in a codec this Python lacks (zstd before Python 3.14) raises ImportError instead of reading the compressed bytes as text.
L15 scrubTabularFile, clearTabularFile, tsvz scrub, tsvz clear and TSVZedLite.clear_file() write the new content over the file and then cut it, under the file's lock; 3.39 emptied the file first, with no lock, so a reader could meet it empty.
L16 A scrub writes only if the file is still what its read saw: it reads again up to three times, then writes nothing, with a warning (tsvz scrub exits 1, C6); 3.39 wrote over rows appended after its read.
L17 scrubTabularFile(lastLineOnly=True) returns the last row and writes nothing; 3.39 wrote that row back as deletion lines, and the store was gone.
L18 A scrub keeps every #_defaults_# line as the file has it, where it was, so every row reads as it did; 3.39 dropped them, so rows appended later got no defaults.
L19 A scrub never changes line 1, except that a header you pass with verifyHeader=False is added; a TSVZed rewrite of a healthy file never changes it, unless a delete in a one-column file takes line 1 out or (5.6) line 1 is the start of a wider header the program gives; 3.39 put an empty line in front of a header line, and a reader given the header then read the header as a row.
L20 A row wider than the column count is read whole (only its empty cells past the count go); 3.39 cut it.
L21 TSVZed reads a one-column file's lone keys as rows, as readTabularFile does (3.39 showed none); a delete there takes the key's lines out at the next commit, not as a line; from 5.6 so do tsvz delete, pop, popitem, a handler and TSVZedLite, at once.
L22 Writes never cut a row: a wider row is written whole; 3.39 cut it to the column count. A strict read takes a wider row whole and drops only a narrower one; a strict store refuses only a narrower row.
L23 A scrub, and a TSVZed rewrite of a healthy file, drop lines and keep the lines they keep byte for byte, in place (a key's last line may move up into its first line's place; a dead key's line readers take their column count from is kept emptied); 3.39 wrote the rows it read.
L24 A TSVZed's whole reload starts from the defaults the program gave, not those its last read ended with.
L25 A TSVZed rewrite writes its defaults line after the rows: a compacting rewrite after the file's lines and before the rows memory adds, only when the file does not already end with those defaults; a rewrite from memory after every row. 3.39 wrote it after the header.
L26 TSVZed no longer rewrites the file when it opens it: rewrite_on_load defaults to False; every rewrite is written whole.
L27 move_to_end appends a deletion line and the row; 3.39 reordered memory and rewrote the file.

.tsvz, .csvz, .nsvz, .psvz: now tsvz-spec-v1

# Change
S1 .csvz/.nsvz/.psvz use , \0 | (3.39: tab). A conflicting delimiter= or encoding= is overridden, with a warning.
S2 A file written by 3.39 under one of these names reads differently (header line becomes data, key\t\t deletes come back, </sep/> stays literal, an unterminated last line is dropped, single-column files read as empty, empty cells are not defaulted, NULs are not stripped). Rename such a file to .tsv.
S3 t[missing] returns the defaults row instead of raising KeyError (see above).
S4 # keys are stored; #_name_# keys are marker writes.
S5 Automatic rewrites are ignored with a warning; rewrite_on_load effectively defaults to False; move_to_end only reorders memory.
S6 Rows are never trimmed or dropped for their width; strict no longer drops rows; appendLinesTabularFile does not pad.
S7 The header is written as a # comment; a new file without a header is empty.
S8 An unterminated tail is ignored on read and truncated on append.
S9 clear keeps the active markers; scrub keeps the header comment and drops other comments, custom markers and checksums.
S10 Files named x.tsvz.<hex> beside x.tsvz are read as parts of the store.
S11 lastLineOnly reads forward (slower on large files).
S12 TSVZedLite.clear() and clear_file() raise OSError when the clear is refused (a part could not be read, the path names one part of a store, or the store kept changing). Memory is reloaded from the unchanged store first.
S13 Compressed parts are written in members of at most 1 MiB of records (#_member_size_#), Zstandard frames with a checksum; an append never reads or repairs the part.
S14 A zero byte in a value is written <NUL>, and a raw zero byte in a record is read as zero-fill damage (spec §4.9): under the default recover only the bytes after it are read. A value that 4.2 or 4.3 wrote with a raw zero byte therefore reads differently in 4.4. Such values are rare; before upgrading, grep -c -P '\x00' store.tsvz (any .tsvz, .csvz or .psvz part) finds them. Stop 4.2 and 4.3 handlers before upgrading: they read <NUL> as text, as they read <CR>.
S15 A lookup (t[key], in, get, del, pop, setdefault) takes the live key equal to the one given before the right-stripped one, so a key ending in whitespace (written while #_strip_trailing_whites_# was false) can be read and deleted by name (spec §20.2.7). Setting a key still right-strips it.

The tsvz command

3.39 command lines still parse, including abbreviated long options (--delim) and -d=,, except the ones C5 and C9 list.

# Change
C1 read into a pipe or a file prints records instead of the table; --format table gives the table.
C2 Every message goes to stderr: "Created …", "File not found", header mismatches, warnings.
C3 read and scrub of a missing store exit 1 with a message (3.39: exit 0, and read printed "File not found" on stdout).
C4 delete deletes every KEY it is given (3.39: only the first).
C5 append or delete without a KEY, or with an empty KEY, is a usage error with exit 2 (3.39 wrote an empty line).
C6 A clear or scrub that writes nothing (one part of a multi-part store, a store that kept changing, a part that declares a spec version newer than 1, per spec §19.4 and §19.8) exits 1.
C7 -c/--header, --defaults, -s/--strict and -f/--force are undocumented aliases of the --x- options. --x-header and --x-defaults keep non-ASCII text.
C8 Usage errors print tsvz's own message, exit 2; the -h text is new.
C9 Arguments after STORE for read, clear and scrub are a usage error, exit 2 (3.39 ignored them, so clear junk cleared the file).
C10 The table (a terminal, or --format table) of get, keys, pop, popitem, setdefault, and of read on a .tsvz-family store, shows the rows only: no row is drawn as a header, and no row is cut to the first row's or the terminal's width. read of a .tsv-family file keeps 3.39's table, whose first row is the file's header line (5.5: padded to the widest row, so no row is cut to it).
C11 The table shows control characters, bidi controls and line separators as escapes (\r, \n, \t, \xNN, \uNNNN), so no value can move the cursor, reorder the line or restyle the terminal. It sizes columns in terminal columns, so CJK text (two columns a character) lines up. The table is for reading: a backslash in a value is shown as is, so use records for exact values.
C12 While stripping is on, get, has, pop, delete and setdefault take the live key equal to a KEY ending in a space or tab before the stripped one (spec §20.2.7), so tsvz keys s | tsvz delete s - deletes every key. delete of such a KEY reads the store first, and exits 1 without writing when the store cannot be read whole.

Spec deviations and interpretations

None of these fails a conformance case: conformance/reference-baseline.json, which lists the cases this implementation does not pass, is empty (see Conformance testing).

  • §17.5: a numbered part opened directly is read alone, with a warning.
  • §14.5: the defaults-on-missing read applies to t[key] only.
  • §18.6: .tsv-family readers hold the access lock shared only while they read (byte 0, through the gate at byte 2; a TSVZed checks what it read before by identity, size and bytes), appends take the append lock (byte 1), and rewrites take it, the gate, then the whole file; on systems other than Linux both are one whole-file flock. What remains a deviation: .tsvz part readers take no lock (they read again until the parts keep still); where only lockf works, writers use it and readers do not lock; Windows readers do not lock; and one-shot appends, the making of a file, scrubs, clears and .tsvz part writes also take an in-process lock per path (_pathLock), which a TSVZed's own writes do not. See docs/limitations.md.
  • §19.4: a scrub whose rows would read differently under the final markers writes them with stripping and fill-empty off, then restores the final markers after the rows.
  • §20.7: -q also silences informational messages ("Created …"); only errors remain.
  • §20.2: scrub of a multi-part store, and clear of one part of one, are refused with exit 1; read, get and parts of a numbered part read that part alone, with a warning.
  • §20.2.4: on .tsv-family files get prints nothing for a missing key, verify checks nothing, parts lists the file, and in a file of one column (where a lone key is a row, so a deletion line deletes nothing) delete, pop and popitem take the key's lines out of the file, a whole rewrite, not an appended line.
  • §20.3: a bulk input line with an empty key is skipped, with a warning.
  • §20.6: a write whose store cannot be created, and a read, get or verify that cannot read every part, or whose parts kept changing through three reads, exit 1 with an error that -q keeps.
  • §21: a served .tsv file with a header line shows that line as a row, as tsvz read does (TSVZed hides it when given the header).
  • §21.8: the server notices changes with stat(). It re-reads the part list while the store's directory changed less than 2 s ago, and reloads a part whose size stayed the same but whose inode, modification time or change time changed. The change time catches a rewrite whose modification time was set back (cp -p, rsync --inplace -a); a rewrite in place that keeps a part's size within one clock tick is not seen until the part changes again.
  • §21.9: tsvz commands and TSVZClient ask the server to answer writes once they are written (--x-written), so a write the server cannot make fails as it would on the files. While writes fail, every answer carries a warning.
  • §21.3: tsvz serve needs Unix-domain sockets. Where Python has none (Windows), it exits 1, and tsvz commands and TSVZClient work on the files.
  • §20.7: on .tsv-family files a -d longer than one character is used, as in 3.39, with a warning; a -d that does not decode is a usage error.

Website

The tsvz.org site lives in tsvz-org/tsvz.org. It renders tsvz-spec-v1.md from a checkout of this repository next to its own, and its tests also check the spec: every § reference names a real section, and the spec uses only markdown the site renders. Run them after editing the spec (see Tests); CI runs them on every push here, and the site publishes main's spec each morning.

Conformance testing

tsvzconform.py tests how closely an implementation of tsvz-spec-v1, in any language, follows the spec. Its cases are JSON files in conformance/cases/, each naming the § clauses it tests, and it drives an implementation only through the spec's command line (§20) and handler socket (§21).

python3 tsvzconform.py --impl ./tsvz --feature crc32,sha256,handler
python3 tsvzconform.py --impl ./tsvz --class reader --only 13

Each failure is printed with its input, what was expected, what came back and a command line that reruns it alone; the summary gives a verdict for each conformance class (reader, writer, cli, handler). conformance/README.md explains the options and the features to claim, and how to load the cases into another language's tests.

Benchmarking implementations

tsvzbench.py compares implementations of tsvz-spec-v1, in any language, side by side on one machine. It drives each one only through the spec's command line (§20) and, when it has one, its handler socket (§21), so any conformant tsvz tool can be measured as it is.

python3 tsvzbench.py --impl ref='python3 TSVZ.py' --impl new='../tsvz-rs/target/release/tsvz' \
                     --suite quick --work-dir /mnt/fast-disk/tsvzbench
  • --impl NAME=COMMAND, repeatable: the first is the baseline, and every other implementation gets a × ratio against it (below 1 is faster). A relative COMMAND runs from the directory you start tsvzbench in.
  • --suite smoke|quick|standard|large: smoke checks a setup in seconds, quick takes about a minute, standard (the default, up to 1M rows) about five, and large (up to 10M rows) twenty or more and ~5 GB of memory for the harness itself.
  • --only cold,bulk,perop,maint picks families: one-shot replays, set - and delete - batches, single operations (CLI and handler), and scrub/clear.
  • --work-dir DIR keeps the generated fixtures between runs. Put it on the disk you mean to measure: not a tmpfs, and not a FUSE file system such as mergerfs (the harness warns about those). The default is a tsvzbench-* directory here.
  • --json PATH also writes every raw sample.

The harness writes its own input stores, so every implementation reads the same bytes, and checks every result against its own replay model: ✓ right, ✗ wrong output or files, ! N an unexpected exit status, ⏱ timed out, refused an allowed refusal. It exits 1 when any cell failed. Each command runs under a small launcher that measures it with wait4; a peak RSS shown as ≤8.0 MiB is the launcher's own size, so the true peak is no higher. Compare an implementation with itself to see the noise: a few percent per cell, but the socket rows, whose latencies are tens of microseconds, can move 10–20% between runs, because a single run can land in a slower mode as a whole.

Tests

python3 -m pytest TSVZ_test.py -q                         # everything, incl. 3.39 differential tests
python3 -m pytest TSVZ_lock_test.py -q                    # file locks between processes and threads (POSIX)
python3 -m pytest ../tsvz.org/tsvz_site_test.py -q        # the spec as tsvz.org renders it (needs the tsvz.org checkout next to this one)
python3 -m pytest tsvzbench_test.py -q                    # the benchmark harness
python3 -m pytest tsvzconform_test.py -q                  # the conformance runner and cases, against the reference
python3 benchTSVZ.py /tmp/b.tsv -n 100000 --compare-old    # benchmark (not a test)
python3 legacyfuzz.py pair --ver OLD/TSVZ.py --ver-b TSVZ.py  # the legacy scrub and rewrite differential fuzzer; see its docstring; run it in a container

TSVZ_old.py is the frozen 3.39 module the differential tests compare against; it is not installed. CI (.github/workflows/test.yml) runs the four test files on Python 3.6, 3.9, 3.12 and 3.14. Accepted limitations are listed in docs/limitations.md.

License

GPL-3.0-or-later © Yufei Pan (pan@zopyr.us)

Metadata

Release files for TSVZ 5.17

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for TSVZ 5.17
File Size Uploaded Provenance Actions
tsvz-5.17.tar.gz 340.3 kB Without provenance Details for tsvz-5.17.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for TSVZ 5.17
File Interpreter ABI Platform Actions
tsvz-5.17-py3-none-any.whl Python 3 none any Details for tsvz-5.17-py3-none-any.whl

Total release size: 570.6 kB

Release files / tsvz-5.17.tar.gz

Download URL tsvz-5.17.tar.gz
Size 340.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0a803b9a6d89025803708f2bce7639745c0c89a949db6d4fcb5b7ce386b08bad
BLAKE2b-256 checksum
How to use checksums
57dfa13887d63c92a53fbc08e99b7c1d034b68eb32160a4ece1c3bd4846b7aa5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / tsvz-5.17-py3-none-any.whl

Download URL tsvz-5.17-py3-none-any.whl
Size 230.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a364e64facdb01545d0663a60cd784b35771dfaf9bbb31e913347fb8dc6a682
BLAKE2b-256 checksum
How to use checksums
257815b8a7a6225d81af85a89f7deec8f07e2df305ae94e082edd01e0428b017
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for TSVZ 5.17

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

5.17 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page