| 1 |
--source include/have_ndb.inc |
| 2 |
|
| 3 |
# Some tests with larger blobs |
| 4 |
|
| 5 |
--echo Larger MaxAllowedPacket as this limits the size of Blob MySQLD can handle |
| 6 |
show variables like 'max_allowed_packet'; |
| 7 |
|
| 8 |
use test; |
| 9 |
|
| 10 |
create table t1 (a int primary key, b longtext) engine=ndb; |
| 11 |
|
| 12 |
delimiter %; |
| 13 |
|
| 14 |
create procedure heavy_insert(times int, bytes int) |
| 15 |
begin |
| 16 |
set @x = 0; |
| 17 |
repeat |
| 18 |
insert into t1 values (1, repeat('B', bytes)); |
| 19 |
delete from t1 where a=1; |
| 20 |
set @x = @x + 1; |
| 21 |
until @x = times |
| 22 |
end repeat; |
| 23 |
insert into t1 values (1, repeat('B', bytes)); |
| 24 |
end % |
| 25 |
|
| 26 |
create procedure heavy_read(times int) |
| 27 |
begin |
| 28 |
set @x = 0; |
| 29 |
repeat |
| 30 |
select a, length(b) from t1 where a=1; |
| 31 |
set @x = @x + 1; |
| 32 |
until @x = times |
| 33 |
end repeat; |
| 34 |
end % |
| 35 |
|
| 36 |
delimiter ;% |
| 37 |
|
| 38 |
--echo Set unlimited batch size for reads+writes |
| 39 |
|
| 40 |
set ndb_blob_read_batch_bytes = 0; |
| 41 |
set ndb_blob_write_batch_bytes = 0; |
| 42 |
|
| 43 |
--echo Now try a heavy insert - idea is to show SendBufferMemory overload on insert |
| 44 |
|
| 45 |
--error 0,1205,1297 |
| 46 |
call heavy_insert(20, 5*1024*1024); |
| 47 |
# NOTE don't check for warnings...as it doesnt fail consistenly |
| 48 |
|
| 49 |
delete from t1; |
| 50 |
|
| 51 |
set ndb_blob_write_batch_bytes=100 * 1024; |
| 52 |
|
| 53 |
--echo Now heavy insert should succeed |
| 54 |
call heavy_insert(10, 5*1024*1024); |
| 55 |
|
| 56 |
--echo Now heavy read should fail |
| 57 |
|
| 58 |
--disable_result_log |
| 59 |
--error 0,1205,1297 |
| 60 |
call heavy_read(100); |
| 61 |
--enable_result_log |
| 62 |
# NOTE don't check for warnings...as it doesnt fail consistenly |
| 63 |
|
| 64 |
set ndb_blob_read_batch_bytes=100 * 1024; |
| 65 |
|
| 66 |
--echo Now heavy read should succeed |
| 67 |
--disable_result_log |
| 68 |
call heavy_read(100); |
| 69 |
--enable_result_log |
| 70 |
|
| 71 |
set ndb_blob_write_batch_bytes=0; |
| 72 |
set ndb_blob_read_batch_bytes=0; |
| 73 |
drop procedure heavy_insert; |
| 74 |
drop procedure heavy_read; |
| 75 |
drop table t1; |