Skip to content

Commit

Permalink
Next batch of SQL persistence fixes (cadence-workflow#1176)
Browse files Browse the repository at this point in the history
* All unit tests are passing now
* Switched shard locking to shared mode
  • Loading branch information
mfateev authored Oct 15, 2018
1 parent 913467e commit a174a4d
Show file tree
Hide file tree
Showing 51 changed files with 1,332 additions and 950 deletions.
31 changes: 31 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions common/mocks/ExecutionManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ type ExecutionManager struct {
mock.Mock
}

// GetName provides a mock function with given fields:
func (_m *ExecutionManager) GetName() string {
ret := _m.Called()

var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}

return r0
}

// CreateWorkflowExecution provides a mock function with given fields: request
func (_m *ExecutionManager) CreateWorkflowExecution(request *persistence.CreateWorkflowExecutionRequest) (*persistence.CreateWorkflowExecutionResponse, error) {
ret := _m.Called(request)
Expand Down
14 changes: 14 additions & 0 deletions common/mocks/HistoryManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ type HistoryManager struct {
mock.Mock
}

// GetName provides a mock function with given fields:
func (_m *HistoryManager) GetName() string {
ret := _m.Called()

var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}

return r0
}

// AppendHistoryEvents provides a mock function with given fields: request
func (_m *HistoryManager) AppendHistoryEvents(request *persistence.AppendHistoryEventsRequest) (*persistence.AppendHistoryEventsResponse, error) {
ret := _m.Called(request)
Expand Down
14 changes: 14 additions & 0 deletions common/mocks/MetadataManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ type MetadataManager struct {
mock.Mock
}

// GetName provides a mock function with given fields:
func (_m *MetadataManager) GetName() string {
ret := _m.Called()

var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}

return r0
}

// Close provides a mock function with given fields:
func (_m *MetadataManager) Close() {
_m.Called()
Expand Down
14 changes: 14 additions & 0 deletions common/mocks/ShardManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ type ShardManager struct {
mock.Mock
}

// GetName provides a mock function with given fields:
func (_m *ShardManager) GetName() string {
ret := _m.Called()

var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}

return r0
}

// Close provides a mock function with given fields:
func (_m *ShardManager) Close() {
_m.Called()
Expand Down
14 changes: 14 additions & 0 deletions common/mocks/TaskManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ type TaskManager struct {
mock.Mock
}

// GetName provides a mock function with given fields:
func (_m *TaskManager) GetName() string {
ret := _m.Called()

var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}

return r0
}

// Close provides a mock function with given fields:
func (_m *TaskManager) Close() {
_m.Called()
Expand Down
14 changes: 14 additions & 0 deletions common/mocks/VisibilityManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ type VisibilityManager struct {
mock.Mock
}

// GetName provides a mock function with given fields:
func (_m *VisibilityManager) GetName() string {
ret := _m.Called()

var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}

return r0
}

// Close provides a mock function with given fields:
func (_m *VisibilityManager) Close() {
_m.Called()
Expand Down
7 changes: 4 additions & 3 deletions common/persistence/cassandra/cassandraHelpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,18 @@ package cassandra

import (
"fmt"
"github.com/uber/cadence/tools/cassandra"
"io/ioutil"
"os"
"strings"

"github.com/uber/cadence/common/logging"
"github.com/uber/cadence/tools/cassandra"

"github.com/gocql/gocql"
log "github.com/sirupsen/logrus"
"github.com/uber/cadence/common/logging"
)

const cassandraPersistenceName = "cassandra"

// NewCassandraCluster creates a cassandra cluster given comma separated list of clusterHosts
func NewCassandraCluster(clusterHosts string, port int, user, password, dc string) *gocql.ClusterConfig {
var hosts []string
Expand Down
5 changes: 2 additions & 3 deletions common/persistence/cassandra/cassandraHistoryPersistence.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ const (

type (
cassandraHistoryPersistence struct {
session *gocql.Session
logger bark.Logger
cassandraStore
}
)

Expand All @@ -78,7 +77,7 @@ func newHistoryPersistence(cfg config.Cassandra, logger bark.Logger) (p.HistoryS
return nil, err
}

return &cassandraHistoryPersistence{session: session, logger: logger}, nil
return &cassandraHistoryPersistence{cassandraStore: cassandraStore{session: session, logger: logger}}, nil
}

// Close gracefully releases the resources held by this object
Expand Down
6 changes: 2 additions & 4 deletions common/persistence/cassandra/cassandraMetadataPersistence.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,8 @@ const (

type (
cassandraMetadataPersistence struct {
session *gocql.Session
cassandraStore
currentClusterName string
logger bark.Logger
}
)

Expand All @@ -113,9 +112,8 @@ func newMetadataPersistence(cfg config.Cassandra, clusterName string, logger bar
}

return &cassandraMetadataPersistence{
session: session,
cassandraStore: cassandraStore{session: session, logger: logger},
currentClusterName: clusterName,
logger: logger,
}, nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ func newMetadataManagerProxy(cfg config.Cassandra,
return &metadataManagerProxy{metadataMgr: metadataMgr, metadataMgrV2: metadataMgrV2, logger: logger}, nil
}

func (m *metadataManagerProxy) GetName() string {
return cassandraPersistenceName
}

func (m *metadataManagerProxy) GetDomain(request *p.GetDomainRequest) (*p.GetDomainResponse, error) {
// the reason this function does not call the v2 get domain is domain cache will
// use the list domain function to get all domain in the v2 table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,8 @@ const (

type (
cassandraMetadataPersistenceV2 struct {
session *gocql.Session
cassandraStore
currentClusterName string
logger bark.Logger
}
)

Expand All @@ -112,9 +111,8 @@ func newMetadataPersistenceV2(cfg config.Cassandra, currentClusterName string, l
}

return &cassandraMetadataPersistenceV2{
session: session,
cassandraStore: cassandraStore{session: session, logger: logger},
currentClusterName: currentClusterName,
logger: logger,
}, nil
}

Expand Down
Loading

0 comments on commit a174a4d

Please sign in to comment.