Skip to content

Commit

Permalink
Remove sticky query (cadence-workflow#2846)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjdawson2016 authored Nov 20, 2019
1 parent 1b10ab3 commit 6189d1d
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 457 deletions.
17 changes: 1 addition & 16 deletions common/client/versionChecker.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,9 @@ const (
// SupportedCLIVersion indicates the highest cli version server will accept requests from
SupportedCLIVersion = "1.4.0"

// GoWorkerStickyQueryVersion indicates the minimum client version of go worker which supports StickyQuery
GoWorkerStickyQueryVersion = "1.0.0"
// JavaWorkerStickyQueryVersion indicates the minimum client version of the java worker which supports StickyQuery
JavaWorkerStickyQueryVersion = "1.0.0"
// GoWorkerConsistentQueryVersion indicates the minimum client version of the go worker which supports ConsistentQuery
GoWorkerConsistentQueryVersion = "1.5.0"

stickyQuery = "sticky-query"
consistentQuery = "consistent-query"
)

Expand All @@ -62,7 +57,6 @@ type (
VersionChecker interface {
ClientSupported(ctx context.Context, enableClientVersionCheck bool) error

SupportsStickyQuery(clientImpl string, clientFeatureVersion string) error
SupportsConsistentQuery(clientImpl string, clientFeatureVersion string) error
}

Expand All @@ -76,12 +70,9 @@ type (
func NewVersionChecker() VersionChecker {
supportedFeatures := map[string]map[string]version.Constraints{
GoSDK: {
stickyQuery: mustNewConstraint(fmt.Sprintf(">=%v", GoWorkerStickyQueryVersion)),
consistentQuery: mustNewConstraint(fmt.Sprintf(">=%v", GoWorkerConsistentQueryVersion)),
},
JavaSDK: {
stickyQuery: mustNewConstraint(fmt.Sprintf(">=%v", JavaWorkerStickyQueryVersion)),
},
JavaSDK: {},
}
supportedClients := map[string]version.Constraints{
GoSDK: mustNewConstraint(fmt.Sprintf("<=%v", SupportedGoSDKVersion)),
Expand Down Expand Up @@ -122,12 +113,6 @@ func (vc *versionChecker) ClientSupported(ctx context.Context, enableClientVersi
return nil
}

// SupportsStickyQuery returns error if sticky query is not supported otherwise nil.
// In case client version lookup fails assume the client does not support feature.
func (vc *versionChecker) SupportsStickyQuery(clientImpl string, clientFeatureVersion string) error {
return vc.featureSupported(clientImpl, clientFeatureVersion, stickyQuery)
}

// SupportsConsistentQuery returns error if consistent query is not supported otherwise nil.
// In case client version lookup fails assume the client does not support feature.
func (vc *versionChecker) SupportsConsistentQuery(clientImpl string, clientFeatureVersion string) error {
Expand Down
68 changes: 0 additions & 68 deletions common/client/versionChecker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,74 +120,6 @@ func (s *VersionCheckerSuite) TestClientSupported() {
}
}

func (s *VersionCheckerSuite) TestSupportsStickyQuery() {
testCases := []struct {
clientImpl string
clientFeatureVersion string
expectErr bool
}{
{
clientImpl: "",
expectErr: true,
},
{
clientImpl: GoSDK,
expectErr: true,
},
{
clientImpl: "unknown",
clientFeatureVersion: "0.0.0",
expectErr: true,
},
{
clientImpl: GoSDK,
clientFeatureVersion: "malformed-feature-version",
expectErr: true,
},
{
clientImpl: GoSDK,
clientFeatureVersion: GoWorkerStickyQueryVersion,
expectErr: false,
},
{
clientImpl: JavaSDK,
clientFeatureVersion: JavaWorkerStickyQueryVersion,
expectErr: false,
},
{
clientImpl: GoSDK,
clientFeatureVersion: "0.9.0",
expectErr: true,
},
{
clientImpl: JavaSDK,
clientFeatureVersion: "0.9.0",
expectErr: true,
},
{
clientImpl: GoSDK,
clientFeatureVersion: "2.0.0",
expectErr: false,
},
{
clientImpl: JavaSDK,
clientFeatureVersion: "2.0.0",
expectErr: false,
},
}

for _, tc := range testCases {
vc := NewVersionChecker()
if tc.expectErr {
err := vc.SupportsStickyQuery(tc.clientImpl, tc.clientFeatureVersion)
s.Error(err)
s.IsType(&shared.ClientVersionNotSupportedError{}, err)
} else {
s.NoError(vc.SupportsStickyQuery(tc.clientImpl, tc.clientFeatureVersion))
}
}
}

func (s *VersionCheckerSuite) TestSupportsConsistentQuery() {
testCases := []struct {
clientImpl string
Expand Down
Loading

0 comments on commit 6189d1d

Please sign in to comment.