forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd0eb429
committed
Handle better implicit transaction state of pipeline mode
When using a pipeline, a transaction starts from the first command andis committed with a Sync message or when the pipeline ends.Functions like IsInTransactionBlock() or PreventInTransactionBlock()were already able to understand a pipeline as being in a transactionblock, but it was not the case of CheckTransactionBlock(). Thisfunction is called for example to generate a WARNING for SET LOCAL,complaining that it is used outside of a transaction block.The current state of the code caused multiple problems, like:- SET LOCAL executed at any stage of a pipeline issued a WARNING, evenif the command was at least second in line where the pipeline is in atransaction state.- LOCK TABLE failed when invoked at any step of a pipeline, even if itshould be able to work within a transaction block.The pipeline protocol assumes that the first command of a pipeline isnot part of a transaction block, and that any follow-up commands isconsidered as within a transaction block.This commit changes the backend so as an implicit transaction block isstarted each time the first Execute message of a pipeline has finishedprocessing, with this implicit transaction block ended once a sync isprocessed. The checks based on XACT_FLAGS_PIPELINING in the routineschecking if we are in a transaction block are not necessary: it isenough to rely on the existing ones.Some tests are added to pgbench, that can be backpatched down to v17when \syncpipeline is involved and down to v14 where \startpipeline and\endpipeline are available. This is unfortunately limited regarding theerror patterns that can be checked, but it provides coverage for variouspipeline combinations to check if these succeed or fail. These testsare able to capture the case of SET LOCAL's WARNING. The author hasproposed a different feature to improve the coverage by adding similarmeta-commands to psql where error messages could be checked, somethingmore useful for the cases where commands cannot be used in transactionblocks, like REINDEX CONCURRENTLY or VACUUM. This is considered asfuture work for v18~.Author: Anthonin BonnefoyReviewed-by: Jelte Fennema-Nio, Michael PaquierDiscussion:https://postgr.es/m/CAO6_XqrWO8uNBQrSu5r6jh+vTGi5Oiyk4y8yXDORdE2jbzw8xw@mail.gmail.comBackpatch-through: 131 parent6e80951 commitd0eb429
File tree
4 files changed
+203
-23
lines changed- doc/src/sgml
- src
- backend
- access/transam
- tcop
- bin/pgbench/t
4 files changed
+203
-23
lines changedLines changed: 11 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1070 | 1070 |
| |
1071 | 1071 |
| |
1072 | 1072 |
| |
1073 |
| - | |
1074 |
| - | |
1075 |
| - | |
1076 |
| - | |
1077 |
| - | |
1078 |
| - | |
1079 |
| - | |
1080 |
| - | |
1081 |
| - | |
1082 |
| - | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
1083 | 1084 |
| |
1084 | 1085 |
| |
1085 | 1086 |
| |
|
Lines changed: 0 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3659 | 3659 |
| |
3660 | 3660 |
| |
3661 | 3661 |
| |
3662 |
| - | |
3663 |
| - | |
3664 |
| - | |
3665 |
| - | |
3666 |
| - | |
3667 |
| - | |
3668 |
| - | |
3669 |
| - | |
3670 |
| - | |
3671 |
| - | |
3672 | 3662 |
| |
3673 | 3663 |
| |
3674 | 3664 |
| |
| |||
3780 | 3770 |
| |
3781 | 3771 |
| |
3782 | 3772 |
| |
3783 |
| - | |
3784 |
| - | |
3785 |
| - | |
3786 | 3773 |
| |
3787 | 3774 |
| |
3788 | 3775 |
| |
|
Lines changed: 18 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2780 | 2780 |
| |
2781 | 2781 |
| |
2782 | 2782 |
| |
| 2783 | + | |
| 2784 | + | |
| 2785 | + | |
| 2786 | + | |
| 2787 | + | |
| 2788 | + | |
| 2789 | + | |
| 2790 | + | |
| 2791 | + | |
| 2792 | + | |
| 2793 | + | |
2783 | 2794 |
| |
2784 | 2795 |
| |
2785 | 2796 |
| |
| |||
4991 | 5002 |
| |
4992 | 5003 |
| |
4993 | 5004 |
| |
| 5005 | + | |
| 5006 | + | |
| 5007 | + | |
| 5008 | + | |
| 5009 | + | |
| 5010 | + | |
| 5011 | + | |
4994 | 5012 |
| |
4995 | 5013 |
| |
4996 | 5014 |
| |
|
Lines changed: 174 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
968 | 968 |
| |
969 | 969 |
| |
970 | 970 |
| |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 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 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
971 | 1145 |
| |
972 | 1146 |
| |
973 | 1147 |
| |
|
0 commit comments
Comments
(0)