Target database must support two-phase transactions.
(self)
| 970 | |
| 971 | @property |
| 972 | def two_phase_transactions(self): |
| 973 | """Target database must support two-phase transactions.""" |
| 974 | |
| 975 | def pg_prepared_transaction(config): |
| 976 | if not against(config, "postgresql"): |
| 977 | return True |
| 978 | |
| 979 | with config.db.connect() as conn: |
| 980 | try: |
| 981 | num = conn.scalar( |
| 982 | text( |
| 983 | "select cast(setting AS integer) from pg_settings " |
| 984 | "where name = 'max_prepared_transactions'" |
| 985 | ) |
| 986 | ) |
| 987 | except exc.OperationalError: |
| 988 | return False |
| 989 | else: |
| 990 | return num > 0 |
| 991 | |
| 992 | return skip_if( |
| 993 | [ |
| 994 | no_support("mssql", "two-phase xact not supported by drivers"), |
| 995 | no_support( |
| 996 | "sqlite", "two-phase xact not supported by database" |
| 997 | ), |
| 998 | no_support("oracle+cx_oracle", "prefer oracledb"), |
| 999 | # in Ia3cbbf56d4882fcc7980f90519412f1711fae74d |
| 1000 | # we are evaluating which modern MySQL / MariaDB versions |
| 1001 | # can handle two-phase testing without too many problems |
| 1002 | # no_support( |
| 1003 | # "mysql", |
| 1004 | # "recent MySQL community editions have too many " |
| 1005 | # "issues (late 2016), disabling for now", |
| 1006 | # ), |
| 1007 | NotPredicate( |
| 1008 | LambdaPredicate( |
| 1009 | pg_prepared_transaction, |
| 1010 | "max_prepared_transactions not available or zero", |
| 1011 | ) |
| 1012 | ), |
| 1013 | ] |
| 1014 | ) |
| 1015 | |
| 1016 | @property |
| 1017 | def two_phase_recovery(self): |
nothing calls this directly
no test coverage detected