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

cqlstore: log deadline exceeded #136

Merged
merged 1 commit into from
Jun 12, 2019
Merged
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
19 changes: 15 additions & 4 deletions store/cqlstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package store

import (
"context"
"fmt"
"time"

"github.com/gocql/gocql"
Expand All @@ -22,8 +23,13 @@ type cqlStore struct {
func (cs *cqlStore) mutate(ctx context.Context, builder qb.Builder, ts time.Time, values ...interface{}) error {
query, _ := builder.ToCql()
var tsUsec int64 = ts.UnixNano() / 1000
if err := cs.session.Query(query, values...).WithContext(ctx).WithTimestamp(tsUsec).Exec(); !ignore(err) {
return errors.Errorf("%v [cluster = %s, query = '%s']", err, cs.name, query)
if err := cs.session.Query(query, values...).WithContext(ctx).WithTimestamp(tsUsec).Exec(); err != nil {
if err == context.DeadlineExceeded {
fmt.Printf("system=%s has exceeded it's dealine for mutation query='%s', error=%s", cs.name, query, err)
}
if !ignore(err) {
return errors.Errorf("%v [cluster = %s, query = '%s']", err, cs.name, query)
}
}
cs.ops.WithLabelValues(cs.name, opType(builder)).Inc()
return nil
Expand All @@ -34,8 +40,13 @@ func (cs *cqlStore) load(ctx context.Context, builder qb.Builder, values []inter
iter := cs.session.Query(query, values...).WithContext(ctx).Iter()
cs.ops.WithLabelValues(cs.name, opType(builder)).Inc()
defer func() {
if e := iter.Close(); !ignore(e) {
err = multierr.Append(err, errors.Errorf("system failed: %s", e.Error()))
if e := iter.Close(); err != nil {
if e == context.DeadlineExceeded {
fmt.Printf("system=%s has exceeded it's dealine for load query='%s', error=%s", cs.name, query, e)
}
if !ignore(e) {
err = multierr.Append(err, errors.Errorf("system failed: %s", e.Error()))
}
}
}()
result = loadSet(iter)
Expand Down