View Issue Details

IDProjectCategoryView StatusLast Update
0009273Talermechant backendpublic2024-10-30 07:44
Reporterfefe Assigned ToChristian Grothoff  
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Product Versiongit (master) 
Target Version0.14Fixed in Version0.14 
Summary0009273: Do we need some explicit transactions? ex: deposit_get_cb
DescriptionHere is the relevant code from deposit_get_cb (in src/backend/taler-merchant-depositcheck.c)

   430 qs = db_plugin->insert_deposit_to_transfer (
   431 db_plugin->cls,
   432 w->deposit_serial,
   433 &dr->details.ok);
   434 if (qs < 0)
   435 {
   436 GNUNET_break (0);
   437 GNUNET_SCHEDULER_shutdown ();
   438 return;
   439 }
   440 qs = db_plugin->update_deposit_confirmation_status (
   441 db_plugin->cls,
   442 w->deposit_serial,
   443 false, /* we are done, wire_pending is now false */
   444 GNUNET_TIME_absolute_to_timestamp (future_retry),
   445 w->retry_backoff,
   446 NULL);

We do an insert first and then an update. If something happens in the middle, like an allocation failure, or a network issue to the database, do we leave the database in an inconsistent state without a transaction around them both here?


TagsNo tags attached.

Activities

Christian Grothoff

2024-10-30 07:43

manager   ~0023635

It'd be fine: the lookup_pending_deposits would simply trigger again, we'd again find the transfer, do nothing, and then do the 2nd SQL transaction. But, more importantly, upon closer inspection, the insert_deposit_to_transfer already *includes* the update_deposit_confirmation_status: it sets wire_pending to FALSE (see pg_insert_deposit_to_transfer.sql), so the 2nd transaction (update_deposit_confirmation_status) is basically entirely superfluous. I'll just remove it.

Christian Grothoff

2024-10-30 07:44

manager   ~0023636

Fixed in 5829b20f..1e015377

Issue History

Date Modified Username Field Change
2024-10-16 13:49 fefe New Issue
2024-10-16 13:49 fefe Status new => assigned
2024-10-16 13:49 fefe Assigned To => Christian Grothoff
2024-10-30 07:43 Christian Grothoff Note Added: 0023635
2024-10-30 07:43 Christian Grothoff Fixed in Version => 0.14
2024-10-30 07:43 Christian Grothoff Target Version => 0.14
2024-10-30 07:44 Christian Grothoff Status assigned => resolved
2024-10-30 07:44 Christian Grothoff Resolution open => fixed
2024-10-30 07:44 Christian Grothoff Note Added: 0023636