mysql_random_data_load
mysql_random_data_load copied to clipboard
Add support for generating binary data in blob/binary columns
These column types were previously getting ASCII text generated for them, and this generates an equivalent amount of random binary data instead.
Tested by pointing the tool at a table with this schema and generating some rows.
mysql> show create table some_data \G
*************************** 1. row ***************************
Table: some_data
Create Table: CREATE TABLE `some_data` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`field2` varchar(300) DEFAULT NULL,
`anotherField` varchar(1200) DEFAULT NULL,
`body_text` text,
`secrets` varbinary(600) DEFAULT NULL,
`seq` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1001 DEFAULT CHARSET=utf8
1 row in set (0.00 sec)
the rows
mysql> select count(*) from some_data;
+----------+
| count(*) |
+----------+
| 1000 |
+----------+
1 row in set (0.01 sec)
mysql> select * from some_data limit 2 \G
*************************** 1. row ***************************
id: 1
field2: dolorem aut molestiae consequuntur.
anotherField: repellat qui sed enim fugiat vel molestiae et quisquam.
body_text: sit porro est molestiae animi nesciunt rem.
x86xd1xe9x1ex00x16y9xcbfx94xd2xc4"xacxdxa0a)9Hu007fix99xebx9dx18xa4Gx84x04]x87xf3xc6|xf2'F镯Z%6yQxbaxa2xfflxd4qăxf1_xb9vxadxb3|X!xb6xd9U&xa4x1ax95x04hvN|x8bv:x1bx1dIԕ\x84x86!c%%?xecsx8dשxe2x8bxf9!x11x9cx16x0fax02Dx86x15xbbxd1?jx8exb6hxd2vxf5x05x98ux92x1efx8a[xdf,u007fĄEx92xd2W+xcdx06hxd2xd6xc5/PTxe2Ѓkxf8Lqtxcbtv6Lxc3xdbxd9hxb0xf7x17.xd8Wx94xbb5x8bf;R]xa1xox9fxff Byxdbx19Dxebסx9dx0f{xbaxcbxe0%Zxa5xb7xd4Kxec@xf8Lx89+x9bxffxd46)xb0";xeexa5xf4xf7Cx91xf4Exd1ZxfdBx94x04x03txf6x92Kx98xcbxf8q?x8dx96-|x8dx01x91x92
seq: 1134554347
*************************** 2. row ***************************
id: 2
field2: ea laboriosam occaecati sint et repellat perferendis.
anotherField: libero voluptates hic et reiciendis.
body_text: assumenda dicta quidem tempora error et quos.
secrets: f:xb7dx9clx93Gx80 yуx03Vxf2xa5L=겤xb4G]cxafxbex8fxb5ix87xc7u007fXx18Rox18x14xbex823Pxeaxb195xf3x1dx84HEx17xe9$xaexf7x8axe1Qxc0aUx92X6xb7aXx85ef0xec)xa3p94xbfPxa2x8dxa1x02x97]xedxa7~ux85yxea=xfeA6xabxf7Rxb3xb8'x1dx03xe9Dxb3xc9xdb6kux04_x8exfdixd2*xe5Ax19GxcbU=vx94&zxefNxbcxea@k2xd6x10x8bօx84xf5~7ʬn3xfexaa2cxa3x99Cp$xbax9cx9bx14gx8a'Ox01xa9x10xae)_nxfbxfe_ZxbfDxccxdxa8\xa1䳎xaf?Dxc6xc6xefx83bxf2xf5Oxc0x0eTïu007fkxd6xfc%Txc1]xfcxacxaax8a,xecxceZ:xbaSxabp[x18۔xb4xd38xa5x14>c@x8dxRr
seq: 210541711
2 rows in set (0.00 sec)
Hi,
Sorry for the late review. Could you fix the merge conflicts please?
Thanks
Seems support for binary fields was committed to master after this was initially written, although using normal ASCII strings for values. For my use case this patch was written for it was important to actually have non-ASCII data in the generated test tables, so I just did a sort of logical merge where it will append more random binary data to such fields if the field side and the size of the generated "fake" strings allows.