[MDEV-12477] MariaDB can't connect 100MB JSON file Created: 2017-04-10 Updated: 2017-04-12 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - Connect |
| Affects Version/s: | 10.1.21 |
| Fix Version/s: | 10.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Simon Tulett | Assignee: | Olivier Bertrand |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | connect-engine, json, memory | ||
| Environment: |
Windows 10, 64 Bit, 16GB RAM |
||
| Description |
|
When trying to load a JSON file produce by mongodump in the format where each row is a separate JSON document as opposed to a single array I hit an out of memory error. I am using the following syntax; CREATE TABLE test I have experimented with lrecl sizes of up to 4096 but it made no difference and eventually crashed the database engine. Since crashing the database engine I now get a different error that I can't get rid of even with smaller files now. Below is some configuration detail and the stack trace from the error logs; Server version: 10.1.21-MariaDB ha_connect.dll!_setjmp()[setjmp.asm:95] |
| Comments |
| Comment by Simon Tulett [ 2017-04-10 ] |
|
I decided to try a simplified version, not using the catfunc option and just importing two columns from my collection but now I get an unexpected EOF error thrown. the JSON file I am trying to connect is coming straight from mongoexport and has been untouched by me. CREATE TABLE test select The exact error message is. SQL Error (1296): Got error 122 'Unexpected EOF in String' from CONNECT This doesn't appear to have triggered a stack trace in the .err file |
| Comment by Simon Tulett [ 2017-04-10 ] |
|
One further update on this, the EOF issues appear to be something to do with the format of the file. I tried using the mongoexport command line parameters --skip and --limit to create a smaller pretty=0 file and attempt an import and I hit an error Unexpected character near f near d":f which appears to be referring to the first character of the value false which is stored in one of my fields? Can MariaDB not handle JSON with true and false unquoted? |
| Comment by Simon Tulett [ 2017-04-11 ] |
|
I've been playing around with a number of different parameters today to try and narrow this issue down. I have discovered that I can successfully create a table when using a PRETTY=2 json file, but can't load more than a few 100 rows of data without hitting an out of memory problem as expected, but when I use the same create table specification for pretty=0 or pretty=1 format files, when trying to select data from the table no matter how big the file is or what mongo collection I have exported from the source database or how small a column set I limit the create table statement to I always get the same result, ERROR 1296 (HY000): Got error 122 'Unexpected EOF in String' from CONNECT. My current create statement below; CREATE TABLE test I have also updated some config parameters in an attempt to get this working, they are as follows; [mysqld] |
| Comment by Simon Tulett [ 2017-04-11 ] |
|
Hopefully my final update on this. In the end I managed to get it to work by increasing the lrecl size to 2097152. The collections I was trying to load had images stored in them. Although this now does work it seems to be working intermittently. Sometimes the select statement will work and return the results other times mysqld will crash with the following stack trace. ha_connect.dll!_setjmp()[setjmp.asm:95] |
| Comment by Olivier Bertrand [ 2017-04-11 ] |
|
Indeed, 'Unexpected EOF in String' refers to a LRECL that is smaller than one MongoDB document. About the error on "ha_connect.dll!_setjmp()[setjmp.asm:95]" this is a strange error that I experienced recently, meaning since I use visual studio 15. It may be a compiler error. By the way, which compiler are you using? Finally I fixed it by getting rid of all these setjmp/longjmp. CONNECT is now using try/catch and throw to achieve the same goal. I am not sure of which MariaDB versions include or will include that change. Anyway, could you attach the json files you exported from MongoDB so I can do some tests with them? For your information: I am working on a new version of CONNECT that will directly work on MongoDB collections via their MongoDB C Driver. This is not distributed yet, and as all new additional features, will probably be distributed only with MariaDB 10.2 and 10.3. |
| Comment by Simon Tulett [ 2017-04-11 ] |
|
I'm on Windows and am using the pre compiled msi and dll. I can't really pass on the exact json I'm using without anonymizing it 1st but will see what I can do and upload when I can. Out of interest I downloaded the most recent msi 10.2.5 using connect version 1.05.0003 and am hitting a similar but different error, so it looks like the latest pre compiled version of the plugin doesn't have your try catch fix in it yet. ha_connect.dll!__intrinsic_setjmp() Do you have any indication at all when this may be available in beta? |
| Comment by Olivier Bertrand [ 2017-04-12 ] |
|
Do you have any indication at all when this may be available in beta About direct connection to MongoDB: there is little chance that the machines generating the pre-compiled MariaDB versions have the MongoDB C Driver installed. To use this feature, it will be probably necessary to download and compile MariaDB from source. |