Commit cdd2ee9
authored
feat: new transaction feature (#1239)
* Move the state up, make it protected
Transaction state should move up to the super class
* Build new transaction options method
Add a method for building transaction options. Also add a method for detecting if a request is a transaction. Build new transaction options
* Correct the fn that builds transactions
Corrected getTransactionRequest. Build the request options properly.
* Set transaction to readOnly in system test.
When this system test isn’t set to be a readOnly transaction then the error occurs which says too much contention.
* Change #parseRunSuccess
Change parseRunSuccess so that it can be used more universally.
* Move parseRunSuccess up to protected
parseRunSuccess should move up to the super class because it now needs to be used there.
* Saves the transaction id
This change saves the transaction id returned from the server for read calls
* Add tests for testing read only transactions
Read only tests are needed
* Add tests that measure read time
Make sure that code using the new transaction option has better performance than code that doesn’t have it.
* ran linter
* Add a test for testing requests
Use the MockedTransactionWrapper to test requests being passed into the Gapic layer.
* Final changes to make test work
Mock out begin transaction. Test for newTransaction consistency type. Mock out commit.
* Add the transaction.run test
A transaction.run test is needed for lookup, lookup, put, commit.
* run linter
* runQuery, lookup, put, commit
Add a test for this sequence of operations and ensure it works properly.
* runAggregationQuery, lookup, put, commit
Four operations that get all the results for running an aggregation query. Adding another test for these four operations.
* put, put, lookup, commit
Last test suite regarding new transaction unit tests.
* Add tests for the commits
Add a bunch of tests for the commit case. Check the commit gapic input.
* Add testing to ensure begin tx is called
Begin transaction should be called at least once. Add code here to increment the counter.
* Document #blockWithMutex
Remove commented code too.
* Document transaction state
* feat: new transaction feature branch
* Add a check for expired
Check for expired on most functions and write tests for the expired check.
* Add commit and rollback blocks
Check for expired state in the commit and rollback blocks.
* run the linter
* Don’t allow readtime to be specified in a txn
Matches the python client.
* throw error for both read time and consistency
* Add test for specifying readtime
* Remove the console logs
* Refactor the test
* Improve test to make sure Gapic layer isn’t called
Also, fix bug with read consistency.
* Run linter
Reorganize tests
New test for readtime and consistency
* Make change to allow the runAggregationQuery go up
* Should error when get is used
* Move tests over and refactor initialized datastore
* Remove only and remove imports
* Introduce parameterized testing for errors
* Use parameters in parameterized tests
* Migrate error tests to parameterized testing
* Change description
* Prepare second describe block for tests
* Revert "Prepare second describe block for tests"
This reverts commit 974117b.
* Always return after the error is sent back
This ensures that an extra call does not get made to the server.
* Add headers
* Tests and implementation for expired on rollback
* fix test
* Wrap rollbacks with a withBeginTransaction.
* Update the test so that it begins the tx before
* Throw error if transaction not started on rollback
* Remove only
* Add a comment to the test regarding new txn.run()
* Ensure that the errors get bubbled up
* Run. linter
* read time and consistency error
* Remove unnecessary change
* Eliminate the call to withBeginTransaction
* Throw error reported in documentation
* Work on streaming errors
Fix the concurrency tests and move the error reporting outside of the stream, add two tests for the streams to make sure errors get reported.
* Move the error throwing up the stack
This makes it so that it is reported in the streams.
* Fix linting errors
* Generate unit tests for getTransactionRequest
I am going to rewrite the getTransactionRequest function so it is a good idea not to change how it works.
* Generate unit tests
Fix the compiler error
Change code so that when readOnly is specified then readwrite options are ignored.
Fix the unit test to adopt this change.
* Make function one ternary operation
Add comments, simplify logic in the function.
* Add two comments
* Update the comment
* Run the linter1 parent 91237e0 commit cdd2ee9
File tree
9 files changed
+1760
-206
lines changed- src
- system-test
- test
- gapic-mocks
9 files changed
+1760
-206
lines changedLarge diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
24 | | - | |
| 23 | + | |
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
28 | | - | |
29 | 27 | | |
30 | 28 | | |
31 | 29 | | |
32 | 30 | | |
33 | 31 | | |
34 | 32 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | 33 | | |
39 | | - | |
| 34 | + | |
40 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
41 | 39 | | |
| 40 | + | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | 57 | | |
62 | 58 | | |
63 | 59 | | |
| |||
85 | 81 | | |
86 | 82 | | |
87 | 83 | | |
88 | | - | |
89 | 84 | | |
90 | 85 | | |
91 | 86 | | |
| |||
115 | 110 | | |
116 | 111 | | |
117 | 112 | | |
| 113 | + | |
118 | 114 | | |
119 | 115 | | |
120 | 116 | | |
| |||
177 | 173 | | |
178 | 174 | | |
179 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
| |||
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
365 | 361 | | |
366 | 362 | | |
367 | 363 | | |
| |||
434 | 430 | | |
435 | 431 | | |
436 | 432 | | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
437 | 441 | | |
438 | 442 | | |
439 | 443 | | |
| |||
442 | 446 | | |
443 | 447 | | |
444 | 448 | | |
| 449 | + | |
445 | 450 | | |
446 | 451 | | |
447 | 452 | | |
| |||
511 | 516 | | |
512 | 517 | | |
513 | 518 | | |
514 | | - | |
| 519 | + | |
515 | 520 | | |
516 | 521 | | |
517 | 522 | | |
| |||
635 | 640 | | |
636 | 641 | | |
637 | 642 | | |
| 643 | + | |
638 | 644 | | |
639 | 645 | | |
640 | 646 | | |
| |||
666 | 672 | | |
667 | 673 | | |
668 | 674 | | |
669 | | - | |
| 675 | + | |
670 | 676 | | |
671 | 677 | | |
672 | 678 | | |
673 | 679 | | |
674 | | - | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | | - | |
683 | | - | |
684 | | - | |
685 | | - | |
686 | | - | |
687 | 680 | | |
688 | 681 | | |
689 | 682 | | |
| |||
696 | 689 | | |
697 | 690 | | |
698 | 691 | | |
699 | | - | |
700 | | - | |
701 | | - | |
702 | | - | |
703 | | - | |
704 | | - | |
705 | | - | |
706 | | - | |
707 | | - | |
708 | | - | |
709 | | - | |
710 | | - | |
711 | | - | |
712 | | - | |
713 | | - | |
714 | | - | |
715 | | - | |
716 | 692 | | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
717 | 696 | | |
718 | 697 | | |
719 | 698 | | |
| |||
766 | 745 | | |
767 | 746 | | |
768 | 747 | | |
769 | | - | |
770 | | - | |
771 | | - | |
772 | | - | |
773 | | - | |
774 | | - | |
775 | | - | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
776 | 751 | | |
777 | 752 | | |
778 | 753 | | |
| |||
805 | 780 | | |
806 | 781 | | |
807 | 782 | | |
808 | | - | |
809 | | - | |
810 | | - | |
811 | | - | |
812 | | - | |
813 | | - | |
814 | | - | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
815 | 786 | | |
816 | 787 | | |
817 | 788 | | |
| |||
1019 | 990 | | |
1020 | 991 | | |
1021 | 992 | | |
1022 | | - | |
| 993 | + | |
1023 | 994 | | |
1024 | 995 | | |
1025 | 996 | | |
| |||
1031 | 1002 | | |
1032 | 1003 | | |
1033 | 1004 | | |
1034 | | - | |
| 1005 | + | |
1035 | 1006 | | |
1036 | 1007 | | |
1037 | | - | |
| 1008 | + | |
1038 | 1009 | | |
1039 | 1010 | | |
1040 | 1011 | | |
| |||
1044 | 1015 | | |
1045 | 1016 | | |
1046 | 1017 | | |
1047 | | - | |
| 1018 | + | |
1048 | 1019 | | |
1049 | 1020 | | |
1050 | 1021 | | |
| |||
1057 | 1028 | | |
1058 | 1029 | | |
1059 | 1030 | | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
1060 | 1056 | | |
1061 | 1057 | | |
1062 | 1058 | | |
| |||
0 commit comments