From 99477fc131a373b8d226dfd4bb42795f13c9ba0c Mon Sep 17 00:00:00 2001 From: Andrew Mains Date: Thu, 27 Aug 2020 13:19:33 -0400 Subject: [PATCH] Migrate github.com/spaolacci/murmur3 to github.com/twmb/murmur3 (#2539) * WIP: migrate github.com/spaolacci/murmur3 to github.com/twmb/murmur3 * Remove murmur3 test, which is not needed going forward --- go.mod | 2 +- go.sum | 2 ++ src/aggregator/hash/hash.go | 2 +- src/aggregator/sharding/hash.go | 2 +- src/dbnode/client/connection_pool.go | 2 +- src/dbnode/config/2node/init_m3db_topology.sh | 0 src/dbnode/sharding/shardset.go | 5 ++--- src/dbnode/sharding/shardset_test.go | 1 - .../bootstrap/bootstrapper/commitlog/source_prop_test.go | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 src/dbnode/config/2node/init_m3db_topology.sh diff --git a/go.mod b/go.mod index 2ec6b65922..27bac79987 100644 --- a/go.mod +++ b/go.mod @@ -94,7 +94,6 @@ require ( github.com/satori/go.uuid v1.2.0 github.com/sergi/go-diff v1.1.0 github.com/shirou/gopsutil v2.20.5+incompatible // indirect - github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 github.com/spf13/cast v1.3.1-0.20190531151931-f31dc0aaab5a // indirect github.com/spf13/cobra v0.0.3 github.com/spf13/jwalterweatherman v1.1.0 // indirect @@ -103,6 +102,7 @@ require ( github.com/streadway/quantile v0.0.0-20150917103942-b0c588724d25 // indirect github.com/stretchr/testify v1.4.0 github.com/subosito/gotenv v1.2.1-0.20190917103637-de67a6614a4d // indirect + github.com/twmb/murmur3 v1.1.3 github.com/twotwotwo/sorts v0.0.0-20160814051341-bf5c1f2b8553 github.com/uber-go/atomic v0.0.0-00010101000000-000000000000 // indirect github.com/uber-go/tally v3.3.13+incompatible diff --git a/go.sum b/go.sum index 8c043c07e8..db8a60e798 100644 --- a/go.sum +++ b/go.sum @@ -740,6 +740,8 @@ github.com/tj/go-spin v1.1.0/go.mod h1:Mg1mzmePZm4dva8Qz60H2lHwmJ2loum4VIrLgVnKw github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/twmb/murmur3 v1.1.3 h1:D83U0XYKcHRYwYIpBKf3Pks91Z0Byda/9SJ8B6EMRcA= +github.com/twmb/murmur3 v1.1.3/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= github.com/twotwotwo/sorts v0.0.0-20160814051341-bf5c1f2b8553 h1:DRC1ubdb3ZmyyIeCSTxjZIQAnpLPfKVgYrLETQuOPjo= github.com/twotwotwo/sorts v0.0.0-20160814051341-bf5c1f2b8553/go.mod h1:Rj7Csq/tZ/egz+Ltc2IVpsA5309AmSMEswjkTZmq2Xc= github.com/uber-go/tally v3.3.13+incompatible h1:5ic2UsDwjcWsw9jvEdWEE2XsmGCLMTt5Ukg4d74fed4= diff --git a/src/aggregator/hash/hash.go b/src/aggregator/hash/hash.go index c78a0dceb9..cab04b71d6 100644 --- a/src/aggregator/hash/hash.go +++ b/src/aggregator/hash/hash.go @@ -24,7 +24,7 @@ // were added. package hash -import "github.com/spaolacci/murmur3" +import "github.com/twmb/murmur3" // Hash128 is a 128-bit hash of an ID consisting of two unsigned 64-bit ints. type Hash128 [2]uint64 diff --git a/src/aggregator/sharding/hash.go b/src/aggregator/sharding/hash.go index a7e0462a54..906f6b4496 100644 --- a/src/aggregator/sharding/hash.go +++ b/src/aggregator/sharding/hash.go @@ -26,7 +26,7 @@ import ( "github.com/m3db/m3/src/metrics/metric/id" - "github.com/spaolacci/murmur3" + "github.com/twmb/murmur3" ) const ( diff --git a/src/dbnode/client/connection_pool.go b/src/dbnode/client/connection_pool.go index db33595869..315886c175 100644 --- a/src/dbnode/client/connection_pool.go +++ b/src/dbnode/client/connection_pool.go @@ -33,7 +33,7 @@ import ( "github.com/m3db/m3/src/dbnode/topology" xclose "github.com/m3db/m3/src/x/close" - "github.com/spaolacci/murmur3" + "github.com/twmb/murmur3" "github.com/uber/tchannel-go/thrift" "go.uber.org/zap" ) diff --git a/src/dbnode/config/2node/init_m3db_topology.sh b/src/dbnode/config/2node/init_m3db_topology.sh new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/dbnode/sharding/shardset.go b/src/dbnode/sharding/shardset.go index e890e4db4d..d3b182b45e 100644 --- a/src/dbnode/sharding/shardset.go +++ b/src/dbnode/sharding/shardset.go @@ -26,8 +26,7 @@ import ( "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/x/ident" - - "github.com/spaolacci/murmur3" + twmbmurmur3 "github.com/twmb/murmur3" ) var ( @@ -161,6 +160,6 @@ func NewHashGenWithSeed(seed uint32) HashGen { // NewHashFn generates a HashFN based on murmur32 with a given seed func NewHashFn(length int, seed uint32) HashFn { return func(id ident.ID) uint32 { - return murmur3.Sum32WithSeed(id.Bytes(), seed) % uint32(length) + return twmbmurmur3.SeedSum32(seed, id.Bytes()) % uint32(length) } } diff --git a/src/dbnode/sharding/shardset_test.go b/src/dbnode/sharding/shardset_test.go index af978877f1..1b16193a74 100644 --- a/src/dbnode/sharding/shardset_test.go +++ b/src/dbnode/sharding/shardset_test.go @@ -25,7 +25,6 @@ import ( "github.com/m3db/m3/src/cluster/shard" "github.com/m3db/m3/src/x/ident" - "github.com/stretchr/testify/require" ) diff --git a/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source_prop_test.go b/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source_prop_test.go index 3a2d682723..3b0d808eb8 100644 --- a/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source_prop_test.go +++ b/src/dbnode/storage/bootstrap/bootstrapper/commitlog/source_prop_test.go @@ -53,7 +53,7 @@ import ( "github.com/leanovate/gopter" "github.com/leanovate/gopter/gen" "github.com/leanovate/gopter/prop" - "github.com/spaolacci/murmur3" + "github.com/twmb/murmur3" "github.com/stretchr/testify/require" )