mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
92e68d49d7
Changed header to GPL version 2 only client/mysqlslap.c: Changed header to GPL version 2 only include/atomic/nolock.h: Changed header to GPL version 2 only include/atomic/rwlock.h: Changed header to GPL version 2 only include/atomic/x86-gcc.h: Changed header to GPL version 2 only include/atomic/x86-msvc.h: Changed header to GPL version 2 only include/my_atomic.h: Changed header to GPL version 2 only include/my_trie.h: Changed header to GPL version 2 only include/my_vle.h: Changed header to GPL version 2 only include/mysql/plugin.h: Changed header to GPL version 2 only mysys/my_atomic.c: Changed header to GPL version 2 only mysys/my_getncpus.c: Changed header to GPL version 2 only mysys/my_memmem.c: Changed header to GPL version 2 only mysys/my_vle.c: Changed header to GPL version 2 only mysys/trie.c: Changed header to GPL version 2 only plugin/Makefile.am: Changed header to GPL version 2 only server-tools/instance-manager/IMService.h: Changed header to GPL version 2 only server-tools/instance-manager/WindowsService.h: Changed header to GPL version 2 only server-tools/instance-manager/exit_codes.h: Changed header to GPL version 2 only server-tools/instance-manager/user_management_commands.h: Changed header to GPL version 2 only sql/authors.h: Changed header to GPL version 2 only sql/contributors.h: Changed header to GPL version 2 only sql/event_data_objects.cc: Changed header to GPL version 2 only sql/event_data_objects.h: Changed header to GPL version 2 only sql/event_db_repository.cc: Changed header to GPL version 2 only sql/event_db_repository.h: Changed header to GPL version 2 only sql/event_queue.cc: Changed header to GPL version 2 only sql/event_queue.h: Changed header to GPL version 2 only sql/event_scheduler.cc: Changed header to GPL version 2 only sql/event_scheduler.h: Changed header to GPL version 2 only sql/events.cc: Changed header to GPL version 2 only sql/events.h: Changed header to GPL version 2 only sql/ha_ndbcluster_binlog.cc: Changed header to GPL version 2 only sql/ha_ndbcluster_binlog.h: Changed header to GPL version 2 only sql/ha_ndbcluster_tables.h: Changed header to GPL version 2 only sql/ha_partition.cc: Changed header to GPL version 2 only sql/ha_partition.h: Changed header to GPL version 2 only sql/item_xmlfunc.cc: Changed header to GPL version 2 only sql/item_xmlfunc.h: Changed header to GPL version 2 only sql/log.h: Changed header to GPL version 2 only sql/partition_element.h: Changed header to GPL version 2 only sql/partition_info.cc: Changed header to GPL version 2 only sql/partition_info.h: Changed header to GPL version 2 only sql/rpl_filter.cc: Changed header to GPL version 2 only sql/rpl_filter.h: Changed header to GPL version 2 only sql/rpl_injector.cc: Changed header to GPL version 2 only sql/rpl_injector.h: Changed header to GPL version 2 only sql/rpl_mi.cc: Changed header to GPL version 2 only sql/rpl_mi.h: Changed header to GPL version 2 only sql/rpl_rli.cc: Changed header to GPL version 2 only sql/rpl_rli.h: Changed header to GPL version 2 only sql/rpl_tblmap.cc: Changed header to GPL version 2 only sql/rpl_tblmap.h: Changed header to GPL version 2 only sql/rpl_utility.cc: Changed header to GPL version 2 only sql/rpl_utility.h: Changed header to GPL version 2 only sql/sql_binlog.cc: Changed header to GPL version 2 only sql/sql_partition.cc: Changed header to GPL version 2 only sql/sql_partition.h: Changed header to GPL version 2 only sql/sql_plugin.cc: Changed header to GPL version 2 only sql/sql_plugin.h: Changed header to GPL version 2 only sql/sql_servers.cc: Changed header to GPL version 2 only sql/sql_servers.h: Changed header to GPL version 2 only sql/sql_tablespace.cc: Changed header to GPL version 2 only sql/sql_yacc.yy.bak: Changed header to GPL version 2 only storage/Makefile.am: Changed header to GPL version 2 only storage/archive/Makefile.am: Changed header to GPL version 2 only storage/blackhole/Makefile.am: Changed header to GPL version 2 only storage/csv/Makefile.am: Changed header to GPL version 2 only storage/example/Makefile.am: Changed header to GPL version 2 only storage/federated/Makefile.am: Changed header to GPL version 2 only storage/innobase/handler/Makefile.am: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/AllocNodeId.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/CreateObj.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/DictObjOp.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/DihFragCount.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/DropFilegroup.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/DropObj.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/Extent.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/RestoreImpl.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/RouteOrd.hpp: Changed header to GPL version 2 only storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp: Changed header to GPL version 2 only storage/ndb/include/ndbapi/NdbIndexStat.hpp: Changed header to GPL version 2 only storage/ndb/ndbapi-examples/mgmapi_logevent/mgmapi_logevent.cpp: Changed header to GPL version 2 only storage/ndb/ndbapi-examples/mgmapi_logevent_dual/mgmapi_logevent_dual.cpp: Changed header to GPL version 2 only storage/ndb/ndbapi-examples/ndbapi_async/ndbapi_async.cpp: Changed header to GPL version 2 only storage/ndb/ndbapi-examples/ndbapi_async1/ndbapi_async1.cpp: Changed header to GPL version 2 only storage/ndb/ndbapi-examples/ndbapi_event/ndbapi_event.cpp: Changed header to GPL version 2 only storage/ndb/ndbapi-examples/ndbapi_retries/ndbapi_retries.cpp: Changed header to GPL version 2 only storage/ndb/ndbapi-examples/ndbapi_scan/ndbapi_scan.cpp: Changed header to GPL version 2 only storage/ndb/ndbapi-examples/ndbapi_simple/ndbapi_simple.cpp: Changed header to GPL version 2 only storage/ndb/ndbapi-examples/ndbapi_simple_dual/ndbapi_simple_dual.cpp: Changed header to GPL version 2 only storage/ndb/ndbapi-examples/ndbapi_simple_index/ndbapi_simple_index.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/dbtux/DbtuxStat.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/diskpage.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/lgman.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/lgman.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/pgman.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/pgman.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/print_file.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/record_types.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/restore.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/restore.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/tsman.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/blocks/tsman.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/DLCFifoList.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/DLCHashTable.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/DynArr256.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/DynArr256.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/KeyTable2Ref.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/LinearPool.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/NdbdSuperPool.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/NdbdSuperPool.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/Pool.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/Pool.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/RWPool.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/RWPool.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/Rope.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/SLFifoList.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/WOPool.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/WOPool.hpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/bench_pool.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/ndbd_malloc_impl.cpp: Changed header to GPL version 2 only storage/ndb/src/kernel/vm/ndbd_malloc_impl.hpp: Changed header to GPL version 2 only storage/ndb/src/mgmsrv/ParamInfo.cpp: Changed header to GPL version 2 only storage/ndb/src/ndbapi/NdbIndexStat.cpp: Changed header to GPL version 2 only storage/ndb/test/ndbapi/testIndexStat.cpp: Changed header to GPL version 2 only storage/ndb/test/tools/listen.cpp: Changed header to GPL version 2 only storage/ndb/tools/restore/ndb_nodegroup_map.h: Changed header to GPL version 2 only strings/my_strchr.c: Changed header to GPL version 2 only unittest/mysys/base64-t.c: Changed header to GPL version 2 only unittest/mysys/bitmap-t.c: Changed header to GPL version 2 only unittest/mysys/my_atomic-t.c: Changed header to GPL version 2 only unittest/mytap/tap.c: Changed header to GPL version 2 only unittest/mytap/tap.h: Changed header to GPL version 2 only win/Makefile.am: Changed header to GPL version 2 only
224 lines
7 KiB
C++
224 lines
7 KiB
C++
/* Copyright (C) 2000-2003 MySQL AB
|
|
|
|
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
|
|
// Typedefs for long names
|
|
typedef NdbDictionary::Object NDBOBJ;
|
|
typedef NdbDictionary::Column NDBCOL;
|
|
typedef NdbDictionary::Table NDBTAB;
|
|
typedef NdbDictionary::Index NDBINDEX;
|
|
typedef NdbDictionary::Dictionary NDBDICT;
|
|
typedef NdbDictionary::Event NDBEVENT;
|
|
|
|
#define IS_TMP_PREFIX(A) (is_prefix(A, tmp_file_prefix))
|
|
|
|
extern ulong ndb_extra_logging;
|
|
|
|
#define INJECTOR_EVENT_LEN 200
|
|
|
|
#define NDB_INVALID_SCHEMA_OBJECT 241
|
|
|
|
extern handlerton *ndbcluster_hton;
|
|
|
|
/*
|
|
The numbers below must not change as they
|
|
are passed between mysql servers, and if changed
|
|
would break compatablility. Add new numbers to
|
|
the end.
|
|
*/
|
|
enum SCHEMA_OP_TYPE
|
|
{
|
|
SOT_DROP_TABLE= 0,
|
|
SOT_CREATE_TABLE= 1,
|
|
SOT_RENAME_TABLE_NEW= 2,
|
|
SOT_ALTER_TABLE= 3,
|
|
SOT_DROP_DB= 4,
|
|
SOT_CREATE_DB= 5,
|
|
SOT_ALTER_DB= 6,
|
|
SOT_CLEAR_SLOCK= 7,
|
|
SOT_TABLESPACE= 8,
|
|
SOT_LOGFILE_GROUP= 9,
|
|
SOT_RENAME_TABLE= 10,
|
|
SOT_TRUNCATE_TABLE= 11
|
|
};
|
|
|
|
const uint max_ndb_nodes= 64; /* multiple of 32 */
|
|
|
|
static const char *ha_ndb_ext=".ndb";
|
|
static const char share_prefix[]= "./";
|
|
|
|
class Ndb_table_guard
|
|
{
|
|
public:
|
|
Ndb_table_guard(NDBDICT *dict, const char *tabname)
|
|
: m_dict(dict)
|
|
{
|
|
DBUG_ENTER("Ndb_table_guard");
|
|
m_ndbtab= m_dict->getTableGlobal(tabname);
|
|
m_invalidate= 0;
|
|
DBUG_PRINT("info", ("m_ndbtab: %p", m_ndbtab));
|
|
DBUG_VOID_RETURN;
|
|
}
|
|
~Ndb_table_guard()
|
|
{
|
|
DBUG_ENTER("~Ndb_table_guard");
|
|
if (m_ndbtab)
|
|
{
|
|
DBUG_PRINT("info", ("m_ndbtab: %p m_invalidate: %d",
|
|
m_ndbtab, m_invalidate));
|
|
m_dict->removeTableGlobal(*m_ndbtab, m_invalidate);
|
|
}
|
|
DBUG_VOID_RETURN;
|
|
}
|
|
const NDBTAB *get_table() { return m_ndbtab; }
|
|
void invalidate() { m_invalidate= 1; }
|
|
const NDBTAB *release()
|
|
{
|
|
DBUG_ENTER("Ndb_table_guard::release");
|
|
const NDBTAB *tmp= m_ndbtab;
|
|
DBUG_PRINT("info", ("m_ndbtab: %p", m_ndbtab));
|
|
m_ndbtab = 0;
|
|
DBUG_RETURN(tmp);
|
|
}
|
|
private:
|
|
const NDBTAB *m_ndbtab;
|
|
NDBDICT *m_dict;
|
|
int m_invalidate;
|
|
};
|
|
|
|
#ifdef HAVE_NDB_BINLOG
|
|
extern pthread_t ndb_binlog_thread;
|
|
extern pthread_mutex_t injector_mutex;
|
|
extern pthread_cond_t injector_cond;
|
|
|
|
extern unsigned char g_node_id_map[max_ndb_nodes];
|
|
extern pthread_t ndb_util_thread;
|
|
extern pthread_mutex_t LOCK_ndb_util_thread;
|
|
extern pthread_cond_t COND_ndb_util_thread;
|
|
extern int ndbcluster_util_inited;
|
|
extern pthread_mutex_t ndbcluster_mutex;
|
|
extern HASH ndbcluster_open_tables;
|
|
extern Ndb_cluster_connection* g_ndb_cluster_connection;
|
|
extern long ndb_number_of_storage_nodes;
|
|
|
|
/*
|
|
Initialize the binlog part of the ndb handlerton
|
|
*/
|
|
void ndbcluster_binlog_init_handlerton();
|
|
/*
|
|
Initialize the binlog part of the NDB_SHARE
|
|
*/
|
|
void ndbcluster_binlog_init_share(NDB_SHARE *share, TABLE *table);
|
|
|
|
bool ndbcluster_check_if_local_table(const char *dbname, const char *tabname);
|
|
bool ndbcluster_check_if_local_tables_in_db(THD *thd, const char *dbname);
|
|
|
|
int ndbcluster_create_binlog_setup(Ndb *ndb, const char *key,
|
|
uint key_len,
|
|
const char *db,
|
|
const char *table_name,
|
|
my_bool share_may_exist);
|
|
int ndbcluster_create_event(Ndb *ndb, const NDBTAB *table,
|
|
const char *event_name, NDB_SHARE *share,
|
|
int push_warning= 0);
|
|
int ndbcluster_create_event_ops(NDB_SHARE *share,
|
|
const NDBTAB *ndbtab,
|
|
const char *event_name);
|
|
int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
|
|
const char *query, int query_length,
|
|
const char *db, const char *table_name,
|
|
uint32 ndb_table_id,
|
|
uint32 ndb_table_version,
|
|
enum SCHEMA_OP_TYPE type,
|
|
const char *new_db,
|
|
const char *new_table_name,
|
|
int have_lock_open);
|
|
int ndbcluster_handle_drop_table(Ndb *ndb, const char *event_name,
|
|
NDB_SHARE *share,
|
|
const char *type_str);
|
|
void ndb_rep_event_name(String *event_name,
|
|
const char *db, const char *tbl);
|
|
int ndb_create_table_from_engine(THD *thd, const char *db,
|
|
const char *table_name);
|
|
int ndbcluster_binlog_start();
|
|
pthread_handler_t ndb_binlog_thread_func(void *arg);
|
|
|
|
/*
|
|
table mysql.ndb_apply_status
|
|
*/
|
|
int ndbcluster_setup_binlog_table_shares(THD *thd);
|
|
extern NDB_SHARE *ndb_apply_status_share;
|
|
extern NDB_SHARE *ndb_schema_share;
|
|
|
|
extern THD *injector_thd;
|
|
extern my_bool ndb_binlog_running;
|
|
extern my_bool ndb_binlog_tables_inited;
|
|
|
|
bool
|
|
ndbcluster_show_status_binlog(THD* thd, stat_print_fn *stat_print,
|
|
enum ha_stat_type stat_type);
|
|
|
|
/*
|
|
prototypes for ndb handler utility function also needed by
|
|
the ndb binlog code
|
|
*/
|
|
int cmp_frm(const NDBTAB *ndbtab, const void *pack_data,
|
|
uint pack_length);
|
|
int ndbcluster_find_all_files(THD *thd);
|
|
#endif /* HAVE_NDB_BINLOG */
|
|
|
|
void ndb_unpack_record(TABLE *table, NdbValue *value,
|
|
MY_BITMAP *defined, byte *buf);
|
|
|
|
NDB_SHARE *ndbcluster_get_share(const char *key,
|
|
TABLE *table,
|
|
bool create_if_not_exists,
|
|
bool have_lock);
|
|
NDB_SHARE *ndbcluster_get_share(NDB_SHARE *share);
|
|
void ndbcluster_free_share(NDB_SHARE **share, bool have_lock);
|
|
void ndbcluster_real_free_share(NDB_SHARE **share);
|
|
int handle_trailing_share(NDB_SHARE *share);
|
|
inline NDB_SHARE *get_share(const char *key,
|
|
TABLE *table,
|
|
bool create_if_not_exists= TRUE,
|
|
bool have_lock= FALSE)
|
|
{
|
|
return ndbcluster_get_share(key, table, create_if_not_exists, have_lock);
|
|
}
|
|
|
|
inline NDB_SHARE *get_share(NDB_SHARE *share)
|
|
{
|
|
return ndbcluster_get_share(share);
|
|
}
|
|
|
|
inline void free_share(NDB_SHARE **share, bool have_lock= FALSE)
|
|
{
|
|
ndbcluster_free_share(share, have_lock);
|
|
}
|
|
|
|
inline void real_free_share(NDB_SHARE **share)
|
|
{
|
|
ndbcluster_real_free_share(share);
|
|
}
|
|
|
|
inline
|
|
Thd_ndb *
|
|
get_thd_ndb(THD *thd) { return (Thd_ndb *) thd->ha_data[ndbcluster_hton->slot]; }
|
|
|
|
inline
|
|
void
|
|
set_thd_ndb(THD *thd, Thd_ndb *thd_ndb) { thd->ha_data[ndbcluster_hton->slot]= thd_ndb; }
|
|
|
|
Ndb* check_ndb_in_thd(THD* thd);
|