Skip to content

Commit

Permalink
Merge pull request #132 from alibaba/feature-1.4
Browse files Browse the repository at this point in the history
Feature 1.4
  • Loading branch information
vinllen committed Apr 16, 2019
2 parents 50f38e4 + 9b95418 commit d1d92f6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/mongoshake/executor/executor.go
Expand Up @@ -25,7 +25,7 @@ const (
OpUpdate = 0x02

OplogsMaxGroupNum = 1000
OplogsMaxGroupSize = 16 * 1024 * 1024 // MongoDB limits 16MB
OplogsMaxGroupSize = 12 * 1024 * 1024 // MongoDB limits 16MB
)

var (
Expand Down
22 changes: 22 additions & 0 deletions src/mongoshake/executor/executor_test.go
Expand Up @@ -168,4 +168,26 @@ func TestMergeToGroups(t *testing.T) {
assert.Equal(t, 1, len(groups[3].oplogRecords), "should be equal")
assert.Equal(t, 1, len(groups[4].oplogRecords), "should be equal")
}

{
fmt.Printf("TestMergeToGroups case %d.\n", nr)
nr++

combiner := LogsGroupCombiner{
maxGroupNr: 10,
maxGroupSize: 12 * 1024 * 1024,
}

logs := []*OplogRecord{
mockLogs("op1", "ns1", 16 * 1024 * 1024, false),
mockLogs("op1", "ns2", 16 * 1024 * 1024, false),
mockLogs("op1", "ns1", 16 * 1024 * 1024, false),
mockLogs("op1", "ns1", 16 * 1024 * 1024, false),
mockLogs("op1", "ns1", 16 * 1024 * 1024, false),
mockLogs("op1", "ns3", 16 * 1024 * 1024, false),
mockLogs("op1", "ns1", 16 * 1024 * 1024, false),
}
groups := combiner.mergeToGroups(logs)
assert.Equal(t, 7, len(groups), "should be equal")
}
}

0 comments on commit d1d92f6

Please sign in to comment.