Skip to content

Commit a22195f

Browse files
authored
skip master data (#116)
1 parent 03287f7 commit a22195f

File tree

32 files changed

+813
-381
lines changed

32 files changed

+813
-381
lines changed

elastic/client_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"fmt"
66
"testing"
77

8-
. "gopkg.in/check.v1"
8+
. "github.com/pingcap/check"
99
)
1010

1111
var host = flag.String("host", "127.0.0.1", "Elasticsearch host")
@@ -104,15 +104,15 @@ func (s *elasticTestSuite) TestParent(c *C) {
104104
ParentType := "parent"
105105

106106
mapping := map[string]interface{}{
107-
docType: map[string]interface{}{
108-
"_parent": map[string]string{"type": ParentType},
107+
docType: map[string]interface{}{
108+
"_parent": map[string]string{"type": ParentType},
109109
},
110110
}
111-
err := s.c.CreateMapping(index, docType, mapping)
111+
err := s.c.CreateMapping(index, docType, mapping)
112112
c.Assert(err, IsNil)
113-
113+
114114
items := make([]*BulkRequest, 10)
115-
115+
116116
for i := 0; i < 10; i++ {
117117
id := fmt.Sprintf("%d", i)
118118
req := new(BulkRequest)

etc/river.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ flavor = "mysql"
2929
# if not set or empty, ignore mysqldump.
3030
mysqldump = "mysqldump"
3131

32+
# if we have no privilege to use mysqldump with --master-data,
33+
# we must skip it.
34+
#skip_master_data = false
35+
3236
# minimal items to be inserted in one bulk
3337
bulk_size = 128
3438

glide.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

glide.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import:
77
- package: github.com/satori/go.uuid
88
version: ^1.1.0
99
- package: github.com/siddontang/go-mysql
10-
version: ead11cac47bd127a8c667efa07f171a9143d8a25
10+
version: 96156dbfdf7556c67eb0889781c072f93295078d
1111
subpackages:
1212
- canal
1313
- client
@@ -22,5 +22,5 @@ import:
2222
- hack
2323
- ioutil2
2424
- sync2
25-
- package: gopkg.in/check.v1
26-
version: 11d3bc7aa68e238947792f30573146a3231fc0f1
25+
- package: github.com/pingcap/check
26+
version: ce8a2f822ab1e245a4eefcef2996531c79c943f1

river/config.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ type Config struct {
2929
Flavor string `toml:"flavor"`
3030
DataDir string `toml:"data_dir"`
3131

32-
DumpExec string `toml:"mysqldump"`
32+
DumpExec string `toml:"mysqldump"`
33+
SkipMasterData bool `toml:"skip_master_data"`
3334

3435
Sources []SourceConfig `toml:"source"`
3536

river/river.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ func NewRiver(c *Config) (*River, error) {
7272
cfg.Password = r.c.ESPassword
7373
r.es = elastic.NewClient(cfg)
7474

75-
7675
r.st = &stat{r: r}
7776
go r.st.Run(r.c.StatAddr)
7877

@@ -90,6 +89,7 @@ func (r *River) newCanal() error {
9089
cfg.ServerID = r.c.ServerID
9190
cfg.Dump.ExecutionPath = r.c.DumpExec
9291
cfg.Dump.DiscardErr = false
92+
cfg.Dump.SkipMasterData = r.c.SkipMasterData
9393

9494
var err error
9595
r.canal, err = canal.NewCanal(cfg)

river/river_extra_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"os"
88
"time"
99

10-
. "gopkg.in/check.v1"
10+
. "github.com/pingcap/check"
1111
)
1212

1313
func (s *riverTestSuite) setupExtra(c *C) (r *River) {

river/river_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import (
77
"testing"
88
"time"
99

10+
. "github.com/pingcap/check"
1011
"github.com/siddontang/go-mysql-elasticsearch/elastic"
1112
"github.com/siddontang/go-mysql/client"
12-
. "gopkg.in/check.v1"
1313
)
1414

1515
var my_addr = flag.String("my_addr", "127.0.0.1:3306", "MySQL addr")
@@ -110,9 +110,9 @@ func (s *riverTestSuite) SetUpSuite(c *C) {
110110
},
111111

112112
&Rule{Schema: "test",
113-
Table: "test_for_json",
114-
Index: "river",
115-
Type: "river",
113+
Table: "test_for_json",
114+
Index: "river",
115+
Type: "river",
116116
},
117117
}
118118

@@ -263,11 +263,11 @@ func (s *riverTestSuite) TestRiver(c *C) {
263263
c.Assert(r.Found, Equals, true)
264264
switch v := r.Source["info"].(type) {
265265
case map[string]interface{}:
266-
c.Assert(v["first"], Equals, "a")
267-
c.Assert(v["second"], Equals, "b")
266+
c.Assert(v["first"], Equals, "a")
267+
c.Assert(v["second"], Equals, "b")
268268
default:
269269
c.Assert(v, Equals, nil)
270-
c.Assert(true, Equals, false)
270+
c.Assert(true, Equals, false)
271271
}
272272

273273
r = s.testElasticGet(c, "100")

vendor/github.com/ngaut/log/crash_darwin.go

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/ngaut/log/crash_unix.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/pingcap/check/checkers2.go

Lines changed: 131 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)