From 8c0d1ece5517eb0ec374744a579273f4107c6d94 Mon Sep 17 00:00:00 2001 From: Cody Soyland Date: Wed, 8 Nov 2017 11:46:17 -0600 Subject: [PATCH 1/3] Remove "plugins.path" configuration option According to Todd, the current plugin direction is static and there is no need for dynamic loading, so this option is no longer needed. --- cmd/server_test.go | 3 --- config.go | 4 ---- ctl/generate_config.go | 3 --- ctl/server.go | 1 - server/server_test.go | 12 ------------ 5 files changed, 23 deletions(-) diff --git a/cmd/server_test.go b/cmd/server_test.go index 53841a5d9..7b983b5e3 100644 --- a/cmd/server_test.go +++ b/cmd/server_test.go @@ -80,13 +80,10 @@ func TestServerConfig(t *testing.T) { hosts = [ "localhost:19444", ] - [plugins] - path = "/var/sloth" `, validation: func() error { v := validator{} v.Check(cmd.Server.Config.Cluster.Hosts, []string{"localhost:1110", "localhost:1111"}) - v.Check(cmd.Server.Config.Plugins.Path, "/var/sloth") v.Check(cmd.Server.Config.AntiEntropy.Interval, pilosa.Duration(time.Minute*9)) return v.Error() }, diff --git a/config.go b/config.go index d68158f5e..cd978c5ca 100644 --- a/config.go +++ b/config.go @@ -81,10 +81,6 @@ type Config struct { LongQueryTime Duration `toml:"long-query-time"` } `toml:"cluster"` - Plugins struct { - Path string `toml:"path"` - } `toml:"plugins"` - AntiEntropy struct { Interval Duration `toml:"interval"` } `toml:"anti-entropy"` diff --git a/ctl/generate_config.go b/ctl/generate_config.go index 87f866bb8..5ddef99b1 100644 --- a/ctl/generate_config.go +++ b/ctl/generate_config.go @@ -60,9 +60,6 @@ max-writes-per-request = 5000 service = "statsd" host = "127.0.0.1:8125" poll-interval = "0m15s" - -[plugins] - path = "" `)+"\n") return nil } diff --git a/ctl/server.go b/ctl/server.go index 2d3b82ca1..c251b8fb0 100644 --- a/ctl/server.go +++ b/ctl/server.go @@ -36,7 +36,6 @@ func BuildServerFlags(cmd *cobra.Command, srv *server.Command) { flags.StringSliceVarP(&srv.Config.Cluster.Hosts, "cluster.hosts", "", []string{}, "Comma separated list of hosts in cluster.") flags.DurationVarP((*time.Duration)(&srv.Config.Cluster.PollInterval), "cluster.poll-interval", "", time.Minute, "Polling interval for cluster.") // TODO what actually is this? flags.DurationVarP((*time.Duration)(&srv.Config.Cluster.LongQueryTime), "cluster.long-query-time", "", time.Minute, "Long Query Time.") - flags.StringVarP(&srv.Config.Plugins.Path, "plugins.path", "", "", "Path to plugin directory.") flags.StringVar(&srv.Config.LogPath, "log-path", "", "Log path") flags.DurationVarP((*time.Duration)(&srv.Config.AntiEntropy.Interval), "anti-entropy.interval", "", time.Minute*10, "Interval at which to run anti-entropy routine.") flags.StringVarP(&srv.CPUProfile, "profile.cpu", "", "", "Where to store CPU profile.") diff --git a/server/server_test.go b/server/server_test.go index 548affac9..1b07be671 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -363,18 +363,6 @@ func TestConfig_Parse_DataDir(t *testing.T) { } } -// Ensure the "plugins" config can be parsed. -func TestConfig_Parse_Plugins(t *testing.T) { - if c, err := ParseConfig(` -[plugins] -path = "/path/to/plugins" -`); err != nil { - t.Fatal(err) - } else if c.Plugins.Path != "/path/to/plugins" { - t.Fatalf("unexpected path: %s", c.Plugins.Path) - } -} - // tempMkdir makes a temporary directory func tempMkdir(t *testing.T) string { dir, err := ioutil.TempDir("", "pilosatemp") From e9a2534af7ac914242f25325953ef29d9ba7b7d3 Mon Sep 17 00:00:00 2001 From: Cody Soyland Date: Wed, 8 Nov 2017 13:12:51 -0600 Subject: [PATCH 2/3] Document undocumented flags and add tests (Fixes #915). --- cmd/server_test.go | 6 +++++- ctl/server.go | 2 +- docs/configuration.md | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/cmd/server_test.go b/cmd/server_test.go index 7b983b5e3..04436c1c4 100644 --- a/cmd/server_test.go +++ b/cmd/server_test.go @@ -45,10 +45,11 @@ func TestServerConfig(t *testing.T) { // TEST 0 { args: []string{"server", "--data-dir", actualDataDir, "--cluster.hosts", "localhost:10111,localhost:10110", "--bind", "localhost:10111"}, - env: map[string]string{"PILOSA_DATA_DIR": "/tmp/myEnvDatadir", "PILOSA_CLUSTER_POLL_INTERVAL": "3m2s"}, + env: map[string]string{"PILOSA_DATA_DIR": "/tmp/myEnvDatadir", "PILOSA_CLUSTER_POLL_INTERVAL": "3m2s", "PILOSA_CLUSTER_LONG_QUERY_TIME": "1m30s", "PILOSA_MAX_WRITES_PER_REQUEST": "2000"}, cfgFileContent: ` data-dir = "/tmp/myFileDatadir" bind = "localhost:0" + max-writes-per-request = 3000 [cluster] poll-interval = "45s" @@ -57,6 +58,7 @@ func TestServerConfig(t *testing.T) { hosts = [ "localhost:19444", ] + long-query-time = "1m10s" `, validation: func() error { v := validator{} @@ -65,6 +67,8 @@ func TestServerConfig(t *testing.T) { v.Check(cmd.Server.Config.Cluster.ReplicaN, 2) v.Check(cmd.Server.Config.Cluster.Hosts, []string{"localhost:10111", "localhost:10110"}) v.Check(cmd.Server.Config.Cluster.PollInterval, pilosa.Duration(time.Second*182)) + v.Check(cmd.Server.Config.Cluster.LongQueryTime, pilosa.Duration(time.Second*90)) + v.Check(cmd.Server.Config.MaxWritesPerRequest, 2000) return v.Error() }, }, diff --git a/ctl/server.go b/ctl/server.go index c251b8fb0..78f72b732 100644 --- a/ctl/server.go +++ b/ctl/server.go @@ -35,7 +35,7 @@ func BuildServerFlags(cmd *cobra.Command, srv *server.Command) { flags.IntVarP(&srv.Config.Cluster.ReplicaN, "cluster.replicas", "", 1, "Number of hosts each piece of data should be stored on.") flags.StringSliceVarP(&srv.Config.Cluster.Hosts, "cluster.hosts", "", []string{}, "Comma separated list of hosts in cluster.") flags.DurationVarP((*time.Duration)(&srv.Config.Cluster.PollInterval), "cluster.poll-interval", "", time.Minute, "Polling interval for cluster.") // TODO what actually is this? - flags.DurationVarP((*time.Duration)(&srv.Config.Cluster.LongQueryTime), "cluster.long-query-time", "", time.Minute, "Long Query Time.") + flags.DurationVarP((*time.Duration)(&srv.Config.Cluster.LongQueryTime), "cluster.long-query-time", "", time.Minute, "Duration that will trigger log and stat messages for slow queries.") flags.StringVar(&srv.Config.LogPath, "log-path", "", "Log path") flags.DurationVarP((*time.Duration)(&srv.Config.AntiEntropy.Interval), "anti-entropy.interval", "", time.Minute*10, "Interval at which to run anti-entropy routine.") flags.StringVarP(&srv.CPUProfile, "profile.cpu", "", "", "Where to store CPU profile.") diff --git a/docs/configuration.md b/docs/configuration.md index 0396e2e95..ba4b7d70a 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -76,6 +76,28 @@ Any flag that has a value that is a comma separated list on the command line bec data-dir = "~/.pilosa" ``` +#### Log Path + +* Description: Path of log file +* Flag: `--log-path="/path/to/logfile"` +* Env: `PILOSA_LOG_PATH="/path/to/logfile"` +* Config: + + ```toml + log_path = "/path/to/logfile" + ``` + +#### Max Writes Per Request + +* Description: Maximum number of mutating commands allowed per request. This includes SetBit, ClearBit, SetRowAttrs, SetColumnAttrs, and SetFieldValue. +* Flag: `--max-writes-per-request=5000` +* Env: `PILOSA_MAX_WRITES_PER_REQUEST=5000` +* Config: + + ```toml + max-writes-per-request = 5000 + ``` + #### Gossip Port * Description: Port to which Pilosa should bind for internal communication. @@ -135,6 +157,18 @@ Any flag that has a value that is a comma separated list on the command line bec poll-interval = "1m0s" ``` +#### Cluster Long Query Time + +* Description: Duration that will trigger log and stat messages for slow queries. +* Flag: `cluster.long-query-time="1m0s"` +* Env: `PILOSA_CLUSTER_LONG_QUERY_TIME="1m0s"` +* Config: + + ```toml + [cluster] + long-query-time = "1m0s" + ``` + #### Cluster Replicas * Description: Number of hosts each piece of data should be stored on. From 857b0b3736f36e876570d8d17ab718fc2b730e82 Mon Sep 17 00:00:00 2001 From: Cody Soyland Date: Wed, 8 Nov 2017 14:33:40 -0600 Subject: [PATCH 3/3] End with a period --- docs/configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/configuration.md b/docs/configuration.md index ba4b7d70a..85af6c1a4 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -78,7 +78,7 @@ Any flag that has a value that is a comma separated list on the command line bec #### Log Path -* Description: Path of log file +* Description: Path of log file. * Flag: `--log-path="/path/to/logfile"` * Env: `PILOSA_LOG_PATH="/path/to/logfile"` * Config: