Merge lp:~dshrews/drizzle/bug730936 into lp:drizzle/7.0

Proposed by David Shrewsbury
Status: Merged
Approved by: Brian Aker
Approved revision: 2222
Merged at revision: 2225
Proposed branch: lp:~dshrews/drizzle/bug730936
Merge into: lp:drizzle/7.0
Diff against target: 102 lines (+42/-3)
4 files modified
plugin/slave/docs/index.rst (+16/-3)
plugin/slave/module.cc (+5/-0)
plugin/slave/queue_producer.h (+5/-0)
plugin/slave/replication_slave.h (+16/-0)
To merge this branch: bzr merge lp:~dshrews/drizzle/bug730936
Reviewer Review Type Date Requested Status
Drizzle Developers Pending
Review via email: mp+52479@code.launchpad.net

Description of the change

A new option to help provision a new slave. Lets us tell the slave where to begin reading the master's transaction log (i.e., use the value output from: drizzledump --single-transaction).

To post a comment you must log in.
Revision history for this message
Joe Daly (skinny.moey) wrote :

a nitpick but this confused me a little.

The usage for this is a little confusing given the column names ID, and COMMIT_ID in the sys_replication_log and what is written when using drizzledump.

  --slave.max-commit-id arg Value to use as the
                                                      maximum commit ID stored
                                                      on the slave

I think it would be more clear if "commit ID" was changed to "COMMIT_ID"

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugin/slave/docs/index.rst'
2--- plugin/slave/docs/index.rst 2011-03-02 18:47:07 +0000
3+++ plugin/slave/docs/index.rst 2011-03-07 21:50:17 +0000
4@@ -14,9 +14,8 @@
5 -------------
6
7 Most of the options that can be used to control the replication slave plugin
8-can only be given in a configuration file. The only exception is the
9-:option:`--slave.config-file` option which designates the location of this configuration
10-file.
11+can only be given in a configuration file. The only exceptions are the
12+:option:`--slave.config-file` and :option:`--slave.max-commit-id` options.
13
14 .. program:: drizzled
15
16@@ -29,6 +28,20 @@
17 file. The relative path used by plugins is within the :option:`--datadir`
18 directory, so a full path is recommended.
19
20+.. option:: --slave.max-commit-id=arg
21+
22+ Manually set the maximum commit ID the slave is assumed to have retrieved
23+ from the master. This value will be used by the slave to determine where
24+ to begin retrieving replication messages from the master transaction log.
25+ This option can be used to provision a new slave machine by setting it to
26+ the value output from the drizzledump client when used with the
27+ --single-transaction option.
28+
29+ This value is not allowed to be set via the configuration file since
30+ you would normally only set it once on initial slave startup. This
31+ eliminates the possibility of forgetting to delete it from the configuration
32+ file for subsequent slave restarts.
33+
34 The options below are read from the configuration file.
35
36 .. confval:: master-host
37
38=== modified file 'plugin/slave/module.cc'
39--- plugin/slave/module.cc 2011-02-17 14:20:50 +0000
40+++ plugin/slave/module.cc 2011-03-07 21:50:17 +0000
41@@ -45,6 +45,8 @@
42 const module::option_map &vm= context.getOptions();
43
44 ReplicationSlave *slave= new ReplicationSlave(vm["config-file"].as<string>());
45+ if (vm.count("max-commit-id"))
46+ slave->setMaxCommitId(vm["max-commit-id"].as<uint64_t>());
47 context.add(slave);
48 return 0;
49 }
50@@ -54,6 +56,9 @@
51 context("config-file",
52 po::value<string>()->default_value(DEFAULT_SLAVE_CFG_FILE.string()),
53 N_("Path to the slave configuration file"));
54+ context("max-commit-id",
55+ po::value<uint64_t>(),
56+ N_("Value to use as the maximum commit ID stored on the slave"));
57 }
58
59 } /* namespace slave */
60
61=== modified file 'plugin/slave/queue_producer.h'
62--- plugin/slave/queue_producer.h 2011-02-28 14:33:56 +0000
63+++ plugin/slave/queue_producer.h 2011-03-07 21:50:17 +0000
64@@ -90,6 +90,11 @@
65 _seconds_between_reconnects= seconds;
66 }
67
68+ void setMaxCommitId(uint64_t value)
69+ {
70+ _saved_max_commit_id= value;
71+ }
72+
73 private:
74 /** Number of seconds to sleep between checking queue for messages */
75 uint32_t _check_interval;
76
77=== modified file 'plugin/slave/replication_slave.h'
78--- plugin/slave/replication_slave.h 2011-02-17 14:20:50 +0000
79+++ plugin/slave/replication_slave.h 2011-03-07 21:50:17 +0000
80@@ -60,6 +60,22 @@
81 return _error;
82 }
83
84+ /**
85+ * Set the initial value for the slave's maximum commit ID.
86+ *
87+ * This value basically determines where to start retrieving events from
88+ * the master. Normally this is computed automatically based on the
89+ * contents of the queue and/or the last applied commit ID. This allows
90+ * us to override those values and start from another point. E.g., new
91+ * slave provisioning or skipping a trouble statement.
92+ *
93+ * @param[in] value The commit ID value.
94+ */
95+ void setMaxCommitId(uint64_t value)
96+ {
97+ _producer.setMaxCommitId(value);
98+ }
99+
100 private:
101 std::string _config_file;
102 std::string _error;

Subscribers

People subscribed via source and target branches