From 211c82036537dae47aeaf523d1f0849ae9fb253a Mon Sep 17 00:00:00 2001 From: Nikunj Aggarwal Date: Mon, 24 Sep 2018 16:48:38 -0400 Subject: [PATCH 1/2] Avoid duplicate ident.ID conversions --- src/query/storage/m3/storage.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/query/storage/m3/storage.go b/src/query/storage/m3/storage.go index 3ade20dbc8..d482dad038 100644 --- a/src/query/storage/m3/storage.go +++ b/src/query/storage/m3/storage.go @@ -255,11 +255,13 @@ func (s *m3storage) Write( } id := query.Tags.ID() + // TODO: Consider caching id -> identId + identId := ident.StringID(id) common := &writeRequestCommon{ store: s, annotation: query.Annotation, unit: query.Unit, - id: id, + id: identId, tagIterator: storage.TagsToIdentTagIterator(query.Tags), attributes: query.Attributes, } @@ -282,7 +284,7 @@ func (s *m3storage) Close() error { func (w *writeRequest) Process(ctx context.Context) error { common := w.writeRequestCommon store := common.store - id := ident.StringID(common.id) + id := common.id var ( namespace ClusterNamespace @@ -321,7 +323,7 @@ type writeRequestCommon struct { store *m3storage annotation []byte unit xtime.Unit - id string + id ident.ID tagIterator ident.TagIterator attributes storage.Attributes } From f5236144dec06ad954706c6a231aaf2435aa6eca Mon Sep 17 00:00:00 2001 From: Nikunj Aggarwal Date: Mon, 24 Sep 2018 17:11:22 -0400 Subject: [PATCH 2/2] Fix lint --- src/query/storage/m3/storage.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/query/storage/m3/storage.go b/src/query/storage/m3/storage.go index d482dad038..8d26b91440 100644 --- a/src/query/storage/m3/storage.go +++ b/src/query/storage/m3/storage.go @@ -255,13 +255,13 @@ func (s *m3storage) Write( } id := query.Tags.ID() - // TODO: Consider caching id -> identId - identId := ident.StringID(id) + // TODO: Consider caching id -> identID + identID := ident.StringID(id) common := &writeRequestCommon{ store: s, annotation: query.Annotation, unit: query.Unit, - id: identId, + id: identID, tagIterator: storage.TagsToIdentTagIterator(query.Tags), attributes: query.Attributes, }