New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TP-841 - Order and partition transactions into partitions: SEED_FILE, REVISION, UPDATE. #334
TP-841 - Order and partition transactions into partitions: SEED_FILE, REVISION, UPDATE. #334
Conversation
677bb6f
to
6155fb4
Compare
Codecov Report
@@ Coverage Diff @@
## master #334 +/- ##
==========================================
+ Coverage 91.26% 91.29% +0.02%
==========================================
Files 276 276
Lines 16322 16572 +250
Branches 1326 1348 +22
==========================================
+ Hits 14897 15129 +232
- Misses 1193 1206 +13
- Partials 232 237 +5
Continue to review full report at Codecov.
|
890e5eb
to
445ffb0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like where this is going – will need some tests ofc.
To what extent should we be using the DRAFT/FINALISED flag elsewhere? Would it be more efficient to use it in TrackedModelQuerySet.approved_up_to_transaction(…)
for example, instead of referring to the workbasket status?
9a3b71c
to
3ca20d2
Compare
aa89ab8
to
cf49c05
Compare
1b57679
to
82eebef
Compare
I'm worried that Maybe |
33b5845
to
4ed57ce
Compare
adeba68
to
8ecd1a4
Compare
@simonwo one (non essential) thing I wanted to get working on this, was using RowNumber in the update(...) statement that corrects the order this would mean we could write transactions without any gaps, in the end I couldn't get this working, probably/hopefully missing something obvious there. I guess gaps shouldn't be a problem - (though it opens a question about deletions: can transactions in a draft workbasket be deleted (probably) - and in that case should we consider removing them before making putting them in the REVISION partition ? |
49e3766
to
d722cb5
Compare
1bc0073
to
01f3486
Compare
Yes, probably everywhere - I think this should try and land and we can move everything else over that hasn't been as future PRs. |
b6f8c06
to
5f7b03e
Compare
cd5bb59
to
c0b6a9c
Compare
… updated afterwards (a revision) or are in a workbasket. This allows these all to have seperate orders. To allow a global order partion, order can be used. To enable moving away from hardcoding that the first workbasket contains transactions, this PR introduces transactions schemas, these can be set in settings and on import, with "seed_first" corresponding to the current implementation, "seed" and "revision" create the corresponding transactions. Data migrations are added to infer the value of the field. Tests to verify transaction order are introduced, which in turn means making changes to factories so that transaction creation and order more closely matches real world operation. Tests found a pre-existingissue that can occur when certain records are placed into a transaction with each other and end up out-of-order, this is pushed out to future work.
c0b6a9c
to
c98a0ba
Compare
This PR introduces partitioning to Transactions.
Global ordering is achieved by ordering on partition, order.
Partitions are:
SEED_FILE: Transactions imported from the initial seed file.
REVISION: Transactions imported or updated later.
DRAFT: Transactions in a workbasket.
During seed file update transactions may transitions are in the SEED_FILE partition.
During ordinary operation transactions are created as DRAFT, then when the WorkBasket is approved the transactions are changed to UPDATE and the order is rewritten to start after the highest REVISION transaction.