~brianaker/drizzle/bug786515-trunk

« back to all changes in this revision

Viewing changes to plugin/slave/replication_schema.cc

  • Committer: Mark Atwood
  • Date: 2011-05-02 23:26:54 UTC
  • mfrom: (2290.1.9 server_uuid_repl)
  • Revision ID: me@mark.atwood.name-20110502232654-hd1ufzm7o4mtrutf
mergeĀ lp:~skinny.moey/drizzle/server_uuid_repl

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
   * Create our applier thread state information table if we need to.
83
83
   */
84
84
 
 
85
  /*
 
86
   * Table: applier_state
 
87
   * Version 1.0: Initial definition
 
88
   * Version 1.1: Added originating_server_uuid and originating_commit_id
 
89
   */
 
90
 
85
91
  sql.clear();
86
92
  sql.push_back("COMMIT");
87
93
  sql.push_back("CREATE TABLE IF NOT EXISTS `sys_replication`.`applier_state`"
88
94
                " (`last_applied_commit_id` BIGINT NOT NULL PRIMARY KEY,"
 
95
                " `originating_server_uuid` VARCHAR(36) NOT NULL,"
 
96
                " `originating_commit_id` BIGINT NOT NULL,"
89
97
                " `status` VARCHAR(20) NOT NULL,"
90
98
                " `error_msg` VARCHAR(250))"
91
 
                " COMMENT = 'VERSION 1.0'");
 
99
                " COMMENT = 'VERSION 1.1'");
92
100
 
93
101
  if (not executeSQL(sql))
94
102
    return false;
108
116
    {
109
117
      sql.clear();
110
118
      sql.push_back("INSERT INTO `sys_replication`.`applier_state`"
111
 
                    " (`last_applied_commit_id`, `status`)"
112
 
                    " VALUES (0, 'STOPPED')");
 
119
                    " (`last_applied_commit_id`, `originating_server_uuid`,"
 
120
                    "  `originating_commit_id`, `status`)"
 
121
                    " VALUES (0, '', 0, 'STOPPED')");
113
122
      if (not executeSQL(sql))
114
123
        return false;
115
124
    }
117
126
 
118
127
  /*
119
128
   * Create our message queue table if we need to.
 
129
   * Version 1.0: Initial definition
 
130
   * Version 1.1: Added originating_server_uuid and originating_commit_id
120
131
   */
121
132
 
122
133
  sql.clear();
123
134
  sql.push_back("COMMIT");
124
135
  sql.push_back("CREATE TABLE IF NOT EXISTS `sys_replication`.`queue`"
125
136
                " (`trx_id` BIGINT NOT NULL, `seg_id` INT NOT NULL,"
126
 
                " `commit_order` BIGINT, `msg` BLOB,"
 
137
                " `commit_order` BIGINT,"
 
138
                " `originating_server_uuid` VARCHAR(36) NOT NULL,"
 
139
                " `originating_commit_id` BIGINT NOT NULL,"
 
140
                " `msg` BLOB,"
127
141
                " PRIMARY KEY(`trx_id`, `seg_id`))"
128
 
                " COMMENT = 'VERSION 1.0'");
 
142
                " COMMENT = 'VERSION 1.1'");
129
143
  if (not executeSQL(sql))
130
144
    return false;
131
145