├── gcache ├── NEWS ├── ChangeLog ├── AUTHORS ├── SConscript ├── CMakeLists.txt ├── tests │ ├── gcache_rb_test.hpp │ ├── gcache_mem_test.hpp │ ├── gcache_top_test.hpp │ ├── gcache_page_test.hpp │ ├── CMakeLists.txt │ ├── gcache_tests.hpp │ └── SConscript ├── Makefile.am ├── src │ ├── gcache_types.hpp │ ├── CMakeLists.txt │ ├── gcache.h │ ├── Makefile.am │ ├── SConscript │ └── gcache_seqno.hpp ├── bootstrap.sh └── README ├── debian ├── compat ├── source │ └── format ├── galera-4.install ├── galera-arbitrator-4.garb.init ├── galera-4.docs ├── galera-arbitrator-4.garb.default ├── galera-arbitrator-4.garb.service ├── galera-arbitrator-4.manpages ├── galera-4.links ├── galera-arbitrator-4.install ├── changelog ├── README.Maintainer ├── gbp.conf ├── upstream │ └── metadata ├── galera-arbitrator-4.lintian-overrides └── rules ├── scripts ├── packages │ ├── empty │ ├── debian │ ├── freebsd │ │ ├── galera-ldconfig │ │ ├── LICENSE │ │ ├── galera-comment │ │ ├── catalog.mk │ │ ├── galera-descr │ │ └── galera-message │ └── CMakeLists.txt ├── openrep │ ├── halt │ ├── kill │ ├── stop │ ├── demote │ ├── offline │ ├── online │ ├── prepare │ ├── promote │ ├── configure │ ├── flush │ ├── provision │ ├── release │ ├── status │ ├── waitevent │ ├── redundant │ ├── not_supported │ ├── common │ └── plugin.cnf ├── mysql │ ├── freebsd │ │ ├── client-message │ │ ├── client-ldconfig │ │ ├── client-comment │ │ ├── server-comment │ │ ├── LICENSE │ │ ├── client-descr │ │ ├── server-descr │ │ ├── catalog.mk │ │ └── server-message │ ├── debian │ │ ├── echo_stderr │ │ ├── mysql-server-wsrep.list │ │ └── etc │ │ │ ├── mysql │ │ │ └── conf.d │ │ │ │ └── mysqld_safe_syslog.cnf │ │ │ ├── logcheck │ │ │ └── ignore.d.paranoid │ │ │ │ └── mysql-server-5_1 │ │ │ └── logrotate.d │ │ │ └── mysql-server │ ├── LICENSE │ ├── mysql_var_5.5.tgz │ ├── mysql_var_5.6.tgz │ ├── mysql_var_5.7.tgz │ ├── mariadb_var_10.4.tgz │ ├── my-5.5.cnf │ ├── centos │ │ └── my.cnf │ └── my-5.1.cnf └── docker │ ├── entrypoint.sh │ ├── Dockerfile │ └── build.sh ├── AUTHORS ├── gcs ├── SConscript ├── doc │ ├── GCS_Architecture.odt │ └── GCS_Architecture.png ├── CMakeLists.txt ├── src │ ├── gcs_code_msg.cpp │ ├── unit_tests │ │ ├── gcs_fc_test.hpp │ │ ├── gcs_fifo_test.hpp │ │ ├── gcs_sm_test.hpp │ │ ├── gcs_comp_test.hpp │ │ ├── gcs_core_test.hpp │ │ ├── gcs_memb_test.hpp │ │ ├── gcs_node_test.hpp │ │ ├── gcs_state_msg_test.hpp │ │ ├── gcs_act_cchange_test.hpp │ │ ├── gcs_group_test.hpp │ │ ├── gcs_proto_test.hpp │ │ ├── gcs_defrag_test.hpp │ │ └── gcs_backend_test.hpp │ ├── gcs_priv.hpp │ ├── gcs_gcomm.hpp │ ├── gcs_spread.hpp │ ├── gcs_msg_type.cpp │ ├── gcs_seqno.hpp │ ├── gcs_test.sh │ ├── gcs_conf.cpp │ ├── gcs_recv_msg.hpp │ ├── gcs_gcache.hpp │ ├── gcs_error.cpp │ └── gcs_act.hpp └── README ├── galera ├── SConscript ├── src │ ├── data_set.cpp │ ├── wsrep_params.hpp │ ├── galera-sym.map │ ├── action_source.hpp │ ├── key_data.cpp │ ├── galera_view.cpp │ ├── galera_info.hpp │ ├── ist_proto.cpp │ └── replicator.cpp ├── CMakeLists.txt └── tests │ └── CMakeLists.txt ├── docs └── README ├── tests ├── conf │ ├── dummy.conf │ ├── my.cnf.1.tmpl │ ├── my.cnf.2.tmpl │ ├── my.cnf.3.tmpl │ ├── sqlgen.conf │ ├── common_my.cnf.tmpl │ └── README.md ├── test_dbt2 │ └── run.sh ├── test_dots │ └── run.sh ├── test_drupal │ ├── drupal6.10.tgz │ ├── drupal6.sql.gz │ ├── drupaldb.sql.gz │ └── loaddb.sh ├── test_insert │ ├── insert_small.sql │ ├── create_big.sql │ ├── create_small.sql │ └── insert_big.sql ├── tap │ └── README ├── test_causal │ └── SConstruct ├── scripts │ ├── remove.sh │ ├── signal.sh │ ├── kill.sh │ ├── misc.sh │ └── command.sh ├── test_upgrade │ └── README ├── test_pc_recovery │ └── README ├── test_stopcont │ └── README ├── run_test_set.sh ├── test_startstop │ └── run.sh ├── test_cppcheck │ └── run.sh ├── t │ └── dummy.sh ├── test_seesaw │ └── README ├── regressions │ ├── lp518749 │ │ └── run.sh │ ├── lp1184034 │ │ └── run.sh │ └── lp587170 │ │ └── run.sh ├── run_sqlgen.sh └── test_sqlgen │ └── run.sh ├── GALERA_VERSION ├── gcomm ├── SConscript ├── CMakeLists.txt └── src │ ├── uuid.cpp │ ├── protocol_version.hpp │ ├── socket.cpp │ ├── gcomm │ ├── exception.hpp │ ├── common.hpp │ └── protostack.hpp │ └── CMakeLists.txt ├── .gitmodules ├── galerautils ├── src │ ├── gu_buffer.cpp │ ├── gu_buf.hpp │ ├── gu_spooky.c │ ├── gu_types.hpp │ ├── gu_buf.h │ ├── gu_compiler.hpp │ ├── gu_asio_debug.hpp │ ├── gu_signals.cpp │ ├── gu_init.h │ ├── gu_abort.h │ ├── gu_exception.cpp │ ├── gu_init.c │ ├── gu_types.h │ ├── gu_assert.h │ ├── gu_inttypes.hpp │ ├── gu_histogram.hpp │ ├── gu_uuid.cpp │ ├── gu_asio_ssl.hpp │ ├── gu_conf.h │ ├── gu_backtrace.c │ ├── gu_gtid.cpp │ ├── gu_mmap.hpp │ ├── gu_assert.hpp │ ├── gu_rand.h │ ├── gu_errno.h │ ├── gu_backtrace.h │ ├── gu_enable_non_virtual_dtor.hpp │ ├── galerautils.h │ ├── gu_crc.hpp │ ├── gu_macros.hpp │ ├── gu_disable_non_virtual_dtor.hpp │ ├── gu_system.h │ ├── gu_hexdump.cpp │ ├── gu_utils.h │ ├── gu_array.hpp │ ├── gu_signals.hpp │ ├── gu_lock_step.h │ ├── gu_asio_utils.hpp │ ├── gu_status.hpp │ ├── gu_string_utils.hpp │ ├── gu_asio_io_service_impl.hpp │ ├── gu_hexdump.h │ ├── gu_stats.hpp │ ├── gu_abort.c │ └── gu_event_service.cpp ├── CMakeLists.txt ├── tests │ ├── gu_str_test.h │ ├── gu_dbug_test.h │ ├── gu_fifo_test.h │ ├── gu_mem_test.h │ ├── gu_time_test.h │ ├── gu_asio_test.hpp │ ├── gu_bswap_test.h │ ├── gu_utils_test.h │ ├── gu_gtid_test.hpp │ ├── gu_vlq_test.hpp │ ├── gu_uuid_test.h │ ├── gu_deqmap_test.hpp │ ├── gu_fnv_test.h │ ├── gu_net_test.hpp │ ├── gu_uri_test.hpp │ ├── gu_utils_test++.hpp │ ├── gu_hash_test.h │ ├── gu_mmh3_test.h │ ├── gu_stats_test.hpp │ ├── gu_thread_test.hpp │ ├── gu_alloc_test.hpp │ ├── gu_atomic_test.hpp │ ├── gu_rset_test.hpp │ ├── gu_config_test.hpp │ ├── gu_digest_test.hpp │ ├── gu_spooky_test.h │ ├── gu_lock_step_test.h │ ├── gu_histogram_test.hpp │ ├── gu_mem_pool_test.hpp │ ├── gu_string_test.hpp │ ├── gu_vector_test.hpp │ ├── gu_crc32c_test.h │ ├── gu_shared_ptr_test.hpp │ ├── gu_datetime_test.hpp │ ├── gu_string_utils_test.hpp │ ├── gu_histogram_test.cpp │ └── gu_time_test.c └── README ├── .whitesource ├── CONTRIBUTING.md ├── cmake ├── common.cmake ├── array.cmake ├── alignment.cmake ├── memorycheck.cmake ├── endian.cmake ├── shared_ptr.cmake ├── asio.cmake ├── coverage.cmake ├── asan.cmake └── os.cmake ├── garb ├── garb_logger.hpp ├── files │ ├── garb.service │ └── garb.cnf └── garb_gcs.hpp ├── asio └── asio │ ├── unyield.hpp │ ├── yield.hpp │ ├── ts │ ├── io_context.hpp │ ├── buffer.hpp │ ├── net.hpp │ ├── timer.hpp │ ├── socket.hpp │ └── executor.hpp │ ├── io_service_strand.hpp │ ├── buffered_stream_fwd.hpp │ ├── version.hpp │ ├── buffered_read_stream_fwd.hpp │ ├── buffered_write_stream_fwd.hpp │ ├── impl │ ├── src.cpp │ ├── system_context.hpp │ └── executor.ipp │ ├── signal_set.hpp │ ├── detail │ ├── limits.hpp │ ├── cstddef.hpp │ ├── date_time_fwd.hpp │ ├── regex_fwd.hpp │ ├── dependent_type.hpp │ ├── win_iocp_thread_info.hpp │ ├── assert.hpp │ ├── operation.hpp │ ├── reactor.hpp │ ├── array_fwd.hpp │ ├── array.hpp │ ├── functional.hpp │ ├── noncopyable.hpp │ ├── wait_op.hpp │ ├── fd_set_adapter.hpp │ ├── null_fenced_block.hpp │ ├── scheduler_thread_info.hpp │ ├── resolve_op.hpp │ ├── signal_init.hpp │ ├── timer_scheduler.hpp │ └── reactor_fwd.hpp │ ├── ssl.hpp │ ├── ssl │ ├── impl │ │ └── src.hpp │ └── detail │ │ └── openssl_types.hpp │ ├── streambuf.hpp │ ├── io_service.hpp │ ├── basic_streambuf_fwd.hpp │ ├── serial_port.hpp │ ├── posix │ ├── descriptor.hpp │ └── stream_descriptor.hpp │ ├── windows │ ├── stream_handle.hpp │ └── object_handle.hpp │ ├── ip │ └── host_name.hpp │ └── deadline_timer.hpp ├── common └── common.h ├── wsrep └── tests │ └── CMakeLists.txt ├── man └── garb-systemd.8 ├── .bzrignore └── .travis.yml /gcache/NEWS: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /gcache/ChangeLog: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 10 2 | -------------------------------------------------------------------------------- /scripts/packages/empty: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /scripts/openrep/halt: -------------------------------------------------------------------------------- 1 | service -------------------------------------------------------------------------------- /scripts/openrep/kill: -------------------------------------------------------------------------------- 1 | service -------------------------------------------------------------------------------- /scripts/openrep/stop: -------------------------------------------------------------------------------- 1 | service -------------------------------------------------------------------------------- /scripts/openrep/demote: -------------------------------------------------------------------------------- 1 | redundant -------------------------------------------------------------------------------- /scripts/openrep/offline: -------------------------------------------------------------------------------- 1 | service -------------------------------------------------------------------------------- /scripts/openrep/online: -------------------------------------------------------------------------------- 1 | service -------------------------------------------------------------------------------- /scripts/openrep/prepare: -------------------------------------------------------------------------------- 1 | redundant -------------------------------------------------------------------------------- /scripts/openrep/promote: -------------------------------------------------------------------------------- 1 | redundant -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /scripts/mysql/freebsd/client-message: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /scripts/openrep/configure: -------------------------------------------------------------------------------- 1 | redundant -------------------------------------------------------------------------------- /scripts/openrep/flush: -------------------------------------------------------------------------------- 1 | not_supported -------------------------------------------------------------------------------- /scripts/openrep/provision: -------------------------------------------------------------------------------- 1 | not_supported -------------------------------------------------------------------------------- /scripts/openrep/release: -------------------------------------------------------------------------------- 1 | not_supported -------------------------------------------------------------------------------- /scripts/openrep/status: -------------------------------------------------------------------------------- 1 | not_supported -------------------------------------------------------------------------------- /scripts/openrep/waitevent: -------------------------------------------------------------------------------- 1 | not_supported -------------------------------------------------------------------------------- /scripts/packages/debian: -------------------------------------------------------------------------------- 1 | ../../debian -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Codership Oy 2 | -------------------------------------------------------------------------------- /gcs/SConscript: -------------------------------------------------------------------------------- 1 | SConscript('src/SConscript') 2 | -------------------------------------------------------------------------------- /debian/galera-4.install: -------------------------------------------------------------------------------- 1 | usr/lib/libgalera_smm.so 2 | -------------------------------------------------------------------------------- /gcache/AUTHORS: -------------------------------------------------------------------------------- 1 | Codership Oy 2 | -------------------------------------------------------------------------------- /debian/galera-arbitrator-4.garb.init: -------------------------------------------------------------------------------- 1 | ../garb/files/garb.sh -------------------------------------------------------------------------------- /debian/galera-4.docs: -------------------------------------------------------------------------------- 1 | AUTHORS 2 | scripts/packages/README 3 | -------------------------------------------------------------------------------- /debian/galera-arbitrator-4.garb.default: -------------------------------------------------------------------------------- 1 | ../garb/files/garb.cnf -------------------------------------------------------------------------------- /scripts/mysql/freebsd/client-ldconfig: -------------------------------------------------------------------------------- 1 | /usr/local/lib/mysql 2 | -------------------------------------------------------------------------------- /debian/galera-arbitrator-4.garb.service: -------------------------------------------------------------------------------- 1 | ../garb/files/garb.service -------------------------------------------------------------------------------- /scripts/mysql/debian/echo_stderr: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "$*" 1>&2 3 | -------------------------------------------------------------------------------- /scripts/packages/freebsd/galera-ldconfig: -------------------------------------------------------------------------------- 1 | /usr/local/lib/galera 2 | -------------------------------------------------------------------------------- /debian/galera-arbitrator-4.manpages: -------------------------------------------------------------------------------- 1 | man/garb-systemd.8 2 | man/garbd.8 3 | -------------------------------------------------------------------------------- /galera/SConscript: -------------------------------------------------------------------------------- 1 | 2 | SConscript(['src/SConscript', 'tests/SConscript']) 3 | -------------------------------------------------------------------------------- /scripts/mysql/debian/mysql-server-wsrep.list: -------------------------------------------------------------------------------- 1 | %include ${MYSQL_MAJOR}.list 2 | -------------------------------------------------------------------------------- /debian/galera-4.links: -------------------------------------------------------------------------------- 1 | usr/lib/libgalera_smm.so usr/lib/galera/libgalera_smm.so 2 | -------------------------------------------------------------------------------- /docs/README: -------------------------------------------------------------------------------- 1 | Documentation moved to https://github.com/codership/documentation 2 | -------------------------------------------------------------------------------- /scripts/mysql/LICENSE: -------------------------------------------------------------------------------- 1 | See ./mysql/LICENSE.mysql and ./galera/LICENSE.galera 2 | -------------------------------------------------------------------------------- /debian/galera-arbitrator-4.install: -------------------------------------------------------------------------------- 1 | garb/files/garb-systemd usr/bin 2 | usr/bin/garbd 3 | -------------------------------------------------------------------------------- /scripts/mysql/debian/etc/mysql/conf.d/mysqld_safe_syslog.cnf: -------------------------------------------------------------------------------- 1 | [mysqld_safe] 2 | syslog 3 | -------------------------------------------------------------------------------- /scripts/mysql/freebsd/client-comment: -------------------------------------------------------------------------------- 1 | wsrep-enabled multithreaded SQL database (client) 2 | -------------------------------------------------------------------------------- /scripts/mysql/freebsd/server-comment: -------------------------------------------------------------------------------- 1 | wsrep-enabled multithreaded SQL database (server) 2 | -------------------------------------------------------------------------------- /tests/conf/dummy.conf: -------------------------------------------------------------------------------- 1 | # Script arguments 2 | t/dummy.sh arg1 arg2 3 | t/dummy.sh arg3 arg4 4 | -------------------------------------------------------------------------------- /tests/test_dbt2/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "Not implemented" > $GALERA_RESULT_DIR/out 4 | exit 1 5 | -------------------------------------------------------------------------------- /tests/test_dots/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "Not implemented" > $GALERA_RESULT_DIR/out 4 | exit 1 5 | -------------------------------------------------------------------------------- /gcs/doc/GCS_Architecture.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mariadb-corporation/galera/HEAD/gcs/doc/GCS_Architecture.odt -------------------------------------------------------------------------------- /gcs/doc/GCS_Architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mariadb-corporation/galera/HEAD/gcs/doc/GCS_Architecture.png -------------------------------------------------------------------------------- /scripts/mysql/freebsd/LICENSE: -------------------------------------------------------------------------------- 1 | This package has a single license: GPLv3 (GNU General Public License version 3). 2 | -------------------------------------------------------------------------------- /scripts/packages/freebsd/LICENSE: -------------------------------------------------------------------------------- 1 | This package has a single license: GPLv2 (GNU General Public License version 2). 2 | -------------------------------------------------------------------------------- /scripts/packages/freebsd/galera-comment: -------------------------------------------------------------------------------- 1 | Galera: a synchronous multi-master wsrep provider (replication engine) 2 | -------------------------------------------------------------------------------- /gcs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2020 Codership Oy 3 | # 4 | 5 | add_subdirectory(src) 6 | -------------------------------------------------------------------------------- /GALERA_VERSION: -------------------------------------------------------------------------------- 1 | GALERA_VERSION_WSREP_API=26 2 | GALERA_VERSION_MAJOR=4 3 | GALERA_VERSION_MINOR=24 4 | GALERA_VERSION_EXTRA= 5 | -------------------------------------------------------------------------------- /gcache/SConscript: -------------------------------------------------------------------------------- 1 | # SConscript for building galerautils 2 | 3 | SConscript(Split('''src/SConscript tests/SConscript''')) 4 | -------------------------------------------------------------------------------- /gcomm/SConscript: -------------------------------------------------------------------------------- 1 | # SCons build script for building gcomm 2 | 3 | SConscript(Split('''src/SConscript test/SConscript''')) 4 | -------------------------------------------------------------------------------- /scripts/mysql/mysql_var_5.5.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mariadb-corporation/galera/HEAD/scripts/mysql/mysql_var_5.5.tgz -------------------------------------------------------------------------------- /scripts/mysql/mysql_var_5.6.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mariadb-corporation/galera/HEAD/scripts/mysql/mysql_var_5.6.tgz -------------------------------------------------------------------------------- /scripts/mysql/mysql_var_5.7.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mariadb-corporation/galera/HEAD/scripts/mysql/mysql_var_5.7.tgz -------------------------------------------------------------------------------- /tests/test_drupal/drupal6.10.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mariadb-corporation/galera/HEAD/tests/test_drupal/drupal6.10.tgz -------------------------------------------------------------------------------- /tests/test_drupal/drupal6.sql.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mariadb-corporation/galera/HEAD/tests/test_drupal/drupal6.sql.gz -------------------------------------------------------------------------------- /tests/test_drupal/drupaldb.sql.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mariadb-corporation/galera/HEAD/tests/test_drupal/drupaldb.sql.gz -------------------------------------------------------------------------------- /scripts/mysql/mariadb_var_10.4.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mariadb-corporation/galera/HEAD/scripts/mysql/mariadb_var_10.4.tgz -------------------------------------------------------------------------------- /tests/conf/my.cnf.1.tmpl: -------------------------------------------------------------------------------- 1 | wsrep_sst_method=rsync 2 | wsrep_sst_auth=root:rootpass 3 | wsrep_sst_receive_address=127.0.1.1:10013 4 | -------------------------------------------------------------------------------- /tests/conf/my.cnf.2.tmpl: -------------------------------------------------------------------------------- 1 | wsrep_sst_method=rsync 2 | wsrep_sst_auth=root:rootpass 3 | wsrep_sst_receive_address=127.0.1.1:10023 4 | -------------------------------------------------------------------------------- /tests/conf/my.cnf.3.tmpl: -------------------------------------------------------------------------------- 1 | wsrep_sst_method=mysqldump 2 | wsrep_sst_auth=root:rootpass 3 | wsrep_sst_receive_address=127.0.1.1:3313 4 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "wsrep-API"] 2 | path = wsrep/src 3 | url = https://github.com/codership/wsrep-API.git 4 | branch = master 5 | -------------------------------------------------------------------------------- /galera/src/data_set.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2013 Codership Oy 3 | // 4 | 5 | #include "data_set.hpp" 6 | 7 | -------------------------------------------------------------------------------- /galerautils/src/gu_buffer.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2010 Codership Oy 3 | // 4 | 5 | #include "gu_buffer.hpp" 6 | 7 | -------------------------------------------------------------------------------- /galera/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2020 Codership Oy 3 | # 4 | 5 | add_subdirectory(src) 6 | add_subdirectory(tests) 7 | -------------------------------------------------------------------------------- /gcache/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2020 Codership Oy 3 | # 4 | 5 | add_subdirectory(src) 6 | add_subdirectory(tests) 7 | -------------------------------------------------------------------------------- /galerautils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2020 Codership Oy 3 | # 4 | 5 | add_subdirectory(src) 6 | add_subdirectory(tests) 7 | -------------------------------------------------------------------------------- /gcomm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2020 Codership Oy 3 | # 4 | 5 | add_subdirectory(src) 6 | add_subdirectory(test) 7 | 8 | -------------------------------------------------------------------------------- /tests/conf/sqlgen.conf: -------------------------------------------------------------------------------- 1 | # Script 2 | test_sqlgen/run.sh --create 1 --rows 500 --duration 10 3 | test_sqlgen/run.sh --create 1 --rows 1000 --duration 10 4 | -------------------------------------------------------------------------------- /tests/test_insert/insert_small.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO test_insert VALUES ( 2 | DEFAULT, 3 | RAND(), 4 | CURRENT_DATE, 5 | CURRENT_TIME, 6 | 'pokemon', 7 | 'drizzl' 8 | ); 9 | -------------------------------------------------------------------------------- /.whitesource: -------------------------------------------------------------------------------- 1 | { 2 | "checkRunSettings": { 3 | "vulnerableCheckRunConclusionLevel": "failure" 4 | }, 5 | "issueSettings": { 6 | "minSeverityLevel": "LOW" 7 | } 8 | } -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | galera-4 (26.4.24) UNRELEASED; urgency=medium 2 | 3 | * Galera 4 release 4 | 5 | -- Codership Oy Mon, 08 Sep 2025 15:06:14 +0300 6 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | If you would like to contribute code to this repository, please sign the Contributor License Agreement. 2 | -------------------------------------------------------------------------------- /scripts/openrep/redundant: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Copuright (C) 2009 Codership Oy 4 | 5 | echo "Operation is redundant: $(basename $0 | sed s/\.sh//)" 6 | exit 0 7 | -------------------------------------------------------------------------------- /scripts/openrep/not_supported: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Copuright (C) 2009 Codership Oy 4 | 5 | echo "Operation not supported: $(basename $0 | sed s/\.sh//)" 6 | exit 0 7 | -------------------------------------------------------------------------------- /tests/test_insert/create_big.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE test_insert ( 2 | i INT AUTO_INCREMENT PRIMARY KEY, 3 | f FLOAT, 4 | d DATE, 5 | t TIME, 6 | c CHAR(32), 7 | v VARCHAR(1024) 8 | ) ENGINE=InnoDB; 9 | -------------------------------------------------------------------------------- /tests/test_insert/create_small.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE test_insert ( 2 | i INT AUTO_INCREMENT PRIMARY KEY, 3 | f FLOAT, 4 | d DATE, 5 | t TIME, 6 | c CHAR(8), 7 | v VARCHAR(1024) 8 | ) ENGINE=InnoDB; 9 | -------------------------------------------------------------------------------- /scripts/openrep/common: -------------------------------------------------------------------------------- 1 | set -x 2 | 3 | MYSQL_BIN=${MYSQL_BIN:-"$MYSQL_ROOT/libexec/mysqld"} 4 | MYSQL_DATA_DIR=${MYSQL_DATA_DIR:-"$MYSQL_ROOT/var"} 5 | MYSQL_CNF=${MYSQL_CNF:-"$MYSQL_ROOT/etc/my.cnf"} 6 | -------------------------------------------------------------------------------- /debian/README.Maintainer: -------------------------------------------------------------------------------- 1 | Build the native Debian packaging using: 2 | $ cd galera 3 | $ git clean -d -f && git reset --hard # clean up any cruft from previous builds 4 | $ dpkg-buildpackage -us -uc -b 5 | 6 | -------------------------------------------------------------------------------- /scripts/mysql/my-5.5.cnf: -------------------------------------------------------------------------------- 1 | # Default mysqld options 2 | [mysqld] 3 | core-file 4 | innodb_buffer_pool_size=420M 5 | innodb_log_file_size=100M 6 | innodb_flush_log_at_trx_commit=2 7 | max_connections=1024 8 | 9 | -------------------------------------------------------------------------------- /cmake/common.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2020 Codership Oy 3 | # 4 | # Common definitions for all modules. 5 | 6 | # Make common/common.h to be included. 7 | add_definitions(-DHAVE_COMMON_H) 8 | -------------------------------------------------------------------------------- /scripts/packages/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2020 Codership Oy 3 | # 4 | 5 | configure_file(codership-galera.spec.in 6 | ${CMAKE_CURRENT_BINARY_DIR}/codership-galera.spec @ONLY) 7 | -------------------------------------------------------------------------------- /gcomm/src/uuid.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 Codership Oy 3 | */ 4 | 5 | #include "gcomm/uuid.hpp" 6 | 7 | 8 | const gcomm::UUID gcomm::UUID::uuid_nil_ = gcomm::UUID(GU_UUID_NIL); 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/tap/README: -------------------------------------------------------------------------------- 1 | 2 | Required packages to run run_test_set.pl 3 | 4 | - TAP::Parser perl module 5 | + 6 | + Ubuntu package: libtap-parser-perl 7 | + CentOS: ? 8 | + Directly from CPAN: http://search.cpan.org/dist/TAP-Parser/ -------------------------------------------------------------------------------- /cmake/array.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2020 Codership Oy 3 | # 4 | 5 | if (CMAKE_CXX_STANDARD EQUAL 98) 6 | add_definitions(-DHAVE_BOOST_ARRAY_HPP) 7 | else() 8 | add_definitions(-DHAVE_STD_ARRAY) 9 | endif() 10 | -------------------------------------------------------------------------------- /debian/gbp.conf: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | # Ignore requirement to use branch name 'master' to make it easier 3 | # for contributors to work with feature and bugfix branches 4 | ignore-branch = True 5 | 6 | # native package configuration 7 | pristine-tar = False 8 | -------------------------------------------------------------------------------- /galerautils/tests/gu_str_test.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007 Codership Oy 2 | 3 | 4 | 5 | #ifndef __gu_str_test__ 6 | #define __gu_str_test__ 7 | 8 | extern Suite *gu_str_suite(void); 9 | 10 | #endif /* __gu_str_test__ */ 11 | -------------------------------------------------------------------------------- /debian/upstream/metadata: -------------------------------------------------------------------------------- 1 | Bug-Database: https://github.com/codership/galera/issues 2 | Bug-Submit: https://github.com/codership/galera/issues/new 3 | Repository: https://github.com/codership/galera.git 4 | Repository-Browse: https://github.com/codership/galera 5 | -------------------------------------------------------------------------------- /galerautils/tests/gu_dbug_test.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2008 Codership Oy 2 | 3 | // $Id$ 4 | 5 | #ifndef __gu_dbug_test__ 6 | #define __gu_dbug_test__ 7 | 8 | Suite *gu_dbug_suite(void); 9 | 10 | #endif /* __gu_dbug_test__ */ 11 | -------------------------------------------------------------------------------- /galerautils/tests/gu_fifo_test.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007 Codership Oy 2 | 3 | // $Id$ 4 | 5 | #ifndef __gu_fifo_test__ 6 | #define __gu_fifo_test__ 7 | 8 | Suite *gu_fifo_suite(void); 9 | 10 | #endif /* __gu_fifo_test__ */ 11 | -------------------------------------------------------------------------------- /galerautils/tests/gu_mem_test.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007 Codership Oy 2 | 3 | // $Id$ 4 | 5 | #ifndef __gu_mem_test__ 6 | #define __gu_mem_test__ 7 | 8 | extern Suite *gu_mem_suite(void); 9 | 10 | #endif /* __gu_mem_test__ */ 11 | -------------------------------------------------------------------------------- /galerautils/tests/gu_time_test.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007 Codership Oy 2 | 3 | // $Id$ 4 | 5 | #ifndef __gu_time_test__ 6 | #define __gu_time_test__ 7 | 8 | Suite *gu_time_suite(void); 9 | 10 | #endif /* __gu_time_test__ */ 11 | -------------------------------------------------------------------------------- /galerautils/tests/gu_asio_test.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Codership Oy 3 | */ 4 | 5 | #ifndef GU_ASIO_TEST_HPP 6 | #define GU_ASIO_TEST_HPP 7 | #include 8 | Suite* gu_asio_suite(); 9 | #endif // GU_ASIO_TEST_HPP 10 | -------------------------------------------------------------------------------- /galerautils/tests/gu_bswap_test.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007 Codership Oy 2 | 3 | // $Id$ 4 | 5 | #ifndef __gu_bswap_test__ 6 | #define __gu_bswap_test__ 7 | 8 | Suite *gu_bswap_suite(void); 9 | 10 | #endif /* __gu_bswap_test__ */ 11 | -------------------------------------------------------------------------------- /galerautils/tests/gu_utils_test.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2010 Codership Oy 2 | 3 | // $Id$ 4 | 5 | #ifndef __gu_utils_test__ 6 | #define __gu_utils_test__ 7 | 8 | Suite *gu_utils_suite(void); 9 | 10 | #endif /* __gu_utils_test__ */ 11 | -------------------------------------------------------------------------------- /gcomm/src/protocol_version.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Codership Oy 3 | */ 4 | #ifndef GCOMM_PROTOCOL_VERSION_HPP 5 | #define GCOMM_PROTOCOL_VERSION_HPP 6 | #define GCOMM_PROTOCOL_MAX_VERSION 1 7 | #endif // GCOMM_PROTOCOL_VERSION_HPP 8 | -------------------------------------------------------------------------------- /scripts/packages/freebsd/catalog.mk: -------------------------------------------------------------------------------- 1 | _LICENSE=GPLv2 2 | _LICENSE_NAME=GNU General Public License version 2 3 | _LICENSE_PERMS=dist-mirror dist-sell pkg-mirror pkg-sell auto-accept 4 | _LICENSE_GROUPS=FSF GPL OSI 5 | _LICENSE_DISTFILES=galera-%{RELEASE}-src.tar.gz 6 | -------------------------------------------------------------------------------- /debian/galera-arbitrator-4.lintian-overrides: -------------------------------------------------------------------------------- 1 | # garbd is intentionally not started automatically upon installation, 2 | # see https://github.com/codership/galera/issues/266 3 | galera-arbitrator-4: script-in-etc-init.d-not-registered-via-update-rc.d etc/init.d/garb 4 | 5 | -------------------------------------------------------------------------------- /galerautils/tests/gu_gtid_test.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 Codership Oy 2 | 3 | #ifndef gu_gtid_test_hpp 4 | #define gu_gtid_test_hpp 5 | 6 | #include 7 | 8 | Suite* gu_gtid_suite(void); 9 | 10 | #endif /* gu_gtid_test_hpp */ 11 | -------------------------------------------------------------------------------- /scripts/mysql/freebsd/client-descr: -------------------------------------------------------------------------------- 1 | MySQL is a very fast, multi-threaded, multi-user and robust SQL 2 | (Structured Query Language) database server. 3 | 4 | WWW: http://www.mysql.com/ 5 | 6 | Built with wsrep patch %{RELEASE}. 7 | 8 | WWW: http://www.codership.com/ 9 | -------------------------------------------------------------------------------- /scripts/mysql/freebsd/server-descr: -------------------------------------------------------------------------------- 1 | MySQL is a very fast, multi-threaded, multi-user and robust SQL 2 | (Structured Query Language) database server. 3 | 4 | WWW: http://www.mysql.com/ 5 | 6 | Built with wsrep patch %{RELEASE}. 7 | 8 | WWW: http://www.codership.com/ 9 | -------------------------------------------------------------------------------- /galerautils/tests/gu_vlq_test.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2011 Codership Oy 3 | // 4 | 5 | #ifndef GU_VLQ_TEST_HPP 6 | #define GU_VLQ_TEST_HPP 7 | 8 | #include 9 | 10 | Suite* gu_vlq_suite(); 11 | 12 | #endif // GU_VLQ_TEST_HPP 13 | -------------------------------------------------------------------------------- /galerautils/tests/gu_uuid_test.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | 7 | #ifndef __gu_uuid_test__ 8 | #define __gu_uuid_test__ 9 | 10 | extern Suite *gu_uuid_suite(void); 11 | 12 | #endif /* __gu_uuid_test__ */ 13 | -------------------------------------------------------------------------------- /gcs/src/gcs_code_msg.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Codership Oy 3 | */ 4 | 5 | #include "gcs_code_msg.hpp" 6 | 7 | void 8 | gcs::core::CodeMsg::print(std::ostream& os) const 9 | { 10 | os << gu::GTID(uuid(), seqno()) << ',' << code(); 11 | } 12 | -------------------------------------------------------------------------------- /gcs/src/unit_tests/gcs_fc_test.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2010 Codership Oy 2 | 3 | // $Id$ 4 | 5 | #ifndef __gcs_fc_test__ 6 | #define __gcs_fc_test__ 7 | 8 | #include 9 | 10 | Suite *gcs_fc_suite(void); 11 | 12 | #endif /* __gcs_fc_test__ */ 13 | -------------------------------------------------------------------------------- /galerautils/tests/gu_deqmap_test.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2020 Codership Oy 2 | 3 | #ifndef __gu_deqmap_test__ 4 | #define __gu_deqmap_test__ 5 | 6 | #include 7 | 8 | extern Suite *gu_deqmap_suite(void); 9 | 10 | #endif /* __gu_deqmap_test__ */ 11 | -------------------------------------------------------------------------------- /galerautils/tests/gu_fnv_test.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2012 Codership Oy 2 | 3 | // $Id$ 4 | 5 | #ifndef __gu_fnv_test__ 6 | #define __gu_fnv_test__ 7 | 8 | #include 9 | 10 | extern Suite *gu_fnv_suite(void); 11 | 12 | #endif /* __gu_fnv_test__ */ 13 | -------------------------------------------------------------------------------- /galerautils/tests/gu_net_test.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007 Codership Oy 2 | 3 | // $Id$ 4 | 5 | #ifndef __gu_net_test__ 6 | #define __gu_net_test__ 7 | 8 | #include 9 | 10 | extern Suite *gu_net_suite(void); 11 | 12 | #endif /* __gu_net_test__ */ 13 | -------------------------------------------------------------------------------- /galerautils/tests/gu_uri_test.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007 Codership Oy 2 | 3 | // $Id$ 4 | 5 | #ifndef __gu_uri_test__ 6 | #define __gu_uri_test__ 7 | 8 | #include 9 | 10 | extern Suite *gu_uri_suite(void); 11 | 12 | #endif /* __gu_uri_test__ */ 13 | -------------------------------------------------------------------------------- /galerautils/tests/gu_utils_test++.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2022 Codership Oy 2 | 3 | #ifndef __gu_utils_test_hpp__ 4 | #define __gu_utils_test_hpp__ 5 | 6 | #include 7 | 8 | Suite* gu_utils_cpp_suite(); 9 | 10 | #endif /* __gu_utils_test_hpp__ */ 11 | -------------------------------------------------------------------------------- /galerautils/tests/gu_hash_test.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2012 Codership Oy 2 | 3 | // $Id$ 4 | 5 | #ifndef __gu_hash_test__ 6 | #define __gu_hash_test__ 7 | 8 | #include 9 | 10 | extern Suite *gu_hash_suite(void); 11 | 12 | #endif /* __gu_hash_test__ */ 13 | -------------------------------------------------------------------------------- /galerautils/tests/gu_mmh3_test.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2012 Codership Oy 2 | 3 | // $Id$ 4 | 5 | #ifndef __gu_mmh3_test__ 6 | #define __gu_mmh3_test__ 7 | 8 | #include 9 | 10 | extern Suite *gu_mmh3_suite(void); 11 | 12 | #endif /* __gu_mmh3_test__ */ 13 | -------------------------------------------------------------------------------- /galerautils/tests/gu_stats_test.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Codership Oy 3 | */ 4 | 5 | #ifndef __gu_stats_test__ 6 | #define __gu_stats_test__ 7 | 8 | #include 9 | 10 | extern Suite *gu_stats_suite(void); 11 | 12 | #endif // __gu_stats_test__ 13 | -------------------------------------------------------------------------------- /galerautils/tests/gu_thread_test.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2016 Codership Oy 3 | // 4 | 5 | #ifndef GU_THREAD_TEST_HPP 6 | #define GU_THREAD_TEST_HPP 7 | 8 | #include 9 | 10 | extern Suite *gu_thread_suite(); 11 | 12 | #endif // GU_THREAD_TEST_HPP 13 | -------------------------------------------------------------------------------- /galerautils/tests/gu_alloc_test.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 Codership Oy 2 | 3 | // $Id$ 4 | 5 | #ifndef __gu_alloc_test__ 6 | #define __gu_alloc_test__ 7 | 8 | #include 9 | 10 | extern Suite *gu_alloc_suite(void); 11 | 12 | #endif /* __gu_alloc_test__ */ 13 | -------------------------------------------------------------------------------- /galerautils/tests/gu_atomic_test.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Codership Oy 2 | 3 | // $Id$ 4 | 5 | #ifndef __gu_atomic_test__ 6 | #define __gu_atomic_test__ 7 | 8 | #include 9 | 10 | Suite *gu_atomic_suite(void); 11 | 12 | #endif /* __gu_atomic_test__ */ 13 | -------------------------------------------------------------------------------- /galerautils/tests/gu_rset_test.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2013 Codership Oy 2 | * 3 | * $Id$ 4 | */ 5 | 6 | #ifndef __gu_rset_test__ 7 | #define __gu_rset_test__ 8 | 9 | #include 10 | 11 | Suite *gu_rset_suite(void); 12 | 13 | #endif /* __gu_rset_test__ */ 14 | -------------------------------------------------------------------------------- /gcs/src/unit_tests/gcs_fifo_test.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007-2015 Codership Oy 2 | 3 | // $Id$ 4 | 5 | #ifndef __gcs_fifo_test__ 6 | #define __gcs_fifo_test__ 7 | 8 | #include 9 | 10 | Suite *gcs_fifo_suite(void); 11 | 12 | #endif /* __gcs_fifo_test__ */ 13 | -------------------------------------------------------------------------------- /gcs/src/unit_tests/gcs_sm_test.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007-2015 Codership Oy 2 | 3 | // $Id$ 4 | 5 | #ifndef __gcs_sm_test__ 6 | #define __gcs_sm_test__ 7 | 8 | #include 9 | 10 | Suite *gcs_send_monitor_suite(void); 11 | 12 | #endif /* __gcs_sm_test__ */ 13 | -------------------------------------------------------------------------------- /scripts/docker/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eu 2 | 3 | # Assume source tree is rooted in output 4 | cd /output 5 | export CFLAGS='-Werror -Wno-deprecated-declarations' 6 | export CMAKE_OPTS='-DGALERA_WITH_UBSAN:BOOL=ON' 7 | export UBSAN_OPTIONS="halt_on_error=1" 8 | ./scripts/build.sh -o --cmake 9 | -------------------------------------------------------------------------------- /scripts/mysql/freebsd/catalog.mk: -------------------------------------------------------------------------------- 1 | _LICENSE=GPLv3 2 | _LICENSE_NAME=GNU General Public License version 3 3 | _LICENSE_PERMS=dist-mirror dist-sell pkg-mirror pkg-sell auto-accept 4 | _LICENSE_GROUPS=FSF GPL OSI 5 | _LICENSE_DISTFILES=mysql-%{MYSQL_VER}.tar.gz mysql-${MYSQL_VER}_wsrep_${RELEASE}.patch 6 | -------------------------------------------------------------------------------- /galerautils/tests/gu_config_test.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 Codership Oy 2 | 3 | // $Id$ 4 | 5 | #ifndef __gu_config_test__ 6 | #define __gu_config_test__ 7 | 8 | #include 9 | 10 | extern Suite *gu_config_suite(void); 11 | 12 | #endif /* __gu_config_test__ */ 13 | -------------------------------------------------------------------------------- /galerautils/tests/gu_digest_test.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2012 Codership Oy 2 | 3 | // $Id$ 4 | 5 | #ifndef __gu_digest_test__ 6 | #define __gu_digest_test__ 7 | 8 | #include 9 | 10 | extern Suite *gu_digest_suite(void); 11 | 12 | #endif /* __gu_digest_test__ */ 13 | -------------------------------------------------------------------------------- /galerautils/tests/gu_spooky_test.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2012 Codership Oy 2 | 3 | // $Id$ 4 | 5 | #ifndef __gu_spooky_test__ 6 | #define __gu_spooky_test__ 7 | 8 | #include 9 | 10 | extern Suite *gu_spooky_suite(void); 11 | 12 | #endif /* __gu_spooky_test__ */ 13 | -------------------------------------------------------------------------------- /tests/test_causal/SConstruct: -------------------------------------------------------------------------------- 1 | Program('causal.cpp', 2 | CXXFLAGS='-O2 -std=c++0x', 3 | CPPFLAGS='-I../../galerautils/src -I/usr/include/mysql++ -I/usr/include/mysql', 4 | LIBS=['mysqlpp', 'boost_program_options', 'galerautils++'], 5 | LIBPATH=['../../galerautils/src']) 6 | -------------------------------------------------------------------------------- /galerautils/tests/gu_lock_step_test.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | 7 | #ifndef __gu_lock_step_test__ 8 | #define __gu_lock_step_test__ 9 | 10 | extern Suite *gu_lock_step_suite(void); 11 | 12 | #endif /* __gu_lock_step_test__ */ 13 | -------------------------------------------------------------------------------- /galerautils/tests/gu_histogram_test.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Codership Oy 3 | */ 4 | 5 | #ifndef __gu_histogram_test__ 6 | #define __gu_histogram_test__ 7 | 8 | #include 9 | 10 | extern Suite *gu_histogram_suite(void); 11 | 12 | #endif // __gu_histogram_test__ 13 | -------------------------------------------------------------------------------- /galerautils/tests/gu_mem_pool_test.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 Codership Oy 2 | 3 | // $Id$ 4 | 5 | #ifndef __gu_mem_pool_test__ 6 | #define __gu_mem_pool_test__ 7 | 8 | #include 9 | 10 | extern Suite *gu_mem_pool_suite(void); 11 | 12 | #endif /* __gu_mem_pool_test__ */ 13 | -------------------------------------------------------------------------------- /galerautils/tests/gu_string_test.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2013 Codership Oy 2 | * 3 | * $Id$ 4 | */ 5 | 6 | #ifndef __gu_string_test__ 7 | #define __gu_string_test__ 8 | 9 | #include 10 | 11 | extern Suite *gu_string_suite(void); 12 | 13 | #endif /* __gu_string_test__ */ 14 | -------------------------------------------------------------------------------- /galerautils/tests/gu_vector_test.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2013 Codership Oy 2 | * 3 | * $Id$ 4 | */ 5 | 6 | #ifndef __gu_vector_test__ 7 | #define __gu_vector_test__ 8 | 9 | #include 10 | 11 | extern Suite *gu_vector_suite(void); 12 | 13 | #endif /* __gu_vector_test__ */ 14 | -------------------------------------------------------------------------------- /scripts/mysql/freebsd/server-message: -------------------------------------------------------------------------------- 1 | ************************************************************************ 2 | 3 | Remember to run mysql_upgrade the first time you start the MySQL server 4 | after an upgrade from an earlier version. 5 | 6 | ************************************************************************ 7 | -------------------------------------------------------------------------------- /galerautils/tests/gu_crc32c_test.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | 7 | #ifndef __gu_crc32c_test_h__ 8 | #define __gu_crc32c_test_h__ 9 | 10 | #include 11 | 12 | Suite* gu_crc32c_suite(void); 13 | 14 | #endif /* __gu_crc32c_test_h__ */ 15 | -------------------------------------------------------------------------------- /galerautils/tests/gu_shared_ptr_test.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2015 Codership Oy 3 | // 4 | 5 | #ifndef GU_SHARED_PTR_TEST_HPP 6 | #define GU_SHARED_PTR_TEST_HPP 7 | 8 | #include 9 | 10 | extern Suite* gu_shared_ptr_suite(void); 11 | 12 | #endif // ! GU_SHARED_PTR_TEST_HPP 13 | -------------------------------------------------------------------------------- /gcs/src/unit_tests/gcs_comp_test.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008-2015 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | 7 | #ifndef __gcs_comp_test__ 8 | #define __gcs_comp_test__ 9 | 10 | #include 11 | 12 | extern Suite *gcs_comp_suite(void); 13 | 14 | #endif /* __gu_comp_test__ */ 15 | -------------------------------------------------------------------------------- /gcs/src/unit_tests/gcs_core_test.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008-2015 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | 7 | #ifndef __gcs_core_test__ 8 | #define __gcs_core_test__ 9 | 10 | #include 11 | 12 | extern Suite *gcs_core_suite(void); 13 | 14 | #endif /* __gu_core_test__ */ 15 | -------------------------------------------------------------------------------- /gcs/src/unit_tests/gcs_memb_test.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011-2015 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | 7 | #ifndef __gcs_memb_test__ 8 | #define __gcs_memb_test__ 9 | 10 | #include 11 | 12 | extern Suite *gcs_memb_suite(void); 13 | 14 | #endif /* __gu_group_test__ */ 15 | -------------------------------------------------------------------------------- /gcs/src/unit_tests/gcs_node_test.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008-2015 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | 7 | #ifndef __gcs_node_test__ 8 | #define __gcs_node_test__ 9 | 10 | #include 11 | 12 | extern Suite *gcs_node_suite(void); 13 | 14 | #endif /* __gu_node_test__ */ 15 | -------------------------------------------------------------------------------- /gcs/src/unit_tests/gcs_state_msg_test.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007-2015 Codership Oy 2 | 3 | // $Id$ 4 | 5 | #ifndef __gcs_state_msg_test__ 6 | #define __gcs_state_msg_test__ 7 | 8 | #include 9 | 10 | Suite *gcs_state_msg_suite(void); 11 | 12 | #endif /* __gcs_state_msg_test__ */ 13 | -------------------------------------------------------------------------------- /galerautils/tests/gu_datetime_test.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | #ifndef __gu_datetime_test_hpp__ 7 | #define __gu_datetime_test_hpp__ 8 | 9 | #include 10 | 11 | Suite* gu_datetime_suite(); 12 | 13 | #endif // __gu_datetime_test_hpp__ 14 | -------------------------------------------------------------------------------- /gcs/src/unit_tests/gcs_act_cchange_test.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2015 Codership Oy 2 | 3 | // $Id$ 4 | 5 | #ifndef __gcs_act_cchange_test__ 6 | #define __gcs_act_cchange_test__ 7 | 8 | #include 9 | 10 | Suite *gcs_act_cchange_suite(void); 11 | 12 | #endif /* __gcs_act_cchange_test__ */ 13 | -------------------------------------------------------------------------------- /gcs/src/unit_tests/gcs_group_test.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008-2015 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | 7 | #ifndef __gcs_group_test__ 8 | #define __gcs_group_test__ 9 | 10 | #include 11 | 12 | extern Suite *gcs_group_suite(void); 13 | 14 | #endif /* __gu_group_test__ */ 15 | -------------------------------------------------------------------------------- /gcs/src/unit_tests/gcs_proto_test.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008-2015 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | 7 | #ifndef __gcs_proto_test__ 8 | #define __gcs_proto_test__ 9 | 10 | #include 11 | 12 | extern Suite *gcs_proto_suite(void); 13 | 14 | #endif /* __gu_proto_test__ */ 15 | -------------------------------------------------------------------------------- /galerautils/tests/gu_string_utils_test.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007 Codership Oy 2 | 3 | // $Id$ 4 | 5 | #ifndef __gu_string_utils_test__ 6 | #define __gu_string_utils_test__ 7 | 8 | #include 9 | 10 | extern Suite* gu_string_utils_suite(void); 11 | 12 | #endif /* __gu_string_utils_test__ */ 13 | -------------------------------------------------------------------------------- /gcs/src/unit_tests/gcs_defrag_test.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008-2015 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | 7 | #ifndef __gcs_defrag_test__ 8 | #define __gcs_defrag_test__ 9 | 10 | #include 11 | 12 | extern Suite *gcs_defrag_suite(void); 13 | 14 | #endif /* __gu_defrag_test__ */ 15 | -------------------------------------------------------------------------------- /gcs/src/unit_tests/gcs_backend_test.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008-2015 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | 7 | #ifndef __gcs_backend_test__ 8 | #define __gcs_backend_test__ 9 | 10 | #include 11 | 12 | extern Suite *gcs_backend_suite(void); 13 | 14 | #endif /* __gu_backend_test__ */ 15 | -------------------------------------------------------------------------------- /tests/scripts/remove.sh: -------------------------------------------------------------------------------- 1 | # 2 | # Routines to remove test distribution from nodes 3 | # 4 | 5 | remove_cmd() 6 | { 7 | local node=${@:$#} 8 | local dirn="${NODE_TEST_DIR[$node]}" 9 | echo -n 'rm -rf '"$dirn"'/*' 10 | } 11 | 12 | remove() 13 | { 14 | start_jobs remove_cmd 15 | 16 | wait_jobs 17 | } 18 | 19 | -------------------------------------------------------------------------------- /gcache/tests/gcache_rb_test.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | #ifndef __gcache_rb_test_hpp__ 7 | #define __gcache_rb_test_hpp__ 8 | 9 | extern "C" { 10 | #include 11 | } 12 | 13 | extern Suite* gcache_rb_suite(); 14 | 15 | #endif // __gcache_rb_test_hpp__ 16 | -------------------------------------------------------------------------------- /tests/test_upgrade/README: -------------------------------------------------------------------------------- 1 | The test 2 | - installs demo package pointed to by OLD, 3 | - starts sqlgen load, 4 | - checks consistency, 5 | - upgrades the nodes one by one to distribution pointed to by NEW, 6 | - checks consistency 7 | 8 | Usage: 9 | 10 | OLD=.tgz NEW=.tgz ./run.sh 11 | 12 | Usage with vsbes backend: 13 | -------------------------------------------------------------------------------- /gcache/tests/gcache_mem_test.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | #ifndef __gcache_mem_test_hpp__ 7 | #define __gcache_mem_test_hpp__ 8 | 9 | extern "C" { 10 | #include 11 | } 12 | 13 | extern Suite* gcache_mem_suite(); 14 | 15 | #endif // __gcache_mem_test_hpp__ 16 | -------------------------------------------------------------------------------- /gcache/tests/gcache_top_test.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | #ifndef __gcache_top_test_hpp__ 7 | #define __gcache_top_test_hpp__ 8 | 9 | extern "C" { 10 | #include 11 | } 12 | 13 | extern Suite* gcache_top_suite(); 14 | 15 | #endif // __gcache_top_test_hpp__ 16 | -------------------------------------------------------------------------------- /tests/test_pc_recovery/README: -------------------------------------------------------------------------------- 1 | The test runs sqlgen load aganist the cluster, and kills all nodes with -9 to 2 | simulate cluster outage. Then restarts nodes and expects them to form PC, 3 | and then checks consistency. 4 | 5 | Usage: 6 | 7 | ./run.sh [N] 8 | 9 | where N is the number of simulations. If N is omitted it goes forever. 10 | -------------------------------------------------------------------------------- /gcache/tests/gcache_page_test.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | #ifndef __gcache_page_test_hpp__ 7 | #define __gcache_page_test_hpp__ 8 | 9 | extern "C" { 10 | #include 11 | } 12 | 13 | extern Suite* gcache_page_suite(); 14 | 15 | #endif // __gcache_page_test_hpp__ 16 | -------------------------------------------------------------------------------- /galerautils/src/gu_buf.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2013 Codership Oy */ 2 | /** 3 | * @file generic buffer declaration 4 | * 5 | * $Id$ 6 | */ 7 | 8 | #ifndef _GU_BUF_HPP_ 9 | #define _GU_BUF_HPP_ 10 | 11 | #include "gu_buf.h" 12 | 13 | namespace gu 14 | { 15 | typedef struct gu_buf Buf; 16 | } 17 | 18 | #endif /* _GU_BUF_HPP_ */ 19 | -------------------------------------------------------------------------------- /cmake/alignment.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2023 Codership Oy 3 | # 4 | # Disable backward compatibility unit tests running old unaligned data format 5 | # on non-x86 platforms because it may cause bus error 6 | # 7 | if (NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "(x86_64|AMD64|i[3-6]86)") 8 | add_definitions(-DGALERA_ONLY_ALIGNED) 9 | endif() 10 | -------------------------------------------------------------------------------- /gcs/src/gcs_priv.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | 7 | /*! 8 | * @file gcs_priv.h Global declarations private to GCS 9 | */ 10 | 11 | #ifndef _gcs_priv_h_ 12 | #define _gcs_priv_h_ 13 | 14 | #include "gcs.hpp" 15 | 16 | #define GCS_DESYNC_REQ "self-desync" 17 | 18 | #endif /* _gcs_priv_h_ */ 19 | -------------------------------------------------------------------------------- /garb/garb_logger.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011 Codership Oy */ 2 | 3 | #ifndef _GARB_LOGGER_HPP_ 4 | #define _GARB_LOGGER_HPP_ 5 | 6 | #include 7 | 8 | namespace garb 9 | { 10 | extern void set_logfile (const std::string& fname); 11 | extern void set_syslog (); 12 | } /* namespace garb */ 13 | 14 | #endif /* _GARB_LOGGER_HPP_ */ 15 | -------------------------------------------------------------------------------- /gcs/src/gcs_gcomm.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008-2014 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | 7 | #ifndef _gcs_gcomm_h_ 8 | #define _gcs_gcomm_h_ 9 | 10 | #include "gcs_backend.hpp" 11 | 12 | extern GCS_BACKEND_REGISTER_FN(gcs_gcomm_register); 13 | 14 | extern GCS_BACKEND_CREATE_FN(gcs_gcomm_create); 15 | 16 | #endif /* _gcs_vs_h_ */ 17 | -------------------------------------------------------------------------------- /gcs/src/gcs_spread.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | /* 7 | * Definition of Spread GC backend 8 | */ 9 | 10 | #ifndef _gcs_spread_h_ 11 | #define _gcs_spread_h_ 12 | 13 | #include "gcs_backend.h" 14 | 15 | extern GCS_BACKEND_CREATE_FN (gcs_spread_create); 16 | 17 | #endif /* _gcs_spread_h_ */ 18 | -------------------------------------------------------------------------------- /scripts/packages/freebsd/galera-descr: -------------------------------------------------------------------------------- 1 | Galera is a fast synchronous multimaster wsrep provider (replication engine) 2 | for transactional databases and similar applications. For more information 3 | about wsrep API see https://github.com/codership/wsrep-API. For a description of Galera 4 | replication engine see http://www.codership.com. 5 | 6 | WWW: http://www.codership.com/ 7 | -------------------------------------------------------------------------------- /galerautils/src/gu_spooky.c: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2012 Codership Oy 2 | 3 | /** 4 | * @file external Spooky hash implementation to avoid code bloat 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "gu_spooky.h" 10 | 11 | void 12 | gu_spooky128_host (const void* const msg, size_t const len, uint64_t* res) 13 | { 14 | gu_spooky_inline (msg, len, res); 15 | } 16 | -------------------------------------------------------------------------------- /galerautils/src/gu_types.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 Codership Oy 2 | 3 | /** 4 | * @file Location of some "standard" types definitions 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #ifndef _GU_TYPES_HPP_ 10 | #define _GU_TYPES_HPP_ 11 | 12 | #include "gu_types.h" 13 | 14 | namespace gu { 15 | 16 | typedef gu_byte_t byte_t; 17 | 18 | } 19 | 20 | #endif /* _GU_TYPES_HPP_ */ 21 | -------------------------------------------------------------------------------- /galera/src/wsrep_params.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2010 Codership Oy 3 | // 4 | 5 | #ifndef WSREP_PARAMS_HPP 6 | #define WSREP_PARAMS_HPP 7 | 8 | #include "wsrep_api.h" 9 | 10 | #include "replicator.hpp" 11 | 12 | void 13 | wsrep_set_params (galera::Replicator& repl, const char* params); 14 | char* wsrep_get_params(const galera::Replicator& repl); 15 | #endif /* WSREP_PARAMS_HPP */ 16 | -------------------------------------------------------------------------------- /gcs/src/gcs_msg_type.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008-2015 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | 7 | #include "gcs_msg_type.hpp" 8 | 9 | const char* gcs_msg_type_string[GCS_MSG_MAX] = { 10 | "ERROR", 11 | "ACTION", 12 | "LAST", 13 | "COMPONENT", 14 | "STATE_UUID", 15 | "STATE_MSG", 16 | "JOIN", 17 | "SYNC", 18 | "FLOW", 19 | "VOTE", 20 | "CAUSAL" 21 | }; 22 | -------------------------------------------------------------------------------- /cmake/memorycheck.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2020 Codership Oy 3 | # 4 | 5 | # 6 | # Tests can be run with Valgrind by `ctest -D ExperimentalMemCheck`. 7 | # 8 | if (GALERA_WITH_VALGRIND) 9 | find_program(CTEST_MEMORYCHECK_COMMAND valgrind) 10 | set(MEMORYCHECK_COMMAND_OPTIONS "--error-exitcode=1 --trace-children=yes --leak-check=full") 11 | add_definitions(-DGALERA_WITH_VALGRIND) 12 | endif() 13 | 14 | -------------------------------------------------------------------------------- /galerautils/src/gu_buf.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2013 Codership Oy */ 2 | /** 3 | * @file generic buffer declaration 4 | * 5 | * $Id$ 6 | */ 7 | 8 | #ifndef _gu_buf_h_ 9 | #define _gu_buf_h_ 10 | 11 | #include "gu_types.h" 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | struct gu_buf 18 | { 19 | const void* ptr; 20 | ssize_t size; 21 | }; 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | 27 | #endif /* _gu_buf_h_ */ 28 | -------------------------------------------------------------------------------- /galerautils/src/gu_compiler.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Codership Oy 3 | */ 4 | 5 | /** @file gu_compiler.hpp 6 | * 7 | * Compiler specific workarounds. 8 | * 9 | */ 10 | #ifndef GU_COMPILER_HPP 11 | #define GU_COMPILER_HPP 12 | 13 | #if (__GNUC__ == 4 && __GNUC_MINOR__ == 4) 14 | #define GALERA_OVERRIDE 15 | #else 16 | #define GALERA_OVERRIDE override 17 | #endif /* #if (__GNUC__ == 4 && __GNUC_MINOR__ == 4) */ 18 | 19 | #endif /* GU_COMPILER_HPP */ 20 | -------------------------------------------------------------------------------- /asio/asio/unyield.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // unyield.hpp 3 | // ~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifdef reenter 12 | # undef reenter 13 | #endif 14 | 15 | #ifdef yield 16 | # undef yield 17 | #endif 18 | 19 | #ifdef fork 20 | # undef fork 21 | #endif 22 | -------------------------------------------------------------------------------- /tests/scripts/signal.sh: -------------------------------------------------------------------------------- 1 | # 2 | # Sends signal to process 3 | # 4 | 5 | signal_cmd() 6 | { 7 | local sig=$1 8 | local node=$2 9 | local dir="${NODE_TEST_DIR[$node]}" 10 | 11 | echo $sig $node 12 | case $DBMS in 13 | "MYSQL") 14 | echo -n "kill -$sig \$(cat $dir/mysql/var/mysqld.pid)" 15 | ;; 16 | "PGSQL"|*) 17 | echo "Not supported" >&2 18 | return 1 19 | ;; 20 | esac 21 | } 22 | 23 | signal_node() 24 | { 25 | node_job signal_cmd "$@" 26 | } 27 | -------------------------------------------------------------------------------- /galerautils/src/gu_asio_debug.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2020 Codership Oy 3 | // 4 | 5 | #ifndef GU_ASIO_DEBUG_HPP 6 | #define GU_ASIO_DEBUG_HPP 7 | 8 | #ifndef GU_ASIO_IMPL 9 | #error This header should not be included directly. 10 | #endif // GU_ASIO_IMPL 11 | 12 | // #define GU_ASIO_ENABLE_DEBUG 13 | #ifdef GU_ASIO_ENABLE_DEBUG 14 | #define GU_ASIO_DEBUG(msg_) log_info << msg_; 15 | #else 16 | #define GU_ASIO_DEBUG(msg_) 17 | #endif /* GU_ASIO_ENABLE_DEBUG */ 18 | 19 | #endif // GU_ASIO_DEBUG_HPP 20 | -------------------------------------------------------------------------------- /gcs/src/gcs_seqno.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008-2012 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | /* 7 | * Operations on seqno. 8 | */ 9 | 10 | #ifndef _gcs_seqno_h_ 11 | #define _gcs_seqno_h_ 12 | 13 | #include "galerautils.h" 14 | #include "gcs.hpp" 15 | 16 | #define gcs_seqno_le(x) ((gcs_seqno_t)gu_le64(x)) 17 | #define gcs_seqno_be(x) ((gcs_seqno_t)gu_be64(x)) 18 | 19 | #define gcs_seqno_htog(x) ((gcs_seqno_t)htog64(x)) 20 | #define gcs_seqno_gtoh gcs_seqno_htog 21 | 22 | #endif /* _gcs_seqno_h_ */ 23 | -------------------------------------------------------------------------------- /galerautils/src/gu_signals.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2021 Codership Oy 2 | 3 | #include "gu_signals.hpp" 4 | 5 | #include 6 | 7 | gu::Signals& gu::Signals::Instance() 8 | { 9 | static gu::Signals instance; 10 | return instance; 11 | } 12 | gu::Signals::signal_connection gu::Signals::connect( 13 | const gu::Signals::slot_type &subscriber) 14 | { 15 | return signal_.connect(subscriber); 16 | } 17 | void gu::Signals::signal(const gu::Signals::SignalType& type) 18 | { 19 | signal_(type); 20 | } 21 | -------------------------------------------------------------------------------- /tests/test_stopcont/README: -------------------------------------------------------------------------------- 1 | The test runs sqlgen load against the cluster and in round robin order makes 2 | nodes stop and continue. After each transition consistency check is done. This 3 | facilitates testing crawling nodes. 4 | 5 | Usage with gcomm backend: 6 | 7 | ./run.sh [N] 8 | 9 | Usage with vsbes backend: 10 | 11 | GCS_TYPE=vsbes VSBES_ADDRESS=192.168.0.1:5678 ./run.sh [N] 12 | 13 | where N is the number of stop/cont transitions. I.e. N=1 means that 1 node will 14 | be killed and restarted. If N is omitted it goes forever. 15 | -------------------------------------------------------------------------------- /galerautils/src/gu_init.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | 7 | /*! @file Common initializer for various galerautils parts. Currently it is 8 | * logger and CRC32C implementation. */ 9 | 10 | #ifndef _GU_INIT_H_ 11 | #define _GU_INIT_H_ 12 | 13 | #if defined(__cplusplus) 14 | extern "C" { 15 | #endif 16 | 17 | #include "gu_log.h" 18 | 19 | extern void 20 | gu_init (gu_log_cb_t log_cb); 21 | 22 | #if defined(__cplusplus) 23 | } 24 | #endif 25 | 26 | #endif /* _GU_INIT_H_ */ 27 | -------------------------------------------------------------------------------- /galerautils/src/gu_abort.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2012-2013 Codership Oy 2 | 3 | /** 4 | * @file "Clean" abort function to avoid stack and core dumps 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #ifndef _gu_abort_h_ 10 | #define _gu_abort_h_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | #include "gu_macros.h" 17 | 18 | /* This function is for clean aborts, when we can't gracefully exit otherwise */ 19 | extern void gu_abort() GU_NORETURN; 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | #endif /* _gu_abort_h_ */ 26 | -------------------------------------------------------------------------------- /gcache/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2020-2025 Codership Oy 3 | # 4 | 5 | add_executable(gcache_tests 6 | gcache_mem_test.cpp 7 | gcache_page_test.cpp 8 | gcache_rb_test.cpp 9 | gcache_top_test.cpp 10 | gcache_tests.cpp 11 | ) 12 | 13 | # TODO: Fix 14 | target_compile_options(gcache_tests 15 | PRIVATE 16 | -Wno-conversion 17 | -Wno-unused-parameter 18 | ) 19 | 20 | target_link_libraries(gcache_tests gcache ${GALERA_UNIT_TEST_LIBS}) 21 | 22 | add_test( 23 | NAME gcache_tests 24 | COMMAND gcache_tests 25 | ) 26 | -------------------------------------------------------------------------------- /tests/run_test_set.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # This is a wrapper script for ./tap/run_test_set.pl 4 | # 5 | 6 | 7 | BASE_DIR=$(cd $(dirname $0); pwd -P) 8 | cd $BASE_DIR 9 | res=$? 10 | if test $res != 0 11 | then 12 | echo "Failed to change directory to $BASE_DIR" 13 | exit 1 14 | fi 15 | 16 | export TEST_BASE_DIR=$BASE_DIR 17 | 18 | . $BASE_DIR/conf/cluster.conf 19 | 20 | $BASE_DIR/tap/run_test_set.pl $@ 21 | 22 | res=$? 23 | 24 | if test $res != 0 25 | then 26 | echo "Failed to run test set, exit code: $res" 27 | exit 1 28 | fi 29 | 30 | exit 0 31 | 32 | -------------------------------------------------------------------------------- /asio/asio/yield.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // yield.hpp 3 | // ~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #include "coroutine.hpp" 12 | 13 | #ifndef reenter 14 | # define reenter(c) ASIO_CORO_REENTER(c) 15 | #endif 16 | 17 | #ifndef yield 18 | # define yield ASIO_CORO_YIELD 19 | #endif 20 | 21 | #ifndef fork 22 | # define fork ASIO_CORO_FORK 23 | #endif 24 | -------------------------------------------------------------------------------- /gcache/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009 Codership Oy 2 | # 3 | # This file is free software; as a special exception the author gives 4 | # unlimited permission to copy and/or distribute it, with or without 5 | # modifications, as long as this notice is preserved. 6 | # 7 | # This program is distributed in the hope that it will be useful, but 8 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the 9 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | # 11 | #EXTRA_DIST = reconf configure 12 | SUBDIRS = src 13 | -------------------------------------------------------------------------------- /galera/src/galera-sym.map: -------------------------------------------------------------------------------- 1 | { 2 | global: wsrep_loader; 3 | wsrep_interface_version; 4 | wsrep_init_allowlist_service_v1; 5 | wsrep_deinit_allowlist_service_v1; 6 | wsrep_init_event_service_v1; 7 | wsrep_deinit_event_service_v1; 8 | wsrep_init_config_service_v1; 9 | wsrep_deinit_config_service_v1; 10 | wsrep_node_isolation_mode_set_v1; 11 | wsrep_certify_v1; 12 | wsrep_init_config_service_v2; 13 | wsrep_deinit_config_service_v2; 14 | local: *; 15 | }; 16 | -------------------------------------------------------------------------------- /galera/src/action_source.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2010-2013 Codership Oy 3 | // 4 | 5 | #ifndef GALERA_ACTION_SOURCE_HPP 6 | #define GALERA_ACTION_SOURCE_HPP 7 | 8 | namespace galera 9 | { 10 | class ActionSource 11 | { 12 | public: 13 | ActionSource() { } 14 | virtual ~ActionSource() { } 15 | virtual ssize_t process(void* ctx, bool& exit_loop) = 0; 16 | virtual long long received() const = 0; 17 | virtual long long received_bytes() const = 0; 18 | }; 19 | } 20 | 21 | #endif // GALERA_ACTION_SOURCE_HPP 22 | -------------------------------------------------------------------------------- /garb/files/garb.service: -------------------------------------------------------------------------------- 1 | # Systemd service file for garbd 2 | 3 | [Unit] 4 | Description=Galera Arbitrator Daemon 5 | Documentation=man:garbd(8) 6 | Documentation=https://galeracluster.com/library/documentation/arbitrator.html 7 | After=network.target 8 | 9 | [Install] 10 | WantedBy=multi-user.target 11 | Alias=garbd.service 12 | 13 | [Service] 14 | User=nobody 15 | ExecStart=/usr/bin/garb-systemd start 16 | 17 | # Use SIGINT because with the default SIGTERM 18 | # garbd fails to reliably transition to 'destroyed' state 19 | KillSignal=SIGINT 20 | 21 | TimeoutSec=2m 22 | PrivateTmp=false 23 | -------------------------------------------------------------------------------- /scripts/packages/freebsd/galera-message: -------------------------------------------------------------------------------- 1 | ************************************************************************ 2 | 3 | If you want to run Galera Arbitrator Daemon (garbd), 4 | remember to configure garb service in /etc/rc.conf, e.g.: 5 | 6 | garb_enable="YES" 7 | garb_galera_nodes="1.1.1.1:4567" 8 | garb_galera_group="wsrep_cluster_name" 9 | garb_galera_options="gmcast.listen_addr=tcp://2.2.2.2:4567" 10 | garb_log_file="/tmp/garb.log" 11 | 12 | To start garbd, use command: 13 | 14 | sudo service garb start 15 | 16 | ************************************************************************ 17 | -------------------------------------------------------------------------------- /galerautils/src/gu_exception.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009-2015 Codership Oy 3 | * 4 | */ 5 | 6 | #include 7 | 8 | #include "gu_utils.hpp" 9 | #include "gu_exception.hpp" 10 | 11 | namespace gu 12 | { 13 | void Exception::trace (const char* file, const char* func, int line) const 14 | { 15 | msg_.reserve (msg_.length() + ::strlen(file) + ::strlen(func) + 15); 16 | msg_ += "\n\t at "; 17 | msg_ += file; 18 | msg_ += ':'; 19 | msg_ += func; 20 | msg_ += "():"; 21 | msg_ += to_string(line); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /gcomm/src/socket.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2012 Codership Oy 3 | // 4 | 5 | #include "socket.hpp" 6 | 7 | static const std::string SocketOptPrefix = "socket."; 8 | 9 | const std::string gcomm::Socket::OptNonBlocking = SocketOptPrefix + "non_blocking"; 10 | const std::string gcomm::Socket::OptIfAddr = SocketOptPrefix + "if_addr"; 11 | const std::string gcomm::Socket::OptIfLoop = SocketOptPrefix + "if_loop"; 12 | const std::string gcomm::Socket::OptCRC32 = SocketOptPrefix + "crc32"; 13 | const std::string gcomm::Socket::OptMcastTTL = SocketOptPrefix + "mcast_ttl"; 14 | -------------------------------------------------------------------------------- /common/common.h: -------------------------------------------------------------------------------- 1 | /* 2 | *Copyright (C) 2012-2014 Codership Oy 3 | */ 4 | 5 | /*! @file Stores some common definitions to be known throughout the modules */ 6 | 7 | #ifndef COMMON_DEFS_H 8 | #define COMMON_DEFS_H 9 | 10 | #define COMMON_BASE_HOST_KEY "base_host" 11 | #define COMMON_BASE_PORT_KEY "base_port" 12 | #define COMMON_BASE_PORT_DEFAULT "4567" 13 | 14 | #define COMMON_BASE_DIR_KEY "base_dir" 15 | #define COMMON_BASE_DIR_DEFAULT "." 16 | 17 | #define COMMON_STATE_FILE "grastate.dat" 18 | #define COMMON_VIEW_STAT_FILE "gvwstate.dat" 19 | 20 | #endif // COMMON_DEFS_H 21 | -------------------------------------------------------------------------------- /asio/asio/ts/io_context.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ts/io_context.hpp 3 | // ~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_TS_IO_CONTEXT_HPP 12 | #define ASIO_TS_IO_CONTEXT_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/io_context.hpp" 19 | 20 | #endif // ASIO_TS_IO_CONTEXT_HPP 21 | -------------------------------------------------------------------------------- /galera/src/key_data.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2023 Codership Oy 3 | // 4 | 5 | #include "key_data.hpp" 6 | 7 | #include 8 | 9 | void 10 | galera::KeyData::print(std::ostream& os) const 11 | { 12 | os << "proto: " << proto_ver << ", type: " << type << ", copy: " 13 | << (copy ? "yes" : "no") << ", parts(" << parts_num << "):"; 14 | 15 | for (int i = 0; i < parts_num; ++i) 16 | { 17 | os << "\n\t" << gu::Hexdump(parts[i].ptr, parts[i].len, true); 18 | } 19 | } 20 | 21 | const wsrep_buf_t 22 | galera::KeyData::zero_part = 23 | { 24 | "", 25 | 1 26 | }; 27 | -------------------------------------------------------------------------------- /galerautils/src/gu_init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013-2016 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | 7 | #include "gu_conf.h" 8 | #include "gu_limits.h" 9 | #include "gu_abort.h" 10 | #include "gu_crc32c.h" 11 | 12 | void 13 | gu_init (gu_log_cb_t log_cb) 14 | { 15 | gu_conf_set_log_callback (log_cb); 16 | 17 | /* this is needed in gu::MMap::sync() */ 18 | size_t const page_size = GU_PAGE_SIZE; 19 | if (page_size & (page_size - 1)) 20 | { 21 | gu_fatal("GU_PAGE_SIZE(%zu) is not a power of 2", GU_PAGE_SIZE); 22 | gu_abort(); 23 | } 24 | 25 | gu_crc32c_configure(); 26 | } 27 | -------------------------------------------------------------------------------- /galerautils/src/gu_types.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 Codership Oy 2 | 3 | /** 4 | * @file Location of some "standard" types definitions 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #ifndef _gu_types_h_ 10 | #define _gu_types_h_ 11 | 12 | #include /* intXX_t and friends */ 13 | #include /* bool */ 14 | #include /* ssize_t */ 15 | #include /* ptrdiff_t */ 16 | #include /* off_t */ 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | typedef unsigned char gu_byte_t; 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | 28 | #endif /* _gu_types_h_ */ 29 | -------------------------------------------------------------------------------- /scripts/mysql/centos/my.cnf: -------------------------------------------------------------------------------- 1 | [mysqld] 2 | datadir=/var/lib/mysql 3 | socket=/var/lib/mysql/mysql.sock 4 | user=mysql 5 | # Default to using old password format for compatibility with mysql 3.x 6 | # clients (those using the mysqlclient10 compatibility package). 7 | old_passwords=1 8 | 9 | [mysqld_safe] 10 | log-error=/var/log/mysqld.log 11 | pid-file=/var/run/mysqld/mysqld.pid 12 | 13 | # 14 | # * IMPORTANT: Additional settings that can override those from this file! 15 | # The files must end with '.cnf', otherwise they'll be ignored. 16 | # WSREP NOTE: additional wsrep configuration is in wsrep.cnf 17 | # 18 | !includedir /etc/mysql/conf.d/ 19 | -------------------------------------------------------------------------------- /tests/test_startstop/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eu 2 | 3 | declare -r DIST_BASE=$(cd $(dirname $0)/..; pwd -P) 4 | TEST_BASE=${TEST_BASE:-"$DIST_BASE"} 5 | 6 | . $TEST_BASE/conf/main.conf 7 | 8 | declare -r SCRIPTS="$DIST_BASE/scripts" 9 | . $SCRIPTS/jobs.sh 10 | . $SCRIPTS/action.sh 11 | . $SCRIPTS/signal.sh 12 | . $SCRIPTS/misc.sh 13 | 14 | TRIES=${1:-"-1"} # -1 stands for indefinite loop 15 | 16 | stop 17 | try=0 18 | 19 | while [ $try -ne $TRIES ] 20 | do 21 | ! let try++ # ! - to protect from -e 22 | 23 | echo -e "\nTry ${try}/${TRIES}\n" 24 | 25 | start 26 | pause 5 27 | consistency_check 28 | stop 29 | 30 | done 31 | -------------------------------------------------------------------------------- /galerautils/README: -------------------------------------------------------------------------------- 1 | libgalerautils is a library of utilities commonly used by Galera project. 2 | Current release includes logging, mutex and malloc debug functions and 3 | convenience macros. 4 | 5 | This software is distributed in the hope that it will be useful, but 6 | WITHOUT ANY WARRANTY, to the extent permitted by law; without even the 7 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 8 | 9 | libgalerautils is free software. Please see the file COPYING for details. 10 | For documentation, please see the files in the doc subdirectory. 11 | For building and installation instructions please see the INSTALL file. 12 | 13 | -------------------------------------------------------------------------------- /garb/files/garb.cnf: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012 Codership Oy 2 | # This config file is to be sourced by garb service script. 3 | 4 | # A comma-separated list of node addresses (address[:port]) in the cluster 5 | # GALERA_NODES="" 6 | 7 | # Galera cluster name, should be the same as on the rest of the nodes. 8 | # GALERA_GROUP="" 9 | 10 | # Optional Galera internal options string (e.g. SSL settings) 11 | # see https://galeracluster.com/library/documentation/galera-parameters.html 12 | # GALERA_OPTIONS="" 13 | 14 | # Log file for garbd. Optional, by default logs to syslog 15 | # LOG_FILE="" 16 | 17 | # Where to persist necessary data 18 | # WORK_DIR="" 19 | -------------------------------------------------------------------------------- /gcs/src/gcs_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # This script checks the output of the gcs_test program 4 | # to verify that all actions that were sent were received 5 | # intact 6 | # 7 | # $Id$ 8 | 9 | SEND_LOG="gcs_test_send.log" 10 | RECV_LOG="gcs_test_recv.log" 11 | 12 | echo "Sent action count: $(wc -l $SEND_LOG)" 13 | echo "Received action count: $(wc -l $RECV_LOG)" 14 | 15 | SEND_MD5=$(cat "$SEND_LOG" | awk '{ print $4 " " $5 }'| sort -n -k 2 | tee sort_send | md5sum) 16 | echo "send_log md5: $SEND_MD5" 17 | RECV_MD5=$(cat "$RECV_LOG" | awk '{ print $4 " " $5 }'| sort -n -k 2 | tee sort_recv | md5sum) 18 | echo "recv_log md5: $RECV_MD5" 19 | 20 | # 21 | -------------------------------------------------------------------------------- /tests/test_cppcheck/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -eu 2 | 3 | OS=$(uname) 4 | [ $OS = "Linux" ] && JOBS=$(grep -c ^processor /proc/cpuinfo) || JOBS=1 5 | 6 | TEST_ROOT=$(cd $(dirname $0); pwd -P) 7 | GALERA_SRC=$TEST_ROOT/../../ 8 | 9 | LOGFILE=cppcheck.log 10 | 11 | # --xml output provides us with error ID in case we need to add suppression 12 | cppcheck --quiet -j $JOBS --force --inline-suppr --xml --inconclusive \ 13 | $GALERA_SRC 2>$LOGFILE 14 | 15 | RCODE=$(grep -c '^= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/io_context_strand.hpp" 19 | 20 | #endif // ASIO_IO_SERVICE_STRAND_HPP 21 | -------------------------------------------------------------------------------- /gcache/src/gcache_types.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2021 Codership Oy 3 | */ 4 | 5 | #ifndef __GCACHE_TYPES__ 6 | #define __GCACHE_TYPES__ 7 | 8 | #include "gcache_seqno.hpp" 9 | 10 | #include "gu_deqmap.hpp" 11 | #include "gu_progress.hpp" 12 | 13 | namespace gcache 14 | { 15 | typedef int64_t progress_t; //should be sufficient for all kinds of progress 16 | typedef gu::Progress::Callback ProgressCallback; 17 | 18 | typedef gu::DeqMap seqno2ptr_t; 19 | typedef seqno2ptr_t::iterator seqno2ptr_iter_t; 20 | 21 | } /* namespace gcache */ 22 | 23 | #endif /* __GCACHE_TYPES__ */ 24 | -------------------------------------------------------------------------------- /gcs/README: -------------------------------------------------------------------------------- 1 | Welcome to libgcs - Group Communication system abstraction library. 2 | 3 | libgcs is intended to simplify the use of Group Communication semantics 4 | in applications which are not initially targeted for it. 5 | 6 | This software is distributed in the hope that it will be useful, but 7 | WITHOUT ANY WARRANTY, to the extent permitted by law; without even the 8 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9 | 10 | libgcs is free software. Please see the file COPYING for details. 11 | For documentation, please see the files in the doc subdirectory. 12 | For building and installation instructions please see the INSTALL file. 13 | 14 | -------------------------------------------------------------------------------- /scripts/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | # Use a base image with a Linux distribution of your choice 2 | # Default: Debian testing for most recent compilers 3 | 4 | ARG base=testing-slim 5 | FROM ${base} 6 | 7 | # Install necessary packages to build DEB 8 | RUN apt update && apt upgrade -y && \ 9 | apt install -y \ 10 | g++ clang cmake check libatomic1 \ 11 | libasio-dev \ 12 | libboost-atomic-dev \ 13 | libboost-program-options-dev \ 14 | && \ 15 | apt clean && rm -rf /var/lib/apt/lists/* 16 | 17 | # Set up the build script to be executed on docker run 18 | COPY entrypoint.sh /root 19 | WORKDIR /root 20 | ENTRYPOINT /root/entrypoint.sh 21 | -------------------------------------------------------------------------------- /cmake/endian.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2020 Codership Oy 3 | # 4 | # Checks for byte order and byteswap headers. 5 | # 6 | 7 | check_include_file(endian.h HAVE_ENDIAN_H) 8 | check_include_file(sys/endian.h HAVE_SYS_ENDIAN_H) 9 | check_include_file(sys/byteorder.h HAVE_SYS_BYTEORDER_H) 10 | 11 | if (HAVE_ENDIAN_H) 12 | add_definitions(-DHAVE_ENDIAN_H) 13 | elseif (HAVE_SYS_ENDIAN_H) 14 | add_definitions(-DHAVE_SYS_ENDIAN_H) 15 | elseif(HAVE_SYS_BYTEORDER_H) 16 | add_definitions(-DHAVE_SYS_BYTEORDER_H) 17 | endif() 18 | 19 | check_include_file(byteswap.h HAVE_BYTESWAP_H) 20 | if (HAVE_BYTESWAP_H) 21 | add_definitions(-DHAVE_BYTESWAP_H) 22 | endif() 23 | -------------------------------------------------------------------------------- /galerautils/src/gu_assert.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007 Codership Oy 2 | 3 | /** 4 | * @file Assert macro definition 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #ifndef _gu_assert_h_ 10 | #define _gu_assert_h_ 11 | 12 | #include "gu_log.h" 13 | 14 | #ifndef DEBUG_ASSERT 15 | #include 16 | #else 17 | #include 18 | #undef assert 19 | /** Assert that sleeps instead of aborting the program, saving it for gdb */ 20 | #define assert(expr) if (!(expr)) { \ 21 | gu_fatal ("Assertion (%s) failed", __STRING(expr)); \ 22 | while(1) sleep(1); } 23 | #endif /* DEBUG_ASSERT */ 24 | 25 | #endif /* _gu_assert_h_ */ 26 | -------------------------------------------------------------------------------- /cmake/shared_ptr.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2020 Codership Oy 3 | # 4 | 5 | # Even with C++11 we still prefer boost::shared_ptr until 6 | # issues with compiling mixed ASIO/boost/std::shared_ptr 7 | # code have been sorted out. 8 | list(APPEND CMAKE_REQUIRED_INCLUDES ${Boost_INCLUDE_DIR}) 9 | check_include_file_cxx(boost/shared_ptr.hpp HAVE_BOOST_SHARED_PTR_HPP) 10 | if (HAVE_BOOST_SHARED_PTR_HPP) 11 | add_definitions(-DHAVE_BOOST_SHARED_PTR_HPP) 12 | return() 13 | endif() 14 | 15 | if (NOT CMAKE_CXX_STANDARD EQUAL 98) 16 | add_definitions(-DHAVE_STD_SHARED_PTR) 17 | return() 18 | endif() 19 | 20 | message(FATAL_ERROR "No suitable shared_ptr library found.") 21 | -------------------------------------------------------------------------------- /gcomm/src/gcomm/exception.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 Codership Oy 3 | */ 4 | 5 | /*! 6 | * @file exception.hpp 7 | * 8 | * @brief GComm exception definitions. 9 | */ 10 | 11 | #ifndef GCOMM_EXCEPTION_HPP 12 | #define GCOMM_EXCEPTION_HPP 13 | 14 | #include "gu_throw.hpp" 15 | 16 | /*! 17 | * Assert macro for runtime condition checking. This should be used 18 | * for conditions that may depend on external input and are required 19 | * to validate correct protocol operation. 20 | */ 21 | #define gcomm_assert(cond_) \ 22 | if ((cond_) == false) gu_throw_fatal << #cond_ << ": " 23 | 24 | #endif // GCOMM_EXCEPTION_HPP 25 | -------------------------------------------------------------------------------- /wsrep/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2020 Codership Oy 3 | # 4 | 5 | # 6 | # Note: Files under ../src are inside wsrep-API submodule, so 7 | # these tests won't compile unless the submodule has been 8 | # initialized/updated. 9 | # 10 | 11 | add_executable(wsrep_test 12 | wsrep_loader_test.c 13 | ../src/wsrep_loader.c 14 | ../src/wsrep_dummy.c) 15 | target_compile_definitions(wsrep_test 16 | PRIVATE 17 | -DWSREP_PROVIDER="${PROJECT_BINARY_DIR}/libgalera_smm.so" 18 | -DGALERA_VERSION="${GALERA_VERSION}" 19 | -DGALERA_GIT_REVISION="${GALERA_GIT_REVISION}") 20 | target_link_libraries(wsrep_test dl) 21 | add_test(NAME wsrep_test COMMAND wsrep_test) 22 | -------------------------------------------------------------------------------- /galerautils/src/gu_inttypes.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2020 Codership Oy 3 | // 4 | 5 | /** @file gu_inttypes.hpp 6 | * 7 | * A convenience header to include correct inttypes header from C++ 8 | * compilation units. 9 | * 10 | * Pre C++11: Define __STDC_FORMAT_MACROS required by older compilers 11 | * and include . 12 | * 13 | * C++11 and above: Include standard library header directly. 14 | */ 15 | 16 | #ifndef GU_INTTYPES_HPP 17 | #define GU_INTTYPES_HPP 18 | 19 | #if __cplusplus < 201103L 20 | #define __STDC_FORMAT_MACROS 21 | #include 22 | #else 23 | #include 24 | #endif // __cplusplus < 201103L 25 | 26 | #endif // GU_INTTYPES_HPP 27 | -------------------------------------------------------------------------------- /galerautils/src/gu_histogram.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Codership Oy 3 | */ 4 | 5 | #ifndef _gu_histogram_hpp_ 6 | #define _gu_histogram_hpp_ 7 | 8 | #include 9 | #include 10 | 11 | namespace gu 12 | { 13 | class Histogram 14 | { 15 | public: 16 | Histogram(const std::string&); 17 | void insert(const double); 18 | void clear(); 19 | friend std::ostream& operator<<(std::ostream&, const Histogram&); 20 | std::string to_string() const; 21 | private: 22 | std::map cnt_; 23 | }; 24 | 25 | std::ostream& operator<<(std::ostream&, const Histogram&); 26 | } 27 | 28 | #endif // _gu_histogram_hpp_ 29 | -------------------------------------------------------------------------------- /gcache/tests/gcache_tests.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2010-2025 Codership Oy 2 | 3 | // $Id$ 4 | 5 | /*! 6 | * @file: package specific part of the main test file. 7 | */ 8 | #ifndef __gcache_tests_hpp__ 9 | #define __gcache_tests_hpp__ 10 | 11 | #include "gcache_mem_test.hpp" 12 | #include "gcache_rb_test.hpp" 13 | #include "gcache_page_test.hpp" 14 | #include "gcache_top_test.hpp" 15 | 16 | extern "C" { 17 | #include 18 | } 19 | 20 | typedef Suite *(*suite_creator_t)(void); 21 | 22 | static suite_creator_t suites[] = 23 | { 24 | gcache_mem_suite, 25 | gcache_rb_suite, 26 | gcache_page_suite, 27 | gcache_top_suite, 28 | 0 29 | }; 30 | 31 | #endif /* __gcache_tests_hpp__ */ 32 | -------------------------------------------------------------------------------- /gcs/src/gcs_conf.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | 7 | /* Logging options */ 8 | #include 9 | 10 | #include "gcs.hpp" 11 | 12 | long gcs_conf_set_log_file (FILE *file) 13 | { return gu_conf_set_log_file (file); } 14 | long gcs_conf_set_log_callback (void (*logger) (int, const char*)) 15 | { return gu_conf_set_log_callback (logger); } 16 | long gcs_conf_self_tstamp_on () 17 | { return gu_conf_self_tstamp_on (); } 18 | long gcs_conf_self_tstamp_off () 19 | { return gu_conf_self_tstamp_off (); } 20 | long gcs_conf_debug_on () 21 | { return gu_conf_debug_on (); } 22 | long gcs_conf_debug_off () 23 | { return gu_conf_debug_off (); } 24 | 25 | -------------------------------------------------------------------------------- /galerautils/src/gu_uuid.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2017 Codership Oy 3 | */ 4 | 5 | #include "gu_uuid.hpp" 6 | 7 | #include 8 | 9 | namespace 10 | { 11 | class scan_error_message 12 | { 13 | std::ostringstream os_; 14 | public: 15 | scan_error_message(const std::string& s) : os_() 16 | { 17 | os_ << "could not parse UUID from '" << s << '\''; 18 | } 19 | 20 | const std::ostringstream& os() const { return os_; } 21 | }; 22 | } 23 | 24 | namespace gu 25 | { 26 | UUIDScanException::UUIDScanException(const std::string& s) 27 | : 28 | Exception(scan_error_message(s).os().str(), EINVAL) 29 | {} 30 | } 31 | -------------------------------------------------------------------------------- /galera/src/galera_view.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2015 Codership Oy 3 | // 4 | 5 | 6 | #include "galera_view.hpp" 7 | 8 | #include 9 | 10 | galera::View::View() 11 | : 12 | members_() 13 | { } 14 | 15 | galera::View::View(const wsrep_view_info_t& view_info) 16 | : 17 | members_() 18 | { 19 | for (int i(0); i < view_info.memb_num; ++i) 20 | { 21 | members_.insert(view_info.members[i].id); 22 | } 23 | } 24 | 25 | galera::View::~View() 26 | { } 27 | 28 | 29 | bool galera::View::subset_of(const MembSet& mset) const 30 | { 31 | return std::includes(mset.begin(), mset.end(), 32 | members_.begin(), members_.end(), UUIDCmp()); 33 | } 34 | -------------------------------------------------------------------------------- /galerautils/src/gu_asio_ssl.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2020 Codership Oy 3 | // 4 | 5 | /** @file gu_asio_ssl.hpp 6 | * 7 | * Common helpers for SSL operations. 8 | */ 9 | 10 | 11 | #ifndef GU_ASIO_SSL_HPP 12 | #define GU_ASIO_SSL_HPP 13 | 14 | #ifndef GU_ASIO_IMPL 15 | #error This header should not be included directly. 16 | #endif // GU_ASIO_IMPL 17 | 18 | #ifdef GALERA_HAVE_SSL 19 | 20 | bool exclude_ssl_error(const asio::error_code& ec); 21 | std::string extra_error_info(const asio::error_code& ec); 22 | 23 | #else // GALERA_HAVE_SSL 24 | 25 | static inline std::string extra_error_info(const asio::error_code&) { return ""; } 26 | 27 | #endif // GALERA_HAVE_SSL 28 | 29 | #endif // GU_ASIO_SSL_HPP 30 | -------------------------------------------------------------------------------- /asio/asio/ts/buffer.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ts/buffer.hpp 3 | // ~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_TS_BUFFER_HPP 12 | #define ASIO_TS_BUFFER_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/buffer.hpp" 19 | #include "asio/completion_condition.hpp" 20 | #include "asio/read.hpp" 21 | #include "asio/write.hpp" 22 | #include "asio/read_until.hpp" 23 | 24 | #endif // ASIO_TS_BUFFER_HPP 25 | -------------------------------------------------------------------------------- /asio/asio/buffered_stream_fwd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // buffered_stream_fwd.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_BUFFERED_STREAM_FWD_HPP 12 | #define ASIO_BUFFERED_STREAM_FWD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | namespace asio { 19 | 20 | template 21 | class buffered_stream; 22 | 23 | } // namespace asio 24 | 25 | #endif // ASIO_BUFFERED_STREAM_FWD_HPP 26 | -------------------------------------------------------------------------------- /scripts/docker/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -eu 2 | 3 | # This script must be erun from the top source directory. 4 | # The purpose is to build the current source with the reasonably 5 | # most recent compiler and strictest checks. 6 | # Environment variables: 7 | # BASE - which distribution to use for building 8 | # CC, CXX compilers to use, e.g.: 9 | # 10 | # $ CC=clang CXX=clang++ ./scripts/docker/build.sh 11 | # 12 | 13 | BASE=${BASE:='debian:testing-slim'} 14 | CC=${CC:-'gcc'} 15 | CXX=${CXX:-'g++'} 16 | 17 | # tag under which the docker image will be created. 18 | TAG="galera-builder-${BASE}" 19 | 20 | docker buildx build -t ${TAG} --build-arg base=${BASE} $(dirname $0) 21 | docker run --volume ${PWD}:/output --env CC=${CC} --env CXX=${CXX} ${TAG} 22 | -------------------------------------------------------------------------------- /galerautils/src/gu_conf.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007 Codership Oy 2 | 3 | /** 4 | * @file 5 | * Configuration interface for libgalerautils 6 | * 7 | * $Id$ 8 | */ 9 | 10 | #ifndef _gu_conf_h_ 11 | #define _gu_conf_h_ 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | /* Logging options */ 18 | #include 19 | #include "gu_log.h" 20 | extern int gu_conf_set_log_file (FILE* file); 21 | extern int gu_conf_set_log_callback (gu_log_cb_t callback); 22 | extern int gu_conf_self_tstamp_on (); 23 | extern int gu_conf_self_tstamp_off (); 24 | extern int gu_conf_debug_on (); 25 | extern int gu_conf_debug_off (); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | 31 | #endif // _gu_conf_h_ 32 | -------------------------------------------------------------------------------- /asio/asio/version.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // version.hpp 3 | // ~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_VERSION_HPP 12 | #define ASIO_VERSION_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | // ASIO_VERSION % 100 is the sub-minor version 19 | // ASIO_VERSION / 100 % 1000 is the minor version 20 | // ASIO_VERSION / 100000 is the major version 21 | #define ASIO_VERSION 101401 // 1.14.1 22 | 23 | #endif // ASIO_VERSION_HPP 24 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | # Enable Debian Hardening 4 | # https://wiki.debian.org/Hardening 5 | export DEB_BUILD_MAINT_OPTIONS = hardening=+all 6 | DPKG_EXPORT_BUILDFLAGS = 1 7 | # Include all defaults, includes buildflags.mk 8 | include /usr/share/dpkg/default.mk 9 | 10 | # Set unit test timeout multiplier to make slow tests 11 | # pass on loaded builders. 12 | export CK_TIMEOUT_MULTIPLIER=5 13 | 14 | override_dh_auto_test: 15 | dh_auto_test -O--no-parallel -- ARGS=--output-on-failure 16 | 17 | # Start earlier than MySQL which has value 19 18 | override_dh_installinit-arch: 19 | dh_installinit -n --name=garb -- defaults 18 22 20 | 21 | override_dh_installsystemd: 22 | dh_installsystemd --name=garb 23 | 24 | %: 25 | 26 | dh $@ --list-missing 27 | -------------------------------------------------------------------------------- /gcomm/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2020 Codership Oy 3 | # 4 | 5 | add_library(gcomm STATIC 6 | asio_protonet.cpp 7 | asio_tcp.cpp 8 | asio_udp.cpp 9 | conf.cpp 10 | defaults.cpp 11 | datagram.cpp 12 | evs_consensus.cpp 13 | evs_input_map2.cpp 14 | evs_message2.cpp 15 | evs_node.cpp 16 | evs_proto.cpp 17 | gmcast.cpp 18 | gmcast_proto.cpp 19 | pc.cpp 20 | pc_proto.cpp 21 | protonet.cpp 22 | protostack.cpp 23 | transport.cpp 24 | uuid.cpp 25 | view.cpp 26 | socket.cpp 27 | ) 28 | 29 | # TODO: Fix these. 30 | target_compile_options(gcomm 31 | PRIVATE 32 | -Wno-unused-parameter 33 | -Wno-conversion 34 | -Wno-overloaded-virtual 35 | ) 36 | 37 | target_link_libraries(gcomm galerautilsxx) 38 | -------------------------------------------------------------------------------- /galerautils/src/gu_backtrace.c: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2012 Codership Oy 2 | 3 | #include "gu_backtrace.h" 4 | #include "gu_log.h" 5 | 6 | #if defined(HAVE_EXECINFO_H) && defined(__GNUC__) 7 | #include 8 | #include 9 | 10 | char** gu_backtrace(int* size) 11 | { 12 | char** strings; 13 | void** array = malloc(*size * sizeof(void*)); 14 | if (!array) 15 | { 16 | gu_error("could not allocate memory for %d pointers\n", *size); 17 | return NULL; 18 | } 19 | *size = backtrace(array, *size); 20 | strings = backtrace_symbols(array, *size); 21 | 22 | free(array); 23 | return strings; 24 | } 25 | #else 26 | char **gu_backtrace(int* size) 27 | { 28 | return NULL; 29 | } 30 | #endif /* */ 31 | 32 | -------------------------------------------------------------------------------- /galerautils/src/gu_gtid.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2017 Codership Oy 3 | */ 4 | 5 | #include "gu_gtid.hpp" 6 | #include "gu_throw.hpp" 7 | 8 | #include 9 | 10 | void 11 | gu::GTID::print(std::ostream& os) const 12 | { 13 | os << uuid_ << ':' << seqno_; 14 | } 15 | 16 | void 17 | gu::GTID::scan(std::istream& is) 18 | { 19 | UUID u; 20 | char c; 21 | seqno_t s; 22 | 23 | try 24 | { 25 | is >> u >> c >> s; 26 | } 27 | catch (std::exception& e) 28 | { 29 | gu_throw_error(EINVAL) << e.what(); 30 | } 31 | 32 | if (c != ':') 33 | { 34 | gu_throw_error(EINVAL) << "Malformed GTID: '" << u << c << s << '\''; 35 | } 36 | 37 | uuid_ = u; 38 | seqno_ = s; 39 | } 40 | -------------------------------------------------------------------------------- /asio/asio/buffered_read_stream_fwd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // buffered_read_stream_fwd.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_BUFFERED_READ_STREAM_FWD_HPP 12 | #define ASIO_BUFFERED_READ_STREAM_FWD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | namespace asio { 19 | 20 | template 21 | class buffered_read_stream; 22 | 23 | } // namespace asio 24 | 25 | #endif // ASIO_BUFFERED_READ_STREAM_FWD_HPP 26 | -------------------------------------------------------------------------------- /asio/asio/buffered_write_stream_fwd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // buffered_write_stream_fwd.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_BUFFERED_WRITE_STREAM_FWD_HPP 12 | #define ASIO_BUFFERED_WRITE_STREAM_FWD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | namespace asio { 19 | 20 | template 21 | class buffered_write_stream; 22 | 23 | } // namespace asio 24 | 25 | #endif // ASIO_BUFFERED_WRITE_STREAM_FWD_HPP 26 | -------------------------------------------------------------------------------- /gcs/src/gcs_recv_msg.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | 7 | /*! 8 | * Receiving message context 9 | */ 10 | 11 | #ifndef _gcs_recv_msg_h_ 12 | #define _gcs_recv_msg_h_ 13 | 14 | #include "gcs_msg_type.hpp" 15 | 16 | typedef struct gcs_recv_msg 17 | { 18 | void* buf; 19 | int buf_len; 20 | int size; 21 | int sender_idx; 22 | gcs_msg_type_t type; 23 | 24 | gcs_recv_msg() { } 25 | gcs_recv_msg(void* b, long bl, long sz, long si, gcs_msg_type_t t) 26 | : 27 | buf(b), 28 | buf_len(bl), 29 | size(sz), 30 | sender_idx(si), 31 | type(t) 32 | { } 33 | } 34 | gcs_recv_msg_t; 35 | 36 | #endif /* _gcs_recv_msg_h_ */ 37 | -------------------------------------------------------------------------------- /asio/asio/ts/net.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ts/net.hpp 3 | // ~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_TS_NET_HPP 12 | #define ASIO_TS_NET_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/ts/netfwd.hpp" 19 | #include "asio/ts/executor.hpp" 20 | #include "asio/ts/io_context.hpp" 21 | #include "asio/ts/timer.hpp" 22 | #include "asio/ts/buffer.hpp" 23 | #include "asio/ts/socket.hpp" 24 | #include "asio/ts/internet.hpp" 25 | 26 | #endif // ASIO_TS_NET_HPP 27 | -------------------------------------------------------------------------------- /scripts/mysql/debian/etc/logcheck/ignore.d.paranoid/mysql-server-5_1: -------------------------------------------------------------------------------- 1 | /etc/init.d/mysql\[[0-9]+\]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists\!$ 2 | /etc/init.d/mysql\[[0-9]+\]: '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$ 3 | /etc/mysql/debian-start\[[0-9]+\]: Checking for crashed MySQL tables\.$ 4 | mysqld\[[0-9]+\]: $ 5 | mysqld\[[0-9]+\]: Version: .* socket: '/var/run/mysqld/mysqld.sock' port: 3306$ 6 | mysqld\[[0-9]+\]: Warning: Ignoring user change to 'mysql' because the user was set to 'mysql' earlier on the command line$ 7 | mysqld_safe\[[0-9]+\]: started$ 8 | usermod\[[0-9]+\]: change user `mysql' GID from `([0-9]+)' to `\1'$ 9 | usermod\[[0-9]+\]: change user `mysql' shell from `/bin/false' to `/bin/false'$ 10 | -------------------------------------------------------------------------------- /tests/scripts/kill.sh: -------------------------------------------------------------------------------- 1 | # 2 | # Ungracefully kills the process 3 | # 4 | 5 | kill_cmd() 6 | { 7 | local node=${@:$#} 8 | local dir="${NODE_TEST_DIR[$node]}" 9 | 10 | case $DBMS in 11 | "MYSQL") 12 | echo -n "kill -9 \$(cat $dir/mysql/var/mysqld.pid)" 13 | ;; 14 | "PGSQL"|*) 15 | echo "Not supported" >&2 16 | return 1 17 | ;; 18 | esac 19 | } 20 | 21 | kill_node() 22 | { 23 | local node=${@:$#} 24 | local dir="${NODE_TEST_DIR[$node]}" 25 | local pid=$(cat $dir/mysql/var/mysqld.pid) 26 | node_job kill_cmd "$@" 27 | # wait process to disappear. 28 | while find_mysqld_pid $pid 29 | do 30 | sleep 0.1 31 | done 32 | } 33 | 34 | kill_all() 35 | { 36 | start_jobs kill_cmd 37 | wait_jobs 38 | } 39 | 40 | -------------------------------------------------------------------------------- /tests/t/dummy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | BASE_DIR=$(cd $(dirname $0); pwd -P) 5 | 6 | 7 | . $BASE_DIR/../tap/tap-functions 8 | 9 | REPORT_DIR="$TEST_REPORT_DIR/dummy" 10 | if ! test -d $REPORT_DIR 11 | then 12 | mkdir $REPORT_DIR 13 | fi 14 | 15 | DUMMY_LOG=$REPORT_DIR/dummy.log 16 | 17 | echo "args: " $@ >> $DUMMY_LOG 18 | echo "pwd: " `pwd` >> $DUMMY_LOG 19 | echo "output: " $REPORT_DIR >> $DUMMY_LOG 20 | echo "nodes :" $CLUSTER_NODES >> $DUMMY_LOG 21 | echo "n_nodes: " $CLUSTER_N_NODES >> $DUMMY_LOG 22 | 23 | plan_tests 7 24 | 25 | ok 0 "first" 26 | okx test 1 -eq 1 27 | is 1 1 "third" 28 | isnt 1 2 "fourth" 29 | 30 | skip ok "maybe not ok but skip" 31 | 32 | TODO="not implemented yet" 33 | ok 0 "test not implemented yet" 34 | unset TODO 35 | 36 | diag "some message" 37 | 38 | ok 0 "final" -------------------------------------------------------------------------------- /tests/test_seesaw/README: -------------------------------------------------------------------------------- 1 | The test runs sqlgen load against the cluster and in round robin order kills 2 | and restarts nodes. After each transition consistency check is done. This 3 | facilitates testing configration changes under highly concurrent load with lots 4 | of certification conflicts. 5 | 6 | Sometimes the first consistency check fails, perhaps due to some race 7 | condition. In that case a second consistency check is attempted and if that 8 | fails the script exits with error code. 9 | 10 | Usage with gcomm backend: 11 | 12 | ./run.sh [N] 13 | 14 | Usage with vsbes backend: 15 | 16 | GCS_TYPE=vsbes VSBES_ADDRESS=192.168.0.1:5678 ./run.sh [N] 17 | 18 | where N is the number of off/on transitions. I.e. N=1 means that 1 node will 19 | be killed and restarted. If N is omitted it goes forever. 20 | -------------------------------------------------------------------------------- /asio/asio/ts/timer.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ts/timer.hpp 3 | // ~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_TS_TIMER_HPP 12 | #define ASIO_TS_TIMER_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/chrono.hpp" 19 | 20 | #include "asio/wait_traits.hpp" 21 | #include "asio/basic_waitable_timer.hpp" 22 | #include "asio/system_timer.hpp" 23 | #include "asio/steady_timer.hpp" 24 | #include "asio/high_resolution_timer.hpp" 25 | 26 | #endif // ASIO_TS_TIMER_HPP 27 | -------------------------------------------------------------------------------- /scripts/openrep/plugin.cnf: -------------------------------------------------------------------------------- 1 | MYSQL_BASE_DIR= 2 | # MYSQLD= 3 | # MYSQL_DATA_DIR= 4 | # MYSQL_CNF= 5 | MYSQL_ROOT_USER=root 6 | MYSQL_ROOT_PSWD=rootpass 7 | WSREP_PROVIDER= 8 | WSREP_CLUSTER_ADDRESS="dummy://" 9 | # WSREP_CLUSTER_NAME= 10 | # WSREP_NODE_NAME= 11 | # WSREP_NODE_INCOMING_ADDRESS= 12 | WSREP_SST_METHOD=mysqldump 13 | WSREP_SST_AUTH=$MYSQL_ROOT_USER:$MYSQL_ROOT_PSWD 14 | # WSREP_SST_ADDRESS= 15 | # WSREP_SST_DONOR="" 16 | 17 | # 18 | # Parameters below rarely require changing 19 | # 20 | WSREP_SLAVE_THREADS=1 21 | WSREP_LOCAL_CACHE_SIZE=20971520 22 | WSREP_START_POSITION= 23 | WSREP_DEBUG=0 24 | WSREP_AUTO_INCREMENT_CONTROL=1 25 | WSREP_RETRY_AUTOCOMMIT=1 26 | WSREP_CONVERT_LOCK_TO_TRX=1 27 | WSREP_DRUPAL_282555_WORKAROUND=1 28 | WSREP_WS_PERSISTENCY=0 29 | # WSREP_DBUG= 30 | # WSREP_DATA_HOME_DIR= 31 | -------------------------------------------------------------------------------- /asio/asio/impl/src.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // impl/src.cpp 3 | // ~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #if defined(_MSC_VER) \ 12 | || defined(__BORLANDC__) \ 13 | || defined(__DMC__) 14 | # pragma message ( \ 15 | "This file is deprecated. " \ 16 | "Please #include instead.") 17 | #elif defined(__GNUC__) \ 18 | || defined(__HP_aCC) \ 19 | || defined(__SUNPRO_CC) \ 20 | || defined(__IBMCPP__) 21 | # warning "This file is deprecated." 22 | # warning "Please #include instead." 23 | #endif 24 | 25 | #include "asio/impl/src.hpp" 26 | -------------------------------------------------------------------------------- /gcache/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2020 Codership Oy 3 | # 4 | 5 | # 6 | # GCache library 7 | # 8 | 9 | add_library(gcache STATIC 10 | GCache_seqno.cpp 11 | gcache_params.cpp 12 | gcache_page.cpp 13 | gcache_page_store.cpp 14 | gcache_rb_store.cpp 15 | gcache_mem_store.cpp 16 | GCache_memops.cpp 17 | GCache.cpp 18 | ) 19 | 20 | # TODO: Fix. 21 | target_compile_options(gcache 22 | PRIVATE 23 | -Wno-conversion 24 | -Wno-unused-parameter 25 | ) 26 | 27 | target_link_libraries(gcache galerautilsxx) 28 | 29 | # 30 | # Gcache test 31 | # 32 | 33 | add_executable(gcache_test test.cpp) 34 | 35 | target_link_libraries(gcache_test gcache pthread rt) 36 | 37 | target_compile_options(gcache_test 38 | PRIVATE 39 | -Wno-conversion 40 | -Wno-unused-parameter) 41 | -------------------------------------------------------------------------------- /man/garb-systemd.8: -------------------------------------------------------------------------------- 1 | .TH GARB-SYSTEMD "8" "January 2020" "garb-systemd" "System Administration Utilities" 2 | .SH NAME 3 | garb-systemd \- systemd start helper for arbitrator daemon 4 | .SH SYNOPSIS 5 | .B garb-systemd 6 | {\fI\,start\/\fR} 7 | .SH "DESCRIPTION" 8 | This is a simple wrapper for garbd written in shell script, which facilitates starting garbd via systemd. While starting garbd, settings are applied from /etc/sysconfig/garb or from environment variables GALERA_NODES, GALERA_GROUP, GALERA_PORT, GALERA_OPTIONS and LOG_FILE. 9 | 10 | For more information, view the source code and read more at https://galeracluster.com/library/documentation/arbitrator.html 11 | 12 | .SH BUGS 13 | See Galera bug tracker at https://github.com/codership/galera 14 | 15 | .SH AUTHOR 16 | Codership Oy 17 | -------------------------------------------------------------------------------- /tests/conf/common_my.cnf.tmpl: -------------------------------------------------------------------------------- 1 | [mysqld] 2 | core-file 3 | bind-address=127.0.1.1 4 | binlog_cache_size=4096 5 | innodb_flush_log_at_trx_commit=0 6 | innodb_buffer_pool_size=64M 7 | innodb_log_file_size=64M 8 | innodb_locks_unsafe_for_binlog=1 9 | innodb_lock_wait_timeout=50 10 | innodb_autoinc_lock_mode=2 11 | 12 | # 13 | query_cache_size=1M 14 | query_cache_type=1 15 | 16 | max_connections=1024 17 | max_connect_errors=4294967295 18 | performance_schema=OFF 19 | binlog_format=ROW 20 | default-storage-engine=innodb 21 | 22 | wsrep_slave_threads=4 23 | 24 | # Some regression tests use causal reads to determine if 25 | # all pending queries have been processed. Set to sufficiently high 26 | # time to avoid timing out too early. 27 | wsrep_provider_options="repl.causal_read_timeout=PT10H;evs.info_log_mask=0x3" 28 | 29 | -------------------------------------------------------------------------------- /asio/asio/signal_set.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // signal_set.hpp 3 | // ~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_SIGNAL_SET_HPP 12 | #define ASIO_SIGNAL_SET_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/basic_signal_set.hpp" 20 | 21 | namespace asio { 22 | 23 | /// Typedef for the typical usage of a signal set. 24 | typedef basic_signal_set<> signal_set; 25 | 26 | } // namespace asio 27 | 28 | #endif // ASIO_SIGNAL_SET_HPP 29 | -------------------------------------------------------------------------------- /asio/asio/detail/limits.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/limits.hpp 3 | // ~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_LIMITS_HPP 12 | #define ASIO_DETAIL_LIMITS_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_HAS_BOOST_LIMITS) 21 | # include 22 | #else // defined(ASIO_HAS_BOOST_LIMITS) 23 | # include 24 | #endif // defined(ASIO_HAS_BOOST_LIMITS) 25 | 26 | #endif // ASIO_DETAIL_LIMITS_HPP 27 | -------------------------------------------------------------------------------- /galerautils/src/gu_mmap.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009-2016 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | 7 | #ifndef __GCACHE_MMAP__ 8 | #define __GCACHE_MMAP__ 9 | 10 | #include "gu_fdesc.hpp" 11 | 12 | namespace gu 13 | { 14 | 15 | class MMap 16 | { 17 | 18 | public: 19 | 20 | size_t const size; 21 | void* const ptr; 22 | 23 | MMap (const FileDescriptor& fd, bool sequential = false); 24 | 25 | ~MMap (); 26 | 27 | void dont_need() const; 28 | void sync(void *addr, size_t length) const; 29 | void sync() const; 30 | void unmap(); 31 | 32 | private: 33 | 34 | bool mapped; 35 | 36 | // This class is definitely non-copyable 37 | MMap (const MMap&); 38 | MMap& operator = (const MMap); 39 | }; 40 | 41 | } /* namespace gu */ 42 | 43 | #endif /* __GCACHE_MMAP__ */ 44 | -------------------------------------------------------------------------------- /gcache/bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This script bootraps the build process for the freshly checked 4 | # working copy 5 | 6 | LOG=$0.log 7 | 8 | run_prog() 9 | { 10 | echo -n "Running $1... " 11 | $* 1>$LOG 2>&1 && echo "Ok" && rm -f $LOG || \ 12 | (echo "Failed. See $LOG"; return 1) 13 | } 14 | set -e 15 | # Make aclocal to search for m4 macros in /usr/local 16 | if test -d /usr/local/share/aclocal 17 | then 18 | ACLOCAL_OPTS=" -I /usr/local/share/aclocal " 19 | fi 20 | 21 | if test -x "$(which autoreconf)" 22 | then 23 | export ACLOCAL="aclocal $ACLOCAL_OPTS" 24 | run_prog autoreconf -fisv 25 | else 26 | run_prog libtoolize && \ 27 | run_prog aclocal $ACLOCAL_OPTS && \ 28 | run_prog autoheader configure.ac && \ 29 | run_prog automake -af && \ 30 | run_prog autoconf 31 | fi 32 | 33 | # 34 | 35 | -------------------------------------------------------------------------------- /galera/src/galera_info.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2009-2018 Codership Oy 2 | 3 | #ifndef __GALERA_INFO_H__ 4 | #define __GALERA_INFO_H__ 5 | 6 | #include "gcs.hpp" 7 | #include "wsrep_api.h" 8 | 9 | /* create view info out of configuration message 10 | * if my_uuid is defined - use it to determine wsrep_view_info_t::my_idx, 11 | * otherwise set my_uuid according to my_idx */ 12 | 13 | extern wsrep_view_info_t* 14 | galera_view_info_create (const gcs_act_cchange& conf, 15 | wsrep_cap_t capabilities, 16 | int my_idx, 17 | wsrep_uuid_t& my_uuid); 18 | 19 | /* make a copy of view info object */ 20 | extern wsrep_view_info_t* 21 | galera_view_info_copy (const wsrep_view_info_t* vi); 22 | 23 | #endif // __GALERA_INFO_H__ 24 | -------------------------------------------------------------------------------- /galerautils/src/gu_assert.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2009 Codership Oy 2 | 3 | /** 4 | * @file Assert macro definition 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #ifndef _gu_assert_hpp_ 10 | #define _gu_assert_hpp_ 11 | 12 | #ifndef DEBUG_ASSERT 13 | #include 14 | #else 15 | 16 | #include 17 | #undef assert 18 | #include "gu_logger.hpp" 19 | 20 | /** Assert that sleeps instead of aborting the program, saving it for gdb */ 21 | #define assert(expr) \ 22 | if (!(expr)) { \ 23 | log_fatal << "Assertion (" << __STRING(expr) << ") failed"; \ 24 | while(1) sleep(1); \ 25 | } 26 | 27 | #endif /* DEBUG_ASSERT */ 28 | 29 | #endif /* _gu_assert_hpp_ */ 30 | -------------------------------------------------------------------------------- /galerautils/src/gu_rand.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 Codership Oy 2 | 3 | /** 4 | * @file routines to generate "random" seeds for RNGs by collecting some easy 5 | * entropy. 6 | * 7 | * gu_rand_seed_long() goes for srand48() 8 | * 9 | * gu_rand_seed_int() goes for srand() and rand_r() 10 | * 11 | * $Id$ 12 | */ 13 | 14 | #ifndef _gu_rand_h_ 15 | #define _gu_rand_h_ 16 | 17 | #include "gu_arch.h" 18 | 19 | #include // for pid_t 20 | 21 | extern long int 22 | gu_rand_seed_long (long long time, const void* heap_ptr, pid_t pid); 23 | 24 | #if GU_WORDSIZE == 32 25 | 26 | extern unsigned int 27 | gu_rand_seed_int (long long time, const void* heap_ptr, pid_t pid); 28 | 29 | #else 30 | 31 | #define gu_rand_seed_int gu_rand_seed_long 32 | 33 | #endif /* GU_WORDSIZE */ 34 | 35 | #endif /* _gu_rand_h_ */ 36 | -------------------------------------------------------------------------------- /gcache/src/gcache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010-2014 Codership Oy 3 | */ 4 | /*! 5 | * @file C-interface to GCache. 6 | */ 7 | 8 | #ifndef _gcache_h_ 9 | #define _gcache_h_ 10 | 11 | #include 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | #include "gu_config.h" 18 | 19 | typedef struct gcache_st gcache_t; 20 | 21 | extern gcache_t* gcache_create (gu_config_t* conf, const char* data_dir); 22 | extern void gcache_destroy (gcache_t* gc); 23 | 24 | extern void* gcache_malloc (gcache_t* gc, int size); 25 | extern void gcache_free (gcache_t* gc, const void* ptr); 26 | extern void* gcache_realloc (gcache_t* gc, void* ptr, int size); 27 | 28 | extern int64_t gcache_seqno_min (gcache_t* gc); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif /* _gcache_h_ */ 35 | -------------------------------------------------------------------------------- /asio/asio/ssl.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ssl.hpp 3 | // ~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_SSL_HPP 12 | #define ASIO_SSL_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/ssl/context.hpp" 19 | #include "asio/ssl/context_base.hpp" 20 | #include "asio/ssl/error.hpp" 21 | #include "asio/ssl/rfc2818_verification.hpp" 22 | #include "asio/ssl/stream.hpp" 23 | #include "asio/ssl/stream_base.hpp" 24 | #include "asio/ssl/verify_context.hpp" 25 | #include "asio/ssl/verify_mode.hpp" 26 | 27 | #endif // ASIO_SSL_HPP 28 | -------------------------------------------------------------------------------- /tests/scripts/misc.sh: -------------------------------------------------------------------------------- 1 | # 2 | # Miscellaneous functions 3 | # 4 | 5 | # Sleeps variable amount of seconds (by default 1-10) 6 | pause() #min_sleep #var_sleep 7 | { 8 | local min_sleep=${1:-"1"} 9 | local var_sleep=${2:-"10"} 10 | local p=$(( $RANDOM % var_sleep + min_sleep )) 11 | 12 | echo "Sleeping for $p sec." 13 | sleep $p 14 | } 15 | 16 | # Pauses given processes (load) to perform consistency check 17 | consistency_check() #pids 18 | { 19 | local ret=0 20 | local pids="$@" 21 | 22 | [ -n "$pids" ] && kill -STOP $pids 23 | sleep 1 24 | check || (sleep 2; check) || (sleep 3; check) || ret=$? 25 | [ -n "$pids" ] && kill -CONT $pids # processes will receive SIGHUP in case of script exit 26 | return $ret 27 | } 28 | 29 | find_mysqld_pid() 30 | { 31 | ps ax | grep mysqld | grep -w ^\ *$1 > /dev/null 32 | } 33 | -------------------------------------------------------------------------------- /galera/src/ist_proto.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2015 Codership Oy 3 | // 4 | 5 | #include "ist_proto.hpp" 6 | 7 | std::ostream& 8 | galera::ist::operator<< (std::ostream& os, const Message& m) 9 | { 10 | os << "ver: " << m.version() 11 | << ", type: " << m.type() 12 | << ", flags: " << m.flags() 13 | << ", ctrl: " << m.ctrl() 14 | << ", len: " << m.len() 15 | << ", seqno: " << m.seqno(); 16 | 17 | return os; 18 | } 19 | 20 | void 21 | galera::ist::Message::throw_invalid_version(uint8_t const v) 22 | { 23 | gu_throw_error(EPROTO) << "invalid protocol version " << int(v) 24 | << ", expected " << int(version_); 25 | } 26 | 27 | void 28 | galera::ist::Message::throw_corrupted_header() 29 | { 30 | gu_throw_error(EINVAL) << "Corrupted IST message header: " << *this; 31 | } 32 | -------------------------------------------------------------------------------- /galera/src/replicator.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2010-2014 Codership Oy 3 | // 4 | 5 | #include "replicator.hpp" 6 | 7 | namespace galera 8 | { 9 | 10 | std::string const Replicator::Param::debug_log = "debug"; 11 | #ifdef GU_DBUG_ON 12 | std::string const Replicator::Param::dbug = "dbug"; 13 | std::string const Replicator::Param::signal = "signal"; 14 | #endif /* GU_DBUG_ON */ 15 | 16 | void Replicator::register_params(gu::Config& conf) 17 | { 18 | conf.add(Param::debug_log, "no", gu::Config::Flag::type_bool); 19 | #ifdef GU_DBUG_ON 20 | conf.add(Param::dbug, ""); 21 | conf.add(Param::signal, ""); 22 | #endif /* GU_DBUG_ON */ 23 | } 24 | 25 | const char* const 26 | Replicator::TRIVIAL_SST(WSREP_STATE_TRANSFER_TRIVIAL); 27 | 28 | const char* const 29 | Replicator::NO_SST(WSREP_STATE_TRANSFER_NONE); 30 | 31 | } /* namespace galera */ 32 | 33 | -------------------------------------------------------------------------------- /galera/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2020 Codership Oy 3 | # 4 | 5 | add_executable(galera_check 6 | galera_check.cpp 7 | data_set_check.cpp 8 | certification_check.cpp 9 | key_set_check.cpp 10 | write_set_ng_check.cpp 11 | trx_handle_check.cpp 12 | service_thd_check.cpp 13 | ist_check.cpp 14 | saved_state_check.cpp 15 | defaults_check.cpp 16 | progress_check.cpp 17 | ) 18 | 19 | target_include_directories(galera_check 20 | PRIVATE 21 | ${PROJECT_SOURCE_DIR}/galera/src 22 | ${PROJECT_SOURCE_DIR}/wsrep/src 23 | ) 24 | 25 | # TODO: Fix. 26 | target_compile_options(galera_check 27 | PRIVATE 28 | -Wno-conversion 29 | -Wno-unused-parameter 30 | ) 31 | 32 | target_link_libraries(galera_check galera_smm_static ${GALERA_UNIT_TEST_LIBS}) 33 | 34 | add_test( 35 | NAME galera_check 36 | COMMAND galera_check 37 | ) 38 | -------------------------------------------------------------------------------- /asio/asio/detail/cstddef.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/cstddef.hpp 3 | // ~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_CSTDDEF_HPP 12 | #define ASIO_DETAIL_CSTDDEF_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include 20 | 21 | namespace asio { 22 | 23 | #if defined(ASIO_HAS_NULLPTR) 24 | using std::nullptr_t; 25 | #else // defined(ASIO_HAS_NULLPTR) 26 | struct nullptr_t {}; 27 | #endif // defined(ASIO_HAS_NULLPTR) 28 | 29 | } // namespace asio 30 | 31 | #endif // ASIO_DETAIL_CSTDDEF_HPP 32 | -------------------------------------------------------------------------------- /galerautils/src/gu_errno.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Codership Oy 3 | */ 4 | 5 | #ifndef GU_ERRNO_H 6 | #define GU_ERRNO_H 7 | 8 | #include 9 | 10 | #if defined(__APPLE__) || defined(__FreeBSD__) 11 | # define GU_ELAST ELAST 12 | #else 13 | /* must be high enough to not collide with system errnos but lower than 256 */ 14 | # define GU_ELAST 200 15 | #endif 16 | 17 | #ifndef EBADFD 18 | # define EBADFD (GU_ELAST+1) 19 | #endif 20 | #ifndef EREMCHG 21 | # define EREMCHG (GU_ELAST+2) 22 | #endif 23 | #ifndef ENOTUNIQ 24 | # define ENOTUNIQ (GU_ELAST+3) 25 | #endif 26 | #ifndef ERESTART 27 | # define ERESTART (GU_ELAST+4) 28 | #endif 29 | #ifndef ENOTRECOVERABLE 30 | # define ENOTRECOVERABLE (GU_ELAST+5) 31 | #endif 32 | #ifndef ENODATA 33 | # define ENODATA (GU_ELAST+6) 34 | #endif 35 | 36 | #endif /* GU_STR_H */ 37 | -------------------------------------------------------------------------------- /asio/asio/ssl/impl/src.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // impl/ssl/src.hpp 3 | // ~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_SSL_IMPL_SRC_HPP 12 | #define ASIO_SSL_IMPL_SRC_HPP 13 | 14 | #define ASIO_SOURCE 15 | 16 | #include "asio/detail/config.hpp" 17 | 18 | #if defined(ASIO_HEADER_ONLY) 19 | # error Do not compile Asio library source with ASIO_HEADER_ONLY defined 20 | #endif 21 | 22 | #include "asio/ssl/impl/context.ipp" 23 | #include "asio/ssl/impl/error.ipp" 24 | #include "asio/ssl/detail/impl/engine.ipp" 25 | #include "asio/ssl/detail/impl/openssl_init.ipp" 26 | #include "asio/ssl/impl/rfc2818_verification.ipp" 27 | 28 | #endif // ASIO_SSL_IMPL_SRC_HPP 29 | -------------------------------------------------------------------------------- /asio/asio/streambuf.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // streambuf.hpp 3 | // ~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_STREAMBUF_HPP 12 | #define ASIO_STREAMBUF_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(ASIO_NO_IOSTREAM) 21 | 22 | #include "asio/basic_streambuf.hpp" 23 | 24 | namespace asio { 25 | 26 | /// Typedef for the typical usage of basic_streambuf. 27 | typedef basic_streambuf<> streambuf; 28 | 29 | } // namespace asio 30 | 31 | #endif // !defined(ASIO_NO_IOSTREAM) 32 | 33 | #endif // ASIO_STREAMBUF_HPP 34 | -------------------------------------------------------------------------------- /asio/asio/ts/socket.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ts/socket.hpp 3 | // ~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_TS_SOCKET_HPP 12 | #define ASIO_TS_SOCKET_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/socket_base.hpp" 19 | #include "asio/basic_socket.hpp" 20 | #include "asio/basic_datagram_socket.hpp" 21 | #include "asio/basic_stream_socket.hpp" 22 | #include "asio/basic_socket_acceptor.hpp" 23 | #include "asio/basic_socket_streambuf.hpp" 24 | #include "asio/basic_socket_iostream.hpp" 25 | #include "asio/connect.hpp" 26 | 27 | #endif // ASIO_TS_SOCKET_HPP 28 | -------------------------------------------------------------------------------- /gcomm/src/gcomm/common.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Codership Oy 3 | */ 4 | 5 | /*! 6 | * @file common.hpp 7 | * 8 | * @brief Imports definitions from the global common.h 9 | */ 10 | 11 | #ifndef GCOMM_COMMON_HPP 12 | #define GCOMM_COMMON_HPP 13 | 14 | #if defined(HAVE_COMMON_H) 15 | #include 16 | #endif 17 | 18 | #include 19 | 20 | namespace gcomm 21 | { 22 | #if defined(HAVE_COMMON_H) 23 | static std::string const BASE_PORT_KEY(COMMON_BASE_PORT_KEY); 24 | static std::string const BASE_PORT_DEFAULT(COMMON_BASE_PORT_DEFAULT); 25 | static std::string const BASE_DIR_DEFAULT(COMMON_BASE_DIR_DEFAULT); 26 | #else 27 | static std::string const BASE_PORT_KEY("base_port"); 28 | static std::string const BASE_PORT_DEFAULT("4567"); 29 | static std::string const BASE_DIR_DEFAULT("."); 30 | #endif 31 | } 32 | 33 | #endif /* GCOMM_COMMON_HPP */ 34 | -------------------------------------------------------------------------------- /scripts/mysql/my-5.1.cnf: -------------------------------------------------------------------------------- 1 | # Default mysqld options 2 | [mysqld] 3 | core-file 4 | innodb_buffer_pool_size=420M 5 | innodb_log_file_size=100M 6 | innodb_flush_log_at_trx_commit=2 7 | max_connections=1024 8 | 9 | # 10 | # Here are options to load innodb plugin. Uncomment, if you want to 11 | # load innodb plugin during server start. 12 | # Note, mysql-galera start script has --plugin option, which sets these 13 | # plugin options on command line. Use one of these methods to load innodb 14 | # plugin, but not both 15 | # 16 | 17 | # MariaDB uses xtradb as a built-in, so no need to load any plugins 18 | ignore_builtin_innodb 19 | plugin-load=innodb=ha_innodb_plugin.so;innodb_trx=ha_innodb_plugin.so;innodb_locks=ha_innodb_plugin.so;innodb_lock_waits=ha_innodb_plugin.so;innodb_cmp=ha_innodb_plugin.so;innodb_cmp_reset=ha_innodb_plugin.so;innodb_cmpmem=ha_innodb_plugin.so;innodb_cmpmem_reset=ha_innodb_plugin.so 20 | 21 | -------------------------------------------------------------------------------- /galerautils/src/gu_backtrace.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2012 Codership Oy 2 | 3 | #ifndef GU_BACKTRACE_H 4 | #define GU_BACKTRACE_H 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif /* __cplusplus */ 9 | 10 | /*! 11 | * Get current backtrace. Return buffer will contain backtrace symbols if 12 | * available. NULL pointer is returned if getting backtrace is not supported 13 | * on current platform. Maximum number of frames in backtrace is passed 14 | * in size parameter, number of frames in returned backtrace is assigned 15 | * in size parameter on return. 16 | * 17 | * @param size Pointer to integer containing maximum number of frames 18 | * in backtrace 19 | * 20 | * @return Allocated array of strings containing backtrace symbols 21 | */ 22 | char** gu_backtrace(int* size); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif /* __cplusplus */ 27 | 28 | #endif /* GU_BACKTRACE_H */ 29 | -------------------------------------------------------------------------------- /tests/regressions/lp518749/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eu 2 | 3 | 4 | declare -r DIST_BASE=$(cd $(dirname $0)/../..; pwd -P) 5 | TEST_BASE=${TEST_BASE:-"$DIST_BASE"} 6 | 7 | . $TEST_BASE/conf/main.conf 8 | 9 | declare -r SCRIPTS="$DIST_BASE/scripts" 10 | . $SCRIPTS/jobs.sh 11 | . $SCRIPTS/action.sh 12 | . $SCRIPTS/kill.sh 13 | . $SCRIPTS/misc.sh 14 | 15 | echo "regression test for lp:518749" 16 | 17 | echo "restarting cluster" 18 | $SCRIPTS/command.sh restart 19 | 20 | mysql --user=$DBMS_ROOT_USER --password=$DBMS_ROOT_PSWD --host=${NODE_INCOMING_HOST[0]} --port=${NODE_INCOMING_PORT[0]} < mysqlfs.sql; 21 | 22 | check; 23 | ret=$?; 24 | if test $ret != 0 25 | then 26 | echo "checksum failed"; 27 | exit 1; 28 | fi 29 | 30 | # Cleanup 31 | mysql --user=$DBMS_ROOT_USER --password=$DBMS_ROOT_PSWD --host=${NODE_INCOMING_HOST[0]} --port=${NODE_INCOMING_PORT[0]} -e "DROP DATABASE mysqlfs"; 32 | 33 | $SCRIPTS/command.sh stop -------------------------------------------------------------------------------- /gcache/README: -------------------------------------------------------------------------------- 1 | GCache is a library to provide transparent on-disk memory buffer cache. 2 | The purpose is to allow (almost) arbitrarily big action cache 3 | without RAM consumption. 4 | 5 | It provides the usual malloc(), realloc(), free() calls plus: 6 | 7 | void seqno_assign(void*, int64_t) - assign GCS seqno to a buffer pointed to. 8 | int64_t seqno_lock_min() - get the lowest seqno present in cache, 9 | return its value. 10 | void* seqno_get_buf(int64_t) - get a pointer to buffer with a given 11 | seqno, unlock previously locked seqno 12 | and lock the current one. 13 | void seqno_release() - release currently locked seqno. 14 | 15 | Details will be determined during development. 16 | 17 | It exploits the fact that action buffers are allocated and discarded in order 18 | close to their TO. 19 | -------------------------------------------------------------------------------- /galerautils/src/gu_enable_non_virtual_dtor.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2020 Codership Oy 3 | // 4 | 5 | // Note that there are no usual header guards because this header 6 | // may have to be included several times for compilation unit. 7 | 8 | /** 9 | * @file gu_enable_non_virtual_dtor.hpp 10 | * 11 | * This file accompanied with gu_disable_non_virtual_dtor.hpp 12 | * can be used to disable/enable -Wnon-virtual-dtor compiler warning 13 | * temporarily when it is not desirable to disable the warning completely 14 | * for compilation. 15 | * 16 | * This can be useful when using public inheritance from standard 17 | * library classes, especially std::enable_shared_from_this. 18 | */ 19 | 20 | #if defined(__GNUG__) 21 | # if (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || (__GNUC__ > 4) 22 | # pragma GCC diagnostic pop 23 | # endif // (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || (__GNUC__ > 4) 24 | #endif 25 | -------------------------------------------------------------------------------- /tests/scripts/command.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eu 2 | 3 | help() 4 | { 5 | echo "Usage: $0 [args]" 6 | echo "Cluster commands: install, remove, start, stop, check" 7 | echo "Node commands: start_node, stop_node, restart_node, check_node," 8 | echo " kill_node" 9 | echo "Command help: $0 help" 10 | } 11 | 12 | if [ $# -eq 0 ]; then help >&2; exit 1; fi 13 | 14 | declare -r DIST_BASE=$(cd $(dirname $0)/..; pwd -P) 15 | declare -r DIST_SCRIPTS="$DIST_BASE/scripts" 16 | 17 | # later create config.sh to read config from command line options 18 | 19 | declare -r TEST_BASE=${TEST_BASE:-"$DIST_BASE"} 20 | 21 | . "$TEST_BASE/conf/main.conf" 22 | 23 | . $DIST_SCRIPTS/jobs.sh 24 | . $DIST_SCRIPTS/install.sh 25 | . $DIST_SCRIPTS/remove.sh 26 | . $DIST_SCRIPTS/action.sh 27 | . $DIST_SCRIPTS/kill.sh 28 | . $DIST_SCRIPTS/signal.sh 29 | 30 | command=$1 31 | shift 32 | 33 | $command "$@" 34 | -------------------------------------------------------------------------------- /galerautils/src/galerautils.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007-2017 Codership Oy 2 | 3 | /** 4 | * @file GaleraUtils main header file 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #ifndef _galerautils_h_ 10 | #define _galerautils_h_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" 14 | { 15 | #endif /* __cplusplus */ 16 | 17 | #include "gu_macros.h" 18 | #include "gu_limits.h" 19 | #include "gu_byteswap.h" 20 | #include "gu_time.h" 21 | #include "gu_log.h" 22 | #include "gu_conf.h" 23 | #include "gu_assert.h" 24 | #include "gu_mem.h" 25 | #include "gu_threads.h" 26 | #include "gu_dbug.h" 27 | #include "gu_fifo.h" 28 | #include "gu_uuid.h" 29 | #include "gu_to.h" 30 | #include "gu_lock_step.h" 31 | #include "gu_utils.h" 32 | #include "gu_config.h" 33 | #include "gu_abort.h" 34 | #include "gu_errno.h" 35 | #include "gu_atomic.h" 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif /* __cplusplus */ 40 | 41 | #endif /* _galerautils_h_ */ 42 | -------------------------------------------------------------------------------- /asio/asio/io_service.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // io_service.hpp 3 | // ~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_IO_SERVICE_HPP 12 | #define ASIO_IO_SERVICE_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/io_context.hpp" 19 | 20 | #include "asio/detail/push_options.hpp" 21 | 22 | namespace asio { 23 | 24 | #if !defined(ASIO_NO_DEPRECATED) 25 | /// Typedef for backwards compatibility. 26 | typedef io_context io_service; 27 | #endif // !defined(ASIO_NO_DEPRECATED) 28 | 29 | } // namespace asio 30 | 31 | #include "asio/detail/pop_options.hpp" 32 | 33 | #endif // ASIO_IO_SERVICE_HPP 34 | -------------------------------------------------------------------------------- /gcache/tests/SConscript: -------------------------------------------------------------------------------- 1 | 2 | Import('check_env') 3 | 4 | env = check_env.Clone() 5 | 6 | # Include paths 7 | env.Append(CPPPATH = Split(''' 8 | #/common 9 | #/gcache/src 10 | #/galerautils/src 11 | ''')) 12 | 13 | env.Prepend(LIBS=File('#/galerautils/src/libgalerautils.a')) 14 | env.Prepend(LIBS=File('#/galerautils/src/libgalerautils++.a')) 15 | env.Prepend(LIBS=File('#/gcache/src/libgcache.a')) 16 | 17 | gcache_tests = env.Program(target = 'gcache_tests', source = Glob('*.cpp')) 18 | 19 | # source = Split(''' 20 | # gcache_tests.cpp 21 | # ''')) 22 | 23 | stamp="gcache_tests.passed" 24 | env.Test(stamp, gcache_tests) 25 | env.Alias("test", stamp) 26 | 27 | Clean(gcache_tests, ['#/gcache_tests.log', '#/gcache.page.000000', '#/rb_test']) 28 | -------------------------------------------------------------------------------- /asio/asio/detail/date_time_fwd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/date_time_fwd.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_DATE_TIME_FWD_HPP 12 | #define ASIO_DETAIL_DATE_TIME_FWD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | namespace boost { 21 | namespace date_time { 22 | 23 | template 24 | class base_time; 25 | 26 | } // namespace date_time 27 | namespace posix_time { 28 | 29 | class ptime; 30 | 31 | } // namespace posix_time 32 | } // namespace boost 33 | 34 | #endif // ASIO_DETAIL_DATE_TIME_FWD_HPP 35 | -------------------------------------------------------------------------------- /galerautils/src/gu_crc.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Codership Oy 3 | * 4 | * @file header for various CRC stuff 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #ifndef GU_CRC_HPP 10 | #define GU_CRC_HPP 11 | 12 | #include "gu_crc32c.h" 13 | 14 | namespace gu 15 | { 16 | 17 | class CRC32C 18 | { 19 | public: 20 | 21 | CRC32C() : state_(GU_CRC32C_INIT) {} 22 | 23 | void append(const void* const data, size_t const size) 24 | { 25 | gu_crc32c_append (&state_, data, size); 26 | } 27 | 28 | uint32_t get() const { return gu_crc32c_get(state_); } 29 | 30 | uint32_t operator() () const { return get(); } 31 | 32 | static uint32_t digest(const void* const data, size_t const size) 33 | { 34 | return gu_crc32c(data, size); 35 | } 36 | 37 | private: 38 | 39 | gu_crc32c_t state_; 40 | 41 | }; /* class CRC32C */ 42 | 43 | } /* namespace gu */ 44 | 45 | #endif /* GU_CRC_HPP */ 46 | -------------------------------------------------------------------------------- /galerautils/src/gu_macros.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2009-2017 Codership Oy 2 | 3 | /** 4 | * @file Miscellaneous C++-related macros 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #ifndef _gu_macros_hpp_ 10 | #define _gu_macros_hpp_ 11 | 12 | #include "gu_macros.h" 13 | 14 | /* To protect against "old-style" casts in libc macros 15 | * must be included after respective libc headers */ 16 | #if defined(SIG_IGN) 17 | extern "C" { static void (* const GU_SIG_IGN)(int) = SIG_IGN; } 18 | #endif 19 | 20 | namespace gu 21 | { 22 | template struct CompileAssert {}; 23 | } /* namespace gu */ 24 | 25 | #define GU_COMPILE_ASSERT(expr,msg) \ 26 | typedef gu::CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] __attribute__((unused)) 27 | 28 | /* For C++11 compatibility */ 29 | #if __cplusplus >= 201103L 30 | # define GU_NOEXCEPT(x) noexcept(x) 31 | #else 32 | # define GU_NOEXCEPT(x) 33 | #endif 34 | 35 | #endif /* _gu_macros_hpp_ */ 36 | -------------------------------------------------------------------------------- /gcache/src/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009 Codership Oy 2 | # 3 | 4 | GCACHE_SRCS = \ 5 | FileDescriptor.cpp \ 6 | MMap.cpp \ 7 | GCache.cpp \ 8 | GCache_header.cpp \ 9 | GCache_memops.cpp \ 10 | GCache_seqno.cpp 11 | 12 | # Describe libGCACHE library target 13 | #include_HEADERS = GCache.hpp 14 | lib_LTLIBRARIES = libgcache.la 15 | libgcache_la_SOURCES = $(GCACHE_SRCS) $(GCACHE_INCS) 16 | INTERFACE = 1 17 | REVISION = 0 18 | AGE = 0 19 | libgcache_la_LDFLAGS = \ 20 | @AM_LDFLAGS@ -version-info $(INTERFACE):$(REVISION):$(AGE) 21 | 22 | # Desclibe GCACHE_test binary target 23 | noinst_PROGRAMS = test 24 | test_SOURCES = test.cpp 25 | test_LDADD = $(lib_LTLIBRARIES) 26 | test_LDFLAGS = @AM_LDFLAGS@ -static 27 | 28 | .PHONY: lib test tags 29 | 30 | lib: $(lib_LTLIBRARIES) 31 | 32 | #test: GCACHE_test 33 | 34 | tags: TAGS 35 | 36 | #SUBDIRS = unit_tests 37 | # 38 | -------------------------------------------------------------------------------- /galerautils/tests/gu_histogram_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Codership Oy 3 | */ 4 | 5 | #include "../src/gu_histogram.hpp" 6 | #include "../src/gu_logger.hpp" 7 | #include 8 | 9 | #include "gu_histogram_test.hpp" 10 | 11 | using namespace gu; 12 | 13 | START_TEST(test_histogram) 14 | { 15 | 16 | Histogram hs("0.0,0.0005,0.001,0.002,0.005,0.01,0.02,0.05,0.1,0.5,1.,5."); 17 | 18 | hs.insert(0.001); 19 | log_info << hs; 20 | 21 | for (size_t i = 0; i < 1000; ++i) 22 | { 23 | hs.insert(double(::rand())/RAND_MAX); 24 | } 25 | 26 | log_info << hs; 27 | 28 | hs.clear(); 29 | 30 | log_info << hs; 31 | } 32 | END_TEST 33 | 34 | Suite* gu_histogram_suite() 35 | { 36 | TCase* t = tcase_create ("test_histogram"); 37 | tcase_add_test (t, test_histogram); 38 | 39 | Suite* s = suite_create ("gu::Histogram"); 40 | suite_add_tcase (s, t); 41 | 42 | return s; 43 | } 44 | -------------------------------------------------------------------------------- /asio/asio/impl/system_context.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // impl/system_context.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_IMPL_SYSTEM_CONTEXT_HPP 12 | #define ASIO_IMPL_SYSTEM_CONTEXT_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/system_executor.hpp" 19 | 20 | #include "asio/detail/push_options.hpp" 21 | 22 | namespace asio { 23 | 24 | inline system_context::executor_type 25 | system_context::get_executor() ASIO_NOEXCEPT 26 | { 27 | return system_executor(); 28 | } 29 | 30 | } // namespace asio 31 | 32 | #include "asio/detail/pop_options.hpp" 33 | 34 | #endif // ASIO_IMPL_SYSTEM_CONTEXT_HPP 35 | -------------------------------------------------------------------------------- /tests/regressions/lp1184034/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ue 2 | # 3 | # https://bugs.launchpad.net/galera/+bug/1184034 4 | # 5 | # BUG BACKGROUND 6 | # 7 | # Running 8 | # 9 | # nmap -sT -p 10 | # 11 | # causes uncaught exception in gcomm asio code 12 | # 13 | 14 | 15 | declare -r DIST_BASE=$(cd $(dirname $0)/../..; pwd -P) 16 | TEST_BASE=${TEST_BASE:-"$DIST_BASE"} 17 | 18 | . $TEST_BASE/conf/main.conf 19 | declare -r SCRIPTS="$DIST_BASE/scripts" 20 | . $SCRIPTS/jobs.sh 21 | . $SCRIPTS/action.sh 22 | . $SCRIPTS/kill.sh 23 | . $SCRIPTS/misc.sh 24 | 25 | echo "##################################################################" 26 | echo "## regression test for lp:1184034" 27 | echo "##################################################################" 28 | echo "Restarting cluster" 29 | ../../scripts/command.sh restart 30 | 31 | 32 | for ii in `seq 1 100` 33 | do 34 | nmap -sT -p ${NODE_GCS_PORT[0]} ${NODE_GCS_HOST[0]} 35 | done 36 | 37 | check_node 0 38 | -------------------------------------------------------------------------------- /tests/test_drupal/loaddb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | TEST_HOME=$(cd $(dirname $0); pwd -P) 4 | MYSQL_HOST=${MYSQL_HOST:-"127.0.0.1"} 5 | MYSQL_PORT=${MYSQL_PORT:-"3306"} 6 | MYSQL_USER=${MYSQL_USER:-"root"} 7 | MYSQL_PSWD=${MYSQL_PSWD:-"rootpass"} 8 | 9 | MYSQL_CMD="mysql -u$MYSQL_USER -p$MYSQL_PSWD -h$MYSQL_HOST -P$MYSQL_PORT " 10 | 11 | set -e 12 | 13 | #Prepare drupaldb database 14 | $MYSQL_CMD -e \ 15 | "GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE 16 | TEMPORARY TABLES, LOCK TABLES 17 | ON drupaldb.* 18 | TO 'drupal'@'%' IDENTIFIED BY 'password'" 19 | 20 | zcat $TEST_HOME/drupaldb.sql.gz | $MYSQL_CMD 21 | 22 | 23 | # Prepare drupal6 database 24 | $MYSQL_CMD -e \ 25 | "GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE 26 | TEMPORARY TABLES, LOCK TABLES 27 | ON drupal6.* 28 | TO 'drupal'@'%' IDENTIFIED BY 'password'" 29 | 30 | zcat $TEST_HOME/drupal6.sql.gz | $MYSQL_CMD 31 | 32 | $MYSQL_CMD -e "FLUSH PRIVILEGES" 33 | 34 | -------------------------------------------------------------------------------- /galerautils/src/gu_disable_non_virtual_dtor.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2020 Codership Oy 3 | // 4 | 5 | // Note that there are no usual header guards because this header 6 | // may have to be included several times for compilation unit. 7 | 8 | /** 9 | * @file gu_disable_non_virtual_dtor.hpp 10 | * 11 | * This file accompanied with gu_enable_non_virtual_dtor.hpp 12 | * can be used to disable/enable -Wnon-virtual-dtor compiler warning 13 | * temporarily when it is not desirable to disable the warning completely 14 | * for compilation. 15 | * 16 | * This can be useful when using public inheritance from standard 17 | * library classes, especially std::enable_shared_from_this. 18 | */ 19 | 20 | #if defined(__GNUG__) 21 | # if (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || (__GNUC__ > 4) 22 | # pragma GCC diagnostic push 23 | # endif // (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || (__GNUC__ > 4) 24 | # pragma GCC diagnostic ignored "-Wnon-virtual-dtor" 25 | #endif 26 | -------------------------------------------------------------------------------- /asio/asio/detail/regex_fwd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/regex_fwd.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_REGEX_FWD_HPP 12 | #define ASIO_DETAIL_REGEX_FWD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #if defined(ASIO_HAS_BOOST_REGEX) 19 | 20 | #include 21 | #include 22 | 23 | namespace boost { 24 | 25 | template 26 | struct sub_match; 27 | 28 | template 29 | class match_results; 30 | 31 | } // namespace boost 32 | 33 | #endif // defined(ASIO_HAS_BOOST_REGEX) 34 | 35 | #endif // ASIO_DETAIL_REGEX_FWD_HPP 36 | -------------------------------------------------------------------------------- /scripts/mysql/debian/etc/logrotate.d/mysql-server: -------------------------------------------------------------------------------- 1 | # - I put everything in one block and added sharedscripts, so that mysql gets 2 | # flush-logs'd only once. 3 | # Else the binary logs would automatically increase by n times every day. 4 | # - The error log is obsolete, messages go to syslog now. 5 | /var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log { 6 | daily 7 | rotate 7 8 | missingok 9 | create 640 mysql adm 10 | compress 11 | sharedscripts 12 | postrotate 13 | test -x /usr/bin/mysqladmin || exit 0 14 | 15 | # If this fails, check debian.conf! 16 | MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" 17 | if [ -z "`$MYADMIN ping 2>/dev/null`" ]; then 18 | # Really no mysqld or rather a missing debian-sys-maint user? 19 | # If this occurs and is not a error please report a bug. 20 | if ps cax | grep -q mysqld; then 21 | exit 1 22 | fi 23 | else 24 | $MYADMIN flush-logs 25 | fi 26 | endscript 27 | } 28 | -------------------------------------------------------------------------------- /asio/asio/detail/dependent_type.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/dependent_type.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_DEPENDENT_TYPE_HPP 12 | #define ASIO_DETAIL_DEPENDENT_TYPE_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #include "asio/detail/push_options.hpp" 21 | 22 | namespace asio { 23 | namespace detail { 24 | 25 | template 26 | struct dependent_type 27 | { 28 | typedef T type; 29 | }; 30 | 31 | } // namespace detail 32 | } // namespace asio 33 | 34 | #include "asio/detail/pop_options.hpp" 35 | 36 | #endif // ASIO_DETAIL_DEPENDENT_TYPE_HPP 37 | -------------------------------------------------------------------------------- /cmake/asio.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2020 Codership Oy 3 | # 4 | 5 | macro(CHECK_ASIO_VERSION) 6 | check_cxx_source_compiles( 7 | " 8 | #include 9 | 10 | #define XSTR(x) STR(x) 11 | #define STR(x) #x 12 | #pragma message \"Asio version: \" XSTR(ASIO_VERSION) 13 | #if ASIO_VERSION < 102201 14 | #error Included asio version is too old 15 | #endif 16 | 17 | int main() 18 | { 19 | return 0; 20 | } 21 | " 22 | ASIO_VERSION_OK 23 | ) 24 | endmacro() 25 | 26 | check_include_file_cxx(asio.hpp HAVE_SYSTEM_ASIO_HPP) 27 | 28 | if (HAVE_SYSTEM_ASIO_HPP) 29 | CHECK_ASIO_VERSION() 30 | if (ASIO_VERSION_OK) 31 | add_definitions(-DHAVE_ASIO_HPP) 32 | else() 33 | unset(HAVE_SYSTEM_ASIO_HPP CACHE) 34 | unset(ASIO_VERSION_OK CACHE) 35 | endif() 36 | endif() 37 | 38 | if(NOT ASIO_VERSION_OK) 39 | message(STATUS "Using bundled asio") 40 | include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/asio) 41 | endif() 42 | 43 | add_definitions(-DHAVE_ASIO_HPP) 44 | -------------------------------------------------------------------------------- /asio/asio/impl/executor.ipp: -------------------------------------------------------------------------------- 1 | // 2 | // impl/executor.ipp 3 | // ~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_IMPL_EXECUTOR_IPP 12 | #define ASIO_IMPL_EXECUTOR_IPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/executor.hpp" 20 | 21 | #include "asio/detail/push_options.hpp" 22 | 23 | namespace asio { 24 | 25 | bad_executor::bad_executor() ASIO_NOEXCEPT 26 | { 27 | } 28 | 29 | const char* bad_executor::what() const ASIO_NOEXCEPT_OR_NOTHROW 30 | { 31 | return "bad executor"; 32 | } 33 | 34 | } // namespace asio 35 | 36 | #include "asio/detail/pop_options.hpp" 37 | 38 | #endif // ASIO_IMPL_EXECUTOR_IPP 39 | -------------------------------------------------------------------------------- /asio/asio/detail/win_iocp_thread_info.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/win_iocp_thread_info.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_WIN_IOCP_THREAD_INFO_HPP 12 | #define ASIO_DETAIL_WIN_IOCP_THREAD_INFO_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/thread_info_base.hpp" 19 | 20 | #include "asio/detail/push_options.hpp" 21 | 22 | namespace asio { 23 | namespace detail { 24 | 25 | struct win_iocp_thread_info : public thread_info_base 26 | { 27 | }; 28 | 29 | } // namespace detail 30 | } // namespace asio 31 | 32 | #include "asio/detail/pop_options.hpp" 33 | 34 | #endif // ASIO_DETAIL_WIN_IOCP_THREAD_INFO_HPP 35 | -------------------------------------------------------------------------------- /galerautils/src/gu_system.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 Codership Oy 2 | 3 | /** 4 | * @system/os/platform dependent functions/macros 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #ifndef _gu_system_h_ 10 | #define _gu_system_h_ 11 | 12 | #define _GNU_SOURCE // program_invocation_name, program_invocation_short_name 13 | #include 14 | 15 | #include // getexecname, getprogname 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif /* __cplusplus */ 20 | 21 | /* See: http://lists.gnu.org/archive/html/bug-gnulib/2010-12/txtrjMzutB7Em.txt 22 | * for implementation of GU_SYS_PROGRAM_NAME on other platforms */ 23 | 24 | #if defined(__sun__) 25 | # define GU_SYS_PROGRAM_NAME getexecname () 26 | #elif defined(__APPLE__) || defined(__FreeBSD__) 27 | # define GU_SYS_PROGRAM_NAME getprogname () 28 | #elif defined(__linux__) 29 | # define GU_SYS_PROGRAM_NAME program_invocation_name 30 | #endif 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif /* __cplusplus */ 35 | 36 | #endif /* _gu_system_h_ */ 37 | -------------------------------------------------------------------------------- /gcs/src/gcs_gcache.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | 7 | #ifndef _gcs_gcache_h_ 8 | #define _gcs_gcache_h_ 9 | 10 | #ifndef GCS_FOR_GARB 11 | #include 12 | #else 13 | #ifndef gcache_t 14 | struct gcache_st; 15 | typedef struct gcache_st gcache_t; 16 | #endif 17 | #endif 18 | 19 | #include 20 | 21 | #include 22 | 23 | static inline void* 24 | gcs_gcache_malloc (gcache_t* gcache, size_t size) 25 | { 26 | #ifndef GCS_FOR_GARB 27 | if (gu_likely(gcache != NULL)) 28 | return gcache_malloc (gcache, size); 29 | else 30 | #endif 31 | return ::malloc (size); 32 | } 33 | 34 | static inline void 35 | gcs_gcache_free (gcache_t* gcache, const void* buf) 36 | { 37 | #ifndef GCS_FOR_GARB 38 | if (gu_likely (gcache != NULL)) 39 | gcache_free (gcache, buf); 40 | else 41 | #endif 42 | ::free (const_cast(buf)); 43 | } 44 | 45 | #endif /* _gcs_gcache_h_ */ 46 | -------------------------------------------------------------------------------- /cmake/coverage.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2020 Codership Oy 3 | # 4 | 5 | # To produce a coverage report, call cmake with -DGALERA_WITH_COVERAGE=ON, 6 | # run 7 | # 8 | # make 9 | # make test 10 | # make ExperimentalCoverage 11 | # make coverage_report 12 | # 13 | # The coverage report output will be in directory root index.html 14 | # 15 | if (GALERA_WITH_COVERAGE) 16 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage") 17 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") 18 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") 19 | find_program(GALERA_LCOV_EXE lcov) 20 | find_program(GALERA_GENHTML_EXE genhtml) 21 | add_custom_target(coverage_report 22 | ${GALERA_LCOV_EXE} --base-directory ${CMAKE_CURRENT_SOURCE_DIR} --capture --directory ${CMAKE_CURRENT_BINARY_DIR} --output lcov.info --no-external --quiet 23 | COMMAND ${GALERA_GENHTML_EXE} --output-directory coverage_report lcov.info) 24 | endif() 25 | -------------------------------------------------------------------------------- /asio/asio/basic_streambuf_fwd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // basic_streambuf_fwd.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_BASIC_STREAMBUF_FWD_HPP 12 | #define ASIO_BASIC_STREAMBUF_FWD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(ASIO_NO_IOSTREAM) 21 | 22 | #include 23 | 24 | namespace asio { 25 | 26 | template > 27 | class basic_streambuf; 28 | 29 | template > 30 | class basic_streambuf_ref; 31 | 32 | } // namespace asio 33 | 34 | #endif // !defined(ASIO_NO_IOSTREAM) 35 | 36 | #endif // ASIO_BASIC_STREAMBUF_FWD_HPP 37 | -------------------------------------------------------------------------------- /gcache/src/SConscript: -------------------------------------------------------------------------------- 1 | 2 | Import('env') 3 | 4 | gcache_env = env.Clone() 5 | 6 | # Include paths 7 | gcache_env.Append(CPPPATH = Split(''' 8 | #/common 9 | #/galerautils/src 10 | ''')) 11 | 12 | gcache_sources = Split (''' 13 | GCache_seqno.cpp 14 | gcache_params.cpp 15 | gcache_page.cpp 16 | gcache_page_store.cpp 17 | gcache_rb_store.cpp 18 | gcache_mem_store.cpp 19 | GCache_memops.cpp 20 | GCache.cpp 21 | ''') 22 | 23 | gcache_env.StaticLibrary('gcache', gcache_sources) 24 | 25 | test_env = gcache_env.Clone() 26 | 27 | test_env.Prepend(LIBS=File('#/galerautils/src/libgalerautils.a')) 28 | test_env.Prepend(LIBS=File('#/galerautils/src/libgalerautils++.a')) 29 | test_env.Prepend(LIBS=File('libgcache.a')) 30 | 31 | test_env.Program(target = 'gcache_test', source = 'test.cpp') 32 | 33 | env.Append(LIBGALERA_OBJS = gcache_env.SharedObject(gcache_sources)) 34 | -------------------------------------------------------------------------------- /tests/run_sqlgen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eu 2 | 3 | declare -r DIST_BASE=$(cd $(dirname $0); pwd -P) 4 | TEST_BASE=${TEST_BASE:-"$DIST_BASE"} 5 | 6 | . $TEST_BASE/conf/main.conf 7 | 8 | declare -r SCRIPTS="$DIST_BASE/scripts" 9 | . $SCRIPTS/jobs.sh 10 | . $SCRIPTS/action.sh 11 | . $SCRIPTS/kill.sh 12 | . $SCRIPTS/misc.sh 13 | 14 | check() 15 | { 16 | consistency_check $sqlgen_pid 17 | } 18 | 19 | #trap check SIGINT 20 | #node=1 21 | #DBMS_HOST=${NODE_INCOMING_HOST[$node]} 22 | #DBMS_PORT=${NODE_INCOMING_PORT[$node]} 23 | 24 | # Start load 25 | SQLGEN=${SQLGEN:-"$DIST_BASE/bin/sqlgen"} 26 | LD_PRELOAD=$GLB_PRELOAD \ 27 | DYLD_INSERT_LIBRARIES=$GLB_PRELOAD \ 28 | DYLD_FORCE_FLAT_NAMESPACE=1 \ 29 | $SQLGEN --user $DBMS_TEST_USER --pswd $DBMS_TEST_PSWD --host $DBMS_HOST \ 30 | --port $DBMS_PORT --users $DBMS_CLIENTS --duration 999999999 \ 31 | --stat-interval 20 --sess-min 999999 --sess-max 999999 \ 32 | --rollbacks 0.1 33 | # >/dev/null 2>$BASE_RUN/seesaw.err & 34 | #declare -r sqlgen_pid=$! 35 | #fg 36 | 37 | -------------------------------------------------------------------------------- /asio/asio/detail/assert.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/assert.hpp 3 | // ~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_ASSERT_HPP 12 | #define ASIO_DETAIL_ASSERT_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_HAS_BOOST_ASSERT) 21 | # include 22 | #else // defined(ASIO_HAS_BOOST_ASSERT) 23 | # include 24 | #endif // defined(ASIO_HAS_BOOST_ASSERT) 25 | 26 | #if defined(ASIO_HAS_BOOST_ASSERT) 27 | # define ASIO_ASSERT(expr) BOOST_ASSERT(expr) 28 | #else // defined(ASIO_HAS_BOOST_ASSERT) 29 | # define ASIO_ASSERT(expr) assert(expr) 30 | #endif // defined(ASIO_HAS_BOOST_ASSERT) 31 | 32 | #endif // ASIO_DETAIL_ASSERT_HPP 33 | -------------------------------------------------------------------------------- /asio/asio/detail/operation.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/operation.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_OPERATION_HPP 12 | #define ASIO_DETAIL_OPERATION_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_HAS_IOCP) 21 | # include "asio/detail/win_iocp_operation.hpp" 22 | #else 23 | # include "asio/detail/scheduler_operation.hpp" 24 | #endif 25 | 26 | namespace asio { 27 | namespace detail { 28 | 29 | #if defined(ASIO_HAS_IOCP) 30 | typedef win_iocp_operation operation; 31 | #else 32 | typedef scheduler_operation operation; 33 | #endif 34 | 35 | } // namespace detail 36 | } // namespace asio 37 | 38 | #endif // ASIO_DETAIL_OPERATION_HPP 39 | -------------------------------------------------------------------------------- /galerautils/src/gu_hexdump.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2013 Codership Oy 2 | /** 3 | * @file operator << for hexdump - definiton 4 | * 5 | * $Id$ 6 | */ 7 | 8 | #include "gu_hexdump.hpp" 9 | 10 | #include "gu_hexdump.h" 11 | #include "gu_logger.hpp" 12 | 13 | namespace gu { 14 | 15 | static size_t const hexdump_bytes_per_go(GU_HEXDUMP_BYTES_PER_LINE * 2); 16 | static size_t const hexdump_reserve_string( 17 | hexdump_bytes_per_go*2 /* chars */ + hexdump_bytes_per_go/4 /* whitespace */ 18 | + 1 /* \0 */ 19 | ); 20 | 21 | std::ostream& 22 | Hexdump::to_stream (std::ostream& os) const 23 | { 24 | char str[hexdump_reserve_string]; 25 | size_t off(0); 26 | 27 | while (off < size_) 28 | { 29 | size_t const to_print(std::min(size_ - off, hexdump_bytes_per_go)); 30 | 31 | gu_hexdump (buf_ + off, to_print, str, sizeof(str), alpha_); 32 | 33 | off += to_print; 34 | 35 | os << str; if (off < size_) os << '\n'; 36 | } 37 | 38 | return os; 39 | } 40 | 41 | } // namespace gu 42 | 43 | 44 | -------------------------------------------------------------------------------- /tests/conf/README.md: -------------------------------------------------------------------------------- 1 | Certificates 2 | ============ 3 | 4 | Note: These certificates should be used for testing purposes only. 5 | 6 | Certificate and key files in this directory: 7 | 8 | Simple key and certificate 9 | -------------------------- 10 | 11 | This key and certificate must be identical on each node: 12 | - galera_key.pem/galera_cert.pem - standalone key/certificate which 13 | can be used for testing in symmetric setups 14 | 15 | 16 | Certificate Chain 17 | ----------------- 18 | 19 | Keys and certificates below have been created by using easy-rsa 3 CLI 20 | utility: https://github.com/OpenVPN/easy-rsa 21 | 22 | - galera-ca.pem - Root CA certificate for testing 23 | - galera-int.pem - Intermediate certificate for testing 24 | - galera-server-n.key Server private key for node n 25 | - galera-server-n.pem - Server certificate for node n 26 | - bundle-galera-server-n.pem File containing both server and intermediate 27 | certificate for node n 28 | 29 | See script gen-cert-chain.sh in this same directory for chain generation. -------------------------------------------------------------------------------- /gcs/src/gcs_error.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Codership Oy 3 | */ 4 | 5 | #include "gcs_error.hpp" 6 | 7 | #include 8 | #include 9 | 10 | const char* gcs_error_str(int err) 11 | { 12 | switch (err) 13 | { 14 | case EINTR: return "Operation interrupted"; 15 | case EAGAIN: return "Operation failed temporarily"; 16 | case EPERM: 17 | case ENOTCONN: return "Not in primary component"; 18 | case ECONNABORTED: return "Connection was closed"; 19 | case EBADF: return "Connection not initialized"; 20 | case ETIMEDOUT: return "Operation timed out"; 21 | default: return strerror(err); 22 | } 23 | } 24 | 25 | const char* gcs_state_transfer_error_str(int err) 26 | { 27 | switch (err) 28 | { 29 | case EAGAIN: 30 | return "No donor candidates temporarily available in suitable state"; 31 | case EHOSTUNREACH: return "Requested donor is not available"; 32 | case EHOSTDOWN: return "Joiner and donor can't be the same node"; 33 | default: return gcs_error_str(err); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /asio/asio/detail/reactor.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/reactor.hpp 3 | // ~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_REACTOR_HPP 12 | #define ASIO_DETAIL_REACTOR_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/reactor_fwd.hpp" 19 | 20 | #if defined(ASIO_HAS_EPOLL) 21 | # include "asio/detail/epoll_reactor.hpp" 22 | #elif defined(ASIO_HAS_KQUEUE) 23 | # include "asio/detail/kqueue_reactor.hpp" 24 | #elif defined(ASIO_HAS_DEV_POLL) 25 | # include "asio/detail/dev_poll_reactor.hpp" 26 | #elif defined(ASIO_HAS_IOCP) || defined(ASIO_WINDOWS_RUNTIME) 27 | # include "asio/detail/null_reactor.hpp" 28 | #else 29 | # include "asio/detail/select_reactor.hpp" 30 | #endif 31 | 32 | #endif // ASIO_DETAIL_REACTOR_HPP 33 | -------------------------------------------------------------------------------- /cmake/asan.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2020-2023 Codership Oy 3 | # 4 | 5 | if (GALERA_WITH_ASAN) 6 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address") 7 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") 8 | add_definitions(-DGALERA_WITH_ASAN) 9 | endif() 10 | 11 | if (GALERA_WITH_UBSAN) 12 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined") 13 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined") 14 | add_definitions(-DGALERA_WITH_UBSAN) 15 | # don't run unit tests that use outdaed unaligned record set format 16 | add_definitions(-DGALERA_ONLY_ALIGNED) 17 | 18 | find_library(UBSAN_LIB NAMES ubsan libubsan.so.1) 19 | message(STATUS ${UBSAN_LIB}) 20 | set(CMAKE_REQUIRED_LIBRARIES ${UBSAN_LIB}) 21 | check_c_source_compiles("int main() { return 0; }" GALERA_HAVE_UBSAN_LIB) 22 | if (NOT GALERA_HAVE_UBSAN_LIB) 23 | message(FATAL_ERROR "Could not find UBSAN support library") 24 | endif() 25 | unset(CMAKE_REQUIRED_LIBRARIES) 26 | list(APPEND GALERA_SYSTEM_LIBS ${UBSAN_LIB}) 27 | endif() 28 | -------------------------------------------------------------------------------- /asio/asio/detail/array_fwd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/array_fwd.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_ARRAY_FWD_HPP 12 | #define ASIO_DETAIL_ARRAY_FWD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | namespace boost { 21 | 22 | template 23 | class array; 24 | 25 | } // namespace boost 26 | 27 | // Standard library components can't be forward declared, so we'll have to 28 | // include the array header. Fortunately, it's fairly lightweight and doesn't 29 | // add significantly to the compile time. 30 | #if defined(ASIO_HAS_STD_ARRAY) 31 | # include 32 | #endif // defined(ASIO_HAS_STD_ARRAY) 33 | 34 | #endif // ASIO_DETAIL_ARRAY_FWD_HPP 35 | -------------------------------------------------------------------------------- /asio/asio/detail/array.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/array.hpp 3 | // ~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_ARRAY_HPP 12 | #define ASIO_DETAIL_ARRAY_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_HAS_STD_ARRAY) 21 | # include 22 | #else // defined(ASIO_HAS_STD_ARRAY) 23 | # include 24 | #endif // defined(ASIO_HAS_STD_ARRAY) 25 | 26 | namespace asio { 27 | namespace detail { 28 | 29 | #if defined(ASIO_HAS_STD_ARRAY) 30 | using std::array; 31 | #else // defined(ASIO_HAS_STD_ARRAY) 32 | using boost::array; 33 | #endif // defined(ASIO_HAS_STD_ARRAY) 34 | 35 | } // namespace detail 36 | } // namespace asio 37 | 38 | #endif // ASIO_DETAIL_ARRAY_HPP 39 | -------------------------------------------------------------------------------- /galerautils/tests/gu_time_test.c: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2007-2020 Codership Oy 2 | 3 | // $Id$ 4 | 5 | #include 6 | #include 7 | #include "gu_time_test.h" 8 | #include "../src/gu_time.h" 9 | 10 | START_TEST (gu_time_test) 11 | { 12 | struct timeval left = { 1, 900000 }; // 1.9 sec 13 | struct timeval right = { 5, 400000 }; // 5.4 sec 14 | double diff, tolerance = 1.0e-15; // double precision tolerance 15 | 16 | diff = gu_timeval_diff (&left, &right); 17 | ck_assert_msg(fabs(3.5 + diff) <= tolerance, 18 | "Expected %f, got %f, delta: %e", -3.5, diff, 3.5 + diff); 19 | diff = gu_timeval_diff (&right, &left); 20 | ck_assert_msg(fabs(3.5 - diff) <= tolerance, 21 | "Expected %f, got %f, delta: %e", 3.5, diff, 3.5 - diff); 22 | } 23 | END_TEST 24 | 25 | Suite *gu_time_suite(void) 26 | { 27 | Suite *s = suite_create("Galera time functions"); 28 | TCase *tc = tcase_create("gu_time"); 29 | 30 | suite_add_tcase (s, tc); 31 | tcase_add_test (tc, gu_time_test); 32 | return s; 33 | } 34 | 35 | -------------------------------------------------------------------------------- /garb/garb_gcs.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011-2016 Codership Oy */ 2 | 3 | #ifndef _GARB_GCS_HPP_ 4 | #define _GARB_GCS_HPP_ 5 | 6 | #include 7 | #include 8 | 9 | namespace garb 10 | { 11 | 12 | class Gcs 13 | { 14 | public: 15 | 16 | Gcs (gu::Config& conf, 17 | const std::string& name, 18 | const std::string& address, 19 | const std::string& group); 20 | 21 | ~Gcs (); 22 | 23 | void recv (gcs_action& act); 24 | 25 | void request_state_transfer (const std::string& request, 26 | const std::string& donor); 27 | 28 | void join (const gu::GTID&, int code); 29 | 30 | void set_last_applied(const gu::GTID&); 31 | 32 | int proto_ver() const { return gcs_proto_ver(gcs_); } 33 | 34 | void close (); 35 | 36 | private: 37 | 38 | bool closed_; 39 | gcs_conn_t* gcs_; 40 | 41 | Gcs (const Gcs&); 42 | Gcs& operator= (const Gcs&); 43 | 44 | }; /* class Gcs */ 45 | 46 | } /* namespace garb */ 47 | 48 | #endif /* _GARB_GCS_HPP_ */ 49 | -------------------------------------------------------------------------------- /galerautils/src/gu_utils.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2010 Codership Oy 2 | 3 | /** 4 | * @file Miscellaneous utility functions 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #ifndef _gu_utils_h_ 10 | #define _gu_utils_h_ 11 | 12 | #include 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | /* 19 | * The string conversion functions below are slighly customized 20 | * versions of standard libc functions designed to understand 'on'/'off' and 21 | * K/M/G size modifiers and the like. 22 | * 23 | * They return pointer to the next character after conversion: 24 | * - if (ret == str) no conversion was made 25 | * - if (ret[0] == '\0') whole string was converted */ 26 | 27 | extern const char* 28 | gu_str2ll (const char* str, long long* ll); 29 | 30 | extern const char* 31 | gu_str2dbl (const char* str, double* dbl); 32 | 33 | extern const char* 34 | gu_str2bool (const char* str, bool* b); 35 | 36 | extern const char* 37 | gu_str2ptr (const char* str, void** ptr); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif /* _gu_utils_h_ */ 44 | -------------------------------------------------------------------------------- /asio/asio/serial_port.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // serial_port.hpp 3 | // ~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) 7 | // 8 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 9 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | // 11 | 12 | #ifndef ASIO_SERIAL_PORT_HPP 13 | #define ASIO_SERIAL_PORT_HPP 14 | 15 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 | # pragma once 17 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 18 | 19 | #include "asio/detail/config.hpp" 20 | 21 | #if defined(ASIO_HAS_SERIAL_PORT) \ 22 | || defined(GENERATING_DOCUMENTATION) 23 | 24 | #include "asio/basic_serial_port.hpp" 25 | 26 | namespace asio { 27 | 28 | /// Typedef for the typical usage of a serial port. 29 | typedef basic_serial_port<> serial_port; 30 | 31 | } // namespace asio 32 | 33 | #endif // defined(ASIO_HAS_SERIAL_PORT) 34 | // || defined(GENERATING_DOCUMENTATION) 35 | 36 | #endif // ASIO_SERIAL_PORT_HPP 37 | -------------------------------------------------------------------------------- /asio/asio/detail/functional.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/functional.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_FUNCTIONAL_HPP 12 | #define ASIO_DETAIL_FUNCTIONAL_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #include 21 | 22 | #if !defined(ASIO_HAS_STD_FUNCTION) 23 | # include 24 | #endif // !defined(ASIO_HAS_STD_FUNCTION) 25 | 26 | namespace asio { 27 | namespace detail { 28 | 29 | #if defined(ASIO_HAS_STD_FUNCTION) 30 | using std::function; 31 | #else // defined(ASIO_HAS_STD_FUNCTION) 32 | using boost::function; 33 | #endif // defined(ASIO_HAS_STD_FUNCTION) 34 | 35 | } // namespace detail 36 | } // namespace asio 37 | 38 | #endif // ASIO_DETAIL_FUNCTIONAL_HPP 39 | -------------------------------------------------------------------------------- /tests/test_sqlgen/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -eu 2 | 3 | BASE_DIR=$(cd $(dirname $0); pwd -P) 4 | 5 | REPORT_DIR="$TEST_REPORT_DIR/sqlgen" 6 | if ! test -d $REPORT_DIR 7 | then 8 | mkdir $REPORT_DIR 9 | if test $? != 0 10 | then 11 | echo "Failed to create report directory" 12 | exit 1 13 | fi 14 | fi 15 | 16 | SQLGEN_LOG=$REPORT_DIR/sqlgen.log 17 | echo "Running sqlgen test, args: $@" >> $SQLGEN_LOG 18 | 19 | . $TEST_BASE_DIR/tap/tap-functions 20 | 21 | plan_tests 1 22 | 23 | 24 | if test $CLUSTER_N_NODES -lt 1 25 | then 26 | skip "ok" "No nodes available, skipping test" 27 | elif ! test -x $BASE_DIR/sqlgen 28 | then 29 | skip "ok" "sqlgen binary not found, skipping test" 30 | else 31 | echo "Starting load" >> $SQLGEN_LOG 32 | args="" 33 | for ii in $CLUSTER_NODES 34 | do 35 | args="$args --host $ii" 36 | done 37 | args="$args --port $MYSQL_PORT $@" 38 | LD_PRELOAD=$GLB_PRELOAD \ 39 | DYLD_INSERT_LIBRARIES=$GLB_PRELOAD \ 40 | DYLD_FORCE_FLAT_NAMESPACE=1 \ 41 | $BASE_DIR/sqlgen $args >> $SQLGEN_LOG 2>&1 42 | ok $? "sqlgen" 43 | fi 44 | 45 | -------------------------------------------------------------------------------- /.bzrignore: -------------------------------------------------------------------------------- 1 | #*# 2 | *$ 3 | *,v 4 | *.BAK 5 | *.a 6 | *.bak 7 | *.elc 8 | *.exe 9 | *.la 10 | *.lo 11 | *.o 12 | *.obj 13 | *.orig 14 | *.py[oc] 15 | *.so 16 | *.os 17 | *.tmp 18 | *.log 19 | *.passed 20 | *~ 21 | .#* 22 | .*.sw[nop] 23 | .*.tmp 24 | ./.python-eggs 25 | .DS_Store 26 | .arch-ids 27 | .arch-inventory 28 | .bzr.log 29 | .del-* 30 | .git 31 | .hg 32 | .jamdeps.libs 33 | .make.state 34 | .sconsign* 35 | .svn 36 | .sw[nop] 37 | .tmp* 38 | BitKeeper 39 | CVS 40 | CVS.adm 41 | RCS 42 | SCCS 43 | TAGS 44 | _darcs 45 | aclocal.m4 46 | autom4te* 47 | config.h 48 | config.h.in 49 | config.log 50 | config.status 51 | config.sub 52 | docs/build/* 53 | stamp-h 54 | stamp-h.in 55 | stamp-h1 56 | scons* 57 | .sconf* 58 | {arch} 59 | galera_check 60 | gu_tests 61 | gu_tests++ 62 | check_gcomm 63 | gcs_test 64 | gcs_tests 65 | cluster.conf 66 | nodes.conf 67 | tests/conf/*.cnf 68 | tests/run 69 | tests/out 70 | tests/bin/* 71 | gcache/src/test 72 | gcache/tests/gcache_tests 73 | Makefile 74 | Makefile.in 75 | .deps 76 | .libs 77 | garb/garbd 78 | gcs/src/.garb 79 | docs/build/ 80 | gcomm/test/ssl_test 81 | galerautils/src/gu_fnv_bench 82 | -------------------------------------------------------------------------------- /asio/asio/posix/descriptor.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // posix/descriptor.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_POSIX_DESCRIPTOR_HPP 12 | #define ASIO_POSIX_DESCRIPTOR_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_HAS_POSIX_STREAM_DESCRIPTOR) \ 21 | || defined(GENERATING_DOCUMENTATION) 22 | 23 | #include "asio/posix/basic_descriptor.hpp" 24 | 25 | namespace asio { 26 | namespace posix { 27 | 28 | /// Typedef for the typical usage of basic_descriptor. 29 | typedef basic_descriptor<> descriptor; 30 | 31 | } // namespace posix 32 | } // namespace asio 33 | 34 | #endif // defined(ASIO_HAS_POSIX_STREAM_DESCRIPTOR) 35 | // || defined(GENERATING_DOCUMENTATION) 36 | 37 | #endif // ASIO_POSIX_DESCRIPTOR_HPP 38 | -------------------------------------------------------------------------------- /asio/asio/detail/noncopyable.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/noncopyable.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_NONCOPYABLE_HPP 12 | #define ASIO_DETAIL_NONCOPYABLE_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #include "asio/detail/push_options.hpp" 21 | 22 | namespace asio { 23 | namespace detail { 24 | 25 | class noncopyable 26 | { 27 | protected: 28 | noncopyable() {} 29 | ~noncopyable() {} 30 | private: 31 | noncopyable(const noncopyable&); 32 | const noncopyable& operator=(const noncopyable&); 33 | }; 34 | 35 | } // namespace detail 36 | 37 | using asio::detail::noncopyable; 38 | 39 | } // namespace asio 40 | 41 | #include "asio/detail/pop_options.hpp" 42 | 43 | #endif // ASIO_DETAIL_NONCOPYABLE_HPP 44 | -------------------------------------------------------------------------------- /gcs/src/gcs_act.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008-2020 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | 7 | #ifndef _gcs_act_h_ 8 | #define _gcs_act_h_ 9 | 10 | #include "gcs.hpp" 11 | 12 | struct gcs_act 13 | { 14 | const void* buf; 15 | ssize_t buf_len; 16 | gcs_act_type_t type; 17 | gcs_act() : buf(NULL), buf_len(0), type(GCS_ACT_ERROR) { } 18 | gcs_act(const void* b, ssize_t bl, gcs_act_type_t t) 19 | : 20 | buf(b), 21 | buf_len(bl), 22 | type(t) 23 | { } 24 | }; 25 | 26 | struct gcs_act_rcvd 27 | { 28 | struct gcs_act act; 29 | const struct gu_buf* local; // local buffer vector if any 30 | gcs_seqno_t id; // global total order seqno 31 | int sender_idx; 32 | gcs_act_rcvd() : act(), local(NULL), id(GCS_SEQNO_ILL), sender_idx(-1) { } 33 | gcs_act_rcvd(const gcs_act& a, const struct gu_buf* loc, 34 | gcs_seqno_t i, int si) 35 | : 36 | act(a), 37 | local(loc), 38 | id(i), 39 | sender_idx(si) 40 | { } 41 | }; 42 | 43 | #endif /* _gcs_act_h_ */ 44 | -------------------------------------------------------------------------------- /asio/asio/ssl/detail/openssl_types.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ssl/detail/openssl_types.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_SSL_DETAIL_OPENSSL_TYPES_HPP 12 | #define ASIO_SSL_DETAIL_OPENSSL_TYPES_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/detail/socket_types.hpp" 20 | #if defined(ASIO_USE_WOLFSSL) 21 | # include 22 | #endif // defined(ASIO_USE_WOLFSSL) 23 | #include 24 | #include 25 | #if !defined(OPENSSL_NO_ENGINE) 26 | # include 27 | #endif // !defined(OPENSSL_NO_ENGINE) 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #endif // ASIO_SSL_DETAIL_OPENSSL_TYPES_HPP 34 | -------------------------------------------------------------------------------- /asio/asio/ts/executor.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ts/executor.hpp 3 | // ~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_TS_EXECUTOR_HPP 12 | #define ASIO_TS_EXECUTOR_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/async_result.hpp" 19 | #include "asio/associated_allocator.hpp" 20 | #include "asio/execution_context.hpp" 21 | #include "asio/is_executor.hpp" 22 | #include "asio/associated_executor.hpp" 23 | #include "asio/bind_executor.hpp" 24 | #include "asio/executor_work_guard.hpp" 25 | #include "asio/system_executor.hpp" 26 | #include "asio/executor.hpp" 27 | #include "asio/dispatch.hpp" 28 | #include "asio/post.hpp" 29 | #include "asio/defer.hpp" 30 | #include "asio/strand.hpp" 31 | #include "asio/packaged_task.hpp" 32 | #include "asio/use_future.hpp" 33 | 34 | #endif // ASIO_TS_EXECUTOR_HPP 35 | -------------------------------------------------------------------------------- /tests/test_insert/insert_big.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO test_insert VALUES ( 2 | DEFAULT, 3 | RAND(), 4 | CURRENT_DATE, 5 | CURRENT_TIME, 6 | 'pokemon forever', 7 | 'opwkmefovcm weofvowd fowehvfe wehg ryu ki67 w2 fe4t5h ytryu76j tkutykuj 8 | thret h4t5 hjy5tyu6j rt hyj5t jty er w cda swc2trt45yu 65i 76ujt yhjn rhjr 9 | tj6yu7kjyt jt regt h4 hjytykiy ukhr4 hthtrjtyu7 tyu jty jtyjutykj 6tyu jt 10 | hr egge rgte tr5h rthyj ry5 kt dferht rt hjyurt hregftdefgwfrovppoodmpfpp 11 | owenj vfweovwjneokmemfdvcwoem wefvowkej 0o=0943i8t5 34fw=eri=we if jfowem 12 | -jfwef =ojk frwe=fok wedfwoerj fwde f23 c2dw xr5ju76 p0- 0= 7u kiki8 rtg 13 | erf wefd qw fdehtr j k iuk o .lp 4 t5gvwed45w ty65 7u 987l9oimr tg wef d 14 | qews xq d34 t5hg 65kji 87j 5t hg erw f 3wefjfdwpewofvdsf ofvkdspfpvsmvsd 15 | wefverfbvegfrbqwertyuiopsadfghjklzxcvbnm,.qwertyuiklopasdfghjkl 3 | // 4 | 5 | // 6 | // Define gu::array through either std::array or boost::array 7 | // 8 | // Because of the lack of alias template in C++ a workaround of defining 9 | // the type inside the struct array is used. 10 | // 11 | // For example, defining gu::array type for type T is done like: 12 | // 13 | // typedef gu::array::type A; 14 | // 15 | // 16 | 17 | #ifndef GU_ARRAY_HPP 18 | #define GU_ARRAY_HPP 19 | 20 | #if defined(HAVE_STD_ARRAY) 21 | # include 22 | # define GU_ARRAY_NAMESPACE std 23 | #elif defined(HAVE_TR1_ARRAY) 24 | # include 25 | # define GU_ARRAY_NAMESPACE std::tr1 26 | #elif defined(HAVE_BOOST_ARRAY_HPP) 27 | # include 28 | # define GU_ARRAY_NAMESPACE boost 29 | #else 30 | #error No supported array headers 31 | #endif 32 | 33 | namespace gu 34 | { 35 | template 36 | struct array 37 | { 38 | typedef GU_ARRAY_NAMESPACE::array type; 39 | }; 40 | } 41 | 42 | #undef GU_ARRAY_NAMESPACE 43 | 44 | #endif // GU_SHARED_PTR_HPP 45 | -------------------------------------------------------------------------------- /asio/asio/detail/wait_op.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/wait_op.hpp 3 | // ~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_WAIT_OP_HPP 12 | #define ASIO_DETAIL_WAIT_OP_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/detail/operation.hpp" 20 | 21 | #include "asio/detail/push_options.hpp" 22 | 23 | namespace asio { 24 | namespace detail { 25 | 26 | class wait_op 27 | : public operation 28 | { 29 | public: 30 | // The error code to be passed to the completion handler. 31 | asio::error_code ec_; 32 | 33 | protected: 34 | wait_op(func_type func) 35 | : operation(func) 36 | { 37 | } 38 | }; 39 | 40 | } // namespace detail 41 | } // namespace asio 42 | 43 | #include "asio/detail/pop_options.hpp" 44 | 45 | #endif // ASIO_DETAIL_WAIT_OP_HPP 46 | -------------------------------------------------------------------------------- /galerautils/src/gu_signals.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2021 Codership Oy 3 | // 4 | 5 | #ifndef GU_SIGNALS_HPP 6 | #define GU_SIGNALS_HPP 7 | 8 | #include 9 | 10 | namespace gu 11 | { 12 | class Signals 13 | { 14 | public: 15 | enum SignalType 16 | { 17 | S_CONFIG_RELOAD_CERTIFICATE, 18 | }; 19 | typedef boost::signals2::signal signal_t; 20 | typedef signal_t::slot_type slot_type; 21 | typedef boost::signals2::connection signal_connection; 22 | static Signals& Instance(); 23 | signal_connection connect(const slot_type &subscriber); 24 | void signal(const SignalType&); 25 | Signals(Signals const&) = delete; 26 | Signals(Signals&&) = delete; 27 | Signals& operator=(Signals const&) = delete; 28 | Signals& operator=(Signals &&) = delete; 29 | private: 30 | Signals() 31 | : signal_() 32 | { }; 33 | ~Signals() = default; 34 | signal_t signal_; 35 | }; 36 | 37 | } // namespace gu 38 | 39 | #endif // GU_SIGNALS_HPP 40 | -------------------------------------------------------------------------------- /galerautils/src/gu_lock_step.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009-2017 Codership Oy 3 | * 4 | * $Id$ 5 | */ 6 | 7 | // This is a small class to facilitate lock-stepping in multithreaded unit tests 8 | 9 | #ifndef _gu_lock_step_h_ 10 | #define _gu_lock_step_h_ 11 | 12 | #include 13 | 14 | #include "gu_threads.h" 15 | 16 | typedef struct gu_lock_step 17 | { 18 | gu_mutex_t mtx; 19 | gu_cond_t cond; 20 | long wait; 21 | long cont; 22 | bool enabled; 23 | } 24 | gu_lock_step_t; 25 | 26 | extern void 27 | gu_lock_step_init (gu_lock_step_t* ls); 28 | 29 | /* enable or disable lock-stepping */ 30 | extern void 31 | gu_lock_step_enable (gu_lock_step_t* ls, bool enable); 32 | 33 | extern void 34 | gu_lock_step_wait (gu_lock_step_t* ls); 35 | 36 | /* returns how many waiters there were, 37 | * waits for timeout_ms milliseconds if no waiters, if timeout_ms < 0 waits forever, 38 | * if 0 - no wait at all */ 39 | extern long 40 | gu_lock_step_cont (gu_lock_step_t* ls, long timeout_ms); 41 | 42 | extern void 43 | gu_lock_step_destroy (gu_lock_step_t* ls); 44 | 45 | #endif /* _gu_lock_step_h_ */ 46 | -------------------------------------------------------------------------------- /galerautils/src/gu_asio_utils.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2020 Codership Oy 3 | // 4 | 5 | /** 6 | * Common implementation utilities for gu Asio 7 | */ 8 | 9 | #ifndef GU_ASIO_UTILS_HPP 10 | #define GU_ASIO_UTILS_HPP 11 | 12 | #ifndef GU_ASIO_IMPL 13 | #error This header should not be included directly. 14 | #endif // GU_ASIO_IMPL 15 | 16 | #include "asio/ip/address.hpp" 17 | #include 18 | 19 | // Workaround for clang 3.4 which pretends to be an old gcc compiler 20 | // which in turn turns off some features in boost headers. Also 21 | // GCC 4.4 and early Boost versions seem to be affected. 22 | #if (defined(__clang__) && __clang_major__ == 3 && __clang_minor__ <= 4) || \ 23 | (__GNUC__ == 4 && __GNUC_MINOR__ == 4) || BOOST_VERSION < 105300 24 | namespace gu 25 | { 26 | template inline T* get_pointer(std::shared_ptr const& r) 27 | { 28 | return r.get(); 29 | } 30 | } 31 | #endif // (defined(__clang__) && __clang_major__ == 3 && 32 | // __clang_minor__ <= 4) || 33 | // (__GNUC__ == 4 && __GNUC_MINOR__ == 4) || BOOST_VERSION < 105300 34 | 35 | #endif // GU_ASIO_UTILS_HPP 36 | -------------------------------------------------------------------------------- /galerautils/src/gu_status.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2014 Codership Oy 2 | 3 | //! 4 | // @file 5 | // Common class for gathering Galera wide status. The class is simple 6 | // string based key-value store. 7 | // 8 | 9 | #ifndef GU_STATUS_HPP 10 | #define GU_STATUS_HPP 11 | 12 | #include "gu_exception.hpp" 13 | #include 14 | #include 15 | 16 | namespace gu 17 | { 18 | 19 | class Status 20 | { 21 | public: 22 | typedef std::map VarMap; 23 | typedef VarMap::iterator iterator; 24 | typedef VarMap::const_iterator const_iterator; 25 | 26 | Status() : vars_() { } 27 | 28 | void insert(const std::string& key, const std::string& val) 29 | { 30 | vars_.insert(std::make_pair(key, val)); 31 | } 32 | 33 | const_iterator begin() { return vars_.begin(); } 34 | 35 | const_iterator end() { return vars_.end(); } 36 | 37 | size_t size() const { return vars_.size(); } 38 | 39 | private: 40 | VarMap vars_; 41 | }; 42 | } 43 | 44 | 45 | 46 | #endif // !GU_STATUS_HPP 47 | -------------------------------------------------------------------------------- /asio/asio/detail/fd_set_adapter.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/fd_set_adapter.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_FD_SET_ADAPTER_HPP 12 | #define ASIO_DETAIL_FD_SET_ADAPTER_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(ASIO_WINDOWS_RUNTIME) 21 | 22 | #include "asio/detail/posix_fd_set_adapter.hpp" 23 | #include "asio/detail/win_fd_set_adapter.hpp" 24 | 25 | namespace asio { 26 | namespace detail { 27 | 28 | #if defined(ASIO_WINDOWS) || defined(__CYGWIN__) 29 | typedef win_fd_set_adapter fd_set_adapter; 30 | #else 31 | typedef posix_fd_set_adapter fd_set_adapter; 32 | #endif 33 | 34 | } // namespace detail 35 | } // namespace asio 36 | 37 | #endif // !defined(ASIO_WINDOWS_RUNTIME) 38 | 39 | #endif // ASIO_DETAIL_FD_SET_ADAPTER_HPP 40 | -------------------------------------------------------------------------------- /gcomm/src/gcomm/protostack.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 Codership Oy 3 | */ 4 | 5 | #ifndef GCOMM_PROTOSTACK_HPP 6 | #define GCOMM_PROTOSTACK_HPP 7 | 8 | #include "gcomm/protolay.hpp" 9 | 10 | #include "gu_lock.hpp" 11 | 12 | #include 13 | #include 14 | 15 | namespace gcomm 16 | { 17 | class Socket; 18 | class Acceptor; 19 | class Protostack; 20 | class Protonet; 21 | class BoostProtonet; 22 | } 23 | 24 | 25 | class gcomm::Protostack 26 | { 27 | public: 28 | Protostack() : protos_(), mutex_() { } 29 | void push_proto(Protolay* p); 30 | void pop_proto(Protolay* p); 31 | gu::datetime::Date handle_timers(); 32 | void dispatch(const void* id, const Datagram& dg, 33 | const ProtoUpMeta& um); 34 | bool set_param(const std::string&, const std::string&, 35 | Protolay::sync_param_cb_t& sync_param_cb); 36 | void enter() { mutex_.lock(); } 37 | void leave() { mutex_.unlock(); } 38 | private: 39 | friend class Protonet; 40 | std::deque protos_; 41 | gu::Mutex mutex_; 42 | }; 43 | 44 | 45 | #endif // GCOMM_PROTOSTACK_HPP 46 | -------------------------------------------------------------------------------- /asio/asio/windows/stream_handle.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // windows/stream_handle.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_WINDOWS_STREAM_HANDLE_HPP 12 | #define ASIO_WINDOWS_STREAM_HANDLE_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_HAS_WINDOWS_STREAM_HANDLE) \ 21 | || defined(GENERATING_DOCUMENTATION) 22 | 23 | #include "asio/windows/basic_stream_handle.hpp" 24 | 25 | namespace asio { 26 | namespace windows { 27 | 28 | /// Typedef for the typical usage of a stream-oriented handle. 29 | typedef basic_stream_handle<> stream_handle; 30 | 31 | } // namespace windows 32 | } // namespace asio 33 | 34 | #endif // defined(ASIO_HAS_WINDOWS_STREAM_HANDLE) 35 | // || defined(GENERATING_DOCUMENTATION) 36 | 37 | #endif // ASIO_WINDOWS_STREAM_HANDLE_HPP 38 | -------------------------------------------------------------------------------- /asio/asio/ip/host_name.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ip/host_name.hpp 3 | // ~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_IP_HOST_NAME_HPP 12 | #define ASIO_IP_HOST_NAME_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include 20 | #include "asio/error_code.hpp" 21 | 22 | #include "asio/detail/push_options.hpp" 23 | 24 | namespace asio { 25 | namespace ip { 26 | 27 | /// Get the current host name. 28 | ASIO_DECL std::string host_name(); 29 | 30 | /// Get the current host name. 31 | ASIO_DECL std::string host_name(asio::error_code& ec); 32 | 33 | } // namespace ip 34 | } // namespace asio 35 | 36 | #include "asio/detail/pop_options.hpp" 37 | 38 | #if defined(ASIO_HEADER_ONLY) 39 | # include "asio/ip/impl/host_name.ipp" 40 | #endif // defined(ASIO_HEADER_ONLY) 41 | 42 | #endif // ASIO_IP_HOST_NAME_HPP 43 | -------------------------------------------------------------------------------- /galerautils/src/gu_string_utils.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2009-2010 Codership Oy 2 | 3 | #ifndef __GU_STRING_UTILS_HPP__ 4 | #define __GU_STRING_UTILS_HPP__ 5 | 6 | #include 7 | #include 8 | 9 | namespace gu 10 | { 11 | /*! 12 | * @brief Split string into tokens using given separator 13 | * 14 | * @param sep token separator 15 | */ 16 | std::vector strsplit(const std::string& s, char sep = ' '); 17 | 18 | /*! 19 | * @brief Split string into tokens using given separator and escape. 20 | * 21 | * @param sep token separator 22 | * @param esc separator escape sequence ('\0' to disable escapes) 23 | * @param empty whether to return empty tokens 24 | */ 25 | std::vector tokenize(const std::string& s, 26 | char sep = ' ', 27 | char esc = '\\', 28 | bool empty = false); 29 | 30 | /*! Remove non-alnum symbols from the beginning and end of string */ 31 | void trim (std::string& s); 32 | } 33 | 34 | #endif /* __GU_STRING_UTILS_HPP__ */ 35 | -------------------------------------------------------------------------------- /cmake/os.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2020 Codership Oy 3 | # 4 | # OS specific tweaks and libraries. 5 | # 6 | 7 | find_library(PTHREAD_LIB pthread) 8 | find_library(RT_LIB rt) 9 | set(GALERA_SYSTEM_LIBS ${PTHREAD_LIB} ${RT_LIB}) 10 | 11 | if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") 12 | # Check if linkage with atomic library is needed for 8 byte atomics 13 | set(ATOMIC_8_TEST_C_SOURCE 14 | "#include 15 | int main() { atomic_llong val; atomic_fetch_add(&val, 1); return 0; }") 16 | check_c_source_compiles("${ATOMIC_8_TEST_C_SOURCE}" GALERA_HAVE_ATOMIC) 17 | if (NOT GALERA_HAVE_ATOMIC) 18 | find_library(ATOMIC_LIB NAMES atomic libatomic.so.1) 19 | message(STATUS ${ATOMIC_LIB}) 20 | set(CMAKE_REQUIRED_LIBRARIES ${ATOMIC_LIB}) 21 | check_c_source_compiles("${ATOMIC_8_TEST_C_SOURCE}" GALERA_HAVE_ATOMIC_LIB) 22 | if (NOT GALERA_HAVE_ATOMIC_LIB) 23 | message(FATAL_ERROR "Could not find support for 64 bit atomic operations") 24 | endif() 25 | unset(CMAKE_REQUIRED_LIBRARIES) 26 | list(APPEND GALERA_SYSTEM_LIBS ${ATOMIC_LIB}) 27 | endif() 28 | endif() 29 | 30 | message(STATUS "Galera system libs: ${GALERA_SYSTEM_LIBS}") 31 | -------------------------------------------------------------------------------- /gcache/src/gcache_seqno.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016-2025 Codership Oy 3 | */ 4 | 5 | #ifndef __GCACHE_SEQNO__ 6 | #define __GCACHE_SEQNO__ 7 | 8 | #include 9 | #include 10 | 11 | namespace gcache 12 | { 13 | typedef int64_t seqno_t; 14 | 15 | static seqno_t const SEQNO_NONE = 0; 16 | static seqno_t const SEQNO_ILL = -1; 17 | static seqno_t const SEQNO_MAX 18 | #if __GNUC__ <= 5 /* workaround for GCC 5 (and below) bug */ 19 | __attribute__((unused)) 20 | #endif 21 | = std::numeric_limits::max(); 22 | /* Protected interface to seqno map */ 23 | class SeqnoMap 24 | { 25 | public: 26 | /* Discards all seqnos upto and including seqno */ 27 | virtual void seqno_discard(const seqno_t& seqno) = 0; 28 | /* Set low limit on available senqos to > seqno 29 | * (global lock should be held while it is called) */ 30 | virtual void set_low_limit(const seqno_t& seqno) = 0; 31 | 32 | virtual ~SeqnoMap() {} 33 | }; /* SeqnoMap */ 34 | 35 | } /* namespace gcache */ 36 | 37 | #endif /* __GCACHE_SEQNO__ */ 38 | -------------------------------------------------------------------------------- /asio/asio/detail/null_fenced_block.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/null_fenced_block.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_NULL_FENCED_BLOCK_HPP 12 | #define ASIO_DETAIL_NULL_FENCED_BLOCK_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/noncopyable.hpp" 19 | 20 | #include "asio/detail/push_options.hpp" 21 | 22 | namespace asio { 23 | namespace detail { 24 | 25 | class null_fenced_block 26 | : private noncopyable 27 | { 28 | public: 29 | enum half_or_full_t { half, full }; 30 | 31 | // Constructor. 32 | explicit null_fenced_block(half_or_full_t) 33 | { 34 | } 35 | 36 | // Destructor. 37 | ~null_fenced_block() 38 | { 39 | } 40 | }; 41 | 42 | } // namespace detail 43 | } // namespace asio 44 | 45 | #include "asio/detail/pop_options.hpp" 46 | 47 | #endif // ASIO_DETAIL_NULL_FENCED_BLOCK_HPP 48 | -------------------------------------------------------------------------------- /asio/asio/detail/scheduler_thread_info.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/scheduler_thread_info.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_SCHEDULER_THREAD_INFO_HPP 12 | #define ASIO_DETAIL_SCHEDULER_THREAD_INFO_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/op_queue.hpp" 19 | #include "asio/detail/thread_info_base.hpp" 20 | 21 | #include "asio/detail/push_options.hpp" 22 | 23 | namespace asio { 24 | namespace detail { 25 | 26 | class scheduler; 27 | class scheduler_operation; 28 | 29 | struct scheduler_thread_info : public thread_info_base 30 | { 31 | op_queue private_op_queue; 32 | long private_outstanding_work; 33 | }; 34 | 35 | } // namespace detail 36 | } // namespace asio 37 | 38 | #include "asio/detail/pop_options.hpp" 39 | 40 | #endif // ASIO_DETAIL_SCHEDULER_THREAD_INFO_HPP 41 | -------------------------------------------------------------------------------- /asio/asio/posix/stream_descriptor.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // posix/stream_descriptor.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_POSIX_STREAM_DESCRIPTOR_HPP 12 | #define ASIO_POSIX_STREAM_DESCRIPTOR_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_HAS_POSIX_STREAM_DESCRIPTOR) \ 21 | || defined(GENERATING_DOCUMENTATION) 22 | 23 | #include "asio/posix/basic_stream_descriptor.hpp" 24 | 25 | namespace asio { 26 | namespace posix { 27 | 28 | /// Typedef for the typical usage of a stream-oriented descriptor. 29 | typedef basic_stream_descriptor<> stream_descriptor; 30 | 31 | } // namespace posix 32 | } // namespace asio 33 | 34 | #endif // defined(ASIO_HAS_POSIX_STREAM_DESCRIPTOR) 35 | // || defined(GENERATING_DOCUMENTATION) 36 | 37 | #endif // ASIO_POSIX_STREAM_DESCRIPTOR_HPP 38 | -------------------------------------------------------------------------------- /galerautils/src/gu_asio_io_service_impl.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2020 Codership Oy 3 | // 4 | 5 | /** @file gu_asio_io_service.hpp 6 | * 7 | * Asio IO service implementation. 8 | */ 9 | 10 | #ifndef GU_ASIO_IO_SERVICE_HPP 11 | #define GU_ASIO_IO_SERVICE_HPP 12 | 13 | #ifndef GU_ASIO_IMPL 14 | #error This header should not be included directly. 15 | #endif // GU_ASIO_IMPL 16 | 17 | #include "gu_asio.hpp" 18 | 19 | #include "asio/io_service.hpp" 20 | #ifdef GALERA_HAVE_SSL 21 | #include "asio/ssl.hpp" 22 | #endif // GALERA_HAVE_SSL 23 | 24 | namespace gu 25 | { 26 | // 27 | // IO Service implementation, wraps asio types. 28 | // 29 | class AsioIoService::Impl 30 | { 31 | public: 32 | Impl() 33 | : io_service_() 34 | #ifdef GALERA_HAVE_SSL 35 | , ssl_context_() 36 | #endif // GALERA_HAVE_SSL 37 | { } 38 | asio::io_service& native() { return io_service_; } 39 | private: 40 | asio::io_service io_service_; 41 | public: 42 | #ifdef GALERA_HAVE_SSL 43 | std::unique_ptr ssl_context_; 44 | #endif // GALERA_HAVE_SSL 45 | }; 46 | } 47 | 48 | #endif // GU_ASIO_IO_SERVICE_HPP 49 | -------------------------------------------------------------------------------- /asio/asio/detail/resolve_op.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/resolve_op.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_RESOLVE_OP_HPP 12 | #define ASIO_DETAIL_RESOLVE_OP_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/error.hpp" 20 | #include "asio/detail/operation.hpp" 21 | 22 | #include "asio/detail/push_options.hpp" 23 | 24 | namespace asio { 25 | namespace detail { 26 | 27 | class resolve_op : public operation 28 | { 29 | public: 30 | // The error code to be passed to the completion handler. 31 | asio::error_code ec_; 32 | 33 | protected: 34 | resolve_op(func_type complete_func) 35 | : operation(complete_func) 36 | { 37 | } 38 | }; 39 | 40 | } // namespace detail 41 | } // namespace asio 42 | 43 | #include "asio/detail/pop_options.hpp" 44 | 45 | #endif // ASIO_DETAIL_RESOLVE_OP_HPP 46 | -------------------------------------------------------------------------------- /asio/asio/detail/signal_init.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/signal_init.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_SIGNAL_INIT_HPP 12 | #define ASIO_DETAIL_SIGNAL_INIT_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(ASIO_WINDOWS) && !defined(__CYGWIN__) 21 | 22 | #include 23 | 24 | #include "asio/detail/push_options.hpp" 25 | 26 | namespace asio { 27 | namespace detail { 28 | 29 | template 30 | class signal_init 31 | { 32 | public: 33 | // Constructor. 34 | signal_init() 35 | { 36 | std::signal(Signal, SIG_IGN); 37 | } 38 | }; 39 | 40 | } // namespace detail 41 | } // namespace asio 42 | 43 | #include "asio/detail/pop_options.hpp" 44 | 45 | #endif // !defined(ASIO_WINDOWS) && !defined(__CYGWIN__) 46 | 47 | #endif // ASIO_DETAIL_SIGNAL_INIT_HPP 48 | -------------------------------------------------------------------------------- /galerautils/src/gu_hexdump.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2012-2013 Codership Oy 2 | 3 | /** 4 | * @file Functions to dump binary buffer contents in a readable form 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #ifndef _gu_hexdump_h_ 10 | #define _gu_hexdump_h_ 11 | 12 | #include "gu_types.h" 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | /* This makes it 32*2 + 7 spaces = 71 character per line - just short of 80 */ 19 | #define GU_HEXDUMP_BYTES_PER_LINE 32 20 | 21 | /*! Dumps contents of the binary buffer in a readable form to a 0-terminated 22 | * string of length not exeeding str_size - 1 23 | * @param buf input binary buffer 24 | * @param but_size size of the input buffer 25 | * @param str target string buffer (will be always 0-terminated) 26 | * @param str_size string buffer size (including terminating 0) 27 | * @param alpha dump alphanumeric characters as they are, padded with '.' 28 | * (e.g. D.u.m.p.) 29 | */ 30 | extern void 31 | gu_hexdump(const void* buf, ssize_t buf_size, 32 | char* str, ssize_t str_size, 33 | bool alpha); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif /* _gu_hexdump_h_ */ 40 | 41 | -------------------------------------------------------------------------------- /galerautils/src/gu_stats.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Codership Oy 3 | */ 4 | 5 | #ifndef _gu_stats_hpp_ 6 | #define _gu_stats_hpp_ 7 | 8 | #include 9 | 10 | namespace gu 11 | { 12 | class Stats 13 | { 14 | public: 15 | Stats():n_(0), 16 | old_m_(), new_m_(), 17 | old_s_(), new_s_(), 18 | min_(), max_() {} 19 | void insert(const double); 20 | void clear() { 21 | n_ = 0; 22 | } 23 | unsigned int times() const { 24 | return n_; 25 | } 26 | double min() const; 27 | double max() const; 28 | double mean() const; 29 | double variance() const; 30 | double std_dev() const; 31 | friend std::ostream& operator<<(std::ostream&, const Stats&); 32 | std::string to_string() const; 33 | private: 34 | unsigned int n_; 35 | double old_m_; 36 | double new_m_; 37 | double old_s_; 38 | double new_s_; 39 | double min_; 40 | double max_; 41 | }; 42 | 43 | std::ostream& operator<<(std::ostream&, const Stats&); 44 | } 45 | 46 | #endif // _gu_stats_hpp_ 47 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | dist: bionic 2 | 3 | language: cpp 4 | 5 | sudo: false 6 | 7 | cache: 8 | - apt 9 | - ccache 10 | 11 | compiler: 12 | - gcc 13 | - clang 14 | 15 | addons: 16 | apt: 17 | sources: 18 | - ubuntu-toolchain-r-test 19 | # https://github.com/travis-ci/travis-ci/issues/3668 20 | # for alternatives in container builds 21 | packages: 22 | - check 23 | - cmake 24 | - debhelper 25 | - libasio-dev 26 | - libboost-dev 27 | - libboost-program-options-dev 28 | - libssl-dev 29 | 30 | script: 31 | - if [ ${CC} != "clang" ]; then 32 | MEM=$(head -n 1 /proc/meminfo); RAM=(${MEM// / }); 33 | MAX_JOBS=$(( ${RAM[1]} / 393216 )); echo Max jobs\:\ $MAX_JOBS; 34 | CORES=$(grep -c ^processor /proc/cpuinfo); 35 | [ $CORES -lt $MAX_JOBS ] && MAX_JOBS=$CORES; echo Real jobs\:\ $MAX_JOBS; 36 | ${CC} --version; ${CXX} --version; 37 | ./scripts/build.sh -j $MAX_JOBS; 38 | export CC=`which gcc-5`; 39 | export CXX=`which g++-5`; 40 | ${CC} --version; ${CXX} --version; 41 | ./scripts/build.sh -j $MAX_JOBS; 42 | else 43 | ${CC} --version ; ${CXX} --version; 44 | ./scripts/build.sh; 45 | fi 46 | -------------------------------------------------------------------------------- /tests/regressions/lp587170/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # 3 | # lp:587170 4 | # 5 | # Verify that ALTER TABLE ... AUTO_INCREMENT produces consistent results. 6 | # 7 | 8 | declare -r DIST_BASE=$(cd $(dirname $0)/../..; pwd -P) 9 | TEST_BASE=${TEST_BASE:-"$DIST_BASE"} 10 | 11 | . $TEST_BASE/conf/main.conf 12 | declare -r SCRIPTS="$DIST_BASE/scripts" 13 | . $SCRIPTS/jobs.sh 14 | . $SCRIPTS/action.sh 15 | . $SCRIPTS/kill.sh 16 | . $SCRIPTS/misc.sh 17 | 18 | echo "##################################################################" 19 | echo "## regression test for lp:1089490" 20 | echo "##################################################################" 21 | 22 | echo "restarting cluster" 23 | ../../scripts/command.sh restart 24 | 25 | 26 | MYSQL="mysql --user=$DBMS_TEST_USER --password=$DBMS_TEST_PSWD --host=${NODE_INCOMING_HOST[0]} --port=${NODE_INCOMING_PORT[0]} -Dtest" 27 | 28 | $MYSQL -e "DROP TABLE IF EXISTS lp587170; 29 | CREATE TABLE lp587170 (i INT); 30 | INSERT INTO lp587170 VALUES (1),(2),(3),(4),(5); 31 | ALTER TABLE lp587170 ADD id INT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;" 32 | 33 | ../../scripts/command.sh check 34 | 35 | 36 | $MYSQL -e "DROP TABLE lp587170" 37 | -------------------------------------------------------------------------------- /galerautils/src/gu_abort.c: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2011-2013 Codership Oy 2 | 3 | /** 4 | * @file Clean abort function 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #define _GNU_SOURCE 10 | #include "gu_abort.h" 11 | 12 | #include "gu_system.h" 13 | #include "gu_log.h" 14 | #include /* for setrlimit() */ 15 | #include /* for signal() */ 16 | #include /* for abort() */ 17 | 18 | #ifdef __linux__ 19 | #include /* for prctl() */ 20 | #endif /* __linux__ */ 21 | 22 | void 23 | gu_abort (void) 24 | { 25 | /* avoid coredump */ 26 | struct rlimit core_limits = { 0, 0 }; 27 | setrlimit (RLIMIT_CORE, &core_limits); 28 | 29 | #ifdef __linux__ 30 | /* Linux with its coredump piping option requires additional care. 31 | * See e.g. https://patchwork.kernel.org/patch/1091782/ */ 32 | prctl(PR_SET_DUMPABLE, 0, 0, 0, 0); 33 | #endif /* __linux__ */ 34 | 35 | /* restore default SIGABRT handler */ 36 | signal (SIGABRT, SIG_DFL); 37 | 38 | #if defined(GU_SYS_PROGRAM_NAME) 39 | gu_info ("%s: Terminated.", GU_SYS_PROGRAM_NAME); 40 | #else 41 | gu_info ("Program terminated."); 42 | #endif 43 | 44 | abort(); 45 | } 46 | 47 | -------------------------------------------------------------------------------- /asio/asio/deadline_timer.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // deadline_timer.hpp 3 | // ~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DEADLINE_TIMER_HPP 12 | #define ASIO_DEADLINE_TIMER_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_HAS_BOOST_DATE_TIME) \ 21 | || defined(GENERATING_DOCUMENTATION) 22 | 23 | #include "asio/detail/socket_types.hpp" // Must come before posix_time. 24 | #include "asio/basic_deadline_timer.hpp" 25 | 26 | #include 27 | 28 | namespace asio { 29 | 30 | /// Typedef for the typical usage of timer. Uses a UTC clock. 31 | typedef basic_deadline_timer deadline_timer; 32 | 33 | } // namespace asio 34 | 35 | #endif // defined(ASIO_HAS_BOOST_DATE_TIME) 36 | // || defined(GENERATING_DOCUMENTATION) 37 | 38 | #endif // ASIO_DEADLINE_TIMER_HPP 39 | -------------------------------------------------------------------------------- /asio/asio/detail/timer_scheduler.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/timer_scheduler.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_TIMER_SCHEDULER_HPP 12 | #define ASIO_DETAIL_TIMER_SCHEDULER_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/detail/timer_scheduler_fwd.hpp" 20 | 21 | #if defined(ASIO_WINDOWS_RUNTIME) 22 | # include "asio/detail/winrt_timer_scheduler.hpp" 23 | #elif defined(ASIO_HAS_IOCP) 24 | # include "asio/detail/win_iocp_io_context.hpp" 25 | #elif defined(ASIO_HAS_EPOLL) 26 | # include "asio/detail/epoll_reactor.hpp" 27 | #elif defined(ASIO_HAS_KQUEUE) 28 | # include "asio/detail/kqueue_reactor.hpp" 29 | #elif defined(ASIO_HAS_DEV_POLL) 30 | # include "asio/detail/dev_poll_reactor.hpp" 31 | #else 32 | # include "asio/detail/select_reactor.hpp" 33 | #endif 34 | 35 | #endif // ASIO_DETAIL_TIMER_SCHEDULER_HPP 36 | -------------------------------------------------------------------------------- /asio/asio/windows/object_handle.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // windows/object_handle.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // Copyright (c) 2011 Boris Schaeling (boris@highscore.de) 7 | // 8 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 9 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | // 11 | 12 | #ifndef ASIO_WINDOWS_OBJECT_HANDLE_HPP 13 | #define ASIO_WINDOWS_OBJECT_HANDLE_HPP 14 | 15 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 | # pragma once 17 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 18 | 19 | #include "asio/detail/config.hpp" 20 | 21 | #if defined(ASIO_HAS_WINDOWS_OBJECT_HANDLE) \ 22 | || defined(GENERATING_DOCUMENTATION) 23 | 24 | #include "asio/windows/basic_object_handle.hpp" 25 | 26 | namespace asio { 27 | namespace windows { 28 | 29 | /// Typedef for the typical usage of an object handle. 30 | typedef basic_object_handle<> object_handle; 31 | 32 | } // namespace windows 33 | } // namespace asio 34 | 35 | #endif // defined(ASIO_HAS_WINDOWS_OBJECT_HANDLE) 36 | // || defined(GENERATING_DOCUMENTATION) 37 | 38 | #endif // ASIO_WINDOWS_OBJECT_HANDLE_HPP 39 | -------------------------------------------------------------------------------- /galerautils/src/gu_event_service.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2021 Codership Oy 3 | // 4 | 5 | #include "gu_event_service.hpp" 6 | 7 | #include 8 | 9 | // 10 | // Event service hooks. 11 | // 12 | 13 | namespace gu 14 | { 15 | std::mutex EventService::mutex; 16 | size_t EventService::usage(0); 17 | 18 | EventService* EventService::instance = nullptr; 19 | 20 | int EventService::init_v1(const wsrep_event_service_v1_t* es) 21 | { 22 | std::lock_guard lock(EventService::mutex); 23 | ++EventService::usage; 24 | 25 | if (EventService::instance) 26 | { 27 | assert(0); 28 | return 0; 29 | } 30 | 31 | EventService::instance = new EventService(es->context, es->event_cb); 32 | return 0; 33 | } 34 | 35 | void EventService::deinit_v1() 36 | { 37 | std::lock_guard lock(EventService::mutex); 38 | assert(EventService::usage > 0); 39 | --EventService::usage; 40 | 41 | if (EventService::usage == 0) 42 | { 43 | delete EventService::instance; 44 | EventService::instance = 0; 45 | } 46 | } 47 | 48 | } /* galera*/ 49 | -------------------------------------------------------------------------------- /asio/asio/detail/reactor_fwd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/reactor_fwd.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_REACTOR_FWD_HPP 12 | #define ASIO_DETAIL_REACTOR_FWD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | namespace asio { 21 | namespace detail { 22 | 23 | #if defined(ASIO_HAS_IOCP) || defined(ASIO_WINDOWS_RUNTIME) 24 | typedef class null_reactor reactor; 25 | #elif defined(ASIO_HAS_IOCP) 26 | typedef class select_reactor reactor; 27 | #elif defined(ASIO_HAS_EPOLL) 28 | typedef class epoll_reactor reactor; 29 | #elif defined(ASIO_HAS_KQUEUE) 30 | typedef class kqueue_reactor reactor; 31 | #elif defined(ASIO_HAS_DEV_POLL) 32 | typedef class dev_poll_reactor reactor; 33 | #else 34 | typedef class select_reactor reactor; 35 | #endif 36 | 37 | } // namespace detail 38 | } // namespace asio 39 | 40 | #endif // ASIO_DETAIL_REACTOR_FWD_HPP 41 | --------------------------------------------------------------------------------