Commit 8fa7e09
authored
KAFKA-19434: Startup state stores initialization (#20749)
Instead of creating Standby tasks from the state directory, we open the
local stores that exists in the state directory.
This resolves the issue raised in [#KAFKA-19434
](https://issues.apache.org/jira/browse/KAFKA-19434), where
store-specific metrics were being duplicated due to tasks being created
in the main thread and then assigned to a StreamThread.
Additionally, since we can now read the offsets from the store during
instance initialization, this clears the way for the implementation of
KIP-1035. As of now, the stores are loading the offsets from the
checkpoint file, but in a later PR, we will read these offsets from the
state store itself.
This PR modifies the behavior of Kafka Streams when initializing. Now
for each pre-existing store on the state directory: We open the store,
read offsets from the checkpoint file and then close it again. The
reason why we open the store is because the store will be responsible
for tracking the offsets and we will deprecate the checkpoint file.
Reviewers: Nikiita Shuplestov<nshupletsov@confluent.io>, Bill
Bejeck<bbejeck@apache.org>1 parent 2d68b60 commit 8fa7e09
File tree
8 files changed
+248
-251
lines changed- streams
- integration-tests/src/test/java/org/apache/kafka/streams/integration
- src
- main/java/org/apache/kafka/streams
- processor/internals
- test/java/org/apache/kafka/streams
- processor/internals
8 files changed
+248
-251
lines changedLines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
287 | 292 | | |
288 | 293 | | |
289 | 294 | | |
| |||
295 | 300 | | |
296 | 301 | | |
297 | 302 | | |
298 | | - | |
299 | | - | |
| 303 | + | |
| 304 | + | |
300 | 305 | | |
301 | 306 | | |
302 | 307 | | |
| |||
Lines changed: 2 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | 644 | | |
648 | 645 | | |
649 | 646 | | |
| |||
1379 | 1376 | | |
1380 | 1377 | | |
1381 | 1378 | | |
1382 | | - | |
1383 | | - | |
| 1379 | + | |
| 1380 | + | |
1384 | 1381 | | |
1385 | 1382 | | |
1386 | 1383 | | |
| |||
Lines changed: 0 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | 232 | | |
246 | 233 | | |
247 | 234 | | |
| |||
Lines changed: 149 additions & 71 deletions
Large diffs are not rendered by default.
Lines changed: 36 additions & 38 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
321 | | - | |
322 | | - | |
| 321 | + | |
323 | 322 | | |
324 | | - | |
| 323 | + | |
325 | 324 | | |
326 | 325 | | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
| 326 | + | |
| 327 | + | |
335 | 328 | | |
336 | 329 | | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
337 | 335 | | |
338 | | - | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
339 | 347 | | |
340 | | - | |
| 348 | + | |
341 | 349 | | |
342 | 350 | | |
343 | 351 | | |
| |||
484 | 492 | | |
485 | 493 | | |
486 | 494 | | |
487 | | - | |
| 495 | + | |
488 | 496 | | |
489 | 497 | | |
490 | 498 | | |
| |||
502 | 510 | | |
503 | 511 | | |
504 | 512 | | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
524 | 518 | | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
530 | 528 | | |
531 | 529 | | |
532 | 530 | | |
| |||
Lines changed: 2 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
416 | 416 | | |
417 | 417 | | |
418 | 418 | | |
419 | | - | |
| 419 | + | |
420 | 420 | | |
421 | | - | |
| 421 | + | |
422 | 422 | | |
423 | 423 | | |
424 | 424 | | |
425 | 425 | | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | 426 | | |
446 | 427 | | |
447 | 428 | | |
| |||
Lines changed: 24 additions & 75 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
| |||
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
31 | | - | |
32 | 30 | | |
33 | 31 | | |
34 | 32 | | |
| |||
80 | 78 | | |
81 | 79 | | |
82 | 80 | | |
83 | | - | |
84 | 81 | | |
85 | 82 | | |
86 | 83 | | |
| |||
855 | 852 | | |
856 | 853 | | |
857 | 854 | | |
858 | | - | |
| 855 | + | |
859 | 856 | | |
860 | | - | |
| 857 | + | |
861 | 858 | | |
862 | | - | |
| 859 | + | |
863 | 860 | | |
864 | 861 | | |
865 | 862 | | |
866 | 863 | | |
867 | | - | |
| 864 | + | |
868 | 865 | | |
869 | | - | |
| 866 | + | |
870 | 867 | | |
871 | | - | |
| 868 | + | |
872 | 869 | | |
873 | | - | |
| 870 | + | |
874 | 871 | | |
875 | 872 | | |
876 | 873 | | |
877 | | - | |
| 874 | + | |
878 | 875 | | |
879 | | - | |
880 | | - | |
881 | | - | |
882 | | - | |
883 | | - | |
884 | | - | |
885 | | - | |
886 | | - | |
887 | | - | |
888 | | - | |
889 | | - | |
890 | | - | |
891 | | - | |
892 | | - | |
893 | | - | |
894 | | - | |
895 | | - | |
896 | | - | |
| 876 | + | |
| 877 | + | |
897 | 878 | | |
898 | 879 | | |
899 | 880 | | |
900 | | - | |
| 881 | + | |
901 | 882 | | |
902 | | - | |
903 | | - | |
904 | | - | |
905 | | - | |
906 | | - | |
907 | | - | |
908 | | - | |
909 | | - | |
910 | | - | |
911 | | - | |
912 | | - | |
913 | | - | |
914 | | - | |
915 | | - | |
916 | | - | |
917 | | - | |
918 | | - | |
919 | | - | |
920 | | - | |
921 | | - | |
922 | | - | |
923 | | - | |
924 | | - | |
925 | | - | |
| 883 | + | |
926 | 884 | | |
927 | 885 | | |
928 | | - | |
929 | | - | |
930 | | - | |
931 | | - | |
932 | | - | |
933 | | - | |
934 | | - | |
935 | | - | |
936 | | - | |
937 | | - | |
938 | | - | |
939 | 886 | | |
940 | | - | |
941 | | - | |
942 | | - | |
| 887 | + | |
943 | 888 | | |
944 | 889 | | |
945 | 890 | | |
946 | | - | |
| 891 | + | |
947 | 892 | | |
948 | 893 | | |
949 | 894 | | |
| 895 | + | |
950 | 896 | | |
951 | | - | |
| 897 | + | |
952 | 898 | | |
953 | 899 | | |
954 | | - | |
| 900 | + | |
955 | 901 | | |
956 | 902 | | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
957 | 906 | | |
958 | 907 | | |
959 | 908 | | |
960 | | - | |
961 | | - | |
| 909 | + | |
| 910 | + | |
962 | 911 | | |
963 | 912 | | |
964 | | - | |
| 913 | + | |
965 | 914 | | |
966 | 915 | | |
967 | 916 | | |
| |||
987 | 936 | | |
988 | 937 | | |
989 | 938 | | |
990 | | - | |
| 939 | + | |
991 | 940 | | |
992 | 941 | | |
993 | 942 | | |
| |||
0 commit comments