From 7105fec0ade3aad2a2c011a6af1bb3b6a381912e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Wed, 8 Apr 2020 23:05:15 +0100 Subject: [PATCH] all: make dgraph/v2 compatible with v1 There were two instances of init-time work being incompatible with v1. That is, if one imported both v1 and v2 as part of a Go build, the resulting binary would end up panicking before main could run. The examples below are done with the latest versions of v1 and v2, and a main.go as follows: package main import ( _ "github.com/dgraph-io/badger" _ "github.com/dgraph-io/badger/v2" ) func main() {} First, the protobuf package used "pb" as its proto package name. This is a problem, because types are registered globally with their fully qualified names, like "pb.Foo". Since both badger/pb and badger/v2/pb tried to globally register types with the same qualified names, we'd get a panic: $ go run . panic: proto: duplicate enum registered: pb.ManifestChange_Operation goroutine 1 [running]: github.com/golang/protobuf/proto.RegisterEnum(...) .../go/pkg/mod/github.com/golang/protobuf@v1.3.1/proto/properties.go:459 github.com/dgraph-io/badger/v2/pb.init.0() .../badger/pb/pb.pb.go:638 +0x459 To fix this, make v2's proto package fully qualified. Since the namespace is global, just "v2.pb" wouldn't suffice; it's not unique enough. "dgraph.badger.v2.pb" seems good, since it follows the Go module path pretty closely. The second issue was with expvar, which too uses globally registered names: $ go run . 2020/04/08 22:59:20 Reuse of exported var name: badger_disk_reads_total panic: Reuse of exported var name: badger_disk_reads_total goroutine 1 [running]: log.Panicln(0xc00010de48, 0x2, 0x2) .../src/log/log.go:365 +0xac expvar.Publish(0x906fcc, 0x17, 0x9946a0, 0xc0000b0318) .../src/expvar/expvar.go:278 +0x267 expvar.NewInt(...) .../src/expvar/expvar.go:298 github.com/dgraph-io/badger/v2/y.init.1() .../badger/y/metrics.go:55 +0x65 exit status 2 This time, replacing the "badger_" var prefix with "badger_v2_" seems like it's simple enough as a fix. Fixes #1208. --- pb/pb.pb.go | 116 ++++++++++++++++++++++++++------------------------- pb/pb.proto | 2 +- y/metrics.go | 26 ++++++------ 3 files changed, 74 insertions(+), 70 deletions(-) diff --git a/pb/pb.pb.go b/pb/pb.pb.go index bb8518594..7e991c2d1 100644 --- a/pb/pb.pb.go +++ b/pb/pb.pb.go @@ -296,10 +296,10 @@ func (m *ManifestChangeSet) GetChanges() []*ManifestChange { type ManifestChange struct { Id uint64 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"` - Op ManifestChange_Operation `protobuf:"varint,2,opt,name=Op,proto3,enum=pb.ManifestChange_Operation" json:"Op,omitempty"` + Op ManifestChange_Operation `protobuf:"varint,2,opt,name=Op,proto3,enum=dgraph.badger.v2.pb.ManifestChange_Operation" json:"Op,omitempty"` Level uint32 `protobuf:"varint,3,opt,name=Level,proto3" json:"Level,omitempty"` KeyId uint64 `protobuf:"varint,4,opt,name=key_id,json=keyId,proto3" json:"key_id,omitempty"` - EncryptionAlgo EncryptionAlgo `protobuf:"varint,5,opt,name=encryption_algo,json=encryptionAlgo,proto3,enum=pb.EncryptionAlgo" json:"encryption_algo,omitempty"` + EncryptionAlgo EncryptionAlgo `protobuf:"varint,5,opt,name=encryption_algo,json=encryptionAlgo,proto3,enum=dgraph.badger.v2.pb.EncryptionAlgo" json:"encryption_algo,omitempty"` Compression uint32 `protobuf:"varint,6,opt,name=compression,proto3" json:"compression,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -508,7 +508,7 @@ func (m *TableIndex) GetEstimatedSize() uint64 { } type Checksum struct { - Algo Checksum_Algorithm `protobuf:"varint,1,opt,name=algo,proto3,enum=pb.Checksum_Algorithm" json:"algo,omitempty"` + Algo Checksum_Algorithm `protobuf:"varint,1,opt,name=algo,proto3,enum=dgraph.badger.v2.pb.Checksum_Algorithm" json:"algo,omitempty"` Sum uint64 `protobuf:"varint,2,opt,name=sum,proto3" json:"sum,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -634,64 +634,68 @@ func (m *DataKey) GetCreatedAt() int64 { } func init() { - proto.RegisterEnum("pb.EncryptionAlgo", EncryptionAlgo_name, EncryptionAlgo_value) - proto.RegisterEnum("pb.ManifestChange_Operation", ManifestChange_Operation_name, ManifestChange_Operation_value) - proto.RegisterEnum("pb.Checksum_Algorithm", Checksum_Algorithm_name, Checksum_Algorithm_value) - proto.RegisterType((*KV)(nil), "pb.KV") - proto.RegisterType((*KVList)(nil), "pb.KVList") - proto.RegisterType((*ManifestChangeSet)(nil), "pb.ManifestChangeSet") - proto.RegisterType((*ManifestChange)(nil), "pb.ManifestChange") - proto.RegisterType((*BlockOffset)(nil), "pb.BlockOffset") - proto.RegisterType((*TableIndex)(nil), "pb.TableIndex") - proto.RegisterType((*Checksum)(nil), "pb.Checksum") - proto.RegisterType((*DataKey)(nil), "pb.DataKey") + proto.RegisterEnum("dgraph.badger.v2.pb.EncryptionAlgo", EncryptionAlgo_name, EncryptionAlgo_value) + proto.RegisterEnum("dgraph.badger.v2.pb.ManifestChange_Operation", ManifestChange_Operation_name, ManifestChange_Operation_value) + proto.RegisterEnum("dgraph.badger.v2.pb.Checksum_Algorithm", Checksum_Algorithm_name, Checksum_Algorithm_value) + proto.RegisterType((*KV)(nil), "dgraph.badger.v2.pb.KV") + proto.RegisterType((*KVList)(nil), "dgraph.badger.v2.pb.KVList") + proto.RegisterType((*ManifestChangeSet)(nil), "dgraph.badger.v2.pb.ManifestChangeSet") + proto.RegisterType((*ManifestChange)(nil), "dgraph.badger.v2.pb.ManifestChange") + proto.RegisterType((*BlockOffset)(nil), "dgraph.badger.v2.pb.BlockOffset") + proto.RegisterType((*TableIndex)(nil), "dgraph.badger.v2.pb.TableIndex") + proto.RegisterType((*Checksum)(nil), "dgraph.badger.v2.pb.Checksum") + proto.RegisterType((*DataKey)(nil), "dgraph.badger.v2.pb.DataKey") } func init() { proto.RegisterFile("pb.proto", fileDescriptor_f80abaa17e25ccc8) } var fileDescriptor_f80abaa17e25ccc8 = []byte{ - // 653 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 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e, 0x73, 0x31, 0xff, 0xf0, 0xbe, 0x41, - 0x9c, 0x29, 0x94, 0x2e, 0xb8, 0xe4, 0x43, 0x5c, 0x6d, 0x4d, 0x99, 0x6c, 0x4f, 0x99, 0x82, 0xe9, - 0x72, 0xc9, 0xf3, 0xa6, 0x74, 0xac, 0x96, 0xcc, 0x4b, 0xf3, 0xd7, 0x67, 0x78, 0xa9, 0x7a, 0x5d, - 0xd3, 0x04, 0x75, 0x6f, 0x5c, 0xea, 0x25, 0x29, 0xb2, 0x4a, 0x8e, 0x74, 0xe5, 0xf1, 0x73, 0xa8, - 0xef, 0x6e, 0x03, 0x2d, 0x41, 0x91, 0xa3, 0x68, 0x14, 0xce, 0x1b, 0xdf, 0x9e, 0x9a, 0xe4, 0xfb, - 0x53, 0x93, 0xfc, 0x7c, 0x6a, 0x92, 0xaf, 0xbf, 0x9a, 0x85, 0x89, 0xa5, 0x7f, 0x0d, 0x67, 0x7f, - 0x02, 0x00, 0x00, 0xff, 0xff, 0x8f, 0xf6, 0xa8, 0xfe, 0x26, 0x04, 0x00, 0x00, + // 705 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcb, 0x6e, 0xf2, 0x56, + 0x10, 0xe6, 0x18, 0x87, 0xcb, 0x10, 0x28, 0x3d, 0xbd, 0xb9, 0xaa, 0x4a, 0x89, 0xa3, 0x28, 0xa8, + 0x52, 0x8c, 0x4a, 0xaa, 0x2e, 0x5a, 0x65, 0x41, 0x08, 0x55, 0x11, 0x44, 0x48, 0x27, 0x51, 0x14, + 0x75, 0x83, 0x8e, 0xed, 0x01, 0x2c, 0x7c, 0x93, 0x7d, 0xb0, 0x42, 0x56, 0x7d, 0x86, 0xae, 0xba, + 0xed, 0xdb, 0x74, 0xd9, 0x45, 0x1f, 0xa0, 0xca, 0xff, 0x22, 0xbf, 0x7c, 0x6c, 0x10, 0x48, 0xfc, + 0xd2, 0xbf, 0x9b, 0xf9, 0xe6, 0xe2, 0x99, 0x6f, 0xbe, 0x63, 0xa8, 0x84, 0xa6, 0x11, 0x46, 0x81, + 0x08, 0xe8, 0x67, 0xf6, 0x22, 0xe2, 0xe1, 0xd2, 0x30, 0xb9, 0xbd, 0xc0, 0xc8, 0x48, 0x7a, 0x46, + 0x68, 0xea, 0xff, 0x11, 0x50, 0xc6, 0x4f, 0xb4, 0x09, 0xc5, 0x15, 0x6e, 0x34, 0xd2, 0x26, 0x9d, + 0x53, 0x96, 0x9a, 0xf4, 0x73, 0x38, 0x49, 0xb8, 0xbb, 0x46, 0x4d, 0x91, 0x58, 0xe6, 0xd0, 0x6f, + 0xa0, 0xba, 0x8e, 0x31, 0x9a, 0x79, 0x28, 0xb8, 0x56, 0x94, 0x91, 0x4a, 0x0a, 0xdc, 0xa3, 0xe0, + 0x54, 0x83, 0x72, 0x82, 0x51, 0xec, 0x04, 0xbe, 0xa6, 0xb6, 0x49, 0x47, 0x65, 0x5b, 0x97, 0x7e, + 0x0b, 0x80, 0x2f, 0xa1, 0x13, 0x61, 0x3c, 0xe3, 0x42, 0x3b, 0x91, 0xc1, 0x6a, 0x8e, 0xf4, 0x05, + 0xa5, 0xa0, 0xca, 0x86, 0x25, 0xd9, 0x50, 0xda, 0xe9, 0x97, 0x62, 0x11, 0x21, 0xf7, 0x66, 0x8e, + 0xad, 0x41, 0x9b, 0x74, 0xea, 0xac, 0x92, 0x01, 0x23, 0x9b, 0x7e, 0x07, 0xb5, 0x3c, 0x68, 0x07, + 0x3e, 0x6a, 0xb5, 0x36, 0xe9, 0x54, 0x18, 0x64, 0xd0, 0x5d, 0xe0, 0xa3, 0xfe, 0x03, 0x94, 0xc6, + 0x4f, 0x13, 0x27, 0x16, 0xf4, 0x12, 0x94, 0x55, 0xa2, 0x91, 0x76, 0xb1, 0x53, 0xeb, 0x7d, 0x65, + 0x1c, 0xa1, 0xc0, 0x18, 0x3f, 0x31, 0x65, 0x95, 0xe8, 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a, 0x39, 0xd2, 0x17, 0xdf, 0x7f, 0x0d, 0x8d, 0x43, 0xc1, 0xd0, + 0x32, 0x14, 0x39, 0xc6, 0xcd, 0xc2, 0xed, 0xf5, 0x3f, 0x6f, 0x2d, 0xf2, 0xef, 0x5b, 0x8b, 0xfc, + 0xff, 0xd6, 0x22, 0x7f, 0xbd, 0x6b, 0x15, 0x7e, 0x3f, 0x5b, 0x38, 0x62, 0xb9, 0x36, 0x0d, 0x2b, + 0xf0, 0xba, 0x19, 0x07, 0x57, 0x4e, 0xd0, 0xcd, 0x68, 0xe8, 0x26, 0xbd, 0x6e, 0x68, 0x9a, 0x25, + 0xf9, 0xd7, 0xba, 0x7e, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xe3, 0xfd, 0x8f, 0x0d, 0xc1, 0x04, 0x00, + 0x00, } func (m *KV) Marshal() (dAtA []byte, err error) { diff --git a/pb/pb.proto b/pb/pb.proto index 7531521b4..9c7751760 100644 --- a/pb/pb.proto +++ b/pb/pb.proto @@ -17,7 +17,7 @@ // Use protos/gen.sh to generate .pb.go files. syntax = "proto3"; -package pb; +package dgraph.badger.v2.pb; option go_package = "github.com/dgraph-io/badger/v2/pb"; diff --git a/y/metrics.go b/y/metrics.go index 2de17d100..742e1aeae 100644 --- a/y/metrics.go +++ b/y/metrics.go @@ -52,17 +52,17 @@ var ( // These variables are global and have cumulative values for all kv stores. func init() { - NumReads = expvar.NewInt("badger_disk_reads_total") - NumWrites = expvar.NewInt("badger_disk_writes_total") - NumBytesRead = expvar.NewInt("badger_read_bytes") - NumBytesWritten = expvar.NewInt("badger_written_bytes") - NumLSMGets = expvar.NewMap("badger_lsm_level_gets_total") - NumLSMBloomHits = expvar.NewMap("badger_lsm_bloom_hits_total") - NumGets = expvar.NewInt("badger_gets_total") - NumPuts = expvar.NewInt("badger_puts_total") - NumBlockedPuts = expvar.NewInt("badger_blocked_puts_total") - NumMemtableGets = expvar.NewInt("badger_memtable_gets_total") - LSMSize = expvar.NewMap("badger_lsm_size_bytes") - VlogSize = expvar.NewMap("badger_vlog_size_bytes") - PendingWrites = expvar.NewMap("badger_pending_writes_total") + NumReads = expvar.NewInt("badger_v2_disk_reads_total") + NumWrites = expvar.NewInt("badger_v2_disk_writes_total") + NumBytesRead = expvar.NewInt("badger_v2_read_bytes") + NumBytesWritten = expvar.NewInt("badger_v2_written_bytes") + NumLSMGets = expvar.NewMap("badger_v2_lsm_level_gets_total") + NumLSMBloomHits = expvar.NewMap("badger_v2_lsm_bloom_hits_total") + NumGets = expvar.NewInt("badger_v2_gets_total") + NumPuts = expvar.NewInt("badger_v2_puts_total") + NumBlockedPuts = expvar.NewInt("badger_v2_blocked_puts_total") + NumMemtableGets = expvar.NewInt("badger_v2_memtable_gets_total") + LSMSize = expvar.NewMap("badger_v2_lsm_size_bytes") + VlogSize = expvar.NewMap("badger_v2_vlog_size_bytes") + PendingWrites = expvar.NewMap("badger_v2_pending_writes_total") }