Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tracker(dm): add task name to unistore folder name #5341

Merged
merged 7 commits into from
May 10, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dm/pkg/schema/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func NewTracker(ctx context.Context, task string, sessionCfg map[string]string,
}
}

storePath, err = ioutil.TempDir("./", "schema-tracker")
storePath, err = ioutil.TempDir("./", task+"-schema-tracker")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using a sub-directory?

BTW, I think we should add a data-dir configuration for dm-worker. We have relay-dir,dump-dir, and schema-tracker file directories now, but all the default values of them are the dm-worker binary's dir. For TiUP data-dir and deploy-dir are separated which looks a bit weird.

Maybe we can do this in the next PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do it later, if we can't find the root cause we will change the implementation, so that configuration will be deprecated soon.

if err != nil {
return nil, err
}
Expand Down
8 changes: 6 additions & 2 deletions dm/syncer/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1261,9 +1261,10 @@ func (s *testSyncerSuite) TestTrackDDL(c *C) {
syncer.ddlDBConn = dbconn.NewDBConn(s.cfg, conn.NewBaseConn(dbConn, &retry.FiniteRetryStrategy{}))
syncer.checkpoint.(*RemoteCheckPoint).dbConn = dbconn.NewDBConn(s.cfg, conn.NewBaseConn(checkPointDBConn, &retry.FiniteRetryStrategy{}))
syncer.schemaTracker, err = schema.NewTracker(context.Background(), s.cfg.Name, defaultTestSessionCfg, syncer.ddlDBConn)
c.Assert(err, IsNil)
defer syncer.schemaTracker.Close()
syncer.exprFilterGroup = NewExprFilterGroup(utils.NewSessionCtx(nil), nil)
c.Assert(syncer.genRouter(), IsNil)
c.Assert(err, IsNil)

cases := []struct {
sql string
Expand Down Expand Up @@ -1579,6 +1580,7 @@ func (s *testSyncerSuite) TestTrackDownstreamTableWontOverwrite(c *C) {
syncer.downstreamTrackConn = dbconn.NewDBConn(s.cfg, conn.NewBaseConn(dbConn, &retry.FiniteRetryStrategy{}))
syncer.schemaTracker, err = schema.NewTracker(ctx, s.cfg.Name, defaultTestSessionCfg, syncer.downstreamTrackConn)
c.Assert(err, IsNil)
defer syncer.schemaTracker.Close()

upTable := &filter.Table{
Schema: "test",
Expand Down Expand Up @@ -1660,8 +1662,10 @@ func (s *testSyncerSuite) TestDownstreamTableHasAutoRandom(c *C) {
"tidb_skip_utf8_check": "0",
schema.TiDBClusteredIndex: "ON",
}
c.Assert(syncer.schemaTracker.Close(), IsNil)
syncer.schemaTracker, err = schema.NewTracker(ctx, s.cfg.Name, sessionCfg, syncer.downstreamTrackConn)
c.Assert(err, IsNil)
defer syncer.schemaTracker.Close()
v, ok := syncer.schemaTracker.GetSystemVar(schema.TiDBClusteredIndex)
c.Assert(v, Equals, "ON")
c.Assert(ok, IsTrue)
Expand Down Expand Up @@ -1839,8 +1843,8 @@ func TestSyncerGetTableInfo(t *testing.T) {
syncer.ddlDBConn = dbconn.NewDBConn(cfg, baseConn)
syncer.downstreamTrackConn = dbconn.NewDBConn(cfg, conn.NewBaseConn(dbConn, &retry.FiniteRetryStrategy{}))
syncer.schemaTracker, err = schema.NewTracker(ctx, cfg.Name, defaultTestSessionCfg, syncer.downstreamTrackConn)
defer syncer.schemaTracker.Close()
require.NoError(t, err)
defer syncer.schemaTracker.Close()

upTable := &filter.Table{
Schema: "test",
Expand Down