Commit 4abf893
JAVA-1193: Refresh token and replica metadata synchronously when schema is altered
This commit also introduces the following refactorings:
1) Cache and reuse host and token information whenever possible
This commit modifies the TokenMap class so that it caches all
the information about hosts and tokens from the last token map
computation. This information can then be reused in a subsequent
token map computation, if only the schema has changed, but not
the topology.
2) Optimize calls to submitNodeListRefresh()
In some circonstances, this method could be called recursively
(i.e., triggered while already processing a node list refresh request).
This commit suppresses the calls to submitNodeListRefresh() from
ControlConnection and replaces them with calls to that method only
when appropriate, i.e.:
- When inside a node refresh, and the node has been added or removed;
- When reconnecting, and the node has been added.
The effect is that submitNodeListRefresh() is NOT called when in
triggerOnAdd() nor in triggerOnRemove(), because we are already inside
a node list refresh operation.
3) Minor optimizations
This commit optimizes code around TokenMap:
- Remove unnecessary field TokenMap.hosts
- Rename fields in TokenMap for consistency
- Avoid creating intermediary Set<String> instances by creating
Set<Token> instances directly when reading rows from system.local and
system.peers.1 parent 74d0201 commit 4abf893
8 files changed
Lines changed: 178 additions & 183 deletions
File tree
- changelog
- driver-core/src
- main/java/com/datastax/driver/core
- test/java/com/datastax/driver/core
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
Lines changed: 9 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1851 | 1851 | | |
1852 | 1852 | | |
1853 | 1853 | | |
1854 | | - | |
| 1854 | + | |
1855 | 1855 | | |
1856 | | - | |
| 1856 | + | |
| 1857 | + | |
1857 | 1858 | | |
1858 | 1859 | | |
1859 | 1860 | | |
| |||
2226 | 2227 | | |
2227 | 2228 | | |
2228 | 2229 | | |
2229 | | - | |
| 2230 | + | |
2230 | 2231 | | |
2231 | | - | |
| 2232 | + | |
2232 | 2233 | | |
2233 | 2234 | | |
2234 | | - | |
| 2235 | + | |
2235 | 2236 | | |
2236 | 2237 | | |
2237 | | - | |
| 2238 | + | |
2238 | 2239 | | |
2239 | 2240 | | |
2240 | 2241 | | |
| |||
2709 | 2710 | | |
2710 | 2711 | | |
2711 | 2712 | | |
| 2713 | + | |
2712 | 2714 | | |
2713 | 2715 | | |
2714 | 2716 | | |
| |||
2745 | 2747 | | |
2746 | 2748 | | |
2747 | 2749 | | |
| 2750 | + | |
2748 | 2751 | | |
2749 | 2752 | | |
2750 | 2753 | | |
| |||
Lines changed: 37 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| 270 | + | |
| 271 | + | |
270 | 272 | | |
271 | 273 | | |
| 274 | + | |
| 275 | + | |
272 | 276 | | |
273 | 277 | | |
274 | 278 | | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | 279 | | |
281 | 280 | | |
282 | 281 | | |
| |||
306 | 305 | | |
307 | 306 | | |
308 | 307 | | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | 308 | | |
315 | 309 | | |
316 | 310 | | |
| |||
545 | 539 | | |
546 | 540 | | |
547 | 541 | | |
548 | | - | |
| 542 | + | |
| 543 | + | |
549 | 544 | | |
550 | 545 | | |
551 | 546 | | |
| |||
555 | 550 | | |
556 | 551 | | |
557 | 552 | | |
558 | | - | |
| 553 | + | |
559 | 554 | | |
| 555 | + | |
| 556 | + | |
560 | 557 | | |
561 | 558 | | |
562 | 559 | | |
| |||
565 | 562 | | |
566 | 563 | | |
567 | 564 | | |
568 | | - | |
569 | | - | |
570 | | - | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
571 | 569 | | |
| 570 | + | |
572 | 571 | | |
573 | 572 | | |
574 | 573 | | |
| |||
579 | 578 | | |
580 | 579 | | |
581 | 580 | | |
582 | | - | |
| 581 | + | |
583 | 582 | | |
584 | 583 | | |
585 | 584 | | |
| |||
596 | 595 | | |
597 | 596 | | |
598 | 597 | | |
599 | | - | |
600 | | - | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
601 | 606 | | |
602 | 607 | | |
603 | 608 | | |
| |||
640 | 645 | | |
641 | 646 | | |
642 | 647 | | |
643 | | - | |
| 648 | + | |
644 | 649 | | |
645 | 650 | | |
646 | 651 | | |
| |||
653 | 658 | | |
654 | 659 | | |
655 | 660 | | |
656 | | - | |
657 | | - | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
658 | 671 | | |
659 | 672 | | |
660 | 673 | | |
| |||
756 | 769 | | |
757 | 770 | | |
758 | 771 | | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
759 | 775 | | |
760 | 776 | | |
761 | 777 | | |
762 | 778 | | |
763 | 779 | | |
764 | 780 | | |
765 | | - | |
766 | 781 | | |
767 | 782 | | |
768 | 783 | | |
| |||
783 | 798 | | |
784 | 799 | | |
785 | 800 | | |
786 | | - | |
787 | | - | |
788 | | - | |
789 | | - | |
790 | | - | |
791 | | - | |
792 | | - | |
793 | 801 | | |
Lines changed: 47 additions & 41 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
| 69 | + | |
75 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
76 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
77 | 87 | | |
78 | 88 | | |
79 | 89 | | |
| |||
264 | 274 | | |
265 | 275 | | |
266 | 276 | | |
267 | | - | |
| 277 | + | |
268 | 278 | | |
269 | 279 | | |
270 | 280 | | |
| |||
384 | 394 | | |
385 | 395 | | |
386 | 396 | | |
387 | | - | |
| 397 | + | |
388 | 398 | | |
389 | 399 | | |
390 | 400 | | |
| |||
609 | 619 | | |
610 | 620 | | |
611 | 621 | | |
612 | | - | |
| 622 | + | |
613 | 623 | | |
614 | 624 | | |
615 | | - | |
616 | | - | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
617 | 628 | | |
618 | 629 | | |
619 | | - | |
| 630 | + | |
620 | 631 | | |
621 | 632 | | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
622 | 636 | | |
623 | | - | |
624 | | - | |
625 | | - | |
| 637 | + | |
| 638 | + | |
626 | 639 | | |
627 | | - | |
628 | | - | |
629 | 640 | | |
630 | 641 | | |
631 | | - | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
632 | 646 | | |
633 | 647 | | |
634 | 648 | | |
635 | 649 | | |
636 | 650 | | |
637 | 651 | | |
638 | | - | |
639 | | - | |
640 | | - | |
| 652 | + | |
641 | 653 | | |
642 | | - | |
643 | 654 | | |
644 | | - | |
645 | | - | |
| 655 | + | |
646 | 656 | | |
647 | | - | |
| 657 | + | |
648 | 658 | | |
649 | | - | |
650 | 659 | | |
651 | 660 | | |
652 | | - | |
653 | | - | |
654 | | - | |
655 | | - | |
656 | | - | |
657 | | - | |
658 | 661 | | |
659 | 662 | | |
660 | 663 | | |
661 | 664 | | |
662 | 665 | | |
663 | | - | |
664 | 666 | | |
665 | 667 | | |
| 668 | + | |
| 669 | + | |
666 | 670 | | |
| 671 | + | |
| 672 | + | |
667 | 673 | | |
668 | 674 | | |
669 | 675 | | |
| |||
691 | 697 | | |
692 | 698 | | |
693 | 699 | | |
694 | | - | |
| 700 | + | |
695 | 701 | | |
696 | 702 | | |
697 | 703 | | |
698 | 704 | | |
699 | | - | |
700 | | - | |
| 705 | + | |
| 706 | + | |
701 | 707 | | |
702 | 708 | | |
703 | 709 | | |
704 | | - | |
| 710 | + | |
705 | 711 | | |
706 | 712 | | |
707 | 713 | | |
| |||
713 | 719 | | |
714 | 720 | | |
715 | 721 | | |
716 | | - | |
| 722 | + | |
717 | 723 | | |
718 | 724 | | |
719 | 725 | | |
| |||
0 commit comments