Skip to content

Commit

Permalink
In the bank tool, do not print all bank transfers by default. (dgraph…
Browse files Browse the repository at this point in the history
…-io#982)

The bank tool is currently printing each bank transfer by default, which
results in a lot of output, specially when running the test for a while.
This PR makes this optional and controllable by a --verbose flag.
  • Loading branch information
martinmr authored Aug 14, 2019
1 parent b56a0dc commit 31395c2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion badger/cmd/bank.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ var stopAll int32
var mmap bool
var checkStream bool
var checkSubscriber bool
var verbose bool

const keyPrefix = "account:"

Expand All @@ -91,6 +92,9 @@ func init() {
bankTest.Flags().BoolVarP(&checkSubscriber, "check_subscriber", "w", false,
"If true, the test will send transactions to another badger instance via the subscriber "+
"interface in order to verify that all the data is published correctly.")
bankTest.Flags().BoolVarP(&verbose, "verbose", "v", false,
"If true, the test will print all the executed bank transfers to standard output. "+
"This outputs a lot so it's best to turn it off when running the test for a while.")

bankDisect.Flags().IntVarP(&numPrevious, "previous", "p", 12,
"Starting from the violation txn, how many previous versions to retrieve.")
Expand Down Expand Up @@ -429,7 +433,7 @@ func runTest(cmd *cobra.Command, args []string) error {
}
err := moveMoney(db, from, to)
atomic.AddUint64(&total, 1)
if err == nil {
if err == nil && verbose {
log.Printf("Moved $5. %d -> %d\n", from, to)
} else {
atomic.AddUint64(&errors, 1)
Expand Down

0 comments on commit 31395c2

Please sign in to comment.