Skip to content

Commit

Permalink
Remove Deprecated code of Events V1 (#2634)
Browse files Browse the repository at this point in the history
  • Loading branch information
longquanzheng committed Oct 11, 2019
1 parent dda75d0 commit 58879ef
Show file tree
Hide file tree
Showing 121 changed files with 496 additions and 4,322 deletions.
30 changes: 0 additions & 30 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,6 @@ steps:
run: integration-test-cassandra
config: docker/buildkite/docker-compose.yml

- label: ":golang: integration test events v2 with cassandra"
agents:
queue: "workers"
docker: "*"
command: "make cover_integration_profile EVENTSV2=true"
artifact_paths:
- "build/coverage/*.out"
retry:
automatic:
limit: 1
plugins:
- docker-compose#v3.0.0:
run: integration-test-cassandra
config: docker/buildkite/docker-compose.yml

- label: ":golang: integration xdc test with cassandra"
agents:
queue: "workers"
Expand Down Expand Up @@ -86,21 +71,6 @@ steps:
run: integration-test-mysql
config: docker/buildkite/docker-compose.yml

- label: ":golang: integration test events v2 with mysql"
agents:
queue: "workers"
docker: "*"
command: "make cover_integration_profile EVENTSV2=true"
artifact_paths:
- "build/coverage/*.out"
retry:
automatic:
limit: 1
plugins:
- docker-compose#v3.0.0:
run: integration-test-mysql
config: docker/buildkite/docker-compose.yml

- label: ":golang: integration xdc test with mysql"
agents:
queue: "workers"
Expand Down
34 changes: 4 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,10 @@ INTEG_TEST_XDC_ROOT=./host/xdc
INTEG_TEST_XDC_DIR=hostxdc
INTEG_TEST_NDC_ROOT=./host/ndc
INTEG_TEST_NDC_DIR=hostndc
EV2_TEST=_ev2

GO_BUILD_LDFLAGS_CMD := $(abspath ./scripts/go-build-ldflags.sh)
GO_BUILD_LDFLAGS := $(shell $(GO_BUILD_LDFLAGS_CMD) LDFLAG)

ifndef EVENTSV2
override EVENTSV2 = false
EV2_TEST=
endif

ifndef PERSISTENCE_TYPE
override PERSISTENCE_TYPE = cassandra
endif
Expand Down Expand Up @@ -93,13 +87,11 @@ PKG_TEST_DIRS := $(filter-out $(INTEG_TEST_ROOT)%,$(TEST_DIRS))
# Code coverage output files
COVER_ROOT := $(BUILD)/coverage
UNIT_COVER_FILE := $(COVER_ROOT)/unit_cover.out
INTEG_COVER_FILE := $(COVER_ROOT)/integ_$(PERSISTENCE_TYPE)$(EV2_TEST)_cover.out
INTEG_COVER_FILE := $(COVER_ROOT)/integ_$(PERSISTENCE_TYPE)_cover.out
INTEG_XDC_COVER_FILE := $(COVER_ROOT)/integ_xdc_$(PERSISTENCE_TYPE)_cover.out
INTEG_CASS_COVER_FILE := $(COVER_ROOT)/integ_cassandra_cover.out
INTEG_CASS_EV2_COVER_FILE := $(COVER_ROOT)/integ_cassandra_ev2_cover.out
INTEG_XDC_CASS_COVER_FILE := $(COVER_ROOT)/integ_xdc_cassandra_cover.out
INTEG_SQL_COVER_FILE := $(COVER_ROOT)/integ_sql_cover.out
INTEG_SQL_EV2_COVER_FILE := $(COVER_ROOT)/integ_sql_ev2_cover.out
INTEG_XDC_SQL_COVER_FILE := $(COVER_ROOT)/integ_xdc_sql_cover.out
INTEG_NDC_COVER_FILE := $(COVER_ROOT)/integ_ndc_$(PERSISTENCE_TYPE)_cover.out
INTEG_NDC_CASS_COVER_FILE := $(COVER_ROOT)/integ_ndc_cassandra_cover.out
Expand Down Expand Up @@ -153,22 +145,6 @@ test: bins
go test -timeout $(TEST_TIMEOUT) -race -coverprofile=$@ "$$dir" $(TEST_TAG) | tee -a test.log; \
done;

test_eventsV2: bins
@rm -f test_eventsV2
@rm -f test_eventsV2.log
@echo Running integration test
@for dir in $(INTEG_TEST_ROOT); do \
go test -timeout $(TEST_TIMEOUT) -coverprofile=$@ "$$dir" -v $(TEST_TAG) -eventsV2=true | tee -a test_eventsV2.log; \
done;

test_eventsV2_xdc: bins
@rm -f test_eventsV2_xdc
@rm -f test_eventsV2_xdc.log
@echo Running integration test for cross dc:
@for dir in $(INTEG_TEST_XDC_ROOT); do \
go test -timeout $(TEST_TIMEOUT) -coverprofile=$@ "$$dir" -v $(TEST_TAG) -eventsV2xdc=true | tee -a test_eventsV2_xdc.log; \
done;

# need to run xdc tests with race detector off because of ringpop bug causing data race issue
test_xdc: bins
@rm -f test
Expand All @@ -194,9 +170,9 @@ cover_integration_profile: clean bins_nothrift
@mkdir -p $(COVER_ROOT)
@echo "mode: atomic" > $(INTEG_COVER_FILE)

@echo Running integration test with $(PERSISTENCE_TYPE) and eventsV2 $(EVENTSV2)
@echo Running integration test with $(PERSISTENCE_TYPE)
@mkdir -p $(BUILD)/$(INTEG_TEST_DIR)
@time go test $(INTEG_TEST_ROOT) $(TEST_ARG) $(TEST_TAG) -eventsV2=$(EVENTSV2) -persistenceType=$(PERSISTENCE_TYPE) $(GOCOVERPKG_ARG) -coverprofile=$(BUILD)/$(INTEG_TEST_DIR)/coverage.out || exit 1;
@time go test $(INTEG_TEST_ROOT) $(TEST_ARG) $(TEST_TAG) -persistenceType=$(PERSISTENCE_TYPE) $(GOCOVERPKG_ARG) -coverprofile=$(BUILD)/$(INTEG_TEST_DIR)/coverage.out || exit 1;
@cat $(BUILD)/$(INTEG_TEST_DIR)/coverage.out | grep -v "^mode: \w\+" >> $(INTEG_COVER_FILE)

cover_xdc_profile: clean bins_nothrift
Expand All @@ -219,14 +195,12 @@ cover_ndc_profile: clean bins_nothrift
@time go test -v -timeout $(TEST_TIMEOUT) $(INTEG_TEST_NDC_ROOT) $(TEST_TAG) -persistenceType=$(PERSISTENCE_TYPE) $(GOCOVERPKG_ARG) -coverprofile=$(BUILD)/$(INTEG_TEST_NDC_DIR)/coverage.out -count=$(TEST_RUN_COUNT) || exit 1;
@cat $(BUILD)/$(INTEG_TEST_NDC_DIR)/coverage.out | grep -v "^mode: \w\+" | grep -v "mode: set" >> $(INTEG_NDC_COVER_FILE)

$(COVER_ROOT)/cover.out: $(UNIT_COVER_FILE) $(INTEG_CASS_COVER_FILE) $(INTEG_CASS_EV2_COVER_FILE) $(INTEG_XDC_CASS_COVER_FILE) $(INTEG_SQL_COVER_FILE) $(INTEG_SQL_EV2_COVER_FILE) $(INTEG_XDC_SQL_COVER_FILE)
$(COVER_ROOT)/cover.out: $(UNIT_COVER_FILE) $(INTEG_CASS_COVER_FILE) $(INTEG_XDC_CASS_COVER_FILE) $(INTEG_SQL_COVER_FILE) $(INTEG_XDC_SQL_COVER_FILE)
@echo "mode: atomic" > $(COVER_ROOT)/cover.out
cat $(UNIT_COVER_FILE) | grep -v "^mode: \w\+" | grep -vP ".gen|[Mm]ock[s]?" >> $(COVER_ROOT)/cover.out
cat $(INTEG_CASS_COVER_FILE) | grep -v "^mode: \w\+" | grep -vP ".gen|[Mm]ock[s]?" >> $(COVER_ROOT)/cover.out
cat $(INTEG_CASS_EV2_COVER_FILE) | grep -v "^mode: \w\+" | grep -vP ".gen|[Mm]ock[s]?" >> $(COVER_ROOT)/cover.out
cat $(INTEG_XDC_CASS_COVER_FILE) | grep -v "^mode: \w\+" | grep -vP ".gen|[Mm]ock[s]?" >> $(COVER_ROOT)/cover.out
cat $(INTEG_SQL_COVER_FILE) | grep -v "^mode: \w\+" | grep -vP ".gen|[Mm]ock[s]?" >> $(COVER_ROOT)/cover.out
cat $(INTEG_SQL_EV2_COVER_FILE) | grep -v "^mode: \w\+" | grep -vP ".gen|[Mm]ock[s]?" >> $(COVER_ROOT)/cover.out
cat $(INTEG_XDC_SQL_COVER_FILE) | grep -v "^mode: \w\+" | grep -vP ".gen|[Mm]ock[s]?" >> $(COVER_ROOT)/cover.out

cover: $(COVER_ROOT)/cover.out
Expand Down
2 changes: 1 addition & 1 deletion common/archiver/filestore/historyArchiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (h *historyArchiver) Archive(

historyIterator := h.historyIterator
if historyIterator == nil { // will only be set by testing code
historyIterator = archiver.NewHistoryIterator(request, h.container.HistoryManager, h.container.HistoryV2Manager, targetHistoryBlobSize)
historyIterator = archiver.NewHistoryIterator(request, h.container.HistoryV2Manager, targetHistoryBlobSize)
}

historyBatches := []*shared.History{}
Expand Down
43 changes: 11 additions & 32 deletions common/archiver/historyIterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ type (
historyIteratorState

request *ArchiveHistoryRequest
historyManager persistence.HistoryManager
historyV2Manager persistence.HistoryV2Manager
sizeEstimator SizeEstimator
historyPageSize int
Expand All @@ -85,22 +84,20 @@ var (
// NewHistoryIterator returns a new HistoryIterator
func NewHistoryIterator(
request *ArchiveHistoryRequest,
historyManager persistence.HistoryManager,
historyV2Manager persistence.HistoryV2Manager,
targetHistoryBlobSize int,
) HistoryIterator {
return newHistoryIterator(request, historyManager, historyV2Manager, targetHistoryBlobSize)
return newHistoryIterator(request, historyV2Manager, targetHistoryBlobSize)
}

// NewHistoryIteratorFromState returns a new HistoryIterator with specified state
func NewHistoryIteratorFromState(
request *ArchiveHistoryRequest,
historyManager persistence.HistoryManager,
historyV2Manager persistence.HistoryV2Manager,
targetHistoryBlobSize int,
initialState []byte,
) (HistoryIterator, error) {
it := newHistoryIterator(request, historyManager, historyV2Manager, targetHistoryBlobSize)
it := newHistoryIterator(request, historyV2Manager, targetHistoryBlobSize)
if initialState == nil {
return it, nil
}
Expand All @@ -112,7 +109,6 @@ func NewHistoryIteratorFromState(

func newHistoryIterator(
request *ArchiveHistoryRequest,
historyManager persistence.HistoryManager,
historyV2Manager persistence.HistoryV2Manager,
targetHistoryBlobSize int,
) *historyIterator {
Expand All @@ -122,7 +118,6 @@ func newHistoryIterator(
FinishedIteration: false,
},
request: request,
historyManager: historyManager,
historyV2Manager: historyV2Manager,
historyPageSize: historyPageSize,
targetHistoryBlobSize: targetHistoryBlobSize,
Expand Down Expand Up @@ -226,32 +221,16 @@ func (i *historyIterator) readHistoryBatches(firstEventID int64) ([]*shared.Hist
}

func (i *historyIterator) readHistory(firstEventID int64) ([]*shared.History, error) {
if i.request.EventStoreVersion == persistence.EventStoreVersionV2 {
req := &persistence.ReadHistoryBranchRequest{
BranchToken: i.request.BranchToken,
MinEventID: firstEventID,
MaxEventID: common.EndEventID,
PageSize: i.historyPageSize,
ShardID: common.IntPtr(i.request.ShardID),
}
historyBatches, _, _, err := persistence.ReadFullPageV2EventsByBatch(i.historyV2Manager, req)
return historyBatches, err
}
req := &persistence.GetWorkflowExecutionHistoryRequest{
DomainID: i.request.DomainID,
Execution: shared.WorkflowExecution{
WorkflowId: common.StringPtr(i.request.WorkflowID),
RunId: common.StringPtr(i.request.RunID),
},
FirstEventID: firstEventID,
NextEventID: common.EndEventID,
PageSize: i.historyPageSize,
req := &persistence.ReadHistoryBranchRequest{
BranchToken: i.request.BranchToken,
MinEventID: firstEventID,
MaxEventID: common.EndEventID,
PageSize: i.historyPageSize,
ShardID: common.IntPtr(i.request.ShardID),
}
resp, err := i.historyManager.GetWorkflowExecutionHistoryByBatch(req)
if err != nil {
return nil, err
}
return resp.History, nil
historyBatches, _, _, err := persistence.ReadFullPageV2EventsByBatch(i.historyV2Manager, req)
return historyBatches, err

}

// reset resets iterator to a certain state given its encoded representation
Expand Down
Loading

0 comments on commit 58879ef

Please sign in to comment.