[MDEV-10525] CONNECT DBF table not created propery - throws LRECL error on SELECT Created: 2016-08-09 Updated: 2017-03-16 Resolved: 2017-03-16 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - Connect |
| Affects Version/s: | 10.1.16 |
| Fix Version/s: | 10.1.22, 10.0.31 |
| Type: | Bug | Priority: | Major |
| Reporter: | Barry O' Neill | Assignee: | Olivier Bertrand |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Environment: |
Windows Server 2012 |
||
| Attachments: |
|
| Description |
|
When you attempt to create a CONNECT DBF table, the create command executes without error. However when an attempt is made to query the data, an LRECL error is thrown and no data is returned. I have also attempted to manually set the LRECL via the options in the create statement but the same result is achieved. I have verified the DBF file and it opens fine it is a DBF version III file. The following executes fine:
However the following:
throws this error:
Upon further inspection the DBF file is actually being read and the table is being created but you cannot use SELECT to view even the empty columns in the table, it consistently throws the LRECL error. If you run the following:
You can then see the structure of dbf_demo(FIELD NAMES CHANGED):
|
| Comments |
| Comment by Olivier Bertrand [ 2016-08-15 ] | ||||||
|
Can you attach the test_dbf.dbf file so I can test what happens with it? | ||||||
| Comment by Marco Banfi [ 2016-09-12 ] | ||||||
|
Hi, I'm having the same problem, the connect engine with the dbf table does work under 10.1.17 windows 64bit the version, but doesn't work under 10.1.17 debian 64bit version (under Wheezy). Throws the LRECL error as reported. I attach a sample dbf file. Thanks, Marco. | ||||||
| Comment by Olivier Bertrand [ 2016-09-13 ] | ||||||
|
The record length is calculated adding the field lengths and the final end of line separator. This one is CRLF on Windows and LF on Linux and CONNECT adds by default 1 on Linux and 2 on Windows. Changing manually LRECL does not work because CONNECT adjust it to be sure it contains the whole line(s). | ||||||
| Comment by Olivier Bertrand [ 2016-09-13 ] | ||||||
|
Hmmm, what I said is true only for FIX, BIN and VCT tables. The case of DBF is different. | ||||||
| Comment by Olivier Bertrand [ 2016-09-13 ] | ||||||
|
There is something strange with this error. I have made tests with the attach file on a 64bit machine both under Windows and Linux and could not reproduce this bug. Now, looking in your error message:
What is weird is the number 857. Normally we are comparing the LRECL calculated by CONNECT with the one coming from the file header. Obviously, the calculated LRECL was lost and replaced by something else. It could come from a shift in the class members due to some values having a different size on some machines. Because the true record length is the one of the file header, this test could be simply suppressed and replace by setting LRECL to the value coming from the file header. If your are working with a source distribution, could you try this: in the file filamdbf.cpp line 413, replace:
by:
(and perhaps also line 642 if needed) So we can test whether this can fix the problem. Note: The show create table should not have a LRECL option. If it was added manually, note that the correct value is 301, not 310. | ||||||
| Comment by Marco Banfi [ 2016-09-13 ] | ||||||
|
Sorry, I'm not working with a source distribution. | ||||||
| Comment by Olivier Bertrand [ 2016-09-13 ] | ||||||
|
Can you publish the exact error message you had on debian? | ||||||
| Comment by Marco Banfi [ 2016-09-14 ] | ||||||
|
Hi, Oliver. Here it is (tested under Debian Jessie 64bit and wheezy 64bit as before). Errore SQL (1296): Got error 174 'Table/File lrecl mismatch (46,24)' from CONNECT BTW: I forgot to report that the original file is built under an old Clipper application. The sample file was anonymized using libreoffice calc. But it has the same behaviour before the treatment. | ||||||
| Comment by Marco Banfi [ 2016-09-15 ] | ||||||
|
Hi, Olivier. I attach a second test case (untouched, no anonymization), it has the same behaviour Error: Table created with: Resulting create table code: Debian Wheezy,64bit mariadb 10.1.17 64bit | ||||||
| Comment by Olivier Bertrand [ 2016-09-18 ] | ||||||
|
This error seems to occurs only on a limited number of platforms. I could not reproduce it and I checked on builbot where MariaDB is compiled on many platforms and all the tests implying DBF tables pass. Therefore I cannot currently fix it but here is what I did: When you create a DBF table with the option accept set to true, for instance adding:
the mismatch between the calculated LRECL and the one extracted from the DBF file header is no more regarded as an error but just as a warning. In addition, because I don't know whether the LRECL is miscalculated or lost between the time it is computed and the time it is compared, I have added a trace showing the calculated value. This trace can be activated by:
Then the LRECL is set to the value extracted from the DBF file header. I don't know whether will actually fix your problem (there can be other side effects) so I'd like you to test it in the next MariaDB release and let me know what happens. | ||||||
| Comment by Marco Banfi [ 2016-09-19 ] | ||||||
|
Thanks, Olivier. I'll keep you informed, I see that the changes will be inserted in 10.1.19. Greetings, Marco. | ||||||
| Comment by Olivier Bertrand [ 2017-01-19 ] | ||||||
|
As a matter of facts, this solution was buggy and could cause a server crash because the block size has to be updated with the new LRECL. | ||||||
| Comment by Marco Banfi [ 2017-03-16 ] | ||||||
|
Hi, Olivier. Just tested the 10.1.22 win64, now it does work. Thanks, Marco. |