This file is indexed.

/usr/share/gocode/src/github.com/influxdata/influxdb/cmd/influx_stress/influx_stress.go is in golang-github-influxdb-influxdb-dev 1.1.1+dfsg1-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package main

import (
	"flag"
	"fmt"
	"log"
	"os"
	"runtime/pprof"

	"github.com/influxdata/influxdb/stress"
	v2 "github.com/influxdata/influxdb/stress/v2"
)

var (
	useV2      = flag.Bool("v2", false, "Use version 2 of stress tool")
	config     = flag.String("config", "", "The stress test file")
	cpuprofile = flag.String("cpuprofile", "", "Write the cpu profile to `filename`")
	db         = flag.String("db", "", "target database within test system for write and query load")
)

func main() {
	o := stress.NewOutputConfig()
	flag.Parse()

	if *cpuprofile != "" {
		f, err := os.Create(*cpuprofile)
		if err != nil {
			fmt.Println(err)
			return
		}
		pprof.StartCPUProfile(f)
		defer pprof.StopCPUProfile()
	}

	if *useV2 {
		if *config != "" {
			v2.RunStress(*config)
		} else {
			v2.RunStress("stress/v2/iql/file.iql")
		}
	} else {

		c, err := stress.NewConfig(*config)
		if err != nil {
			log.Fatal(err)
			return
		}

		if *db != "" {
			c.Provision.Basic.Database = *db
			c.Write.InfluxClients.Basic.Database = *db
			c.Read.QueryClients.Basic.Database = *db
		}

		w := stress.NewWriter(c.Write.PointGenerators.Basic, &c.Write.InfluxClients.Basic)
		r := stress.NewQuerier(&c.Read.QueryGenerators.Basic, &c.Read.QueryClients.Basic)
		s := stress.NewStressTest(&c.Provision.Basic, w, r)

		bw := stress.NewBroadcastChannel()
		bw.Register(c.Write.InfluxClients.Basic.BasicWriteHandler)
		bw.Register(o.HTTPHandler("write"))

		br := stress.NewBroadcastChannel()
		br.Register(c.Read.QueryClients.Basic.BasicReadHandler)
		br.Register(o.HTTPHandler("read"))

		s.Start(bw.Handle, br.Handle)

	}
}