List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:October 27 2011 7:45am
Subject:bzr push into mysql-5.5-cluster branch (magnus.blaudd:3624 to 3625)
View as plain text  
 3625 Magnus Blåudd	2011-10-27
      ndb binlog
       - move anyvalue functions to their own file

    added:
      sql/ndb_anyvalue.cc
      sql/ndb_anyvalue.h
    modified:
      sql/ha_ndbcluster.cc
      sql/ha_ndbcluster_binlog.cc
      sql/ha_ndbcluster_binlog.h
      storage/ndb/CMakeLists.txt
 3624 Magnus Blåudd	2011-10-27
      ndb binlog
       - move functions related to schema dist into the scope of "Ndb_schema_event_handler"

    modified:
      sql/ha_ndbcluster_binlog.cc
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2011-10-23 07:47:05 +0000
+++ b/sql/ha_ndbcluster.cc	2011-10-27 07:42:25 +0000
@@ -51,6 +51,7 @@
 #include <ndb_version.h>
 #include "ndb_mi.h"
 #include "ndb_conflict_trans.h"
+#include "ndb_anyvalue.h"
 
 // ndb interface initialization/cleanup
 extern "C" void ndb_init_internal();

=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc	2011-10-27 06:25:19 +0000
+++ b/sql/ha_ndbcluster_binlog.cc	2011-10-27 07:42:25 +0000
@@ -56,6 +56,7 @@ bool ndb_log_empty_epochs(void);
 #include "ha_ndbcluster_tables.h"
 
 #include "ndb_dist_priv_util.h"
+#include "ndb_anyvalue.h"
 
 /*
   Timeout for syncing schema events between
@@ -7467,88 +7468,6 @@ ndbcluster_show_status_binlog(THD* thd,
   DBUG_RETURN(FALSE);
 }
 
-/*
-   AnyValue carries ServerId or Reserved codes
-   Bits from opt_server_id_bits to 30 may carry other data
-   so we ignore them when reading/setting AnyValue.
- 
-   332        21        10        0
-   10987654321098765432109876543210
-   roooooooooooooooooooooooosssssss
- 
-   r = Reserved bit indicates whether
-   bits 0-7+ have ServerId (0) or
-   some special reserved code (1).
-   o = Optional bits, depending on value
-       of server-id-bits will be 
-       serverid bits or user-specific 
-       data
-   s = Serverid bits or reserved codes
-       At least 7 bits will be available
-       for serverid or reserved codes
-  
-*/
-
-#define NDB_ANYVALUE_RESERVED_BIT   0x80000000
-#define NDB_ANYVALUE_RESERVED_MASK  0x8000007f
-
-#define NDB_ANYVALUE_NOLOGGING_CODE 0x8000007f
-
-#ifndef DBUG_OFF
-void dbug_ndbcluster_anyvalue_set_userbits(Uint32& anyValue)
-{
-  /* 
-     Set userData part of AnyValue (if there is one) to
-     all 1s to test that it is ignored
-  */
-  const Uint32 userDataMask = ~(opt_server_id_mask | 
-                                NDB_ANYVALUE_RESERVED_BIT);
-
-  anyValue |= userDataMask;
-}
-#endif
-
-bool ndbcluster_anyvalue_is_reserved(Uint32 anyValue)
-{
-  return ((anyValue & NDB_ANYVALUE_RESERVED_BIT) != 0);
-}
-
-bool ndbcluster_anyvalue_is_nologging(Uint32 anyValue)
-{
-  return ((anyValue & NDB_ANYVALUE_RESERVED_MASK) ==
-          NDB_ANYVALUE_NOLOGGING_CODE);
-}
-
-void ndbcluster_anyvalue_set_nologging(Uint32& anyValue)
-{
-  anyValue |= NDB_ANYVALUE_NOLOGGING_CODE;
-}
-
-void ndbcluster_anyvalue_set_normal(Uint32& anyValue)
-{
-  /* Clear reserved bit and serverid bits */
-  anyValue &= ~(NDB_ANYVALUE_RESERVED_BIT);
-  anyValue &= ~(opt_server_id_mask);
-}
-
-bool ndbcluster_anyvalue_is_serverid_in_range(Uint32 serverId)
-{
-  return ((serverId & ~opt_server_id_mask) == 0);
-}
-
-Uint32 ndbcluster_anyvalue_get_serverid(Uint32 anyValue)
-{
-  assert(! (anyValue & NDB_ANYVALUE_RESERVED_BIT) );
-
-  return (anyValue & opt_server_id_mask);
-}
-
-void ndbcluster_anyvalue_set_serverid(Uint32& anyValue, Uint32 serverId)
-{
-  assert(! (anyValue & NDB_ANYVALUE_RESERVED_BIT) );
-  anyValue &= ~(opt_server_id_mask);
-  anyValue |= (serverId & opt_server_id_mask); 
-}
 
 #ifdef NDB_WITHOUT_SERVER_ID_BITS
 

=== modified file 'sql/ha_ndbcluster_binlog.h'
--- a/sql/ha_ndbcluster_binlog.h	2011-10-24 07:49:34 +0000
+++ b/sql/ha_ndbcluster_binlog.h	2011-10-27 07:42:25 +0000
@@ -257,18 +257,6 @@ ndbcluster_check_if_local_table(const ch
 bool
 ndbcluster_check_if_local_tables_in_db(THD *thd, const char *dbname);
 
-bool ndbcluster_anyvalue_is_reserved(Uint32 anyValue);
-bool ndbcluster_anyvalue_is_nologging(Uint32 anyValue);
-void ndbcluster_anyvalue_set_nologging(Uint32& anyValue);
-bool ndbcluster_anyvalue_is_serverid_in_range(Uint32 serverId);
-void ndbcluster_anyvalue_set_normal(Uint32& anyValue);
-Uint32 ndbcluster_anyvalue_get_serverid(Uint32 anyValue);
-void ndbcluster_anyvalue_set_serverid(Uint32& anyValue, Uint32 serverId);
-
-#ifndef DBUG_OFF
-void dbug_ndbcluster_anyvalue_set_userbits(Uint32& anyValue);
-#endif
-
 /*
    Helper for reading/writing Binlog extra row info
    in Ndb format.

=== added file 'sql/ndb_anyvalue.cc'
--- a/sql/ndb_anyvalue.cc	1970-01-01 00:00:00 +0000
+++ b/sql/ndb_anyvalue.cc	2011-10-27 07:42:25 +0000
@@ -0,0 +1,105 @@
+/*
+   Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+*/
+
+#include "ndb_anyvalue.h"
+
+/*
+   AnyValue carries ServerId or Reserved codes
+   Bits from opt_server_id_bits to 30 may carry other data
+   so we ignore them when reading/setting AnyValue.
+
+   332        21        10        0
+   10987654321098765432109876543210
+   roooooooooooooooooooooooosssssss
+
+   r = Reserved bit indicates whether
+   bits 0-7+ have ServerId (0) or
+   some special reserved code (1).
+   o = Optional bits, depending on value
+       of server-id-bits will be
+       serverid bits or user-specific
+       data
+   s = Serverid bits or reserved codes
+       At least 7 bits will be available
+       for serverid or reserved codes
+
+*/
+
+#include <my_global.h>
+
+extern ulong opt_server_id_mask;
+
+#define NDB_ANYVALUE_RESERVED_BIT   0x80000000
+#define NDB_ANYVALUE_RESERVED_MASK  0x8000007f
+
+#define NDB_ANYVALUE_NOLOGGING_CODE 0x8000007f
+
+#ifndef DBUG_OFF
+void dbug_ndbcluster_anyvalue_set_userbits(Uint32& anyValue)
+{
+  /*
+     Set userData part of AnyValue (if there is one) to
+     all 1s to test that it is ignored
+  */
+  const Uint32 userDataMask = ~(opt_server_id_mask |
+                                NDB_ANYVALUE_RESERVED_BIT);
+
+  anyValue |= userDataMask;
+}
+#endif
+
+bool ndbcluster_anyvalue_is_reserved(Uint32 anyValue)
+{
+  return ((anyValue & NDB_ANYVALUE_RESERVED_BIT) != 0);
+}
+
+bool ndbcluster_anyvalue_is_nologging(Uint32 anyValue)
+{
+  return ((anyValue & NDB_ANYVALUE_RESERVED_MASK) ==
+          NDB_ANYVALUE_NOLOGGING_CODE);
+}
+
+void ndbcluster_anyvalue_set_nologging(Uint32& anyValue)
+{
+  anyValue |= NDB_ANYVALUE_NOLOGGING_CODE;
+}
+
+void ndbcluster_anyvalue_set_normal(Uint32& anyValue)
+{
+  /* Clear reserved bit and serverid bits */
+  anyValue &= ~(NDB_ANYVALUE_RESERVED_BIT);
+  anyValue &= ~(opt_server_id_mask);
+}
+
+bool ndbcluster_anyvalue_is_serverid_in_range(Uint32 serverId)
+{
+  return ((serverId & ~opt_server_id_mask) == 0);
+}
+
+Uint32 ndbcluster_anyvalue_get_serverid(Uint32 anyValue)
+{
+  assert(! (anyValue & NDB_ANYVALUE_RESERVED_BIT) );
+
+  return (anyValue & opt_server_id_mask);
+}
+
+void ndbcluster_anyvalue_set_serverid(Uint32& anyValue, Uint32 serverId)
+{
+  assert(! (anyValue & NDB_ANYVALUE_RESERVED_BIT) );
+  anyValue &= ~(opt_server_id_mask);
+  anyValue |= (serverId & opt_server_id_mask);
+}

=== added file 'sql/ndb_anyvalue.h'
--- a/sql/ndb_anyvalue.h	1970-01-01 00:00:00 +0000
+++ b/sql/ndb_anyvalue.h	2011-10-27 07:42:25 +0000
@@ -0,0 +1,35 @@
+/*
+   Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+*/
+
+#ifndef NDB_ANYVALUE_H
+#define NDB_ANYVALUE_H
+
+#include <ndb_types.h>
+
+bool ndbcluster_anyvalue_is_reserved(Uint32 anyValue);
+bool ndbcluster_anyvalue_is_nologging(Uint32 anyValue);
+void ndbcluster_anyvalue_set_nologging(Uint32& anyValue);
+bool ndbcluster_anyvalue_is_serverid_in_range(Uint32 serverId);
+void ndbcluster_anyvalue_set_normal(Uint32& anyValue);
+Uint32 ndbcluster_anyvalue_get_serverid(Uint32 anyValue);
+void ndbcluster_anyvalue_set_serverid(Uint32& anyValue, Uint32 serverId);
+
+#ifndef DBUG_OFF
+void dbug_ndbcluster_anyvalue_set_userbits(Uint32& anyValue);
+#endif
+
+#endif

=== modified file 'storage/ndb/CMakeLists.txt'
--- a/storage/ndb/CMakeLists.txt	2011-10-24 12:45:30 +0000
+++ b/storage/ndb/CMakeLists.txt	2011-10-27 07:42:25 +0000
@@ -80,6 +80,7 @@ SET(NDBCLUSTER_SOURCES
   ../../sql/ndb_global_schema_lock.cc
   ../../sql/ndb_mi.cc
   ../../sql/ndb_conflict_trans.cc
+  ../../sql/ndb_anyvalue.cc
 )
 
 # Include directories used when building ha_ndbcluster

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5-cluster branch (magnus.blaudd:3624 to 3625) Magnus Blåudd27 Oct