DBIx-QuickDB

 view release on metacpan or  search on metacpan

AI_DOCS/SINGLE_FILE_DATADIR.md  view on Meta::CPAN

- **MySQL / InnoDB**: redo logs, `.pid`, socket, tmp files — unless forced with
  flags (see below).

So a single-file, read-only base needs a **writable scratch layer** for the bits
the server must touch. Scratch can be throwaway (tmpfs).

## Single-File Packaging Options

| Method                         | Single file | Rootless mount        | Read-only      | Notes                          |
|--------------------------------|-------------|-----------------------|----------------|--------------------------------|
| ext4 image + `mount -o loop`   | yes         | **no** (root/fstab)   | optional       | classic; regular user blocked  |
| **SquashFS + `squashfuse`**    | yes         | **yes** (FUSE)        | yes (always)   | compressed; best fit           |
| `fuse2fs` on ext4 image        | yes         | yes (FUSE)            | optional       | rw possible but slow           |
| tarball                        | yes         | no (must extract)     | n/a            | not directly usable            |

## Can Regular Users Mount It?

- Plain `mount` of a disk image: **no** — needs root, or a pre-configured
  `/etc/fstab` entry with the `user` option.
- **FUSE: yes** — `squashfuse`, `fuse2fs`, `fuse-overlayfs` all run unprivileged
  (where FUSE is permitted, which is the Linux default).

Changes  view on Meta::CPAN

0.000050  2026-06-10 14:14:43-07:00 America/Los_Angeles

    - Watcher teardown blocks on the reap after sending SIGKILL instead of racing a deadline that was too short at low QDB_STOP_GRACE.
    - t/Pool wraps every server-spawning db()/fetch_db() in the resource-skip helper so a semaphore-exhausted host skips instead of failing.

0.000049  2026-06-09 17:14:55-07:00 America/Los_Angeles

    - Added Driver::destroy_quietly(): fast-destroy teardown for disposable clones (cleanup => 1) that kills, reaps, and removes the data dir immediately instead of a graceful shutdown that can block 2*QDB_STOP_GRACE+2 seconds.
    - Added an opt-in fast_destroy attribute: DESTROY uses destroy_quietly() when cleanup => 1, falls through to the graceful path when cleanup => 0, and is inherited by clones via clone_data().
    - Added per-driver fast_stop_sig() for fast/forced teardown: default SIGKILL, PostgreSQL overrides to SIGQUIT so the postmaster releases its SysV semaphores instead of leaking them; watcher escalates to SIGKILL if it does not stop promptly.
    - Added a watcher fast-eliminate request (SIGUSR1) that kills with fast_stop_sig, reaps, and deletes the data dir; blocked (not ignored) across the startup exec so a request racing startup stays pending instead of being dropped.
    - The graceful teardown path (stop()/eliminate()) now escalates a stuck shutdown through fast_stop_sig before SIGKILL, so it releases SysV semaphores instead of leaking them.
    - get_db() and the pool tests skip_all instead of failing when a host is out of System V semaphores/shared memory; added skipall_on_resource_error(), also covering the DBIx::QuickDB->import path (t/QuickDB) and mid-run pool clone builds (t/Pool).
    - On a start timeout, start() now reports the server's launch log and whether its process is still alive, instead of only the often-empty error log.
    - Added t/fast_destroy.t, t/watcher_fast_kill.t, and t/resource_skip.t.

0.000048  2026-06-06 10:53:27-07:00 America/Los_Angeles

    - Fixed a pid-reuse race that could shut down the wrong database server. After a server was stopped, its watcher exited and the OS could recycle the watcher's pid; a later teardown signal (e.g. eliminate() from the watcher object's DESTROY, which...
    - Removed two redundant pid-signalling paths that carried the same pid-reuse hazard: the post-wait() server-pid poll in Driver::stop() (the watcher already reaps the server before it exits, so stop() now just trusts wait()) and the direct server-...
    - Added t/clone_sequence.t, an explicit PostgreSQL regression asserting a clone of a stopped source continues its SERIAL sequence with the exact next id (no SEQ_LOG_VALS +32 jump); the broad Pool test only checks id ordering

lib/DBIx/QuickDB/Watcher.pm  view on Meta::CPAN

    my $fsig = $self->{+DB}->fast_stop_sig // 'KILL';

    # Ignore SIGTERM/SIGINT before exec so the watcher cannot be killed
    # during startup before _do_watch installs its signal handlers.
    # SIG_IGN persists across exec, and any pending signal will be held
    # until _do_watch replaces these with proper handlers.
    $SIG{TERM} = 'IGNORE';
    $SIG{INT}  = 'IGNORE';

    # Block (rather than ignore) the fast-eliminate signal across the exec. A
    # blocked signal stays *pending* instead of being discarded, so a
    # fast_eliminate() that races server startup -- arriving after the socket is
    # up (so the caller's start() has returned) but before _do_watch has
    # installed its handler -- is not lost: _do_watch unblocks it once the
    # handler is in place and it fires immediately. SIG_IGN would silently drop
    # it, leaving the caller's wait() to block for the full stop-grace timeout.
    POSIX::sigprocmask(POSIX::SIG_BLOCK(), POSIX::SigSet->new(POSIX::SIGUSR1()));

    exec(
        $^X, '-Ilib',

lib/DBIx/QuickDB/Watcher.pm  view on Meta::CPAN


    my %params = @ARGV;

    my $kill = $params{kill} // '';
    my $hup  = $params{hup}  // 0;
    local $SIG{TERM} = sub { $kill = 'TERM' };
    local $SIG{INT}  = sub { $kill = 'INT' };
    local $SIG{USR1} = sub { $kill = 'FAST_TERM' };
    local $SIG{HUP}  = sub { $hup  = 1 };

    # watch() blocked SIGUSR1 before exec so a fast_eliminate() racing startup
    # would stay pending rather than be discarded. Now that the handler above is
    # installed, unblock it -- any pending fast-eliminate fires here and sets
    # $kill before we enter the watch loop.
    POSIX::sigprocmask(POSIX::SIG_UNBLOCK(), POSIX::SigSet->new(POSIX::SIGUSR1()));

    my $blah;
    close(STDIN);
    open(STDIN, '<', \$blah) or warn "$!";

    my $master_pid  = $params{master_pid} or die "No master pid provided";



( run in 0.547 second using v1.01-cache-2.11-cpan-bbe5e583499 )