-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Eventhub Partition Key and UI Graph (#1083)
We now hash the partition key column value obtained from the destination table name in create mirror for PG->EH. This is to reduce the number of Eventhub batches we create. Noticed that not doing so makes the mirror extremely slow Also fixes some code of the UI Graph component
- Loading branch information
1 parent
1b906e7
commit 8c5bb09
Showing
4 changed files
with
43 additions
and
19 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
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,18 @@ | ||
package utils | ||
|
||
import ( | ||
"fmt" | ||
"hash/fnv" | ||
) | ||
|
||
func hashString(s string) uint32 { | ||
h := fnv.New32a() | ||
h.Write([]byte(s)) | ||
return h.Sum32() | ||
} | ||
|
||
func HashedPartitionKey(s string, numPartitions uint32) string { | ||
hashValue := hashString(s) | ||
partition := hashValue % numPartitions | ||
return fmt.Sprintf("%d", partition) | ||
} |
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