mirror of
https://github.com/penpot/penpot.git
synced 2026-11-16 15:11:17 +00:00
* ✨ Reference the file data storage object with a foreign key The file data pointer lived in `file_data.metadata.storage-ref-id`, a JSON key. The storage GC parsed it to find live references, and nothing stopped it from physically deleting an object a live row still pointed at: a failure in that scan lost the blob. Migration 0159 moves the pointer to a nullable `storage_object_id` column on `file_data`, backfills it from the metadata key, removes the key from the rows it backfills, indexes the column and rebuilds the foreign key to `storage_object(id)` as `NO ACTION DEFERRABLE INITIALLY IMMEDIATE`. `INITIALLY IMMEDIATE` is deliberate: the GC catches the violation inside the chunk transaction, while a deferred check would fire at commit, outside it, and the sweep would never move past the blocked chunk. The column is the only source of truth. The `storage-ref-id` entry is gone from the file metadata schema, and the single point that serializes the metadata drops it, so no write can resurrect it. `upsert!` does not query the row: the pointer of the row being replaced travels in its params, and the object is touched before the row is written. Fragments and snapshots pass nil because a modified pointer always gets a new id; the offload passes its own row; `insert-file!` drops it, since an INSERT never replaces a persisted object. `update-file!` takes the file map read from the database plus the fields to change and merges them, so the pointer comes from the read map and no caller can lose it by building a partial map. A map without `:data` raises `:missing-file-data`: it is not `assert`, which is compiled out in the deployed binary. The params cannot override the pointer or retarget the write with `:id`/`:file-id`. `bfc/file->response` strips the pointer from every response (`get-file`, `create-file`, `duplicate-file`, the view-only bundle, the team access request, the comments read, the library summary, the snapshot read and the debug download). A `file-data` object is authentication-only, so a leaked id would let any logged-in profile fetch the blob from `/assets/by-id`. `get-file-fragment` resolves through the file data backend, so a fragment on cold storage no longer hands nil to `blob/decode`, and answers only the keys of its result schema. The storage GC reference scan, the restore union and `objects-gc` read the column. The offload reads `SELECT fd.*`, so its rows go through a `decode-row` that decodes jsonb metadata and drops a JSON null, which the row schema rejected; a row without a readable object raises `:missing-storage-object` with the file and row ids. A chunk blocked by the foreign key (SQLState 23503) is a real anomaly, since the reference scan should have frozen the object: it stays an error with its own hint and the chunk is retried on the next run until the reference is fixed. The release is a coordinated restart, not a rolling deploy, and not rollback-safe for the rows it writes: the previous code writes and scans the metadata pointer, so a key it writes misses the backfill and removing it loses the reference. `operations/2.20.0-file-data-storage-object-id.md` builds the column, the index and the foreign key online and runs the backfill with every instance stopped, then marks the step as applied; a fresh or small instance does the whole job in the migration. The runbook keeps the validation scan out of the stopped window and adds a lock timeout and retry to the online statements. Tests cover the foreign key shape, the backfill and its corrupt and orphan guards, the rebuild of a missing index and of a wrong, non-deferrable or deferred constraint, the deletion refused by a live reference, the metadata cleanup, the offload row normalizations, the touched objects of the unshare and the restore, the response stripping on every call site and the chunk blocked by the foreign key. The backend memories and the developer guide document the pointer, the GC behavior and the two migration paths. Closes #12768 AI-assisted-by: deepseek-v4.1-flash AI-assisted-by: inkling-2-small-free * 🐛 Hold the file row lock across the migration write `get-file` applies the pending migrations in memory and, when it finds any, persists the result. That write read the row without a lock and `update-file!` is an unconditional UPDATE, so a save that committed in between was overwritten: the saved content, `revn` and `modified-at` went back, the next save from that client failed with `:revn-conflict` and the object the save left became an orphan the storage GC cannot revisit once it is frozen. The read now runs in a transaction of its own (`get-file` calls `get-file*` inside `db/tx-run!` and accepts a cfg map only), so the `file` row lock covers the re-check and the write. `get-file*` reads the row once (`sql:get-file` plus `resolve-applied-migrations`) and completes it with `attach-file-data`; only when a migration is pending it reads the file again under `FOR UPDATE`, re-checks `need-migration?` on that fresh map and persists it (`migrate-file`). The common case stays at one row read and one migrations resolution, the migration case keeps a single decoded copy in the heap, and a row that changed in between is not overwritten. A migration found on the unlocked read is applied in memory only, for the next read to persist. `migrate-file` returns the reattached map when it persists, with the `:storage-object-id` of the row the write left, and the realized map when it does not; `:realize?` is what returns the read fully plain. `fdata/upsert!` answers `{:written ... :storage-object-id ...}` instead of a boolean, `update-file!` propagates it and the migrating read puts it back in the map it returns, so a caller that persists again touches the current object instead of the replaced one. `insert-file!` keeps nil: an INSERT never replaces a persisted object. The write also compares the stored pointer with the caller's value (`IS NOT DISTINCT FROM`) and raises `:stale-file-data-pointer` when it affects no row. Every writer holds the `file` row lock, so a pointer that no longer matches is a protocol violation, not a race to retry. The expected pointer is a separate argument because the storage branch replaces `:storage-object-id` before the upsert, and the check lives in `upsert-in-database`: the `legacy-db` branches do not use that SQL and their count can legitimately be zero. The save, snapshot and restore-backup reads take `FOR UPDATE` instead of `FOR SHARE`: they inherit the lock, and the migration branch asks for the exclusive one in the same transaction, so a shared lock that upgrades deadlocks two concurrent readers. A data read rejects `:lock-for-share?` for the same reason; only row-only reads accept it. `sql:get-file-without-data` is a plain select now, not a CTE, which makes locking legal without loading the data. Realization has a single owner: `attach-file-data` only resolves and decodes, and `get-file*` realizes once per path. The applied migrations no longer travel in the `get-file-with-summary` response, cache hit and cache miss alike. `embed-assets` reads each library without `:realize?`, so its `:components` is an unloaded pointer map; `absorb-assets` walks it with `vals`, `PointerMap.seq` calls `load!` and that raised with no loader bound, so every export with `:merge-libraries` of a library with components failed. The absorb runs under the library's own loader now. The in-place binfile import (`import-file-and-overwrite*`, `::overwrite`, `::bfc/file-id`) had no product caller and cannot carry the previous `storage_object_id`, so overwriting a storage-backed row would leave its object unreclaimed. `import-files!` rejects a cfg with `::bfc/file-id` (`:not-supported`) and the helpers only that path used go with it (`invalidate-thumbnails`, `*reference-file*`, the `::overwrite` id branch of `index-object` and of `save-file!`, the `on-conflict-do-nothing?` flag of the media insert). Tests: a new `file-migration-read-test` pins the single read, the locked re-read, the concurrent save interleaving, the double migration and the read-only path; the upsert tests cover the return shape and the stale pointer; the SQL recorder they share lives in `backend-tests.helpers`, and the save, snapshot, restore and summary sequences follow the new reads. The backend memories document the read contract and the pointer. AI-assisted-by: deepseek-v4.1-flash * 🐛 Harden the get-file guard and skip its read-only transaction The cfg guard of `get-file` was an `assert`, which `app.config` elides when `:backend-asserts` is off, so a deployed binary accepted a bare pool or connection while the docstring promised it raises. It throws `IllegalArgumentException` now, the class the option guards of the same namespace already use, and the existing test expects it instead of `AssertionError`. A read with `:read-only?` applies the pending migrations in memory and writes nothing, so the transaction the migration write needs only costs two round trips there. `get-file` runs it with `db/run!` instead: with a cfg that carries a connection it still joins the caller's transaction, and only the reads that would have opened their own skip it. A lock option needs a read-write transaction from the caller, because PostgreSQL rejects row locks in a read-only one; the docstring states that. Tests: the guard test expects the new class; a cfg marked `::db/read-only` reads a pending migration without persisting it (the config flag that fills that key is legacy, but the key is set by hand); and a read-only read is pinned as not opening a transaction while the same call without the option does. The backend memory documents the split and the guard. AI-assisted-by: deepseek-v4.1-flash
366 lines
16 KiB
Clojure
366 lines
16 KiB
Clojure
;; This Source Code Form is subject to the terms of the Mozilla Public
|
|
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
;;
|
|
;; Copyright (c) KALEIDOS INC Sucursal en España SL
|
|
|
|
(ns backend-tests.file-migration-read-test
|
|
"Persisting the migrations applied on read is an optimization of the read:
|
|
the read already returns migrated data, so the write must never overwrite a
|
|
row written after that read, and it must keep a single decoded copy of the
|
|
file in the heap."
|
|
(:require
|
|
[app.binfile.common :as bfc]
|
|
[app.common.features :as cfeat]
|
|
[app.common.files.migrations :as fmg]
|
|
[app.common.uuid :as uuid]
|
|
[app.config :as cf]
|
|
[app.db :as db]
|
|
[app.features.fdata :as fdata]
|
|
[app.features.file-migrations :as fmigr]
|
|
[app.rpc :as-alias rpc]
|
|
[app.util.pointer-map :as pmap]
|
|
[backend-tests.helpers :as th]
|
|
[clojure.test :as t]))
|
|
|
|
(t/use-fixtures :once th/state-init)
|
|
(t/use-fixtures :each th/database-reset)
|
|
|
|
(def ^:private migration-name
|
|
"0031-migrate-stroke-width-token-attr")
|
|
|
|
(defn- create-file!
|
|
[]
|
|
(let [profile (th/create-profile* 1)
|
|
file (th/create-file* 1 {:profile-id (:id profile)
|
|
:project-id (:default-project-id profile)
|
|
:is-shared false})]
|
|
{:profile-id (:id profile)
|
|
:file-id (:id file)
|
|
:page-id (first (:pages (:data (bfc/get-file th/*system* (:id file)))))}))
|
|
|
|
(defn- force-migration!
|
|
"Make the next read see a pending migration, the way the snapshot tests do:
|
|
the version matches, so only a missing row triggers the migration."
|
|
[file-id]
|
|
(th/db-delete! :file-migration
|
|
{:file-id file-id
|
|
:name migration-name}))
|
|
|
|
(defn- file-data-row
|
|
[file-id]
|
|
(th/db-get :file-data {:file-id file-id :id file-id}))
|
|
|
|
(defn- storage-object
|
|
[id]
|
|
(th/db-get :storage-object {:id id} {::db/remove-deleted false}))
|
|
|
|
(defn- save!
|
|
"Run a real save request so the test exercises the same write path a client
|
|
takes, not a hand-built row."
|
|
[profile-id file-id revn changes]
|
|
(th/command! {::th/type :update-file
|
|
::rpc/profile-id profile-id
|
|
:id file-id
|
|
:session-id (uuid/random)
|
|
:revn revn
|
|
:vern 0
|
|
:features (cfeat/get-enabled-features cf/flags)
|
|
:changes changes}))
|
|
|
|
(t/deftest migrate-on-read-does-not-overwrite-a-concurrent-save
|
|
;; A save commits after the read that saw the pending migration. The read
|
|
;; must decide again on the map it takes under the `file` row lock, so it
|
|
;; writes nothing: the save survives, `revn` never goes back (a client whose
|
|
;; revn is higher than the stored one cannot save again) and the object the
|
|
;; save left stays referenced instead of becoming a frozen orphan.
|
|
(with-redefs [cf/get (th/config-get-mock {:file-data-backend "storage"})]
|
|
(let [{:keys [profile-id file-id page-id]} (create-file!)
|
|
shape-id (uuid/random)
|
|
fired? (atom false)
|
|
replaced (atom nil)
|
|
saved-at (atom nil)
|
|
saved-revn (atom nil)]
|
|
|
|
(force-migration! file-id)
|
|
|
|
(with-redefs [fmigr/resolve-applied-migrations
|
|
(let [orig fmigr/resolve-applied-migrations]
|
|
(fn [cfg file]
|
|
(let [result (orig cfg file)]
|
|
(when (compare-and-set! fired? false true)
|
|
;; The save commits once the read has already
|
|
;; seen the pending migration. It applies the
|
|
;; migration on its own and records it.
|
|
(let [out (save! profile-id file-id 0
|
|
[(th/add-rect-change page-id shape-id)])]
|
|
(t/is (nil? (:error out))))
|
|
|
|
(let [row (file-data-row file-id)]
|
|
(reset! replaced (:storage-object-id row))
|
|
(reset! saved-revn (:revn (th/db-get :file {:id file-id})))
|
|
(reset! saved-at (:modified-at (th/db-get :file {:id file-id}))))
|
|
|
|
;; Freeze the object the save left, as the storage
|
|
;; GC would if it saw it before a stale write
|
|
;; replaced the row again: a write that does not
|
|
;; touch it leaks the blob forever.
|
|
(th/db-update! :storage-object
|
|
{:touched-at nil}
|
|
{:id @replaced}))
|
|
result)))]
|
|
|
|
(let [returned (db/tx-run! th/*system*
|
|
(fn [cfg] (bfc/get-file cfg file-id)))
|
|
row (th/db-get :file {:id file-id})
|
|
persisted (db/tx-run! th/*system*
|
|
(fn [cfg] (bfc/get-file cfg file-id
|
|
:migrate? false
|
|
:realize? true)))]
|
|
|
|
(t/testing "the save survives the read"
|
|
(t/is (= @saved-revn (:revn returned)))
|
|
(t/is (= @saved-revn (:revn row)))
|
|
(t/is (= @saved-at (:modified-at row)))
|
|
(t/is (some? (get-in persisted [:data :pages-index page-id :objects shape-id]))))
|
|
|
|
(t/testing "the read writes nothing and the file ends migrated"
|
|
(t/is (not (fmg/need-migration? returned)))
|
|
(t/is (= @replaced (:storage-object-id (file-data-row file-id))))
|
|
(t/is (seq (th/db-query :file-migration
|
|
{:file-id file-id
|
|
:name migration-name}))))
|
|
|
|
(t/testing "the next save of the same client does not conflict"
|
|
(let [out (save! profile-id file-id @saved-revn
|
|
[(th/add-rect-change page-id (uuid/random))])]
|
|
(t/is (nil? (:error out))))))))))
|
|
|
|
(t/deftest migration-already-applied-by-another-reader-is-not-persisted
|
|
;; Two readers see the migration pending; the first to get the lock migrates
|
|
;; and persists. The second must re-check on its locked read and write
|
|
;; nothing (a second write would create another object for the same data).
|
|
(with-redefs [cf/get (th/config-get-mock {:file-data-backend "storage"})]
|
|
(let [{:keys [file-id]} (create-file!)
|
|
fired? (atom false)
|
|
pointer (atom nil)]
|
|
|
|
(force-migration! file-id)
|
|
|
|
(with-redefs [fmg/need-migration?
|
|
(let [orig fmg/need-migration?]
|
|
(fn [file]
|
|
(let [result (orig file)]
|
|
(when (and result (compare-and-set! fired? false true))
|
|
;; The other reader wins the lock, migrates and
|
|
;; persists before this one gets it.
|
|
(db/tx-run! th/*system*
|
|
(fn [cfg] (bfc/get-file cfg file-id)))
|
|
(reset! pointer (:storage-object-id (file-data-row file-id))))
|
|
result)))]
|
|
|
|
(db/tx-run! th/*system*
|
|
(fn [cfg] (bfc/get-file cfg file-id)))
|
|
|
|
(t/testing "the reader that lost the race does not write"
|
|
(t/is (uuid? @pointer))
|
|
(t/is (= @pointer (:storage-object-id (file-data-row file-id)))))
|
|
|
|
(t/testing "the file ends migrated"
|
|
(t/is (seq (th/db-query :file-migration
|
|
{:file-id file-id
|
|
:name migration-name}))))))))
|
|
|
|
(t/deftest migration-read-loads-the-file-data-once
|
|
;; The probe decides with a row read without data, so the migration path
|
|
;; keeps a single decoded copy of the file in the heap (a large file can be
|
|
;; hundreds of MB and a second copy can exhaust it).
|
|
(let [{:keys [file-id]} (create-file!)
|
|
reads (atom 0)]
|
|
|
|
(force-migration! file-id)
|
|
|
|
(with-redefs [fdata/resolve-file-data
|
|
(let [orig fdata/resolve-file-data]
|
|
(fn [cfg file]
|
|
(when (= file-id (:id file))
|
|
(swap! reads inc))
|
|
(orig cfg file)))]
|
|
|
|
(db/tx-run! th/*system*
|
|
(fn [cfg] (bfc/get-file cfg file-id)))
|
|
|
|
(t/is (= 1 @reads)))))
|
|
|
|
(t/deftest realize-runs-once-per-read-path
|
|
;; `fdata/realize` is a full walk of the decoded data. The read owns it once
|
|
;; per path; the migration path pays it twice on purpose, once inside
|
|
;; `migrate-file` (the chain needs plain data) and once on its result.
|
|
(let [{:keys [file-id]} (create-file!)
|
|
calls (atom 0)
|
|
read! (fn [opts]
|
|
(reset! calls 0)
|
|
(with-redefs [fdata/realize
|
|
(let [orig fdata/realize]
|
|
(fn [cfg file]
|
|
(swap! calls inc)
|
|
(orig cfg file)))]
|
|
(db/tx-run! th/*system*
|
|
(fn [cfg] (bfc/get-file cfg file-id opts)))))]
|
|
(t/testing "a plain read realizes once"
|
|
(read! {:realize? true})
|
|
(t/is (= 1 @calls)))
|
|
|
|
(t/testing "a read-only read realizes once"
|
|
(read! {:realize? true :read-only? true})
|
|
(t/is (= 1 @calls)))
|
|
|
|
(t/testing "the migration path realizes twice"
|
|
(force-migration! file-id)
|
|
(read! {:realize? true})
|
|
(t/is (= 2 @calls)))))
|
|
|
|
(t/deftest row-only-read-resolves-the-applied-migrations-on-demand
|
|
;; A row-only read resolves the applied migrations by default, because the
|
|
;; row can be completed later and the caller may need them; the explicit
|
|
;; opt-out leaves them out.
|
|
(let [{:keys [file-id]} (create-file!)
|
|
with-migrations (bfc/get-file th/*system* file-id :load-data? false)
|
|
without (bfc/get-file th/*system* file-id
|
|
:load-data? false
|
|
:load-migrations? false)]
|
|
(t/is (seq (:migrations with-migrations)))
|
|
(t/is (nil? (:migrations without)))))
|
|
|
|
(t/deftest migrating-read-returns-the-pointer-it-persisted
|
|
;; The map a migrating read returns must carry the pointer of the row it
|
|
;; left: a caller that writes with it touches that object instead of the
|
|
;; replaced one. The storage GC freezes a referenced object, so a write
|
|
;; that misses it leaks the blob forever.
|
|
(with-redefs [cf/get (th/config-get-mock {:file-data-backend "storage"})]
|
|
(let [{:keys [file-id]} (create-file!)]
|
|
(force-migration! file-id)
|
|
(let [file (db/tx-run! th/*system*
|
|
(fn [cfg] (bfc/get-file cfg file-id)))
|
|
left (:storage-object-id (file-data-row file-id))]
|
|
|
|
(t/testing "the read reports the pointer of the persisted row"
|
|
(t/is (uuid? left))
|
|
(t/is (= left (:storage-object-id file))))
|
|
|
|
;; Freeze the object while the row still references it, as the storage
|
|
;; GC does; the later write must touch it (see the concurrent-save
|
|
;; test for the same technique).
|
|
(th/db-update! :storage-object {:touched-at nil} {:id left})
|
|
|
|
(db/tx-run! th/*system*
|
|
(fn [cfg] (bfc/update-file! cfg file)))
|
|
|
|
(let [row (file-data-row file-id)]
|
|
(t/testing "the write replaces the row and touches the object it left"
|
|
(t/is (not= left (:storage-object-id row)))
|
|
(t/is (some? (:touched-at (storage-object left))))))))))
|
|
|
|
(t/deftest read-completes-with-a-single-row-read
|
|
;; The common read is one row read (with its data columns) and
|
|
;; `attach-file-data` completes it.
|
|
(let [{:keys [file-id page-id]} (create-file!)
|
|
[file sqls] (th/read-recording-sql
|
|
#(db/tx-run! th/*system*
|
|
(fn [cfg] (bfc/get-file cfg file-id))))]
|
|
(t/is (= [bfc/sql:get-file] sqls))
|
|
(t/is (some? (get-in file [:data :pages-index page-id])))))
|
|
|
|
(t/deftest read-resolves-the-applied-migrations-once
|
|
;; The common read resolves the applied migrations once. The migration path
|
|
;; resolves them again on the locked re-read (it must decide on the fresh
|
|
;; row) and once more after persisting (to return the applied set); no path
|
|
;; resolves them twice without a reason.
|
|
(let [{:keys [file-id]} (create-file!)
|
|
calls (atom 0)
|
|
read! (fn []
|
|
(reset! calls 0)
|
|
(with-redefs [fmigr/resolve-applied-migrations
|
|
(let [orig fmigr/resolve-applied-migrations]
|
|
(fn [cfg file]
|
|
(swap! calls inc)
|
|
(orig cfg file)))]
|
|
(db/tx-run! th/*system*
|
|
(fn [cfg] (bfc/get-file cfg file-id)))))]
|
|
|
|
(read!)
|
|
(t/is (= 1 @calls))
|
|
|
|
(force-migration! file-id)
|
|
(read!)
|
|
(t/is (= 3 @calls))))
|
|
|
|
(t/deftest migration-read-rereads-the-row-under-lock
|
|
;; The first read decides; only when a migration is pending the row is read
|
|
;; again, and that second read takes the `file` row lock.
|
|
(let [{:keys [file-id]} (create-file!)]
|
|
(force-migration! file-id)
|
|
(let [[_ sqls] (th/read-recording-sql
|
|
#(db/tx-run! th/*system*
|
|
(fn [cfg] (bfc/get-file cfg file-id))))]
|
|
(t/is (= [bfc/sql:get-file
|
|
(str bfc/sql:get-file " FOR UPDATE of f")]
|
|
sqls)))))
|
|
|
|
(t/deftest read-only-migration-never-writes
|
|
;; A read-only context migrates in memory: no lock, no row write and no
|
|
;; storage write. The pending migration stays pending.
|
|
(with-redefs [cf/get (th/config-get-mock {:file-data-backend "storage"})]
|
|
(let [{:keys [file-id page-id]} (create-file!)
|
|
pointer (:storage-object-id (file-data-row file-id))]
|
|
|
|
(force-migration! file-id)
|
|
|
|
(let [returned (db/tx-run! th/*system*
|
|
(fn [cfg] (bfc/get-file cfg file-id :read-only? true)))]
|
|
|
|
(t/testing "the read returns migrated, realized data"
|
|
(t/is (not (pmap/pointer-map? (get-in returned [:data :pages-index page-id])))))
|
|
|
|
(t/testing "nothing is persisted"
|
|
(t/is (= pointer (:storage-object-id (file-data-row file-id))))
|
|
(t/is (empty? (th/db-query :file-migration
|
|
{:file-id file-id
|
|
:name migration-name}))))))))
|
|
|
|
(t/deftest read-only-cfg-migration-never-writes
|
|
;; A cfg marked `::db/read-only` migrates in memory too: `db/tx-run!` opens
|
|
;; the transaction read-only, `get-file*` sees the connection read-only and
|
|
;; takes the no-persist branch. The config flag that fills this key is
|
|
;; legacy, but the key is set by hand (objects-gc, the REPL), so the read
|
|
;; must keep working under it.
|
|
(with-redefs [cf/get (th/config-get-mock {:file-data-backend "storage"})]
|
|
(let [{:keys [file-id page-id]} (create-file!)
|
|
pointer (:storage-object-id (file-data-row file-id))]
|
|
|
|
(force-migration! file-id)
|
|
|
|
(let [returned (db/tx-run! (assoc th/*system* ::db/read-only true)
|
|
(fn [cfg] (bfc/get-file cfg file-id)))]
|
|
|
|
(t/testing "the read returns migrated data"
|
|
(t/is (not (pmap/pointer-map? (get-in returned [:data :pages-index page-id])))))
|
|
|
|
(t/testing "nothing is persisted"
|
|
(t/is (= pointer (:storage-object-id (file-data-row file-id))))
|
|
(t/is (empty? (th/db-query :file-migration
|
|
{:file-id file-id
|
|
:name migration-name}))))))))
|
|
|
|
(t/deftest read-only-read-does-not-open-a-transaction
|
|
;; A read-only read takes no lock and writes nothing, so `get-file` runs it
|
|
;; on a plain connection instead of opening a transaction of its own. The
|
|
;; redefinition proves both directions: the same call without the option
|
|
;; does open one.
|
|
(let [{:keys [file-id]} (create-file!)]
|
|
(with-redefs [db/tx-run! (fn [& _]
|
|
(throw (ex-info "opened a transaction" {})))]
|
|
(t/is (some? (bfc/get-file th/*system* file-id :read-only? true)))
|
|
(t/is (thrown? clojure.lang.ExceptionInfo
|
|
(bfc/get-file th/*system* file-id))))))
|