Skip to content

Commit

Permalink
Merge pull request #105 from scylladb/issue_104
Browse files Browse the repository at this point in the history
gemini: attempt mutation on both systems
  • Loading branch information
Henrik Johansson authored May 16, 2019
2 parents f4bf3f1 + 5794069 commit 54b7e15
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Unreleased

- Gemini now tries to perform mutation on both systems regardless of
if one of them fail.

## [1.0.1] - 2019-05-16

- Gemini ensures that primary key buckets do not overflow int32.
Expand Down
12 changes: 6 additions & 6 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,25 @@ func (s *Session) Close() {
s.oracleSession.Close()
}

func (s *Session) Mutate(query string, values ...interface{}) error {
func (s *Session) Mutate(query string, values ...interface{}) (e error) {
if err := s.testSession.Query(query, values...).Exec(); err != nil {
return fmt.Errorf("%v [cluster = test, query = '%s']", err, query)
e = multierr.Append(e, fmt.Errorf("%v [cluster = test, query = '%s']", err, query))
}
if err := s.oracleSession.Query(query, values...).Exec(); err != nil {
return fmt.Errorf("%v [cluster = oracle, query = '%s']", err, query)
e = multierr.Append(e, fmt.Errorf("%v [cluster = oracle, query = '%s']", err, query))
}
return nil
return
}

func (s *Session) Check(table Table, query string, values ...interface{}) (err error) {
testIter := s.testSession.Query(query, values...).Iter()
oracleIter := s.oracleSession.Query(query, values...).Iter()
defer func() {
if e := testIter.Close(); e != nil {
err = multierr.Append(err, errors.Errorf("test system failed: %s", err.Error()))
err = multierr.Append(err, errors.Errorf("test system failed: %s", e.Error()))
}
if e := oracleIter.Close(); e != nil {
err = multierr.Append(err, errors.Errorf("oracle failed: %s", err.Error()))
err = multierr.Append(err, errors.Errorf("oracle failed: %s", e.Error()))
}
}()

Expand Down

0 comments on commit 54b7e15

Please sign in to comment.