From 5eec74132750f4119b1b761e7607aeee83928a67 Mon Sep 17 00:00:00 2001 From: Will Currie Date: Wed, 16 Jan 2019 06:28:05 +1100 Subject: [PATCH 1/2] Add Why Is "Connect to Replica" mode preferred? --- doc/questions.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/questions.md b/doc/questions.md index be6eab0..7585bc7 100644 --- a/doc/questions.md +++ b/doc/questions.md @@ -28,3 +28,9 @@ It is therefore unlikely that `gh-ost` will support this behavior. Yes. TL;DR if running all on same replica/master, make sure to provide `--replica-server-id`. [Read more](cheatsheet.md#concurrent-migrations) # Why + +### Why Is the "Connect to Replica" mode preferred? + +To avoid placing extra load on the master. `gh-ost` connects as a replication client. Each additional replica adds some load to the master. + +To monitor replication lag from a replica. This makes the replication lag throttle, `--max-lag-millis`, more representative of the lag experienced by other replicas following the master (perhaps N levels deep in a tree of replicas). From afa108f8fa49ec66a3b873c094f1bd09e4aaa169 Mon Sep 17 00:00:00 2001 From: twotwotwo Date: Tue, 22 Jan 2019 12:26:55 -0800 Subject: [PATCH 2/2] inspect: remove redundant join conditions The TABLE_SCHEMA and TABLE_NAME are already guaranteed to have the same value in COLUMNS and UNIQUES because of the WHEREs in each query. Dropping it from the ON clause makes it complete much faster. On (at least) MySQL 5.6 installs with thousands of tables, this query completes in a few seconds without the additional join conditions, but takes more than a minute with it. --- go/logic/inspect.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/go/logic/inspect.go b/go/logic/inspect.go index 5f875a0..5643c58 100644 --- a/go/logic/inspect.go +++ b/go/logic/inspect.go @@ -622,8 +622,6 @@ func (this *Inspector) getCandidateUniqueKeys(tableName string) (uniqueKeys [](* GROUP BY TABLE_SCHEMA, TABLE_NAME, INDEX_NAME ) AS UNIQUES ON ( - COLUMNS.TABLE_SCHEMA = UNIQUES.TABLE_SCHEMA AND - COLUMNS.TABLE_NAME = UNIQUES.TABLE_NAME AND COLUMNS.COLUMN_NAME = UNIQUES.FIRST_COLUMN_NAME ) WHERE