Commit be58522
authored
fix: Improved error handling in SeekableStreamIndexTaskRunner. (#19218)
The main improvement is that "persist" is moved out of a finally block,
and now only happens on the normal path. This has two benefits. First,
there is no point in persisting on the error path, and the in-memory
index might be in a bad state anyway at that point. Second, moving the
persist call out of "finally" fixes an issue where an exception thrown
from "persist" would cause an exception thrown from "add" to be lost.
This can come up in production when the in-memory index grows too large,
causing the main code to throw an OutOfMemoryError, and then something
goes wrong with the persist too. In this situation the original
OutOfMemoryError would not have been logged.
A secondary improvement is that we catch Throwable rather than Exception
to trigger cleanup and when handling errors that occur during cleanup.
This ensures we don't miss cleanup tasks when an Error is thrown by
the main code, and that we don't lose the original exception if an Error
is thrown by the cleanup code.1 parent f5ec8be commit be58522
2 files changed
Lines changed: 15 additions & 27 deletions
File tree
- extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka
- indexing-service/src/main/java/org/apache/druid/indexing/seekablestream
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1752 | 1752 | | |
1753 | 1753 | | |
1754 | 1754 | | |
1755 | | - | |
1756 | | - | |
| 1755 | + | |
| 1756 | + | |
1757 | 1757 | | |
1758 | 1758 | | |
1759 | 1759 | | |
| |||
Lines changed: 13 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
445 | 445 | | |
446 | 446 | | |
447 | 447 | | |
448 | | - | |
| 448 | + | |
449 | 449 | | |
450 | 450 | | |
451 | 451 | | |
| |||
607 | 607 | | |
608 | 608 | | |
609 | 609 | | |
610 | | - | |
611 | | - | |
612 | 610 | | |
613 | 611 | | |
614 | 612 | | |
| |||
809 | 807 | | |
810 | 808 | | |
811 | 809 | | |
812 | | - | |
| 810 | + | |
813 | 811 | | |
814 | | - | |
815 | 812 | | |
816 | 813 | | |
817 | 814 | | |
| |||
821 | 818 | | |
822 | 819 | | |
823 | 820 | | |
824 | | - | |
825 | | - | |
826 | | - | |
827 | | - | |
828 | | - | |
829 | | - | |
830 | | - | |
831 | | - | |
832 | | - | |
833 | | - | |
834 | | - | |
835 | | - | |
| 821 | + | |
836 | 822 | | |
837 | 823 | | |
| 824 | + | |
| 825 | + | |
838 | 826 | | |
839 | 827 | | |
840 | 828 | | |
| |||
861 | 849 | | |
862 | 850 | | |
863 | 851 | | |
864 | | - | |
| 852 | + | |
865 | 853 | | |
866 | 854 | | |
867 | 855 | | |
| |||
913 | 901 | | |
914 | 902 | | |
915 | 903 | | |
916 | | - | |
| 904 | + | |
917 | 905 | | |
918 | 906 | | |
919 | 907 | | |
920 | 908 | | |
921 | 909 | | |
922 | 910 | | |
923 | 911 | | |
924 | | - | |
| 912 | + | |
925 | 913 | | |
926 | 914 | | |
927 | 915 | | |
| |||
937 | 925 | | |
938 | 926 | | |
939 | 927 | | |
940 | | - | |
| 928 | + | |
941 | 929 | | |
942 | | - | |
| 930 | + | |
943 | 931 | | |
944 | 932 | | |
945 | 933 | | |
946 | 934 | | |
947 | 935 | | |
948 | 936 | | |
949 | 937 | | |
950 | | - | |
| 938 | + | |
951 | 939 | | |
952 | 940 | | |
953 | 941 | | |
| |||
966 | 954 | | |
967 | 955 | | |
968 | 956 | | |
969 | | - | |
970 | | - | |
| 957 | + | |
| 958 | + | |
971 | 959 | | |
972 | 960 | | |
973 | 961 | | |
| |||
0 commit comments