Skip to content

Commit

Permalink
Fix coding styles
Browse files Browse the repository at this point in the history
Signed-off-by: yangxuan <xuan.yang@zilliz.com>
  • Loading branch information
XuanYang-cn committed Apr 17, 2024
1 parent 31145d2 commit f12e76b
Show file tree
Hide file tree
Showing 9 changed files with 405 additions and 107 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ generate-mockery-datanode: getdeps
$(INSTALL_PATH)/mockery --name=BinlogIO --dir=$(PWD)/internal/datanode/io --output=$(PWD)/internal/datanode/io --filename=mock_binlogio.go --with-expecter --structname=MockBinlogIO --outpkg=io --inpackage
$(INSTALL_PATH)/mockery --name=FlowgraphManager --dir=$(PWD)/internal/datanode --output=$(PWD)/internal/datanode --filename=mock_fgmanager.go --with-expecter --structname=MockFlowgraphManager --outpkg=datanode --inpackage
$(INSTALL_PATH)/mockery --name=ChannelManager --dir=$(PWD)/internal/datanode --output=$(PWD)/internal/datanode --filename=mock_channelmanager.go --with-expecter --structname=MockChannelManager --outpkg=datanode --inpackage
$(INSTALL_PATH)/mockery --name=Compactor --dir=$(PWD)/internal/datanode/compaction --output=$(PWD)/internal/datanode/compaction --filename=mock_compactor.go --with-expecter --structname=MockCompactor --outpkg=compaction --inpackage

generate-mockery-metastore: getdeps
$(INSTALL_PATH)/mockery --name=RootCoordCatalog --dir=$(PWD)/internal/metastore --output=$(PWD)/internal/metastore/mocks --filename=mock_rootcoord_catalog.go --with-expecter --structname=RootCoordCatalog --outpkg=mocks
Expand Down Expand Up @@ -511,4 +512,4 @@ mmap-migration:
@source $(PWD)/scripts/setenv.sh && \
mkdir -p $(INSTALL_PATH) && go env -w CGO_ENABLED="1" && \
GO111MODULE=on $(GO) build -ldflags="-r $${RPATH} -X '$(OBJPREFIX).BuildTags=$(BUILD_TAGS)' -X '$(OBJPREFIX).BuildTime=$(BUILD_TIME)' -X '$(OBJPREFIX).GitCommit=$(GIT_COMMIT)' -X '$(OBJPREFIX).GoVersion=$(GO_VERSION)'" \
-tags dynamic -o $(INSTALL_PATH)/mmap-migration $(MMAP_MIGRATION_PATH)/main.go 1>/dev/null
-tags dynamic -o $(INSTALL_PATH)/mmap-migration $(MMAP_MIGRATION_PATH)/main.go 1>/dev/null
2 changes: 1 addition & 1 deletion internal/datanode/compaction/mix_compactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func (t *mixCompactionTask) statSerializeWrite(ctx context.Context, buffer *writ
}

func (t *mixCompactionTask) serializeWrite(ctx context.Context, buffer *writebuffer.SegmentInsertBuffer) (kvs map[string][]byte, fieldBinlogs map[int64]*datapb.FieldBinlog, err error) {
ctx, span := otel.Tracer(typeutil.DataNodeRole).Start(ctx, "serializeWrite")
_, span := otel.Tracer(typeutil.DataNodeRole).Start(ctx, "serializeWrite")
defer span.End()

blobs, tr, err := buffer.SerializeYield()
Expand Down
12 changes: 5 additions & 7 deletions internal/datanode/compaction/mix_compactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (

"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"

"github.com/milvus-io/milvus/internal/datanode/allocator"
"github.com/milvus-io/milvus/internal/datanode/io"
"github.com/milvus-io/milvus/internal/datanode/metacache"
Expand All @@ -38,7 +37,6 @@ import (
"github.com/milvus-io/milvus/internal/proto/datapb"
"github.com/milvus-io/milvus/internal/proto/etcdpb"
"github.com/milvus-io/milvus/internal/storage"

"github.com/milvus-io/milvus/pkg/common"
"github.com/milvus-io/milvus/pkg/util/merr"
"github.com/milvus-io/milvus/pkg/util/paramtable"
Expand Down Expand Up @@ -254,10 +252,10 @@ func (s *MixCompactionTaskSuite) TestCompactTwoToOne() {
func (s *MixCompactionTaskSuite) TestMergeEntityExpired() {
s.initSegBuffer(3)
// entityTs == tsoutil.ComposeTSByTime(milvusBirthday, 0)
collTtl := 864000 // 10 days
currTs := tsoutil.ComposeTSByTime(getMilvusBirthday().Add(time.Second*(time.Duration(collTtl)+1)), 0)
collTTL := 864000 // 10 days
currTs := tsoutil.ComposeTSByTime(getMilvusBirthday().Add(time.Second*(time.Duration(collTTL)+1)), 0)
s.task.currentTs = currTs
s.task.plan.CollectionTtl = int64(collTtl)
s.task.plan.CollectionTtl = int64(collTTL)

kvs, _, err := s.task.serializeWrite(context.TODO(), s.segBuf)
s.Require().NoError(err)
Expand Down Expand Up @@ -489,7 +487,7 @@ func (s *MixCompactionTaskSuite) TestIsExpiredEntity() {

tests := []struct {
description string
collTtl int64
collTTL int64
nowTs uint64
entityTs uint64

Expand All @@ -512,7 +510,7 @@ func (s *MixCompactionTaskSuite) TestIsExpiredEntity() {
s.Run(test.description, func() {
t := &mixCompactionTask{
plan: &datapb.CompactionPlan{
CollectionTtl: test.collTtl,
CollectionTtl: test.collTTL,
},
currentTs: test.nowTs,
}
Expand Down
307 changes: 307 additions & 0 deletions internal/datanode/compaction/mock_compactor.go

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

Loading

0 comments on commit f12e76b

Please sign in to comment.