Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

dumpling: properly enable EscapeBackslash with upstream SQL mode #1142

Merged
merged 1 commit into from
Oct 13, 2020

Conversation

lance6716
Copy link
Collaborator

@lance6716 lance6716 commented Oct 12, 2020

What problem does this PR solve?

part of #1130

What is changed and how it works?

because loader will use upstream's SQL mode, if upstream has NO_BACKSLASH_ESCAPES, we should not escape \ in dump files.

Check List

Tests

  • Integration test

Code changes

Side effects

Related changes

  • Need to cherry-pick to the release branch

@lance6716 lance6716 added needs-cherry-pick-release-2.0 This PR should be cherry-picked to release-2.0. Remove this label after cherry-picked to release-2.0 priority/normal Minor change, requires approval from ≥1 primary reviewer status/PTAL This PR is ready for review. Add this label back after committing new changes type/bug-fix Bug fix labels Oct 12, 2020
@lance6716 lance6716 changed the title dumpling: properly enable EscapeBackslash since loader use upstream's… dumpling: properly enable EscapeBackslash with upstream SQL mode Oct 12, 2020
Copy link
Member

@csuzhangxc csuzhangxc left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -277,4 +276,9 @@ func (m *Dumpling) detectSQLMode() {
}
m.logger.Info("found upstream SQL mode", zap.String("SQL mode", sqlMode))
m.cfg.LoaderConfig.SQLMode = sqlMode
if strings.Contains(sqlMode, "NO_BACKSLASH_ESCAPES") {
Copy link
Member

@csuzhangxc csuzhangxc Oct 12, 2020

Choose a reason for hiding this comment

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

we may also use HasNoBackslashEscapesMode from TiDB instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If it's Aurora upstream, some SQL mode can't be supported using TiDB parser

@csuzhangxc csuzhangxc added status/LGT1 One reviewer already commented LGTM and removed status/PTAL This PR is ready for review. Add this label back after committing new changes labels Oct 12, 2020
@csuzhangxc csuzhangxc added this to the v2.0.0 RC.3 milestone Oct 12, 2020
Copy link
Contributor

@lichunzhu lichunzhu left a comment

Choose a reason for hiding this comment

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

LGTM

@lance6716 lance6716 merged commit 9ae67af into pingcap:master Oct 13, 2020
@lance6716 lance6716 deleted the fix-backslash branch October 13, 2020 03:16
ti-srebot pushed a commit to ti-srebot/dm that referenced this pull request Oct 13, 2020
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link

cherry pick to release-2.0 in PR #1151

@ti-srebot ti-srebot added already-cherry-pick-2.0 The related PR is already cherry-picked to release-2.0. Add this label once the PR is cherry-picked and removed needs-cherry-pick-release-2.0 This PR should be cherry-picked to release-2.0. Remove this label after cherry-picked to release-2.0 labels Oct 13, 2020
lance6716 pushed a commit that referenced this pull request Oct 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
already-cherry-pick-2.0 The related PR is already cherry-picked to release-2.0. Add this label once the PR is cherry-picked priority/normal Minor change, requires approval from ≥1 primary reviewer status/LGT1 One reviewer already commented LGTM type/bug-fix Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants