Commit 899ec1f
Pass capacity: 0 to MemoryMappedFile.CreateFromFile, drop the #1090 retry loop
MemoryMappedFile.CreateFromFile accepts capacity: 0 to mean "size the
mapping from the file's current length on disk." The framework does its
own stat as part of the mapping creation, so there is no caller-side
capacity for the file size to disagree with — the race window that
#1090 was about is closed at the API boundary.
This also lets us drop the FileStream we were holding alongside
SharedMapping. The only thing it was being used for was capturing
fc.Length to feed into our retry loop, plus being kept alive so the
mapping had a handle. The path-based CreateFromFile overload opens
its own handle and disposes it with the MemoryMappedFile, so we no
longer need our own.
Removes the retry loop in CreateMemoryMappedFile, the s_capacityRetryCount
and s_maxCapacityAttemptsObserved test-observability counters, and the
fileStream field on SharedMapping.
Rewrites TestOpenInputConcurrentFileExtension_Issue1090 from a "race
fired and was retried" assertion into a "OpenInput succeeds under
concurrent file extension" smoke test. With capacity: 0 the original
race no longer reaches the framework, so 8700 OpenInput iterations
over 15s observed zero retries before the change. The test now
shortens to a 5s window and simply asserts that every OpenInput
completes cleanly while another thread extends/truncates the file.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 62ef06f commit 899ec1f
2 files changed
Lines changed: 47 additions & 112 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
496 | 496 | | |
497 | 497 | | |
498 | 498 | | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
509 | 510 | | |
510 | 511 | | |
511 | 512 | | |
| |||
549 | 550 | | |
550 | 551 | | |
551 | 552 | | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | 553 | | |
557 | 554 | | |
558 | 555 | | |
559 | 556 | | |
560 | | - | |
561 | | - | |
562 | | - | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
563 | 561 | | |
564 | 562 | | |
565 | 563 | | |
566 | 564 | | |
567 | | - | |
| 565 | + | |
568 | 566 | | |
569 | 567 | | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | 568 | | |
576 | 569 | | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | 570 | | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
| 571 | + | |
596 | 572 | | |
597 | 573 | | |
598 | 574 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | 69 | | |
78 | 70 | | |
79 | 71 | | |
| |||
762 | 754 | | |
763 | 755 | | |
764 | 756 | | |
765 | | - | |
766 | 757 | | |
767 | 758 | | |
768 | | - | |
| 759 | + | |
769 | 760 | | |
770 | 761 | | |
771 | | - | |
772 | 762 | | |
773 | 763 | | |
774 | 764 | | |
775 | 765 | | |
776 | 766 | | |
777 | 767 | | |
778 | | - | |
779 | | - | |
780 | | - | |
781 | | - | |
782 | | - | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
783 | 785 | | |
784 | 786 | | |
785 | 787 | | |
786 | 788 | | |
787 | | - | |
788 | | - | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
789 | 799 | | |
790 | | - | |
| 800 | + | |
791 | 801 | | |
792 | 802 | | |
793 | 803 | | |
794 | 804 | | |
795 | 805 | | |
796 | | - | |
797 | 806 | | |
798 | 807 | | |
799 | 808 | | |
| |||
805 | 814 | | |
806 | 815 | | |
807 | 816 | | |
808 | | - | |
| 817 | + | |
809 | 818 | | |
810 | 819 | | |
811 | 820 | | |
812 | 821 | | |
813 | 822 | | |
814 | 823 | | |
815 | | - | |
816 | | - | |
817 | | - | |
818 | | - | |
819 | | - | |
820 | | - | |
821 | | - | |
822 | | - | |
823 | | - | |
824 | | - | |
825 | | - | |
826 | | - | |
827 | | - | |
828 | | - | |
829 | | - | |
830 | | - | |
831 | | - | |
832 | | - | |
833 | | - | |
834 | | - | |
835 | | - | |
836 | | - | |
837 | | - | |
838 | | - | |
839 | | - | |
840 | | - | |
841 | | - | |
842 | | - | |
843 | | - | |
844 | | - | |
845 | | - | |
846 | | - | |
847 | | - | |
848 | | - | |
849 | | - | |
850 | | - | |
851 | | - | |
852 | | - | |
853 | | - | |
854 | | - | |
855 | | - | |
856 | | - | |
857 | | - | |
858 | | - | |
859 | | - | |
860 | | - | |
861 | | - | |
862 | | - | |
863 | | - | |
864 | | - | |
865 | 824 | | |
866 | 825 | | |
867 | 826 | | |
| |||
0 commit comments