Skip to content

Instantly share code, notes, and snippets.

View grooverdan's full-sized avatar
💭
compile, test, repeat

Daniel Black grooverdan

💭
compile, test, repeat
View GitHub Profile
MariaDB [test]> create table t1 (i double);
Query OK, 0 rows affected (0.001 sec)
MariaDB [test]> insert into t1 values (20.50);
Query OK, 1 row affected (0.001 sec)
MariaDB [test]> select * from t1;
+------+
| i |
+------+
@grooverdan
grooverdan / Dockerfile
Created September 12, 2022 00:11
attempted php build against mariadb embedded
FROM php:cli
COPY mysql_config /usr/bin/
RUN apt-get update ; \
apt-get install -y libmariadbd-dev \
&& docker-php-ext-configure mysqli --with-mysqli=/usr/bin/mysql_config --with-mysql-sock=/tmp/mariadb.sock \
&& docker-php-ext-install mysqli pdo_mysql
@grooverdan
grooverdan / MDEV-29190.cnf
Created August 11, 2022 08:54
sysbench MDEV-29190
[mariadbd]
#event_scheduler=ON
innodb-buffer-pool-size=2M
innodb-page-size=4k
performance_schema = 1
# downsizing performance schema memory usage: T99485
performance_schema_max_thread_instances = 500
performance_schema_max_cond_instances = 1000
performance_schema_accounts_size = 300
performance_schema_hosts_size = 300
This file has been truncated, but you can view the full file.
use mysql;
set @wsrep_is_on=(select sum(VARIABLE_NAME='wsrep_on' AND SESSION_VALUE='ON') from information_schema.SYSTEM_VARIABLES);
SELECT concat('%', GROUP_CONCAT(OPTION), '%') INTO @replicate_opt FROM (SELECT DISTINCT concat('REPLICATE_', UPPER(ENGINE)) AS OPTION FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('time_zone', 'time_zone_name', 'time_zone_transition', 'time_zone_transition_type', 'time_zone_leap_second') AND ENGINE in ('MyISAM', 'Aria')) AS o ORDER BY OPTION DESC;
set @wsrep_cannot_replicate_tz=@wsrep_is_on AND (select sum(VARIABLE_NAME='wsrep_mode' and GLOBAL_VALUE NOT LIKE @replicate_opt) from information_schema.SYSTEM_VARIABLES);
execute immediate if(@wsrep_cannot_replicate_tz, "select ENGINE into @time_zone_engine from information_schema.TABLES where TABLE_SCHEMA=DATABASE() and TABLE_NAME='time_zone'", 'do 0');
execute immedia
// testing https://bugs.launchpad.net/ubuntu/+source/mariadb-10.6/+bug/1970634
#include <stdexcept>
class aio_uring
{
static constexpr char volatile * v= 0;
public:
aio_uring()
connection node_2;
connection node_1;
CREATE TABLE `legacy_item_requests` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`request` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SELECT * FROM legacy_item_requests;
@grooverdan
grooverdan / gist:ad68b0161aa2ba9860b769a5304e83ab
Created January 13, 2022 21:43
MariaDB Database per user, on demand (aka systemd multi-instance socket activated) (LCA2022 Miniconf talk)
MariaDB Database per user, on demand (aka systemd multi-instance socket activated)
This is to provide attendee's the notes needed related to the talk without
needing to transcribe from script or video:
Attendee notes:
My.cnf template to be copied into user home directories:
Thread 34 (Thread 0x7f4089ffb640 (LWP 896292)):
#0 0x00007f40dd56c7b0 in __lll_lock_wait () from /lib64/libpthread.so.0
No symbol table info available.
#1 0x00007f40dd5656b2 in pthread_mutex_lock () from /lib64/libpthread.so.0
No symbol table info available.
#2 0x0000000000dc1f5e in psi_mutex_lock (that=0x15ca200 <buf_pool>, file=<optimized out>, line=<optimized out>) at /home/dan/repos/mariadb-server-10.8/mysys/my_thr_init.c:489
state = {m_flags = 100, m_operation = PSI_MUTEX_LOCK, m_mutex = 0x3e, m_thread = 0xffffffffffffffff, m_timer_start = 32, m_timer = 0x7f4089ff9a50, m_wait = 0x0}
locker = 0x0
result = <optimized out>
@grooverdan
grooverdan / timezones.sql
Created November 24, 2021 00:39
timezones for MariaDB-10.6
This file has been truncated, but you can view the full file.
\d |
IF (select count(*) from information_schema.global_variables where
variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=InnoDB;
ALTER TABLE time_zone_name ENGINE=InnoDB;
ALTER TABLE time_zone_transition ENGINE=InnoDB;
ALTER TABLE time_zone_transition_type ENGINE=InnoDB;
END IF|
\d ;
TRUNCATE TABLE time_zone;
$ podman run -d --rm -e MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 mariadb:10.5.10
Resolved "mariadb" as an alias (/home/dan/.cache/containers/short-name-aliases.conf)
Trying to pull docker.io/library/mariadb:10.5.10...
Getting image source signatures
Copying blob e989e430508e skipped: already exists
Copying blob 26ea6552a462 skipped: already exists
Copying blob c549ccf8d472 skipped: already exists
Copying blob 9f8d09317d80 skipped: already exists
Copying blob 2bc055a5511d skipped: already exists
Copying blob 329b1f41043f skipped: already exists