-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Add redis cluster load balancing #6895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mattklein123
merged 92 commits into
envoyproxy:master
from
HenryYYang:add-redis-cluster-mode
Jun 6, 2019
Merged
Changes from 89 commits
Commits
Show all changes
92 commits
Select commit
Hold shift + click to select a range
6dcb8de
Add cluster factory interface and implementation for the existing clu…
HenryYYang 1ac5471
Add configurable factory
HenryYYang b4253c2
Fix format issues
HenryYYang 3e056bb
make cluster type oneof
HenryYYang f5420ee
Fix format error.
HenryYYang d3a9004
Add integration tests
HenryYYang 759e505
Updated comments and docs.
HenryYYang 789316a
Merge branch 'master' into add-cluster-extension
HenryYYang e7b1625
Merge remote-tracking branch 'origin' into add-cluster-extension
HenryYYang ef1f54a
remove TestBase from new tests
HenryYYang cb3e0eb
Merge branch 'add-cluster-extension' of github.com:HenryYYang/envoy i…
HenryYYang 35b2c86
fix formatting
HenryYYang b3c41e2
fix formatting
HenryYYang a5e19da
fix formatting
HenryYYang 5311662
fix clang tidy
HenryYYang 6634824
fix typo
HenryYYang 587b1d0
fix clang-tidy
HenryYYang ff123bf
Merge branch 'master' of github.com:envoyproxy/envoy into add-cluster…
HenryYYang d16d0b9
delete deprecated api
HenryYYang b82e014
Fix PR feedbacks
HenryYYang 0cf38a8
Fix PR feedbacks
HenryYYang 506f51b
Merge branch 'master' into add-cluster-extension
HenryYYang f75d362
Remove TestBase
HenryYYang d51e41a
Fix PR feedbacks
HenryYYang 6ccc257
Fix missing import
HenryYYang 0cb3806
Fix duplicate registration
HenryYYang 1716d48
Split implementation and registration of custom static cluster out of…
HenryYYang 735524d
fix format
HenryYYang b06aca8
remove CUSTOM_CLUSTER_CONFIG
HenryYYang 0a53ccb
Kick CI
HenryYYang 661875e
Merge branch 'master' into add-redis-cluster
HenryYYang 72acffa
Add redis cluster
HenryYYang fe83017
Add redis cluster test
HenryYYang b25de9f
Support ipv6
HenryYYang e95f67e
add version history
HenryYYang f51b36a
Merge branch 'master' into add-redis-cluster
HenryYYang c186184
Kick CI
HenryYYang a30136b
Merge branch 'master' into add-redis-cluster
FAYiEKcbD0XFqF2QK2E4viAHg8rMm2VbjYKdjTg 8027e1e
docs
FAYiEKcbD0XFqF2QK2E4viAHg8rMm2VbjYKdjTg e42cac4
Merge branch 'master' into add-redis-cluster
FAYiEKcbD0XFqF2QK2E4viAHg8rMm2VbjYKdjTg dabacd1
make docs work zomg
FAYiEKcbD0XFqF2QK2E4viAHg8rMm2VbjYKdjTg 9a8c5ff
fix compile error
FAYiEKcbD0XFqF2QK2E4viAHg8rMm2VbjYKdjTg d2c4606
mitch comments
FAYiEKcbD0XFqF2QK2E4viAHg8rMm2VbjYKdjTg 96bbf69
fix issue
FAYiEKcbD0XFqF2QK2E4viAHg8rMm2VbjYKdjTg 6738ca9
extra protection on cancels
FAYiEKcbD0XFqF2QK2E4viAHg8rMm2VbjYKdjTg 385a6a5
Revert "extra protection on cancels"
FAYiEKcbD0XFqF2QK2E4viAHg8rMm2VbjYKdjTg ae24a89
respond to mitch and matt comments
FAYiEKcbD0XFqF2QK2E4viAHg8rMm2VbjYKdjTg e20db9a
fix spelling
FAYiEKcbD0XFqF2QK2E4viAHg8rMm2VbjYKdjTg 354d635
Merge branch 'master' into add-redis-cluster
FAYiEKcbD0XFqF2QK2E4viAHg8rMm2VbjYKdjTg 6535c6e
Merge branch 'master' into add-redis-cluster
FAYiEKcbD0XFqF2QK2E4viAHg8rMm2VbjYKdjTg 1bb84fb
Update docs per matt comments, put a function in an anonymous namespace
FAYiEKcbD0XFqF2QK2E4viAHg8rMm2VbjYKdjTg d0d73bb
add test for cluster factory exception pass and fail cases
FAYiEKcbD0XFqF2QK2E4viAHg8rMm2VbjYKdjTg 098ccd2
Add integration test
HenryYYang 7a2eb43
Merge branch 'add-redis-cluster' of github.com:HenryYYang/envoy into …
HenryYYang c35d0b5
Merge branch 'master' into add-redis-cluster
HenryYYang 97f16fe
Fix merge issues
HenryYYang 169fe5d
Fix clang_tidy errors
HenryYYang 71209e2
Add more robust error checking.
HenryYYang dab3be9
Add more test for cluster slots response
HenryYYang 3f1bc38
delete twemproxy from dictionary
HenryYYang 569b693
Small refactor of the RedisCluster class
HenryYYang 152e1ab
Merge branch 'master' into add-redis-cluster
HenryYYang f746acf
Fix code review feedbacks
HenryYYang db280e3
Fix code review feedback.
HenryYYang 710c915
Fix redis cluster test
HenryYYang 074221c
Add Redis cluster routing.
HenryYYang fbd1030
Add to spelling_dictionary
HenryYYang 0ca25c5
Merge branch 'master' into add-redis-cluster-mode
HenryYYang b63ef2d
Fix clang and format
HenryYYang 0d810f5
Merge branch 'master' into add-redis-cluster-mode
HenryYYang 272dde4
Fix memory test
HenryYYang 2a69c70
Update coowner file
HenryYYang 17f7da2
Add redis cluster loadbalancer
HenryYYang 1c94671
fix format
HenryYYang 4b1d635
Added back imports
HenryYYang 890a207
Merge branch 'master' into add-redis-cluster-mode
HenryYYang 6fbceeb
Merge branch 'master' into add-redis-cluster-mode
HenryYYang ebd37fb
Integrate Matt's loadbalancer changes
HenryYYang a056992
Force loadbalancer update when redis cluster slot is changed.
HenryYYang 8dd1228
Fix clang error
HenryYYang 726c112
Fix PR feedback and failed tests.
HenryYYang 5089623
Merge branch 'master' into add-redis-cluster-mode
HenryYYang c89880a
Merge branch 'master' into add-redis-cluster-mode
HenryYYang 9847905
Fix BUILD file
HenryYYang de46435
Fix PR feedbacks
HenryYYang 41bdde3
Fix format
HenryYYang 1a96dbf
Fix failed tests
HenryYYang 1b8fdb7
Kick CI
HenryYYang 863fee1
revert state test
HenryYYang 4e765ae
fix PR feedback
HenryYYang c9d7630
Move crc16 source code.
HenryYYang 8d0c8d8
Fix format
HenryYYang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| #include "crc16.h" | ||
|
|
||
| #include "absl/strings/string_view.h" | ||
|
|
||
| namespace Envoy { | ||
| namespace Extensions { | ||
| namespace Clusters { | ||
| namespace Redis { | ||
|
|
||
| /** | ||
| * XMODEM CRC16 implementation according to CITT standards. | ||
| * Based on (F). | ||
| * @param key The string to hash. | ||
| * @return The CRC16 hash code. | ||
| */ | ||
| static const uint16_t crc16tab[256] = { | ||
| 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, | ||
| 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, | ||
| 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 0x2462, 0x3443, 0x0420, 0x1401, | ||
| 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, | ||
| 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738, | ||
| 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, | ||
| 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, | ||
| 0x1a71, 0x0a50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, | ||
| 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 0xedae, 0xfd8f, 0xcdec, 0xddcd, | ||
| 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, | ||
| 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca, 0xa1eb, | ||
| 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, | ||
| 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, | ||
| 0x4235, 0x5214, 0x6277, 0x7256, 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, | ||
| 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xa7db, 0xb7fa, 0x8799, 0x97b8, | ||
| 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, | ||
| 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827, | ||
| 0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, | ||
| 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, | ||
| 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, | ||
| 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, | ||
| 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0}; | ||
|
|
||
| // (https://github.com/antirez/redis/blob/unstable/src/crc16.c) | ||
|
HenryYYang marked this conversation as resolved.
Outdated
|
||
| uint16_t Crc16::crc16(absl::string_view key) { | ||
| const char* buf = static_cast<const char*>(key.data()); | ||
| uint64_t len = key.size(); | ||
| uint64_t counter; | ||
| uint16_t crc = 0; | ||
| for (counter = 0; counter < len; counter++) { | ||
| crc = (crc << 8) ^ crc16tab[((crc >> 8) ^ *buf++) & 0x00FF]; | ||
| } | ||
| return crc; | ||
| } | ||
|
|
||
| } // namespace Redis | ||
| } // namespace Clusters | ||
| } // namespace Extensions | ||
| } // namespace Envoy | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #pragma once | ||
|
|
||
| #include <string> | ||
|
|
||
| #include "absl/strings/ascii.h" | ||
|
|
||
| namespace Envoy { | ||
| namespace Extensions { | ||
| namespace Clusters { | ||
| namespace Redis { | ||
|
|
||
| class Crc16 { | ||
| public: | ||
| /** | ||
| * XMODEM CRC16 implementation according to CITT standards. | ||
| * Based on (https://github.com/antirez/redis/blob/unstable/src/crc16.c). | ||
| * @param key The string to hash. | ||
| * @return The CRC16 hash code. | ||
| */ | ||
| static uint16_t crc16(absl::string_view key); | ||
| }; | ||
| } // namespace Redis | ||
| } // namespace Clusters | ||
| } // namespace Extensions | ||
| } // namespace Envoy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.