Fork me on GitHub
#datomic
<
2024-02-26
>
cch103:02:21

Got burned* by this one tonight. • Datomic Cloud

(d/transact (-> @user/sysref :datomic/connection) {:tx-data nil})
=> Execution error (ExceptionInfo) at datomic.client.impl.shared/api->client-req (shared.clj:258).
Expected collection for :tx-data
• Datomic Local
(d/transact (-> @user/sysref :datomic/connection) {:tx-data nil})
{:db-before #datomic.core.db.Db{:id "stt", :basisT 100047, :indexBasisT -1, :index-root-id nil, :asOfT nil, :sinceT nil, :raw nil},
 :db-after #datomic.core.db.Db{:id "stt", :basisT 100048, :indexBasisT -1, :index-root-id nil, :asOfT nil, :sinceT nil, :raw nil},
 :tx-data [#datom[13194139633360 50 #inst "2024-02-26T03:54:14.483-00:00" 13194139633360 true]],
 :tempids {}}
• Clearly there is a problem in our code, but we got burned because the exceptions in production prevented some essential side effects from happening and when developing against dev local we never noticed the problem.

✍️ 2
silian04:02:03

Thanks for sharing this.

cch117:02:39

I've got a scenario where I am starting my ion code and immediately transacting something. The transaction is failing because (most likely) the database has not yet been loaded. I'm trying to find a reasonable coordination mechanism to block the transaction until the system has successfully loaded the database. Would a call d/db-stats work? I could also write a throw-away query, but I worry a bit about a query completing after the database is partially loaded and before a transaction can succeede.

Joe Lane18:02:43

Why not use a retry with linear backoff?

cch119:02:40

That's what I'm doing now, but mainly for logging consistency I would like to log transaction failures except at startup.

az21:02:50

Wondering if someone can clarify naming things correctly in a datomic system. Details in the thread.

az21:02:57

For a hypothetical setup is this right? App overview: An inventory system Dev setup System name: inventory-dev Storage Template Stack name: inventory-dev Compute Template - (Primary compute group) Stack name: inventory-dev-primary-compute System name: inventory-dev App name: inventory-dev Compute Template - (Analytics compute group) Stack name: inventory-dev-analytics-compute System name: inventory-dev App name: inventory-dev-analytics (Different codebase) Prod setup System name: inventory-prod Storage Template Stack name: inventory-prod (Do I even create a new storage stack?) Compute Template - (Primary compute group) Stack name: inventory-prod-primary-compute System name: inventory-prod App name: inventory-prod Compute Template - (Analytics compute group) Stack name: inventory-prod-analytics-compute System name: inventory-prod App name: inventory-prod-analytics (Different codebase) Questions 1. Should the system name be suffixed with resources? inventory-dev, inventory-prod? 2. Is the storage stack's "stack name" be the system name? 3. Is the term compute stack synonymous compute group when used in docs? 4. Do I create different systems for dev and prod or can they live within the same system?