Skip to content

Commit

Permalink
Gxed Badger hack: use the same net/trace everywhere
Browse files Browse the repository at this point in the history
net/trace cannot be imported on different versions from different modules.

Additionally, we also cannot export ExpVars with the same names from two different
packages (one being gxed-badger and the other being the go-modded one). Since those
two packages have different import paths, go considers them different and runs
init() twice, causing the issues.
  • Loading branch information
hsanjuan committed Jan 31, 2020
1 parent d9497bf commit 012d6a8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"log"
"sync"

"github.com/ipfs/fs-repo-migrations/ipfs-6-to-7/gx/ipfs/QmTEmsyNnckEq8rEfALfdhLHjrEHGoSGFDrAYReuetn7MC/go-net/trace"
"golang.org/x/net/trace"

"github.com/ipfs/fs-repo-migrations/ipfs-6-to-7/gx/ipfs/QmdKhi5wUQyV9i3GcTyfUmpfTntWjXu8DcyT9HyNbznYrn/badger/table"
"github.com/ipfs/fs-repo-migrations/ipfs-6-to-7/gx/ipfs/QmdKhi5wUQyV9i3GcTyfUmpfTntWjXu8DcyT9HyNbznYrn/badger/y"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (

"github.com/ipfs/fs-repo-migrations/ipfs-6-to-7/gx/ipfs/QmdKhi5wUQyV9i3GcTyfUmpfTntWjXu8DcyT9HyNbznYrn/badger/options"

"github.com/ipfs/fs-repo-migrations/ipfs-6-to-7/gx/ipfs/QmTEmsyNnckEq8rEfALfdhLHjrEHGoSGFDrAYReuetn7MC/go-net/trace"
"golang.org/x/net/trace"

"github.com/ipfs/fs-repo-migrations/ipfs-6-to-7/gx/ipfs/QmVmDhyTTUcQXFD1rRQ64fGLMSAoaQvNH3hwuaCFAPq2hy/errors"
"github.com/ipfs/fs-repo-migrations/ipfs-6-to-7/gx/ipfs/QmdKhi5wUQyV9i3GcTyfUmpfTntWjXu8DcyT9HyNbznYrn/badger/skl"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"sort"
"time"

"github.com/ipfs/fs-repo-migrations/ipfs-6-to-7/gx/ipfs/QmTEmsyNnckEq8rEfALfdhLHjrEHGoSGFDrAYReuetn7MC/go-net/trace"
"golang.org/x/net/trace"

"github.com/ipfs/fs-repo-migrations/ipfs-6-to-7/gx/ipfs/QmVmDhyTTUcQXFD1rRQ64fGLMSAoaQvNH3hwuaCFAPq2hy/errors"
"github.com/ipfs/fs-repo-migrations/ipfs-6-to-7/gx/ipfs/QmdKhi5wUQyV9i3GcTyfUmpfTntWjXu8DcyT9HyNbznYrn/badger/protos"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ import (

"github.com/ipfs/fs-repo-migrations/ipfs-6-to-7/gx/ipfs/QmdKhi5wUQyV9i3GcTyfUmpfTntWjXu8DcyT9HyNbznYrn/badger/options"

"github.com/ipfs/fs-repo-migrations/ipfs-6-to-7/gx/ipfs/QmTEmsyNnckEq8rEfALfdhLHjrEHGoSGFDrAYReuetn7MC/go-net/trace"
"github.com/ipfs/fs-repo-migrations/ipfs-6-to-7/gx/ipfs/QmVmDhyTTUcQXFD1rRQ64fGLMSAoaQvNH3hwuaCFAPq2hy/errors"
"github.com/ipfs/fs-repo-migrations/ipfs-6-to-7/gx/ipfs/QmdKhi5wUQyV9i3GcTyfUmpfTntWjXu8DcyT9HyNbznYrn/badger/y"
"golang.org/x/net/trace"
)

// Values have their first byte being byteData or byteDelete. This helps us distinguish between
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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_disk_reads_total2")
NumWrites = expvar.NewInt("badger_disk_writes_total2")
NumBytesRead = expvar.NewInt("badger_read_bytes2")
NumBytesWritten = expvar.NewInt("badger_written_bytes2")
NumLSMGets = expvar.NewMap("badger_lsm_level_gets_total2")
NumLSMBloomHits = expvar.NewMap("badger_lsm_bloom_hits_total2")
NumGets = expvar.NewInt("badger_gets_total2")
NumPuts = expvar.NewInt("badger_puts_total2")
NumBlockedPuts = expvar.NewInt("badger_blocked_puts_total2")
NumMemtableGets = expvar.NewInt("badger_memtable_gets_total2")
LSMSize = expvar.NewMap("badger_lsm_size_bytes2")
VlogSize = expvar.NewMap("badger_vlog_size_bytes2")
PendingWrites = expvar.NewMap("badger_pending_writes_total2")
}

0 comments on commit 012d6a8

Please sign in to comment.