Managing Ledgers, Funds, Budgets, Fiscals Years and tracking associated values (UXPROD-1144)

[FOLIO-2269] Document distributed transaction use cases and solutions Created: 18/Sep/19  Updated: 03/Jun/20  Resolved: 25/Oct/19

Status: Closed
Project: FOLIO
Components: Documentation
Affects versions: None
Fix versions: None
Parent: Managing Ledgers, Funds, Budgets, Fiscals Years and tracking associated values

Type: Story Priority: P3
Reporter: Craig McNally Assignee: Craig McNally
Resolution: Done Votes: 0
Labels: NFR
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original estimate: Not Specified

Sprint: ACQ Sprint 74, ACQ Sprint 75
Story Points: 2
Development Team: Thunderjet
Tester Assignee: Craig McNally
Epic Link: Managing Ledgers, Funds, Budgets, Fiscals Years and tracking associated values

 Description   

Overview

The tech leads recently discussed the topic of distributed transactions and possible solutions. As a first step we agreed to document the scenarios and solutions (workarounds) employed, along with concrete examples.

The acquisitions team has run into this problem frequently and has tried several different approaches. For this reason it makes sense for them to take the lead in getting this documentation started. Marc Johnson has also volunteered to contribute to this with examples from circulation.

Approach

Create a wiki page with:

  • Introduction/Overview - what is the purpose of the page
  • Sections for each type of solution w/ explicit examples
    • Eventual consistency via vertx event bus (proactive)
      • PO/POL/Piece receiving/payment status
    • Eventual consistency via update on GET (reactive)
      • Calculation of invoice totals
    • Moving logic to Storage layer and using DB transactions
      • Transaction processing
    • etc.
  • Any other ideas that were discussed but not implemented for whatever reason (e.g. pub sub because it's not fully baked yet)
  • Links to related documentation e.g. spike deliverables

Ideally we could provide initial lists of pros/cons for each of the documented approaches (probably in the respective sections). At least add a sub-section where the pros/cons can be captured later on.

The https://folio-org.atlassian.net/wiki/display/TLG/Tech+Leads+Group+Home space in confluence might be a good home for this - suggestion, not a requirement

Acceptance Criteria

  • Wiki page is created as described above

NOTE: Whoever takes this story may be asked to join the discussion in the tech leads meeting at some later date. (Optional)



 Comments   
Comment by Craig McNally [ 18/Sep/19 ]

David Crossley I've unassigned you (it was given to you automatically) - the acquisitions team will point and pull this story

Comment by Marc Johnson [ 02/Oct/19 ]

Given that no document has been set up for this yet, I thought I'd provide some thoughts here.

The most relevant example from circulation is when the item status is changed as part of circulation processes.

Updating item status during check out and check in

Typically, when an item is checked out, a loan is created within circulation and the item status in inventory is changed to checked out. If one of these operations fails, the other should be undone, which likely means the item status should be done first as it is likely easier to reverse.

Similarly, when checking in an item, a loan could be closed, and the item status is likely to change, either to available or a request fulfilment related status.

This could get more complicated when there are other side effects applied from these changes, for example, loan action history or item status history.

Other possible examples

  • Creating instances via data import

What do we mean by distributed transactions

With the example above, it is relatively apparent that there are changes which need coordinating across contexts (circulation and inventory).

As FOLIO uses distributed business logic and storage modules, we could also consider any operation that involves more than one record (maybe of the same type, maybe of different types) as a distributed transaction, even though these changes are in the same context.

Using an example from above, during a check in, a loan might be closed and request fulfilment might start. It might be that both of these operations need to be reversed if one fails (it might also be that repeating the process is acceptable).

Comment by Viachaslau Khandramai (Inactive) [ 21/Oct/19 ]

Document created: https://folio-org.atlassian.net/wiki/display/FOLIJET/Spike%3A+Distributed+transaction+use+cases+and+solutions. Information about Circulation from Marc Johnson added.

Comment by Marc Johnson [ 22/Oct/19 ]

Владислав Велицкий That link appears to be broken, when I navigated to the page, it was actually at https://folio-org.atlassian.net/wiki/pages/viewpage.action?pageId=1379386 ?

Comment by Viachaslau Khandramai (Inactive) [ 22/Oct/19 ]

Marc Johnson, fixed.

Generated at Thu Feb 08 23:19:26 UTC 2024 using Jira 1001.0.0-SNAPSHOT#100246-sha1:7a5c50119eb0633d306e14180817ddef5e80c75d.