Skip to content

make cassandra service_name_index inserts idempotent#587

Merged
yurishkuro merged 2 commits intojaegertracing:masterfrom
kwojcik:idem
Dec 6, 2017
Merged

make cassandra service_name_index inserts idempotent#587
yurishkuro merged 2 commits intojaegertracing:masterfrom
kwojcik:idem

Conversation

@kwojcik
Copy link
Copy Markdown

@kwojcik kwojcik commented Dec 6, 2017

Use the span hash as the source of variation for bucket choice instead of an atomic counter so that the inserts are idempotent.

Signed-off-by: Kevin Wojcik kwojcik@uber.com

Signed-off-by: Kevin Wojcik <kwojcik@uber.com>
@@ -200,7 +198,7 @@ func (s *SpanWriter) indexByDuration(span *dbmodel.Span, startTime time.Time) er
}

func (s *SpanWriter) indexBySerice(traceID model.TraceID, span *dbmodel.Span) error {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

while you're here, do you mind doing s/indexBySerice/indexByService :D

@coveralls
Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling f9fa47b on kwojcik:idem into ** on jaegertracing:master**.

Signed-off-by: Kevin Wojcik <kwojcik@uber.com>
@coveralls
Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling 87eba97 on kwojcik:idem into ** on jaegertracing:master**.

@coveralls
Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling 87eba97 on kwojcik:idem into ** on jaegertracing:master**.

func (s *SpanWriter) indexBySerice(traceID model.TraceID, span *dbmodel.Span) error {
bucketNo := atomic.AddUint32(&s.bucketCounter, 1) % defaultNumBuckets
func (s *SpanWriter) indexByService(traceID model.TraceID, span *dbmodel.Span) error {
bucketNo := span.SpanHash % defaultNumBuckets
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

good call

@yurishkuro yurishkuro merged commit 3fddfb2 into jaegertracing:master Dec 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants