Commit 2946e68
committed
Commit after truncate to reduce lock contention
Truncate takes an `AccessExclusive` lock on the table, which blocks all
other transactions from accessing the table, including select for
datastore_info and any other access to the table contents. Since those
operations are called from the web interface, the UI can hang for the
timeout period or untill the copy finishes. This is poor user
experience when dealing with large files.
So, truncate in it's own transaction, so that the AccessExclusive lock
is held for the least amount of time possible.1 parent 7b8bc6f commit 2946e68
1 file changed
Lines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1053 | 1053 | | |
1054 | 1054 | | |
1055 | 1055 | | |
1056 | | - | |
1057 | | - | |
1058 | | - | |
| 1056 | + | |
1059 | 1057 | | |
1060 | 1058 | | |
1061 | 1059 | | |
1062 | 1060 | | |
1063 | | - | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
1064 | 1065 | | |
1065 | 1066 | | |
1066 | 1067 | | |
1067 | 1068 | | |
1068 | 1069 | | |
1069 | 1070 | | |
1070 | 1071 | | |
1071 | | - | |
| 1072 | + | |
1072 | 1073 | | |
1073 | 1074 | | |
1074 | 1075 | | |
| |||
0 commit comments