-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kafka partition selection based on bifrost partition method (#122)
* Kafka partition selection based on bifrost partition method * expose kafka partition configuration * set default * remove breaks * Update transport/transporters/kafka/batch/batch.go Co-authored-by: Ruban Rengaraju <[email protected]> --------- Co-authored-by: Ruban Rengaraju <[email protected]>
- Loading branch information
1 parent
ef2aee8
commit 0a9c5e3
Showing
7 changed files
with
126 additions
and
30 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
EXPECTED_COUNT=21 | ||
# Bifrost | ||
WORKERS=1 | ||
KAFKA_PARTITION_METHOD=transaction-constant | ||
|
||
# Verifier | ||
KAFKA_PARTITION_COUNT=2 | ||
WORKERS=3 | ||
PARTITION_METHOD=transaction | ||
BATCHER_ROUTING_METHOD=round-robin | ||
EXPECTED_COUNT=21 |
This file contains 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 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 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 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 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 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,37 @@ | ||
/* | ||
Copyright 2023 Nextdoor.com, Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package utils | ||
|
||
type KafkaPartitionMethod int | ||
|
||
const ( | ||
KAFKA_PART_TXN KafkaPartitionMethod = iota // Uses each msgs's txn to select kafka partition | ||
KAFKA_PART_BATCH // All messages in a batch go to the same random partition | ||
KAFKA_PART_RANDOM // Messages are randomly assigned a partition by Sarama | ||
KAFKA_PART_TXN_CONST // Similar to KAFKA_PART_TXN but should only be used for testing | ||
KAFKA_PART_TABLE_NAME // Partitions by message table name | ||
) | ||
|
||
var ( | ||
NameToPartitionMethod = map[string]KafkaPartitionMethod{ | ||
"random": KAFKA_PART_RANDOM, | ||
"batch": KAFKA_PART_BATCH, | ||
"transaction": KAFKA_PART_TXN, | ||
"transaction-constant": KAFKA_PART_TXN_CONST, | ||
"tablename": KAFKA_PART_TABLE_NAME, | ||
} | ||
) |