forked from cadence-workflow/cadence
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add History V2: API and Cassandra implementation (cadence-workflow#1156)
* Schema and interface * fix fmt * fix interfaces * fix build * fix build * fix updateTask_test * finish common/persistence/historyStore.go * fix and add checking in common/persistence/historyStore.go * cql templates * stash common/persistence/cassandra/cassandraHistoryPersistence.go * stash * fix name for appendHistoryNodes * fix name * fix name * NewBranch-stash * append * processCommonErrors * ReadHistoryBranch * ForkHistoryBranch * GetHistoryTree * stash * update ForkHistoryBranch * finish deleteBranchAndRootNode * minor fix * comments and small improvments * fix build * fix comment * rename methods to make more sense * fix build * add v2 test suite * first test for v2 * finish first test * fix bug for delete root * fix ReadBranch * simplify Append API * fix bugs * testing deleting with creating concurrently * add checking forking node for appendNode * return branchInfo for append API * fix in query * fix readHistory for forking * fix all concurrent tests * fix comment * more test for override in append * fix race in test code * workaround when range deletion is not supported in old Cassandra * remove ID from dataBlob * improve validate branch status * improve slice allocation * improve make slice * add perf test for history v1/v2 * add idl for historyBranch * events v3 * finalize schema * sqlManager * remove code for common/persistence/historyStore.go * fix interface * eventsv3 * historyV2Store * reset cassandraHistoryPersistence * finish common/persistence/cassandra/cassandraHistoryV2Persistence.go * fix GetHistoryTree * fix fork for batch * fix getHistoryTree response type * implement historyV2 factory * fix bugs * fix forking point * draft common/persistence/persistence-tests/historyV2PersistenceTest.go * reimplement ReadHistoryBranch * fix all tests * add test * add more test * add more test * done perf test * disable perf test * fix read perf test * add protection for read same nodeID * disable perf test * use same encoding for read perf test * Remove IsNewTree * disable perf test * not calling NewHistoryV2Manager for sql * fix lint
- Loading branch information
1 parent
1086b6a
commit ebc991d
Showing
28 changed files
with
3,574 additions
and
12 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
// Copyright (c) 2017 Uber Technologies, Inc. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
package mocks | ||
|
||
import "github.com/uber/cadence/common/persistence" | ||
import "github.com/stretchr/testify/mock" | ||
|
||
type HistoryV2Manager struct { | ||
mock.Mock | ||
} | ||
|
||
// GetName provides a mock function with given fields: | ||
func (_m *HistoryV2Manager) 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 | ||
} | ||
|
||
// NewHistoryBranch provides a mock function with given fields: request | ||
func (_m *HistoryV2Manager) NewHistoryBranch(request *persistence.NewHistoryBranchRequest) (*persistence.NewHistoryBranchResponse, error) { | ||
ret := _m.Called(request) | ||
|
||
var r0 *persistence.NewHistoryBranchResponse | ||
if rf, ok := ret.Get(0).(func(*persistence.NewHistoryBranchRequest) *persistence.NewHistoryBranchResponse); ok { | ||
r0 = rf(request) | ||
} else { | ||
if ret.Get(0) != nil { | ||
r0 = ret.Get(0).(*persistence.NewHistoryBranchResponse) | ||
} | ||
} | ||
|
||
var r1 error | ||
if rf, ok := ret.Get(1).(func(*persistence.NewHistoryBranchRequest) error); ok { | ||
r1 = rf(request) | ||
} else { | ||
r1 = ret.Error(1) | ||
} | ||
return r0, r1 | ||
} | ||
|
||
// AppendHistoryNodes provides a mock function with given fields: request | ||
func (_m *HistoryV2Manager) AppendHistoryNodes(request *persistence.AppendHistoryNodesRequest) (*persistence.AppendHistoryNodesResponse, error) { | ||
ret := _m.Called(request) | ||
var r0 *persistence.AppendHistoryNodesResponse | ||
if rf, ok := ret.Get(0).(func(*persistence.AppendHistoryNodesRequest) *persistence.AppendHistoryNodesResponse); ok { | ||
r0 = rf(request) | ||
} else { | ||
if ret.Get(0) != nil { | ||
r0 = ret.Get(0).(*persistence.AppendHistoryNodesResponse) | ||
} | ||
} | ||
|
||
var r1 error | ||
if rf, ok := ret.Get(1).(func(*persistence.AppendHistoryNodesRequest) error); ok { | ||
r1 = rf(request) | ||
} else { | ||
r1 = ret.Error(1) | ||
} | ||
return r0, r1 | ||
} | ||
|
||
// ReadHistoryBranch provides a mock function with given fields: request | ||
func (_m *HistoryV2Manager) ReadHistoryBranch(request *persistence.ReadHistoryBranchRequest) (*persistence.ReadHistoryBranchResponse, error) { | ||
ret := _m.Called(request) | ||
var r0 *persistence.ReadHistoryBranchResponse | ||
if rf, ok := ret.Get(0).(func(*persistence.ReadHistoryBranchRequest) *persistence.ReadHistoryBranchResponse); ok { | ||
r0 = rf(request) | ||
} else { | ||
if ret.Get(0) != nil { | ||
r0 = ret.Get(0).(*persistence.ReadHistoryBranchResponse) | ||
} | ||
} | ||
var r1 error | ||
if rf, ok := ret.Get(1).(func(*persistence.ReadHistoryBranchRequest) error); ok { | ||
r1 = rf(request) | ||
} else { | ||
r1 = ret.Error(1) | ||
} | ||
return r0, r1 | ||
} | ||
|
||
// ForkHistoryBranch provides a mock function with given fields: request | ||
func (_m *HistoryV2Manager) ForkHistoryBranch(request *persistence.ForkHistoryBranchRequest) (*persistence.ForkHistoryBranchResponse, error) { | ||
ret := _m.Called(request) | ||
var r0 *persistence.ForkHistoryBranchResponse | ||
if rf, ok := ret.Get(0).(func(*persistence.ForkHistoryBranchRequest) *persistence.ForkHistoryBranchResponse); ok { | ||
r0 = rf(request) | ||
} else { | ||
if ret.Get(0) != nil { | ||
r0 = ret.Get(0).(*persistence.ForkHistoryBranchResponse) | ||
} | ||
} | ||
var r1 error | ||
if rf, ok := ret.Get(1).(func(*persistence.ForkHistoryBranchRequest) error); ok { | ||
r1 = rf(request) | ||
} else { | ||
r1 = ret.Error(1) | ||
} | ||
return r0, r1 | ||
} | ||
|
||
// DeleteHistoryBranch provides a mock function with given fields: request | ||
func (_m *HistoryV2Manager) DeleteHistoryBranch(request *persistence.DeleteHistoryBranchRequest) error { | ||
ret := _m.Called(request) | ||
var r0 error | ||
if rf, ok := ret.Get(0).(func(*persistence.DeleteHistoryBranchRequest) error); ok { | ||
r0 = rf(request) | ||
} else { | ||
r0 = ret.Error(0) | ||
} | ||
return r0 | ||
} | ||
|
||
// GetHistoryTree provides a mock function with given fields: request | ||
func (_m *HistoryV2Manager) GetHistoryTree(request *persistence.GetHistoryTreeRequest) (*persistence.GetHistoryTreeResponse, error) { | ||
ret := _m.Called(request) | ||
var r0 *persistence.GetHistoryTreeResponse | ||
if rf, ok := ret.Get(0).(func(*persistence.GetHistoryTreeRequest) *persistence.GetHistoryTreeResponse); ok { | ||
r0 = rf(request) | ||
} else { | ||
if ret.Get(0) != nil { | ||
r0 = ret.Get(0).(*persistence.GetHistoryTreeResponse) | ||
} | ||
} | ||
var r1 error | ||
if rf, ok := ret.Get(1).(func(*persistence.GetHistoryTreeRequest) error); ok { | ||
r1 = rf(request) | ||
} else { | ||
r1 = ret.Error(1) | ||
} | ||
return r0, r1 | ||
} | ||
|
||
// Close provides a mock function with given fields: | ||
func (_m *HistoryV2Manager) Close() { | ||
_m.Called() | ||
} | ||
|
||
var _ persistence.HistoryV2Manager = (*HistoryV2Manager)(nil) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.