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

Set namespace and ID as NoFinalize #956

Merged
merged 1 commit into from
Sep 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 10 additions & 2 deletions src/query/storage/m3/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,12 @@ func newUnaggregatedClusterNamespace(
if err := def.Validate(); err != nil {
return nil, err
}

ns := def.NamespaceID
// Set namespace to NoFinalize to avoid cloning it in write operations
ns.NoFinalize()
return &clusterNamespace{
namespaceID: def.NamespaceID,
namespaceID: ns,
options: ClusterNamespaceOptions{
attributes: storage.Attributes{
MetricsType: storage.UnaggregatedMetricsType,
Expand All @@ -308,8 +312,12 @@ func newAggregatedClusterNamespace(
if err := def.Validate(); err != nil {
return nil, err
}

ns := def.NamespaceID
// Set namespace to NoFinalize to avoid cloning it in write operations
ns.NoFinalize()
return &clusterNamespace{
namespaceID: def.NamespaceID,
namespaceID: ns,
options: ClusterNamespaceOptions{
attributes: storage.Attributes{
MetricsType: storage.AggregatedMetricsType,
Expand Down
2 changes: 2 additions & 0 deletions src/query/storage/m3/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ func (s *m3storage) Write(
id := query.Tags.ID()
// TODO: Consider caching id -> identID
Copy link
Contributor

Choose a reason for hiding this comment

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

Caching these in an LRU would actually probably save a ton of allocs unrelated to this P.R

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think there's some other refactoring of this going on in #942, so don't want to step on any toes there and lead to messy merges; we'll definitely circle back on adding an LRU here

identID := ident.StringID(id)
// Set id to NoFinalize to avoid cloning it in write operations
identID.NoFinalize()
common := &writeRequestCommon{
store: s,
annotation: query.Annotation,
Expand Down