Merge pull request #1197 from jaten-molecula/rowcache_off_by_default

rowcache off by default. pilosa server --rowcache-on turns it back on.
This commit is contained in:
tgruben 2020-12-08 19:32:19 -06:00 committed by GitHub
commit d05531b77a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 15 deletions

View file

@ -95,8 +95,8 @@ func BuildServerFlags(cmd *cobra.Command, srv *server.Command) {
// cannot detect and honor the PILOSA_TXSRC env var over-ride.
flags.StringVarP(&srv.Config.Txsrc, "txsrc", "", "", fmt.Sprintf("transaction/storage to use: one of roaring, rbf, bolt, lmdb, or a blue-green setup: rbf_roaring, roaring_rbf, bolt_roaring, roaring_bolt, bolt_rbf, etc. The default is: %v. The env var PILOSA_TXSRC is over-ridden by --tx option on the command line.", pilosa.DefaultTxsrc))
// RowcacheOff
flags.BoolVarP((&srv.Config.RowcacheOff), "rowcache-off", "", srv.Config.RowcacheOff, "turn off the rowcache for all backends (reduces memory use)")
// RowcacheOn
flags.BoolVarP((&srv.Config.RowcacheOn), "rowcache-on", "", srv.Config.RowcacheOn, "turn on the rowcache for all backends (may speed some queries)")
// RBF specific flags. See pilosa/rbf/cfg/cfg.go for definitions.
srv.Config.RBFConfig.DefineFlags(flags)

View file

@ -145,8 +145,8 @@ type HolderOpts struct {
// server.go OptServerTxsrc
Txsrc string
// RowcacheOff, if true, turns off the row cache for all storage backends.
RowcacheOff bool
// RowcacheOn, if true, turns on the row cache for all storage backends.
RowcacheOn bool
}
func (h *Holder) StartTransaction(ctx context.Context, id string, timeout time.Duration, exclusive bool) (*Transaction, error) {
@ -207,7 +207,7 @@ type HolderConfig struct {
NewAttrStore func(string) AttrStore
Logger logger.Logger
Txsrc string
RowcacheOff bool
RowcacheOn bool
RBFConfig *rbfcfg.Config
AntiEntropyInterval time.Duration
@ -263,7 +263,7 @@ func NewHolder(path string, cfg *HolderConfig) *Holder {
OpenIDAllocator: cfg.OpenIDAllocator,
translationSyncer: cfg.TranslationSyncer,
Logger: cfg.Logger,
Opts: HolderOpts{Txsrc: cfg.Txsrc, RowcacheOff: cfg.RowcacheOff},
Opts: HolderOpts{Txsrc: cfg.Txsrc, RowcacheOn: cfg.RowcacheOn},
SnapshotQueue: defaultSnapshotQueue,
@ -274,7 +274,7 @@ func NewHolder(path string, cfg *HolderConfig) *Holder {
indexes: make(map[string]*Index),
}
rbf.SetRowcacheOn(!cfg.RowcacheOff)
rbf.SetRowcacheOn(cfg.RowcacheOn)
txf, err := NewTxFactory(cfg.Txsrc, path, h)
panicOn(err)

View file

@ -356,11 +356,11 @@ func OptServerTxsrc(txsrc string) ServerOption {
}
}
// OptServerRowcacheOff is a functional option on Server
// used to turn off the row cache.
func OptServerRowcacheOff(rowcacheOff bool) ServerOption {
// OptServerRowcacheOn is a functional option on Server
// used to turn on the row cache.
func OptServerRowcacheOn(rowcacheOn bool) ServerOption {
return func(s *Server) error {
s.holderConfig.RowcacheOff = rowcacheOff
s.holderConfig.RowcacheOn = rowcacheOn
return nil
}
}
@ -438,7 +438,7 @@ func NewServer(opts ...ServerOption) (*Server, error) {
}
s.holder = NewHolder(path, s.holderConfig)
s.holder.Stats.SetLogger(s.logger)
s.holder.Logger.Printf("RowCacheOff: %v", s.holderConfig.RowcacheOff)
s.holder.Logger.Printf("RowCacheOn: %v", s.holderConfig.RowcacheOn)
cwd, err := os.Getwd()
if err != nil {
return nil, err

View file

@ -201,8 +201,10 @@ type Config struct {
// returned from the blueGreenTx.
Txsrc string `toml:"txsrc"`
// RowcacheOff, if true, turns off the row cache for all storage backends.
RowcacheOff bool `toml:"rowcache-off"`
// RowcacheOn, if true, turns on the row cache for all storage backends.
// The default is now off because it makes rbf queries faster and uses
// much less memory.
RowcacheOn bool `toml:"rowcache-on"`
// RBFConfig defines all externally configurable RBF flags.
RBFConfig *rbfcfg.Config

View file

@ -411,7 +411,7 @@ func (m *Command) SetupServer() error {
pilosa.OptServerClusterName(m.Config.Cluster.Name),
pilosa.OptServerSerializer(proto.Serializer{}),
pilosa.OptServerTxsrc(m.Config.Txsrc),
pilosa.OptServerRowcacheOff(m.Config.RowcacheOff),
pilosa.OptServerRowcacheOn(m.Config.RowcacheOn),
pilosa.OptServerRBFConfig(m.Config.RBFConfig),
pilosa.OptServerQueryHistoryLength(m.Config.QueryHistoryLength),
coordinatorOpt,