Commit ff53ba7
fix: use 1× vlog mmap and add pre-rotation check
Two changes to prevent virtual address space exhaustion on 32-bit:
1. Reduce vlog file mmap from 2× to 1× ValueLogFileSize. The 2× multiplier
was dead headroom — each 4 MB vlog file consumed 8 MB of address space,
and with hundreds of files the total exceeded the 3 GB 32-bit limit.
2. Add a pre-emptive rotation check before each vlog entry write. When an
entry would straddle the file boundary, rotate to a fresh file first so
the entry lands cleanly. This avoids the need for dynamic mmap growth
via Truncate/mremap, which can fail on 32-bit under address pressure.
The rotation logic is extracted into a shared rotateVlog helper used by
both the pre-rotation check and the existing toDisk().
Giant entries that exceed the file size still fall through to the
existing Truncate path.
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 46f238b commit ff53ba7
2 files changed
Lines changed: 32 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
533 | 533 | | |
534 | 534 | | |
535 | 535 | | |
536 | | - | |
| 536 | + | |
537 | 537 | | |
538 | 538 | | |
539 | 539 | | |
| |||
609 | 609 | | |
610 | 610 | | |
611 | 611 | | |
612 | | - | |
| 612 | + | |
613 | 613 | | |
614 | 614 | | |
615 | 615 | | |
| |||
859 | 859 | | |
860 | 860 | | |
861 | 861 | | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
862 | 875 | | |
863 | 876 | | |
864 | 877 | | |
865 | | - | |
866 | | - | |
867 | | - | |
868 | | - | |
869 | | - | |
870 | | - | |
871 | | - | |
872 | | - | |
873 | | - | |
| 878 | + | |
874 | 879 | | |
875 | 880 | | |
876 | 881 | | |
| |||
890 | 895 | | |
891 | 896 | | |
892 | 897 | | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
893 | 913 | | |
894 | 914 | | |
895 | 915 | | |
| |||
923 | 943 | | |
924 | 944 | | |
925 | 945 | | |
926 | | - | |
927 | | - | |
928 | 946 | | |
929 | 947 | | |
930 | 948 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
915 | 915 | | |
916 | 916 | | |
917 | 917 | | |
918 | | - | |
919 | 918 | | |
920 | 919 | | |
921 | 920 | | |
| |||
962 | 961 | | |
963 | 962 | | |
964 | 963 | | |
965 | | - | |
| 964 | + | |
966 | 965 | | |
967 | 966 | | |
968 | 967 | | |
| |||
0 commit comments