~ourdelta-core/ourdelta/trunk015fmt

« back to all changes in this revision

Viewing changes to mysql/5.0/google/mirror_binlog/mirror_binlog.patch

Merge from percona d6 (MySQL 5.0) branch.
microslow backward compatibility fixups

Show diffs side-by-side

added added

removed removed

Lines of Context:
1060
1060
   (void) pthread_mutex_init(&LOCK_global_user_client_stats, MY_MUTEX_INIT_FAST);
1061
1061
   (void) pthread_mutex_init(&LOCK_global_table_stats, MY_MUTEX_INIT_FAST);
1062
1062
   (void) pthread_mutex_init(&LOCK_global_index_stats, MY_MUTEX_INIT_FAST);
1063
 
@@ -3396,39 +3427,8 @@ server.");
 
1063
@@ -3394,42 +3425,13 @@ server.");
 
1064
     }
 
1065
   }
1064
1066
 
 
1067
+#ifdef HAVE_REPLICATION
1065
1068
   if (opt_bin_log)
1066
1069
   {
1067
1070
-    char buf[FN_REFLEN];
1099
1102
-    */
1100
1103
-    using_update_log=1;
1101
1104
   }
 
1105
+#endif
1102
1106
 
1103
1107
   if (xid_cache_init())
1104
 
@@ -3478,9 +3478,10 @@ server.");
 
1108
   {
 
1109
@@ -3478,11 +3480,12 @@ server.");
1105
1110
     unireg_abort(1);
1106
1111
   }
1107
1112
 
1108
1113
-  if (opt_bin_log && mysql_bin_log.open(opt_bin_logname, LOG_BIN, 0,
1109
1114
-                                        WRITE_CACHE, 0, max_binlog_size, 0))
 
1115
+#ifdef HAVE_REPLICATION
1110
1116
+  if (opt_bin_log &&
1111
1117
+      make_master(NULL, opt_bin_logname, opt_binlog_index_name, NULL) != 0) {
1112
1118
     unireg_abort(1);
1113
1119
+  }
1114
1120
 
1115
 
 #ifdef HAVE_REPLICATION
 
1121
-#ifdef HAVE_REPLICATION
1116
1122
   if (opt_bin_log && expire_logs_days)
1117
 
@@ -4984,6 +4985,8 @@ enum options_mysqld
 
1123
   {
 
1124
     time_t purge_time= time(0) - expire_logs_days*24*60*60;
 
1125
@@ -4984,6 +4987,8 @@ enum options_mysqld
1118
1126
   OPT_SYNC_REPLICATION,
1119
1127
   OPT_SYNC_REPLICATION_SLAVE_ID,
1120
1128
   OPT_SYNC_REPLICATION_TIMEOUT,
1123
1131
   OPT_BDB_NOSYNC,
1124
1132
   OPT_ENABLE_SHARED_MEMORY,
1125
1133
   OPT_SHARED_MEMORY_BASE_NAME,
1126
 
@@ -5691,6 +5694,11 @@ Can't be set to 1 if --log-slave-updates
 
1134
@@ -5691,6 +5696,13 @@ Can't be set to 1 if --log-slave-updates
1127
1135
   {"rpl-recovery-rank", OPT_RPL_RECOVERY_RANK, "Undocumented.",
1128
1136
    (gptr*) &rpl_recovery_rank, (gptr*) &rpl_recovery_rank, 0, GET_ULONG,
1129
1137
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 
1138
+#ifdef HAVE_REPLICATION
1130
1139
+  {"rpl_mirror_binlog_enabled", OPT_RPL_MIRROR_BINLOG,
1131
1140
+   "1 = support mirroring binlogs.  0 = disable mirroring binlogs",
1132
1141
+   (gptr*) &rpl_mirror_binlog_enabled,
1133
1142
+   (gptr*) &rpl_mirror_binlog_enabled, 0, GET_BOOL, NO_ARG,
1134
1143
+   0, 0, 1, 0, 1, 0},
 
1144
+#endif
1135
1145
   {"safe-mode", OPT_SAFE, "Skip some optimize stages (for testing).",
1136
1146
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
1137
1147
 #ifndef TO_BE_DELETED
1138
 
@@ -5812,6 +5820,11 @@ log and this option does nothing anymore
 
1148
@@ -5812,6 +5824,13 @@ log and this option does nothing anymore
1139
1149
   {"symbolic-links", 's', "Enable symbolic link support.",
1140
1150
    (gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG,
1141
1151
    IF_PURIFY(0,1), 0, 0, 0, 0, 0},
 
1152
+#ifdef HAVE_REPLICATION
1142
1153
+  {"sync-mirror-binlog", OPT_SYNC_MIRROR_BINLOG,
1143
1154
+   "Sync the mirrored binlog to disk after every #th event. "
1144
1155
+   "#=0 (the default) does no sync. Syncing slows MySQL down",
1145
1156
+   (gptr*) &sync_mirror_binlog_period,
1146
1157
+   (gptr*) &sync_mirror_binlog_period, 0, GET_ULONG, REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1, 0},
 
1158
+#endif
1147
1159
   {"sysdate-is-now", OPT_SYSDATE_IS_NOW,
1148
1160
    "Non-default option to alias SYSDATE() to NOW() to make it safe-replicable. Since 5.0, SYSDATE() returns a `dynamic' value different for different invocations, even within the same statement.",
1149
1161
    (gptr*) &global_system_variables.sysdate_is_now,
1150
 
@@ -6584,6 +6597,7 @@ struct show_var_st status_vars[]= {
 
1162
@@ -6584,6 +6603,7 @@ struct show_var_st status_vars[]= {
1151
1163
   {"Delayed_errors",           (char*) &delayed_insert_errors,  SHOW_LONG},
1152
1164
   {"Delayed_insert_threads",   (char*) &delayed_insert_threads, SHOW_LONG_CONST},
1153
1165
   {"Delayed_writes",           (char*) &delayed_insert_writes,  SHOW_LONG},
1790
1802
===================================================================
1791
1803
--- mysql-5.0.67.orig/sql/set_var.cc
1792
1804
+++ mysql-5.0.67/sql/set_var.cc
1793
 
@@ -342,6 +342,8 @@ sys_var_thd_msl_flag        sys_log_slow_verbos
 
1805
@@ -342,6 +342,10 @@ sys_var_thd_msl_flag       sys_log_slow_verbos
1794
1806
                                        slog_verb);
1795
1807
 sys_var_long_ptr       sys_rpl_recovery_rank("rpl_recovery_rank",
1796
1808
                                              &rpl_recovery_rank);
 
1809
+#ifdef HAVE_REPLICATION
1797
1810
+sys_var_bool_ptr sys_rpl_mirror_binlog_enabled("rpl_mirror_binlog_enabled",
1798
1811
+                                               &rpl_mirror_binlog_enabled);
 
1812
+#endif
1799
1813
 sys_var_long_ptr       sys_query_cache_size("query_cache_size",
1800
1814
                                             &query_cache_size,
1801
1815
                                             fix_query_cache_size);
1802
 
@@ -361,6 +363,9 @@ sys_var_thd_ulong   sys_trans_alloc_block_
 
1816
@@ -361,6 +365,11 @@ sys_var_thd_ulong  sys_trans_alloc_block_
1803
1817
 sys_var_thd_ulong      sys_trans_prealloc_size("transaction_prealloc_size",
1804
1818
                                                &SV::trans_prealloc_size,
1805
1819
                                                0, fix_trans_mem_root);
 
1820
+#ifdef HAVE_REPLICATION
1806
1821
+sys_var_long_ptr       sys_sync_mirror_binlog_period(
1807
1822
+                            "sync_mirror_binlog_period",
1808
1823
+                            &sync_mirror_binlog_period);
 
1824
+#endif
1809
1825
 
1810
1826
 #ifdef HAVE_QUERY_CACHE
1811
1827
 sys_var_long_ptr       sys_query_cache_limit("query_cache_limit",
1812
 
@@ -765,6 +770,7 @@ sys_var *sys_variables[]=
 
1828
@@ -765,6 +774,9 @@ sys_var *sys_variables[]=
1813
1829
   &sys_relay_log_purge,
1814
1830
 #endif
1815
1831
   &sys_rpl_recovery_rank,
 
1832
+#ifdef HAVE_REPLICATION
1816
1833
+  &sys_rpl_mirror_binlog_enabled,
 
1834
+#endif
1817
1835
   &sys_safe_updates,
1818
1836
   &sys_secure_auth,
1819
1837
   &sys_secure_file_priv,
1820
 
@@ -1093,6 +1099,8 @@ struct show_var_st init_vars[]= {
 
1838
@@ -1093,6 +1105,10 @@ struct show_var_st init_vars[]= {
1821
1839
   {"relay_log_space_limit",  (char*) &relay_log_space_limit,        SHOW_LONGLONG},
1822
1840
 #endif
1823
1841
   {sys_rpl_recovery_rank.name,(char*) &sys_rpl_recovery_rank,       SHOW_SYS},
 
1842
+#ifdef HAVE_REPLICATION
1824
1843
+  {sys_rpl_mirror_binlog_enabled.name,
1825
1844
+   (char *) &sys_rpl_mirror_binlog_enabled,                         SHOW_SYS},
 
1845
+#endif
1826
1846
   {"secure_auth",             (char*) &sys_secure_auth,             SHOW_SYS},
1827
1847
   {"secure_file_priv",        (char*) &sys_secure_file_priv,        SHOW_SYS},
1828
1848
 #ifdef HAVE_SMEM
2028
2048
===================================================================
2029
2049
--- mysql-5.0.67.orig/sql/sql_parse.cc
2030
2050
+++ mysql-5.0.67/sql/sql_parse.cc
2031
 
@@ -403,6 +403,15 @@ int check_user(THD *thd, enum enum_serve
 
2051
@@ -403,6 +403,16 @@ int check_user(THD *thd, enum enum_serve
2032
2052
                   thd->main_security_ctx.master_access,
2033
2053
                   (thd->db ? thd->db : "*none*")));
2034
2054
 
 
2055
+#ifdef HAVE_REPLICATION
2035
2056
+      /* If we are in failover mode, reject all non-super user connections. */
2036
2057
+      if (is_in_failover() &&
2037
2058
+          !(thd->main_security_ctx.master_access & SUPER_ACL)) {
2039
2060
+                       "super-user only during failover");
2040
2061
+       DBUG_RETURN(-1);
2041
2062
+      }
2042
 
+
 
2063
+#endif
2043
2064
+
2044
2065
       if (check_count)
2045
2066
       {
2046
2067
         VOID(pthread_mutex_lock(&LOCK_thread_count));
2047
 
@@ -3466,6 +3475,22 @@ mysql_execute_command(THD *thd)
 
2068
@@ -3466,6 +3476,22 @@ mysql_execute_command(THD *thd)
2048
2069
     else
2049
2070
       res = load_master_data(thd);
2050
2071
     break;