- Notifications
You must be signed in to change notification settings - Fork28
Commit54428db
committed
Fix error handling in temp-file deletion with log_temp_files active.
The original coding in FileClose() reset the file-is-temp flag beforeunlinking the file, so that if control came back through due to an error,it wouldn't try to unlink the file twice. This was correct when written,but when the log_temp_files feature was added, the logging action was putin between those two steps. An error occurring during the logging action--- such as a query cancel --- would result in the unlink not getting doneat all, as in recent report from Michael Glaesemann.To fix this, make sure that we do both the stat and the unlink before doinganything that could conceivably CHECK_FOR_INTERRUPTS. There is a judgmentcall here, which is which log message to emit first: if you can see onlyone, which should it be? I chose to log unlink failure at the risk oflosing the log_temp_files log message --- after all, if the unlink doesfail, the temp file is still there for you to see.Back-patch to all versions that have log_temp_files. The code was OKbefore that.1 parent854ae8c commit54428db
1 file changed
+33
-6
lines changedLines changed: 33 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1032 | 1032 |
| |
1033 | 1033 |
| |
1034 | 1034 |
| |
1035 |
| - | |
1036 | 1035 |
| |
1037 | 1036 |
| |
1038 | 1037 |
| |
| |||
1055 | 1054 |
| |
1056 | 1055 |
| |
1057 | 1056 |
| |
1058 |
| - | |
| 1057 | + | |
1059 | 1058 |
| |
1060 | 1059 |
| |
1061 | 1060 |
| |
1062 |
| - | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
1063 | 1068 |
| |
| 1069 | + | |
1064 | 1070 |
| |
1065 | 1071 |
| |
1066 |
| - | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
1067 | 1087 |
| |
1068 | 1088 |
| |
1069 | 1089 |
| |
| |||
1072 | 1092 |
| |
1073 | 1093 |
| |
1074 | 1094 |
| |
| 1095 | + | |
| 1096 | + | |
1075 | 1097 |
| |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
1076 | 1105 |
| |
1077 |
| - | |
1078 |
| - | |
1079 | 1106 |
| |
1080 | 1107 |
| |
1081 | 1108 |
| |
|
0 commit comments
Comments
(0)