forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd811d74
committed
Fix race in SERIALIZABLE READ ONLY.
Commitbdaabb9 started skipping doomed transactions when building thelist of possible conflicts for SERIALIZABLE READ ONLY. That makessense, because doomed transactions won't commit, but a couple of subtlethings broke:1. If all uncommitted r/w transactions are doomed, a READ ONLYtransaction would arbitrarily not benefit from the safe snapshotoptimization. It would not be taken immediately, and yet no othertransaction would set SXACT_FLAG_RO_SAFE later.2. In the same circumstances but with DEFERRABLE, GetSafeSnapshot()would correctly exit its wait loop without sleeping and then take theoptimization in non-assert builds, but assert builds would fail a sanitycheck that SXACT_FLAG_RO_SAFE had been set by another transaction.This is similar to the case for PredXact->WritableSxactCount == 0. Weshould opt out immediately if our possibleUnsafeConflicts list is emptyafter filtering.The code to maintain the serializable global xmin is moved down belowthe new opt out site, because otherwise we'd have to reverse its effectsbefore returning.Back-patch to all supported releases. Bug #17368.Reported-by: Alexander Lakhin <exclusion@gmail.com>Discussion:https://postgr.es/m/17116-d6ca217acc180e30%40postgresql.orgDiscussion:https://postgr.es/m/20110707212159.GF76634%40csail.mit.edu1 parent324281f commitd811d74
1 file changed
+31
-18
lines changedLines changed: 31 additions & 18 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1846 | 1846 |
| |
1847 | 1847 |
| |
1848 | 1848 |
| |
1849 |
| - | |
1850 |
| - | |
1851 |
| - | |
1852 |
| - | |
1853 |
| - | |
1854 |
| - | |
1855 |
| - | |
1856 |
| - | |
1857 |
| - | |
1858 |
| - | |
1859 |
| - | |
1860 |
| - | |
1861 |
| - | |
1862 |
| - | |
1863 |
| - | |
1864 |
| - | |
1865 |
| - | |
1866 |
| - | |
1867 | 1849 |
| |
1868 | 1850 |
| |
1869 | 1851 |
| |
| |||
1900 | 1882 |
| |
1901 | 1883 |
| |
1902 | 1884 |
| |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
| 1892 | + | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
1903 | 1898 |
| |
1904 | 1899 |
| |
1905 | 1900 |
| |
| |||
1908 | 1903 |
| |
1909 | 1904 |
| |
1910 | 1905 |
| |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
1911 | 1924 |
| |
1912 | 1925 |
| |
1913 | 1926 |
| |
|
0 commit comments
Comments
(0)