Commit e908c71
Karolina Szczepankiewicz
WL#7353 Recover relay log by truncating half written transactions [1/3]
Step 1. Log sanitizer - common class for relay/binary log recovery
This step refactors Binlog_recovery class and methods to be re-usable
during the relay log recovery process. Introduced changes:
New Log_sanitizer class, containing utilities for:
- iteration over events in existing log file/files and extracting:
- the last valid log position
- the last valid source log file and position
- removal of log files containing only partially-written transactions from disk
and the index file
- truncation of the last log file to contain only fully written transactions
Some of the functionalities are used only for relay log recovery. Binary log
recovery will never remove binlog file, since binary log file always start
after the last finished transaction. When relay log recovery is considered, we
need to find a start place, which will be either:
- a Query Event containing the end of the transaction:
- COMMIT / ROLLBACK / XA COMMIT / XA ROLLBACK
- a Query Event containing an atomic DDL
- a source Rotate Event
- a Xid Event
Afterwards, searching for the last valid position begins. If no valid position
can be found in relay log files (e.g. we cannot decrypt relay log files),
relay log recovery won't perform any action.
Change-Id: If76694d2dfa0c62ff7b7243cff9bea451117b3761 parent 889a66a commit e908c71
File tree
12 files changed
+935
-452
lines changed- sql
- binlog
12 files changed
+935
-452
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12686 | 12686 | | |
12687 | 12687 | | |
12688 | 12688 | | |
| 12689 | + | |
| 12690 | + | |
| 12691 | + | |
12689 | 12692 | | |
12690 | 12693 | | |
12691 | 12694 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1020 | 1020 | | |
1021 | 1021 | | |
1022 | 1022 | | |
| 1023 | + | |
1023 | 1024 | | |
1024 | 1025 | | |
1025 | 1026 | | |
| |||
1078 | 1079 | | |
1079 | 1080 | | |
1080 | 1081 | | |
| 1082 | + | |
1081 | 1083 | | |
1082 | 1084 | | |
1083 | 1085 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1903 | 1903 | | |
1904 | 1904 | | |
1905 | 1905 | | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
1906 | 1930 | | |
1907 | 1931 | | |
1908 | 1932 | | |
1909 | 1933 | | |
1910 | 1934 | | |
1911 | 1935 | | |
1912 | | - | |
1913 | | - | |
1914 | 1936 | | |
1915 | 1937 | | |
1916 | 1938 | | |
1917 | 1939 | | |
1918 | 1940 | | |
1919 | | - | |
1920 | | - | |
1921 | | - | |
1922 | | - | |
1923 | | - | |
1924 | | - | |
1925 | | - | |
| 1941 | + | |
| 1942 | + | |
1926 | 1943 | | |
1927 | 1944 | | |
1928 | 1945 | | |
| |||
3296 | 3313 | | |
3297 | 3314 | | |
3298 | 3315 | | |
3299 | | - | |
3300 | | - | |
3301 | | - | |
| 3316 | + | |
| 3317 | + | |
| 3318 | + | |
| 3319 | + | |
| 3320 | + | |
3302 | 3321 | | |
3303 | 3322 | | |
3304 | 3323 | | |
3305 | 3324 | | |
3306 | 3325 | | |
3307 | 3326 | | |
3308 | 3327 | | |
3309 | | - | |
| 3328 | + | |
| 3329 | + | |
3310 | 3330 | | |
3311 | 3331 | | |
3312 | 3332 | | |
| 3333 | + | |
3313 | 3334 | | |
3314 | 3335 | | |
3315 | 3336 | | |
3316 | 3337 | | |
3317 | 3338 | | |
3318 | | - | |
| 3339 | + | |
3319 | 3340 | | |
3320 | 3341 | | |
3321 | 3342 | | |
| 3343 | + | |
| 3344 | + | |
| 3345 | + | |
| 3346 | + | |
3322 | 3347 | | |
3323 | | - | |
| 3348 | + | |
3324 | 3349 | | |
3325 | | - | |
3326 | 3350 | | |
3327 | | - | |
3328 | | - | |
3329 | | - | |
3330 | 3351 | | |
3331 | 3352 | | |
3332 | 3353 | | |
| |||
5868 | 5889 | | |
5869 | 5890 | | |
5870 | 5891 | | |
5871 | | - | |
5872 | | - | |
5873 | | - | |
5874 | | - | |
5875 | | - | |
5876 | | - | |
5877 | | - | |
| 5892 | + | |
| 5893 | + | |
| 5894 | + | |
| 5895 | + | |
5878 | 5896 | | |
5879 | | - | |
5880 | | - | |
5881 | | - | |
5882 | | - | |
5883 | | - | |
5884 | | - | |
5885 | | - | |
| 5897 | + | |
| 5898 | + | |
| 5899 | + | |
| 5900 | + | |
| 5901 | + | |
| 5902 | + | |
| 5903 | + | |
| 5904 | + | |
5886 | 5905 | | |
5887 | | - | |
5888 | | - | |
5889 | | - | |
5890 | | - | |
5891 | | - | |
5892 | | - | |
5893 | | - | |
| 5906 | + | |
| 5907 | + | |
| 5908 | + | |
| 5909 | + | |
5894 | 5910 | | |
5895 | 5911 | | |
5896 | | - | |
| 5912 | + | |
5897 | 5913 | | |
5898 | 5914 | | |
| 5915 | + | |
| 5916 | + | |
| 5917 | + | |
5899 | 5918 | | |
5900 | 5919 | | |
5901 | | - | |
| 5920 | + | |
5902 | 5921 | | |
5903 | | - | |
| 5922 | + | |
5904 | 5923 | | |
5905 | 5924 | | |
5906 | 5925 | | |
5907 | 5926 | | |
5908 | 5927 | | |
5909 | | - | |
| 5928 | + | |
5910 | 5929 | | |
5911 | 5930 | | |
5912 | 5931 | | |
5913 | 5932 | | |
5914 | 5933 | | |
5915 | 5934 | | |
5916 | 5935 | | |
5917 | | - | |
| 5936 | + | |
5918 | 5937 | | |
5919 | 5938 | | |
5920 | 5939 | | |
5921 | 5940 | | |
5922 | 5941 | | |
5923 | | - | |
| 5942 | + | |
5924 | 5943 | | |
5925 | 5944 | | |
5926 | 5945 | | |
| |||
6028 | 6047 | | |
6029 | 6048 | | |
6030 | 6049 | | |
6031 | | - | |
| 6050 | + | |
| 6051 | + | |
6032 | 6052 | | |
6033 | 6053 | | |
6034 | 6054 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
322 | 326 | | |
323 | 327 | | |
324 | 328 | | |
| |||
857 | 861 | | |
858 | 862 | | |
859 | 863 | | |
860 | | - | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
861 | 894 | | |
862 | 895 | | |
863 | 896 | | |
| |||
0 commit comments