10979
if ( $o->get('binary-key') ) {
10980
PTDEBUG && _d('--binary-key : checking if replicate table has binary type columns');
10979
if ( $o->get('binary-index') ) {
10980
PTDEBUG && _d('--binary-index : checking if replicate table has binary type columns');
10981
10981
my $create_table = $tp->get_create_table( $dbh, $db, $tbl );
10982
if ( $create_table !~ /lower_boundary`?\s+blob/si
10983
|| $create_table !~ /upper_boundary`?\s+blob/si )
10982
if ( $create_table !~ /lower_boundary`?\s+BLOB/si
10983
|| $create_table !~ /upper_boundary`?\s+BLOB/si )
10985
die "--binary-key was specified but current replicate table "
10986
. "has text datatype boundary columns.\n"
10987
. "You need to drop the current table and recreate it using "
10988
. "both --create-replicate-table and --binary-key\n"
10989
. "Alternatively you can manually create the replicate table "
10990
. "as specified in the docs. See --binary-key usage\n";
10985
die "--binary-index was specified but the current checksum table ($db.$tbl) uses"
10986
." TEXT columns. To use BLOB columns, drop the current checksum table, then recreate"
10987
." it by specifying --create-replicate-table --binary-index.";
11149
11146
my $sql = $o->read_para_after(__FILE__, qr/MAGIC_create_replicate/);
11150
11147
$sql =~ s/CREATE TABLE checksums/CREATE TABLE IF NOT EXISTS $repl_table/;
11151
11148
$sql =~ s/;$//;
11152
if ( $o->get('binary-key') ) {
11153
$sql =~ s/`?lower_boundary`?\s+text/`lower_boundary` blob/s;
11154
$sql =~ s/`?upper_boundary`?\s+text/`upper_boundary` blob/s;
11149
if ( $o->get('binary-index') ) {
11150
$sql =~ s/`?lower_boundary`?\s+TEXT/`lower_boundary` BLOB/is;
11151
$sql =~ s/`?upper_boundary`?\s+TEXT/`upper_boundary` BLOB/is;
11156
11153
PTDEBUG && _d($dbh, $sql);
11830
11827
See "Replicas using row-based replication" under L<"LIMITATIONS">.
11829
=item --binary-index
11834
11831
This option modifies the behavior of L<"--create-replicate-table"> such that the
11835
replicate table's upper and lower boundary columns are created with binary (blob)
11832
replicate table's upper and lower boundary columns are created with the BLOB
11837
11834
This is useful in cases where you have trouble checksuming tables with keys that
11838
11835
include a binary datatype or that have non-standard character sets.
12372
12369
structure (MAGIC_create_replicate):
12374
12371
CREATE TABLE checksums (
12375
db char(64) NOT NULL,
12376
tbl char(64) NOT NULL,
12377
chunk int NOT NULL,
12378
chunk_time float NULL,
12379
chunk_index varchar(200) NULL,
12380
lower_boundary text NULL,
12381
upper_boundary text NULL,
12382
this_crc char(40) NOT NULL,
12383
this_cnt int NOT NULL,
12384
master_crc char(40) NULL,
12385
master_cnt int NULL,
12386
ts timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
12372
db CHAR(64) NOT NULL,
12373
tbl CHAR(64) NOT NULL,
12374
chunk INT NOT NULL,
12375
chunk_time FLOAT NULL,
12376
chunk_index VARCHAR(200) NULL,
12377
lower_boundary TEXT NULL,
12378
upper_boundary TEXT NULL,
12379
this_crc CHAR(40) NOT NULL,
12380
this_cnt INT NOT NULL,
12381
master_crc CHAR(40) NULL,
12382
master_cnt INT NULL,
12383
ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
12387
12384
PRIMARY KEY (db, tbl, chunk),
12388
12385
INDEX ts_db_tbl (ts, db, tbl)
12389
12386
) ENGINE=InnoDB;
12391
Note: lower_boundary and upper_boundary datatype can also be set to blob.
12392
See L<"--binary-key">
12388
Note: lower_boundary and upper_boundary data type can be BLOB. See L<"--binary-index">.
12394
12390
By default, L<"--[no]create-replicate-table"> is true, so the database and
12395
12391
the table specified by this option are created automatically if they do not