GithubHelp home page GithubHelp logo

midenok / mariadb Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tempesta-tech/mariadb

0.0 0.0 0.0 1.19 GB

MariaDB server is a community developed fork of MySQL server. Started by core members of the original MySQL team, MariaDB actively works with outside developers to deliver the most featureful, stable, and sanely licensed open SQL server in the industry.

License: GNU General Public License v2.0

Shell 0.75% CMake 0.77% C 34.37% C++ 57.72% Perl 2.06% Batchfile 0.02% Pascal 0.26% HTML 1.36% PHP 0.79% Assembly 0.70% SourcePawn 0.01% Pawn 0.02% SQLPL 0.05% Visual Basic 0.01% Perl 6 0.01% PLpgSQL 0.03% M4 0.08% Makefile 0.04% XS 0.02% Objective-C 0.95%

mariadb's People

Contributors

abarkov avatar bjornmu avatar bkandasa avatar blaudden avatar buggynours avatar cvicentiu avatar dr-m avatar elenst avatar esmet avatar fizzfaldt avatar gkodinov avatar grooverdan avatar gurusami avatar igorbabaev avatar jhauglid avatar kentoku avatar kevgs avatar knielsen avatar leifwalsh avatar marcalff avatar midenok avatar montywi avatar mydanny avatar pastcompute avatar prohaska avatar sanja-byelkin avatar spetrunia avatar vaintroub avatar vasild avatar vuvova avatar

Watchers

 avatar  avatar

mariadb's Issues

InnoDB undo records scanning O(log n) complexity

Implementation: undo index and binary search

  • Create undo index: undo index is associated with history of particular record; DB_ROLL_PTR points to index entry, index entry points to actual record (original DB_ROLL_PTR value). It must be possible to figure out first index entry (and header) from DB_ROLL_PTR of any record.
  • Undo index header indicates allocated size, used size. Should undo index be reallocated or it should be of max history size at once (no need in allocated size in this case)?
  • Decide where to place undo index (in undo segment, undo log?). Undo index is associated with first undo record, created when first undo record is created and freed when record is purged (or when undo segment/log is freed?).
  • Fix any of API working with DB_ROLL_PTR to respect undo index. DATA_ROLL_PTR code invasion: 22.
  • Replace linear seach with binary search in row_vers_build_for_consistent_read().
    Search criteria: view->changes_visible(i) && !view->changes_visible(i-1), where i is index from undo index.

Local undo index as alternative

Scan undo records in row_vers_build_for_consistent_read() without trx_undo_prev_version_build(), build temporary undo index. Then do binary search. This avoids copying of whole records in linear scan.

This is much easier to implement than permanent undo index and it can be used as first stage of development.

References

Sequence bugs

MDEV-13715

CREATE SEQUENCE s;
ALTER TABLE s PARTITION BY HASH(start_value) PARTITIONS 2;
#0  0x000055555658eb42 in ha_partition::engine_name (this=0x7fff80013158) at /home/midenok/src/mariadb/midenok/src/sql/ha_partition.h:507
#1  0x0000555555c29c1c in mysql_prepare_create_table (thd=0x7fff80000d50, create_info=0x7fffe54b14c0, alter_info=0x7fffe54b1410, db_options=0x7fffe54ae33c, file=0x7fff80013158, key_info_buffer=0x7fffe54af9d0, key_count=0x7fffe54af9a0, create_table_mode=-2) at /home/midenok/src/mariadb/midenok/src/sql/sql_table.cc:3244
#2  0x0000555555c2dfd9 in mysql_create_frm_image (thd=0x7fff80000d50, db=0x7fff800119c8 "test", table_name=0x7fff80011360 "s", create_info=0x7fffe54b14c0, alter_info=0x7fffe54b1410, create_table_mode=-2, key_info=0x7fffe54af9d0, key_count=0x7fffe54af9a0, frm=0x7fffe54afa30) at /home/midenok/src/mariadb/midenok/src/sql/sql_table.cc:4621
#3  0x0000555555c2e9f7 in create_table_impl (thd=0x7fff80000d50, orig_db=0x7fff800119c8 "test", orig_table_name=0x7fff80011360 "s", db=0x7fff800119c8 "test", table_name=0x7fffe54b03e0 "#sql-5401_8", path=0x7fffe54b0c4c "./test/#sql-5401_8", options=..., create_info=0x7fffe54b14c0, alter_info=0x7fffe54b1410, create_table_mode=-2, is_trans=0x0, key_info=0x7fffe54af9d0, key_count=0x7fffe54af9a0, frm=0x7fffe54afa30) at /home/midenok/src/mariadb/midenok/src/sql/sql_table.cc:4865
#4  0x0000555555c3a677 in mysql_alter_table (thd=0x7fff80000d50, new_db=0x7fff800119c8 "test", new_name=0x0, create_info=0x7fffe54b14c0, table_list=0x7fff80011398, alter_info=0x7fffe54b1410, order_num=0, order=0x0, ignore=false) at /home/midenok/src/mariadb/midenok/src/sql/sql_table.cc:9234
#5  0x0000555555cbd550 in Sql_cmd_alter_table::execute (this=0x7fff80011d40, thd=0x7fff80000d50) at /home/midenok/src/mariadb/midenok/src/sql/sql_alter.cc:318
#6  0x0000555555b68d7e in mysql_execute_command (thd=0x7fff80000d50) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:6230
#7  0x0000555555b6d176 in mysql_parse (thd=0x7fff80000d50, rawbuf=0x7fff80011278 "ALTER TABLE s PARTITION BY HASH(start_value) PARTITIONS 2", length=57, parser_state=0x7fffe54b26a0, is_com_multi=false, is_next_command=false) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:7923
(gdb) p table
$2 = (TABLE *) 0x0

Related to 17a87d6

MDEV-13720

Issue #22

Bush

Why bash and not perl f.ex.?

Frequently used commands have default context (git, make).

10.5 proposals

Partitioning syntax:

# Create 1 history partition and 1 working partition
create table t1 (i int) with system versioning partition by system_time;
# Create 2 history partitions and 1 working partition
create table t1 (i int) with system versioning partition by system_time partitions (2);

Transaction syntax:

create table t1 (i int) with transaction system versioning;

PXC optimizations

@@ -1814,15 +1863,21 @@ log_online_purge_changed_page_bitmaps(
                lsn = LSN_MAX;
        }
 
+       bool log_bmp_sys_inited = false;
        if (srv_redo_log_thread_started) {
                /* User requests might happen with both enabled and disabled
                tracking */
-               mutex_enter(&log_bmp_sys->mutex);
+               log_bmp_sys_inited = true;
+               mutex_enter(&log_bmp_sys_mutex);
+               if (!srv_redo_log_thread_started) {
+                       log_bmp_sys_inited = false;
+                       mutex_exit(&log_bmp_sys_mutex);
+               }
        }
 
        if (!log_online_setup_bitmap_file_range(&bitmap_files, 0, LSN_MAX)) {
-               if (srv_redo_log_thread_started) {
-                       mutex_exit(&log_bmp_sys->mutex);
+               if (log_bmp_sys_inited) {
+                       mutex_exit(&log_bmp_sys_mutex);
                }
                return true;
        }

Commit c01c75da8ec67197e5b2f86edbdd9541df717faa

Report intro

All recommendations here are pure practical. It is good when code requires less work with achieving more result.

2 words about patterns. Not all pattern are good and those that are good are not always good. I guess most of you have read books about patterns. Except me: so I am having the best position to teach you some more. You should understand what is behind every pattern. Tell some examples, get into proxies and tell why proxies are bad (#19).

Passing by reference

Passing by reference is good, passing by pointer is bad. If I pass by pointer to constructor I don't know whether it is just assigned or copied. Example:

  Item_field(THD *thd, Name_resolution_context *context_arg,
             const char *db_arg,const char *table_name_arg,
	     const LEX_CSTRING *field_name_arg);

field_name_arg is copied, but I have to go into Item_ident ctor to make sure:

Item_ident::Item_ident(THD *thd, Name_resolution_context *context_arg,
                       const char *db_name_arg,const char *table_name_arg,
		       const LEX_CSTRING *field_name_arg)
...
   field_name(*field_name_arg),
...

Another reason: passing wrong pointer makes problem happen farther than real cause.

Add timezone modifier to timestamp literal

Related issue MDEV-16026: Global system_versioning_asof must not be used if client sessions can have non-default time zone

set session system_versioning_asof= @@global.system_versioning_asof;

nikitamalyavin [14:09]
ну оно работать будет не так, как ожидается. но это, наверное, и не исправить простыми путями

потому что присвоится не значение в unix time, а как раз timestamp (edited)
можно порекомендоваать в документации написать, что правильно такое делать через convert_tz
так и сделаю

THD::mem_root non-definite nature

THD::mem_root is a whore that changes from case to case. Now it is connection-wide, then it is statement-wide and afterwards it is PS substatement-wide. Such logic is unstable as functions that allocate from thd->mem_root are forcefully bound to some execution phase, but it is not evident and there is no protection from calling them at another phases (and better they should be possible to be called there). See example in tempesta-tech#441 and tempesta-tech#442.

As 1ea2b29 shows statement-wide allocations introduce leaks (per-statement). Proper fix 715a507.

CONTINUE HANDLER FOR 0

Analog of bash prompt_command for mysql. Such handler should work from within or without SP.

MDEV-13713

MDEV-13713

--source include/have_innodb.inc

create sequence s engine=InnoDB;

begin;
select nextval(s);

--connect (con1,localhost,root,,)
--echo # INSERT starts waiting for a metadata lock
--send insert into s values (1,1,100000000000000,1,1,1000,0,0);

--connection default
--let $show_statement= SHOW PROCESSLIST
--let $field= State
--let $condition= = 'Waiting for table metadata lock'

--source include/wait_show_condition.inc
--error ER_LOCK_DEADLOCK
insert into s values (1,1,100000000000001,1,1,1000,0,0);

# Cleanup
commit;
--connection con1
--reap
--disconnect con1
--connection default
DROP SEQUENCE s;

Abort on connection with InnoDB partitioning

1. m_key_not_found_partitions->bitmap zeroed

#0  Partition_helper::init_partitioning (this=0x7ffff306ede0, mem_root=0x7ffff3118f20) at /home/midenok/src/mariadb/trunk/src/sql/partitioning/partition_handler.h:289
#1  0x0000555555f6792c in innobase_upgrade_handler (hnd=0x7ffff30fc088, mem_root=0x7ffff3118f20) at /home/midenok/src/mariadb/trunk/src/storage/innobase/handler/ha_innodb.cc:1726
#2  0x0000555555c066dd in open_table_from_share (thd=0x7ffff3047070, share=0x7ffff30dd588, alias=0x7ffff3095090 "t5", db_stat=33, prgflag=8, ha_open_flags=16, outparam=0x7ffff3118470, is_create_table=false) at /home/midenok/src/mariadb/trunk/src/sql/table.cc:3252
#3  0x0000555555a8f4c4 in open_table (thd=0x7ffff3047070, table_list=0x7ffff7f22670, ot_ctx=0x7ffff7f22310) at /home/midenok/src/mariadb/trunk/src/sql/sql_base.cc:1860
#4  0x0000555555a92088 in open_and_process_table (thd=0x7ffff3047070, lex=0x7ffff304aad8, tables=0x7ffff7f22670, counter=0x7ffff7f223dc, flags=1024, prelocking_strategy=0x7ffff7f223e0, has_prelocking_list=false, ot_ctx=0x7ffff7f22310) at /home/midenok/src/mariadb/trunk/src/sql/sql_base.cc:3392
#5  0x0000555555a93259 in open_tables (thd=0x7ffff3047070, options=..., start=0x7ffff7f223c0, counter=0x7ffff7f223dc, flags=1024, prelocking_strategy=0x7ffff7f223e0) at /home/midenok/src/mariadb/trunk/src/sql/sql_base.cc:3909
#6  0x0000555555a8be6a in open_tables (thd=0x7ffff3047070, tables=0x7ffff7f223c0, counter=0x7ffff7f223dc, flags=1024, prelocking_strategy=0x7ffff7f223e0) at /home/midenok/src/mariadb/trunk/src/sql/sql_base.h:236
#7  0x0000555555a94b29 in open_normal_and_derived_tables (thd=0x7ffff3047070, tables=0x7ffff7f22670, flags=1024, dt_phases=34) at /home/midenok/src/mariadb/trunk/src/sql/sql_base.cc:4727
#8  0x0000555555b93c57 in mysqld_list_fields (thd=0x7ffff3047070, table_list=0x7ffff7f22670, wild=0x7ffff30950a8 "") at /home/midenok/src/mariadb/trunk/src/sql/sql_show.cc:1416
#9  0x0000555555afdfd2 in dispatch_command (command=COM_FIELD_LIST, thd=0x7ffff3047070, packet=0x7ffff3089074 "", packet_length=3, is_com_multi=false, is_next_command=false) at /home/midenok/src/mariadb/trunk/src/sql/sql_parse.cc:1993
#10 0x0000555555afc595 in do_command (thd=0x7ffff3047070) at /home/midenok/src/mariadb/trunk/src/sql/sql_parse.cc:1358
#11 0x0000555555c4fdd4 in do_handle_one_connection (connect=0x7ffff5874050) at /home/midenok/src/mariadb/trunk/src/sql/sql_connect.cc:1354
#12 0x0000555555c4fb53 in handle_one_connection (arg=0x7ffff5874050) at /home/midenok/src/mariadb/trunk/src/sql/sql_connect.cc:1260
#13 0x00007ffff70c36ca in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#14 0x00007ffff63510af in clone () from /lib/x86_64-linux-gnu/libc.so.6

2. m_key_not_found_partitions->bitmap inited

#0  my_bitmap_init (map=0x7ffff306ee98, buf=0x7ffff3082bf0, n_bits=2, thread_safe=0 '\000') at /home/midenok/src/mariadb/trunk/src/mysys/my_bitmap.c:198
#1  0x000055555650f7a1 in Partition_helper::open_partitioning (this=0x7ffff306ede0, part_share=0x7ffff3040c80) at /home/midenok/src/mariadb/trunk/src/sql/partitioning/partition_handler.cc:346
#2  0x0000555555f9d7c0 in ha_innopart::open (this=0x7ffff306e688, name=0x7ffff30ddbe0 "./test/t5") at /home/midenok/src/mariadb/trunk/src/storage/innobase/handler/ha_innopart.cc:1029
#3  0x0000555555d68def in handler::ha_open (this=0x7ffff306e688, table_arg=0x7ffff3118470, name=0x7ffff30ddbe0 "./test/t5", mode=2, test_if_locked=18) at /home/midenok/src/mariadb/trunk/src/sql/handler.cc:2506
#4  0x0000555555c06cb6 in open_table_from_share (thd=0x7ffff3047070, share=0x7ffff30dd588, alias=0x7ffff3095090 "t5", db_stat=33, prgflag=8, ha_open_flags=18, outparam=0x7ffff3118470, is_create_table=false) at /home/midenok/src/mariadb/trunk/src/sql/table.cc:3370
#5  0x0000555555a8f4c4 in open_table (thd=0x7ffff3047070, table_list=0x7ffff7f22670, ot_ctx=0x7ffff7f22310) at /home/midenok/src/mariadb/trunk/src/sql/sql_base.cc:1860
#6  0x0000555555a92088 in open_and_process_table (thd=0x7ffff3047070, lex=0x7ffff304aad8, tables=0x7ffff7f22670, counter=0x7ffff7f223dc, flags=1024, prelocking_strategy=0x7ffff7f223e0, has_prelocking_list=false, ot_ctx=0x7ffff7f22310) at /home/midenok/src/mariadb/trunk/src/sql/sql_base.cc:3392
#7  0x0000555555a93259 in open_tables (thd=0x7ffff3047070, options=..., start=0x7ffff7f223c0, counter=0x7ffff7f223dc, flags=1024, prelocking_strategy=0x7ffff7f223e0) at /home/midenok/src/mariadb/trunk/src/sql/sql_base.cc:3909
#8  0x0000555555a8be6a in open_tables (thd=0x7ffff3047070, tables=0x7ffff7f223c0, counter=0x7ffff7f223dc, flags=1024, prelocking_strategy=0x7ffff7f223e0) at /home/midenok/src/mariadb/trunk/src/sql/sql_base.h:236
#9  0x0000555555a94b29 in open_normal_and_derived_tables (thd=0x7ffff3047070, tables=0x7ffff7f22670, flags=1024, dt_phases=34) at /home/midenok/src/mariadb/trunk/src/sql/sql_base.cc:4727
#10 0x0000555555b93c57 in mysqld_list_fields (thd=0x7ffff3047070, table_list=0x7ffff7f22670, wild=0x7ffff30950a8 "") at /home/midenok/src/mariadb/trunk/src/sql/sql_show.cc:1416
#11 0x0000555555afdfd2 in dispatch_command (command=COM_FIELD_LIST, thd=0x7ffff3047070, packet=0x7ffff3089074 "", packet_length=3, is_com_multi=false, is_next_command=false) at /home/midenok/src/mariadb/trunk/src/sql/sql_parse.cc:1993

3. raised

#0  0x00007ffff627e7ef in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff62803ea in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007ffff6276bb7 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#3  0x00007ffff6276c62 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x000055555650f666 in Partition_helper::~Partition_helper (this=0x7ffff306ede0, __in_chrg=<optimized out>) at /home/midenok/src/mariadb/trunk/src/sql/partitioning/partition_handler.cc:300
#5  0x0000555555f9d406 in ha_innopart::~ha_innopart (this=0x7ffff306e688, __in_chrg=<optimized out>) at /home/midenok/src/mariadb/trunk/src/storage/innobase/handler/ha_innopart.cc:852
#6  0x0000555555f9d42e in ha_innopart::~ha_innopart (this=0x7ffff306e688, __in_chrg=<optimized out>) at /home/midenok/src/mariadb/trunk/src/storage/innobase/handler/ha_innopart.cc:853
#7  0x0000555555c0712a in open_table_from_share (thd=0x7ffff3047070, share=0x7ffff30dd588, alias=0x7ffff3095090 "t5", db_stat=33, prgflag=8, ha_open_flags=18, outparam=0x7ffff3118470, is_create_table=false) at /home/midenok/src/mariadb/trunk/src/sql/table.cc:3461
#8  0x0000555555a8f4c4 in open_table (thd=0x7ffff3047070, table_list=0x7ffff7f22670, ot_ctx=0x7ffff7f22310) at /home/midenok/src/mariadb/trunk/src/sql/sql_base.cc:1860
#9  0x0000555555a92088 in open_and_process_table (thd=0x7ffff3047070, lex=0x7ffff304aad8, tables=0x7ffff7f22670, counter=0x7ffff7f223dc, flags=1024, prelocking_strategy=0x7ffff7f223e0, has_prelocking_list=false, ot_ctx=0x7ffff7f22310) at /home/midenok/src/mariadb/trunk/src/sql/sql_base.cc:3392
#10 0x0000555555a93259 in open_tables (thd=0x7ffff3047070, options=..., start=0x7ffff7f223c0, counter=0x7ffff7f223dc, flags=1024, prelocking_strategy=0x7ffff7f223e0) at /home/midenok/src/mariadb/trunk/src/sql/sql_base.cc:3909
#11 0x0000555555a8be6a in open_tables (thd=0x7ffff3047070, tables=0x7ffff7f223c0, counter=0x7ffff7f223dc, flags=1024, prelocking_strategy=0x7ffff7f223e0) at /home/midenok/src/mariadb/trunk/src/sql/sql_base.h:236
#12 0x0000555555a94b29 in open_normal_and_derived_tables (thd=0x7ffff3047070, tables=0x7ffff7f22670, flags=1024, dt_phases=34) at /home/midenok/src/mariadb/trunk/src/sql/sql_base.cc:4727
#13 0x0000555555b93c57 in mysqld_list_fields (thd=0x7ffff3047070, table_list=0x7ffff7f22670, wild=0x7ffff30950a8 "") at /home/midenok/src/mariadb/trunk/src/sql/sql_show.cc:1416
#14 0x0000555555afdfd2 in dispatch_command (command=COM_FIELD_LIST, thd=0x7ffff3047070, packet=0x7ffff3089074 "", packet_length=3, is_com_multi=false, is_next_command=false) at /home/midenok/src/mariadb/trunk/src/sql/sql_parse.cc:1993

MySQL syntax extensions

  • FULL OUTER JOIN
  • SP args default values
  • EXECUTE AND DROP stmt; for PS (EXECUTE IMMEDIATELY exists?)

InnoDB's MVCC has O(N^2) behaviors

Reproduce

setup: create table t1 (a int, b int, c int, primary key(a,b), key (b,c)) engine=InnoDB;

T1: BEGIN; SELECT * FROM t1;

T2: 10000 * INSERT INTO t1 VALUES (1,2,3) ON DUPLICATE KEY UPDATE c=c+1

T1: SELECT * FROM t1 FORCE INDEX (PRIMARY)
(this will be immediate and bump Innodb_buffer_pool_read_requests by ~10k)

T1: SELECT * FROM t1 FORCE INDEX (b)
(this will be not immediate and bump Innodb_buffer_pool_read_requests by ~100000k or ~100m or....)
delimiter ~~
create or replace procedure insert_n(n int)
begin
    declare i int default 0;
    while i < n do
        insert into t1 values (1, 2, 3) on duplicate key update c= c + 1;
        set i = i + 1;
    end while;
end~~
delimiter ;
delimiter ~~
create or replace function bprrs()
returns int
begin
    declare ret int;
    select variable_value
    from information_schema.global_status
    where
        variable_name = 'innodb_buffer_pool_read_requests'
    into ret;
    return ret;
end~~
delimiter ;

Premature free problem

  • Split THD by used arenas: shorter arena have its own class and its own members (if there are any THD members that live only on shorter arenas);

  • Item and Field are dynamically allocated (in optimizer f.ex.): they can be short-lived or long-lived. Use reference counting inside container. I.e. Item will not be destructed until container is not destructed. Containers are: List, Item itself, etc.

MDEV-13720

https://jira.mariadb.org/browse/MDEV-13720

CREATE TEMPORARY TABLE tmp (i INT);
SELECT NEXT VALUE FOR tmp;

Assertion for temporary table

#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff644cf5d in __GI_abort () at abort.c:90
#2  0x00007ffff6442f17 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x5555567f0b20 "table && table->s->sequence", file=file@entry=0x5555567f0020 "/home/midenok/src/mariadb/midenok/src/sql/item_func.cc", line=line@entry=6960, function=function@entry=0x5555567f31e0 <Item_func_nextval::val_int()::__PRETTY_FUNCTION__> "virtual longlong Item_func_nextval::val_int()") at assert.c:92
#3  0x00007ffff6442fc2 in __GI___assert_fail (assertion=0x5555567f0b20 "table && table->s->sequence", file=0x5555567f0020 "/home/midenok/src/mariadb/midenok/src/sql/item_func.cc", line=6960, function=0x5555567f31e0 <Item_func_nextval::val_int()::__PRETTY_FUNCTION__> "virtual longlong Item_func_nextval::val_int()") at assert.c:101
#4  0x0000555555e95a79 in Item_func_nextval::val_int (this=0x7fff78013b58) at /home/midenok/src/mariadb/midenok/src/sql/item_func.cc:6960
#5  0x0000555555e2f697 in Item::send (this=0x7fff78013b58, protocol=0x7fff780012f0, buffer=0x7fffe54b0af0) at /home/midenok/src/mariadb/midenok/src/sql/item.cc:7163
#6  0x0000555555a8c40d in Protocol::send_result_set_row (this=0x7fff780012f0, row_items=0x7fff780051c8) at /home/midenok/src/mariadb/midenok/src/sql/protocol.cc:979
#7  0x0000555555b0fbdf in select_send::send_data (this=0x7fff78013d00, items=...) at /home/midenok/src/mariadb/midenok/src/sql/sql_class.cc:2803
#8  0x0000555555bab9ff in JOIN::exec_inner (this=0x7fff78013d20) at /home/midenok/src/mariadb/midenok/src/sql/sql_select.cc:3755
#9  0x0000555555bab3da in JOIN::exec (this=0x7fff78013d20) at /home/midenok/src/mariadb/midenok/src/sql/sql_select.cc:3675
#10 0x0000555555bac881 in mysql_select (thd=0x7fff78000d50, tables=0x0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fff78013d00, unit=0x7fff78004938, select_lex=0x7fff78005098) at /home/midenok/src/mariadb/midenok/src/sql/sql_select.cc:4077
#11 0x0000555555b9ec82 in handle_select (thd=0x7fff78000d50, lex=0x7fff78004870, result=0x7fff78013d00, setup_tables_done_option=0) at /home/midenok/src/mariadb/midenok/src/sql/sql_select.cc:363
#12 0x0000555555b69dde in execute_sqlcom_select (thd=0x7fff78000d50, all_tables=0x7fff78013520) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:6476
#13 0x0000555555b6195e in mysql_execute_command (thd=0x7fff78000d50) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:3575
#14 0x0000555555b6d100 in mysql_parse (thd=0x7fff78000d50, rawbuf=0x7fff78013438 "SELECT NEXT VALUE FOR tmp2", length=26, parser_state=0x7fffe54b26a0, is_com_multi=false, is_next_command=false) at /home/midenok/src/mariadb/midenok/src/sql/sql_parse.cc:7923

Utilize RAII

Example: MDEV-16043.

The bug is caused by commits da59130ec18a (moved code from another place) and f033fbd9f236 (imitated by similarity). That's why I strongly recommend to reconsider position of RAII and utilize such classes as Query_arena_stmt.

tempesta-tech#383

From tempesta-tech#383

call 1
LJ RJ
$85 = 0x7fff84015198 "t2"
$86 = 2
$87 = 0x2012580  "t1.sys_trx_end = 18446744073709551615"
$88 = 1
$89 = (COND *) 0x7fff84017ab0
$90 = (TABLE_LIST *) 0x7fff840151a0
$91 = (Item *) 0x7fff84018020
$113 = 0x7fff84014b10 "t1"
$114 = 1
$115 = 0x2012580  "t2.sys_trx_end = 18446744073709551615"
$116 = 2
$117 = (COND *) 0x7fff84018008
$118 = (TABLE_LIST *) 0x7fff84014b18
$119 = (Item *) 0x7fff84017c38
$92 = 0x7fff84014b10 "t1"
$93 = 1
$94 = 0x2012580  "t1.sys_trx_end = 18446744073709551615"
$95 = 1
$96 = (COND *) 0x7fff84017ab0
$97 = (TABLE_LIST *) 0x7fff84014b18
$98 = (Item *) 0x0
$120 = 0x7fff84015198 "t2"
$121 = 2
$122 = 0x2012580  "t2.sys_trx_end = 18446744073709551615"
$123 = 2
$124 = (COND *) 0x7fff84018008
$125 = (TABLE_LIST *) 0x7fff840151a0
$126 = (Item *) 0x0
call 2
$99 = 0x7fff84015198 "t2"
$100 = 2
$101 = 0x2012580  "t1.sys_trx_end = 18446744073709551615"
$102 = 1
$103 = (COND *) 0x7fff84018b38
$104 = (TABLE_LIST *) 0x7fff840151a0
$105 = (Item *) 0x7fff84018020
$127 = 0x7fff84014b10 "t1"
$128 = 1
$129 = 0x2012580  "t1.sys_trx_end = 18446744073709551615"
$130 = 1
$131 = (COND *) 0x7fff84018b58
$132 = (TABLE_LIST *) 0x7fff84014b18
$133 = (Item *) 0x7fff84017c38
$106 = 0x7fff84014b10 "t1"
$107 = 1
$108 = 0x2012580  "t1.sys_trx_end = 18446744073709551615"
$109 = 1
$110 = (COND *) 0x7fff84018b38
$111 = (TABLE_LIST *) 0x7fff84014b18
$112 = (Item *) 0x0
$134 = 0x7fff84015198 "t2"
$135 = 2
$136 = 0x2012580  "t1.sys_trx_end = 18446744073709551615 and t1.x = t2.x and t1.sys_trx_end = 18446744073709551615"
$137 = 3
$138 = (COND *) 0x7fff840bda80
$139 = (TABLE_LIST *) 0x7fff840151a0
$140 = (Item *) 0x0

Real users on System Versioning

On System Versioning there was 2 bug reports from non-developers in last 30 days and 8 bug reports in last 60 days. This is against total non-developer MDEV reports of 77 in last 30 days and 140 in last 60 days. So 8 is roughly 5% of the feature usage share.

For example the situation on replication component is not much different: 6 in last 30 days, 12 in last 60 days and 20 in last 90 days. So we can see some stability for Replication of average 6 per month.

Of course, the numbers are low, so we can't talk about precision here. Moreover the feature maturity is different. But we can try to check the correlation on Stack Overflow. For System Versioning there are 1600 questions. For replication there are about 3700 questions. The correlation of numbers looks the same to me.

So I would say the usage share of System Versioning in MariaDB is not very low but it can be higher.
Especially in front of MySQL that doesn't have it. This is an advantage that can be used to attract some users from MySQL but it should be presented well to mass media. Currently I didn't found such presentations in Google. All the articles I've seen that enlighten differences between MySQL and MariaDB don't mention System Versioning. That would be good to see some article that stresses on System Versioning in MariaDB and maybe tells about some advantages from Microsoft SQL temporal tables.

MDEV-18727 improve DML operation of System Versioning

Bug 1: endless loop on view update

Reproduce

create or replace table t1 (x int) with system versioning;
insert into t1 values (1);
create or replace view v1 as select * from t1;
update v1 set x= 2;

Result

Operation doesn't complete, history is inserted endlessly.

SV features Enterprise-only

  • Make transactional SV enterprise-only with performance improvement;
  • SV feature about filtered history insert;
  • Probably global TRX_ID;
  • More configuration options.

Perl snippets in mysql-test are dumb

  1. they are unconnected
perl;
my $a= 'abc';
EOF
perl;
printf "A: $a\n";
EOF

--echo $a
  1. they are badly integrated with test code
--let a= abc
perl;
print "A: $a\n";
EOF
--echo $a

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.