Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dbnode] Add namespace runtime options for runtime per-namespace config changes #2446

Merged
merged 46 commits into from
Jul 22, 2020
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
9992e3d
[dbnode] Add namespace runtime options manager
robskillington Jul 4, 2020
aac4198
Respect flush indexing concurrency runtime options
robskillington Jul 6, 2020
7409332
Merge branch 'master' into r/namespace-runtime-options
robskillington Jul 6, 2020
001164b
Merge branch 'master' into r/namespace-runtime-options
robskillington Jul 6, 2020
c321ffc
Fix fn pointer assignment
robskillington Jul 6, 2020
8779db1
Revert test files
robskillington Jul 6, 2020
c228639
Update runtime options
robskillington Jul 6, 2020
fbe1cec
Add note
robskillington Jul 6, 2020
dd4fcc8
Share underlying indexing resources across segment builders to bound …
robskillington Jul 6, 2020
ef41525
Reset sharded jobs after use
robskillington Jul 6, 2020
f8e5049
Fix upsert options endpoint
robskillington Jul 6, 2020
b069000
Reset docs batch between flushing batch during warm index flush
robskillington Jul 6, 2020
2f848fa
Merge branch 'master' into r/namespace-runtime-options
robskillington Jul 8, 2020
fd722e2
Merge branch 'master' into r/namespace-runtime-options
robskillington Jul 8, 2020
94564b8
Fix update namespace flow and also do not attempt index flush when no…
robskillington Jul 8, 2020
a264484
Add log for updating index runtime options
robskillington Jul 8, 2020
dd00127
Use context pool for FST readers, also fix avoid unnecessary locking …
robskillington Jul 9, 2020
e5a7dd5
Merge branch 'master' into r/namespace-runtime-options
robskillington Jul 16, 2020
62b8f68
Merge branch 'master' into r/namespace-runtime-options
robskillington Jul 17, 2020
09bc443
Address feedback
robskillington Jul 17, 2020
bbfb16a
Address feedback
robskillington Jul 18, 2020
5e3e9c6
Fix concurrency issue
robskillington Jul 18, 2020
a687e0f
Fix tests
robskillington Jul 18, 2020
8acd924
Fix tests
robskillington Jul 18, 2020
2ef0f02
Fix test build
robskillington Jul 18, 2020
296d834
Fix not closing listener
robskillington Jul 18, 2020
38039ac
Fix build
robskillington Jul 18, 2020
8f4daee
Use per CPU queue for shard insert queue
robskillington Jul 19, 2020
aa07507
Less locks in shard insert queue
robskillington Jul 19, 2020
7116768
Fix uninit var
robskillington Jul 19, 2020
8ec78e0
Single insertion for shard insert queue batch exec
robskillington Jul 19, 2020
09fcc34
Write bootstrap data to side-buffer then rotate/merge after bootstrap…
robskillington Jul 20, 2020
e8f25ea
With higher tchannel send buffer size
robskillington Jul 20, 2020
3cb6f0e
Rate limit reading index files
robskillington Jul 20, 2020
12c467e
Avoid applying rate limit currently
robskillington Jul 21, 2020
4518df4
Revert "Avoid applying rate limit currently"
robskillington Jul 22, 2020
9ab8944
Revert "Rate limit reading index files"
robskillington Jul 22, 2020
63f1f47
Do not autovalidate index segments on boot
robskillington Jul 22, 2020
83a89d1
Check is sealed directly rather than inferring block is already closed
robskillington Jul 22, 2020
3421885
Synchronous lock on bootstrap series insert for faster bootstrap
robskillington Jul 22, 2020
95a9b05
Fix insertSeriesSync
robskillington Jul 22, 2020
2a38d80
Address feedback
robskillington Jul 22, 2020
bc253fa
Add FST writer options to FST writer
robskillington Jul 22, 2020
5c45949
Merge branch 'master' into r/namespace-runtime-options
robskillington Jul 22, 2020
1b9a463
Fix test and revise tchannel send frame default value
robskillington Jul 22, 2020
921551a
Merge branch 'r/namespace-runtime-options' of github.com:m3db/m3 into…
robskillington Jul 22, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
357 changes: 307 additions & 50 deletions src/dbnode/generated/proto/namespace/namespace.pb.go

Large diffs are not rendered by default.

28 changes: 18 additions & 10 deletions src/dbnode/generated/proto/namespace/namespace.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
syntax = "proto3";

package namespace;

import "google/protobuf/wrappers.proto";
import "github.com/m3db/m3/src/dbnode/generated/proto/namespace/schema.proto";

message RetentionOptions {
Expand All @@ -19,18 +21,24 @@ message IndexOptions {
}

message NamespaceOptions {
bool bootstrapEnabled = 1;
bool flushEnabled = 2;
bool writesToCommitLog = 3;
bool cleanupEnabled = 4;
bool repairEnabled = 5;
RetentionOptions retentionOptions = 6;
bool snapshotEnabled = 7;
IndexOptions indexOptions = 8;
SchemaOptions schemaOptions = 9;
bool coldWritesEnabled = 10;
bool bootstrapEnabled = 1;
bool flushEnabled = 2;
bool writesToCommitLog = 3;
bool cleanupEnabled = 4;
bool repairEnabled = 5;
RetentionOptions retentionOptions = 6;
bool snapshotEnabled = 7;
IndexOptions indexOptions = 8;
SchemaOptions schemaOptions = 9;
bool coldWritesEnabled = 10;
NamespaceRuntimeOptions runtimeOptions = 11;
}

message Registry {
map<string, NamespaceOptions> namespaces = 1;
}

message NamespaceRuntimeOptions {
google.protobuf.DoubleValue writeIndexingPerCPUConcurrency = 1;
google.protobuf.DoubleValue flushIndexingPerCPUConcurrency = 2;
}
59 changes: 58 additions & 1 deletion src/dbnode/namespace/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import (
"github.com/m3db/m3/src/dbnode/retention"
"github.com/m3db/m3/src/x/ident"
xtime "github.com/m3db/m3/src/x/time"

protobuftypes "github.com/gogo/protobuf/types"
)

var (
Expand Down Expand Up @@ -80,6 +82,25 @@ func ToIndexOptions(
return iopts, nil
}

// ToRuntimeOptions converts nsproto.NamespaceRuntimeOptions to RuntimeOptions.
func ToRuntimeOptions(
opts *nsproto.NamespaceRuntimeOptions,
) (RuntimeOptions, error) {
robskillington marked this conversation as resolved.
Show resolved Hide resolved
runtimeOpts := NewRuntimeOptions()
if opts == nil {
return runtimeOpts, nil
}
if v := opts.WriteIndexingPerCPUConcurrency; v != nil {
newValue := v.Value
runtimeOpts = runtimeOpts.SetWriteIndexingPerCPUConcurrency(&newValue)
}
if v := opts.FlushIndexingPerCPUConcurrency; v != nil {
newValue := v.Value
runtimeOpts = runtimeOpts.SetFlushIndexingPerCPUConcurrency(&newValue)
}
return runtimeOpts, nil
}

// ToMetadata converts nsproto.Options to Metadata
func ToMetadata(
id string,
Expand All @@ -104,6 +125,11 @@ func ToMetadata(
return nil, err
}

runtimeOpts, err := ToRuntimeOptions(opts.RuntimeOptions)
if err != nil {
return nil, err
}

mopts := NewOptions().
SetBootstrapEnabled(opts.BootstrapEnabled).
SetFlushEnabled(opts.FlushEnabled).
Expand All @@ -114,7 +140,12 @@ func ToMetadata(
SetSchemaHistory(sr).
SetRetentionOptions(ropts).
SetIndexOptions(iopts).
SetColdWritesEnabled(opts.ColdWritesEnabled)
SetColdWritesEnabled(opts.ColdWritesEnabled).
SetRuntimeOptions(runtimeOpts)

if err := mopts.Validate(); err != nil {
return nil, err
}

return NewMetadata(ident.StringID(id), mopts)
}
Expand Down Expand Up @@ -172,5 +203,31 @@ func OptionsToProto(opts Options) *nsproto.NamespaceOptions {
BlockSizeNanos: iopts.BlockSize().Nanoseconds(),
},
ColdWritesEnabled: opts.ColdWritesEnabled(),
RuntimeOptions: toRuntimeOptions(opts.RuntimeOptions()),
}
}

// toRuntimeOptions returns the corresponding RuntimeOptions proto.
func toRuntimeOptions(opts RuntimeOptions) *nsproto.NamespaceRuntimeOptions {
if opts == nil || opts.IsDefaults() {
return nil
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice trick 👍

}
var (
writeIndexingPerCPUConcurrency *protobuftypes.DoubleValue
flushIndexingPerCPUConcurrency *protobuftypes.DoubleValue
)
if v := opts.WriteIndexingPerCPUConcurrency(); v != nil {
writeIndexingPerCPUConcurrency = &protobuftypes.DoubleValue{
Value: *v,
}
}
if v := opts.FlushIndexingPerCPUConcurrency(); v != nil {
flushIndexingPerCPUConcurrency = &protobuftypes.DoubleValue{
Value: *v,
}
}
return &nsproto.NamespaceRuntimeOptions{
WriteIndexingPerCPUConcurrency: writeIndexingPerCPUConcurrency,
FlushIndexingPerCPUConcurrency: flushIndexingPerCPUConcurrency,
robskillington marked this conversation as resolved.
Show resolved Hide resolved
}
}
6 changes: 4 additions & 2 deletions src/dbnode/namespace/dynamic.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,13 @@ func (r *dynamicRegistry) run() {

if m.Equal(r.maps()) {
r.metrics.numInvalidUpdates.Inc(1)
r.logger.Warn("dynamic namespace registry received identical update, skipping")
r.logger.Warn("dynamic namespace registry received identical update, skipping",
zap.Int("version", val.Version()))
continue
}

r.logger.Info("dynamic namespace registry updated to version", zap.Int("version", val.Version()))
r.logger.Info("dynamic namespace registry updated to version",
zap.Int("version", val.Version()))
r.Lock()
r.currentValue = val
r.currentMap = m
Expand Down
36 changes: 32 additions & 4 deletions src/dbnode/namespace/namespace_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading