Skip to content

Commit c6a72d2

Browse files
committed
- MDEV-11366 SIGBUS errors in Connect Storage Engine for ArmHF and MIPS.
Fix includes launchpad fix plus more to cover writing BIN tables. modified: storage/connect/tabfix.cpp modified: storage/connect/value.cpp modified: storage/connect/value.h - Typo: Change the name of filamzip to filamgz to prepare future ZIP tables. modified: storage/connect/CMakeLists.txt added: storage/connect/filamgz.cpp added: storage/connect/filamgz.h deleted: storage/connect/filamzip.cpp deleted: storage/connect/filamzip.h modified: storage/connect/plgdbsem.h modified: storage/connect/reldef.cpp modified: storage/connect/tabdos.cpp modified: storage/connect/tabdos.h modified: storage/connect/tabfix.cpp modified: storage/connect/tabfmt.cpp modified: storage/connect/tabjson.cpp
1 parent c82462c commit c6a72d2

File tree

12 files changed

+197
-151
lines changed

12 files changed

+197
-151
lines changed

storage/connect/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ SET(CONNECT_SOURCES
2020
ha_connect.cc connect.cc user_connect.cc mycat.cc
2121
fmdlex.c osutil.c plugutil.c rcmsg.c rcmsg.h
2222
array.cpp blkfil.cpp colblk.cpp csort.cpp
23-
filamap.cpp filamdbf.cpp filamfix.cpp filamtxt.cpp filamzip.cpp
23+
filamap.cpp filamdbf.cpp filamfix.cpp filamgz.cpp filamtxt.cpp
2424
filter.cpp json.cpp jsonudf.cpp maputil.cpp myconn.cpp myutil.cpp plgdbutl.cpp
2525
reldef.cpp tabcol.cpp tabdos.cpp tabfix.cpp tabfmt.cpp tabjson.cpp table.cpp
2626
tabmul.cpp tabmysql.cpp taboccur.cpp tabpivot.cpp tabsys.cpp tabtbl.cpp tabutil.cpp
2727
tabvir.cpp tabxcl.cpp valblk.cpp value.cpp xindex.cpp xobject.cpp
2828

2929
array.h blkfil.h block.h catalog.h checklvl.h colblk.h connect.h csort.h
30-
engmsg.h filamap.h filamdbf.h filamfix.h filamtxt.h filamzip.h
30+
engmsg.h filamap.h filamdbf.h filamfix.h filamgz.h filamtxt.h
3131
filter.h global.h ha_connect.h inihandl.h json.h jsonudf.h maputil.h msgid.h
3232
mycat.h myconn.h myutil.h os.h osutil.h plgcnx.h plgdbsem.h preparse.h reldef.h
3333
resource.h tabcol.h tabdos.h tabfix.h tabfmt.h tabjson.h tabmul.h tabmysql.h
@@ -38,7 +38,7 @@ user_connect.h valblk.h value.h xindex.h xobject.h xtable.h)
3838
# Definitions that are shared for all OSes
3939
#
4040
add_definitions( -DMARIADB -DFORCE_INIT_OF_VARS -Dconnect_EXPORTS)
41-
add_definitions( -DHUGE_SUPPORT -DZIP_SUPPORT -DPIVOT_SUPPORT )
41+
add_definitions( -DHUGE_SUPPORT -DGZ_SUPPORT -DPIVOT_SUPPORT )
4242

4343

4444
#
@@ -270,9 +270,9 @@ IF(CONNECT_WITH_JDBC)
270270
# Find required libraries and include directories
271271
SET (JAVA_SOURCES JdbcInterface.java)
272272
add_jar(JdbcInterface ${JAVA_SOURCES})
273-
install_jar(JdbcInterface DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
274-
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/JavaWrappers.jar
275-
DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
273+
install_jar(JdbcInterface DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
274+
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/JavaWrappers.jar
275+
DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
276276
add_definitions(-DJDBC_SUPPORT)
277277
ELSE()
278278
SET(JDBC_LIBRARY "")

storage/connect/filamzip.cpp renamed to storage/connect/filamgz.cpp

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
/*********** File AM Zip C++ Program Source Code File (.CPP) ***********/
2-
/* PROGRAM NAME: FILAMZIP */
1+
/************ File AM GZ C++ Program Source Code File (.CPP) ***********/
2+
/* PROGRAM NAME: FILAMGZ */
33
/* ------------- */
44
/* Version 1.5 */
55
/* */
66
/* COPYRIGHT: */
77
/* ---------- */
8-
/* (C) Copyright to the author Olivier BERTRAND 2005-2015 */
8+
/* (C) Copyright to the author Olivier BERTRAND 2005-2016 */
99
/* */
1010
/* WHAT THIS PROGRAM DOES: */
1111
/* ----------------------- */
@@ -56,7 +56,7 @@
5656
/***********************************************************************/
5757
//#define ZLIB_DLL
5858

59-
#include "filamzip.h"
59+
#include "filamgz.h"
6060

6161
/***********************************************************************/
6262
/* DB static variables. */
@@ -66,13 +66,13 @@ extern int num_read, num_there, num_eq[]; // Statistics
6666
/* ------------------------------------------------------------------- */
6767

6868
/***********************************************************************/
69-
/* Implementation of the ZIPFAM class. */
69+
/* Implementation of the GZFAM class. */
7070
/***********************************************************************/
71-
ZIPFAM::ZIPFAM(PZIPFAM txfp) : TXTFAM(txfp)
71+
GZFAM::GZFAM(PGZFAM txfp) : TXTFAM(txfp)
7272
{
7373
Zfile = txfp->Zfile;
7474
Zpos = txfp->Zpos;
75-
} // end of ZIPFAM copy constructor
75+
} // end of GZFAM copy constructor
7676

7777
/***********************************************************************/
7878
/* Zerror: Error function for gz calls. */
@@ -82,7 +82,7 @@ ZIPFAM::ZIPFAM(PZIPFAM txfp) : TXTFAM(txfp)
8282
/* library, errnum is set to Z_ERRNO and the application may consult */
8383
/* errno to get the exact error code. */
8484
/***********************************************************************/
85-
int ZIPFAM::Zerror(PGLOBAL g)
85+
int GZFAM::Zerror(PGLOBAL g)
8686
{
8787
int errnum;
8888

@@ -101,18 +101,18 @@ int ZIPFAM::Zerror(PGLOBAL g)
101101
/***********************************************************************/
102102
/* Reset: reset position values at the beginning of file. */
103103
/***********************************************************************/
104-
void ZIPFAM::Reset(void)
104+
void GZFAM::Reset(void)
105105
{
106106
TXTFAM::Reset();
107107
//gzrewind(Zfile); // Useful ?????
108108
Zpos = 0;
109109
} // end of Reset
110110

111111
/***********************************************************************/
112-
/* ZIP GetFileLength: returns an estimate of what would be the */
112+
/* GZ GetFileLength: returns an estimate of what would be the */
113113
/* uncompressed file size in number of bytes. */
114114
/***********************************************************************/
115-
int ZIPFAM::GetFileLength(PGLOBAL g)
115+
int GZFAM::GetFileLength(PGLOBAL g)
116116
{
117117
int len = TXTFAM::GetFileLength(g);
118118

@@ -124,9 +124,9 @@ int ZIPFAM::GetFileLength(PGLOBAL g)
124124
} // end of GetFileLength
125125

126126
/***********************************************************************/
127-
/* ZIP Access Method opening routine. */
127+
/* GZ Access Method opening routine. */
128128
/***********************************************************************/
129-
bool ZIPFAM::OpenTableFile(PGLOBAL g)
129+
bool GZFAM::OpenTableFile(PGLOBAL g)
130130
{
131131
char opmode[4], filename[_MAX_PATH];
132132
MODE mode = Tdbp->GetMode();
@@ -137,7 +137,7 @@ bool ZIPFAM::OpenTableFile(PGLOBAL g)
137137
break;
138138
case MODE_UPDATE:
139139
/*****************************************************************/
140-
/* Updating ZIP files not implemented yet. */
140+
/* Updating GZ files not implemented yet. */
141141
/*****************************************************************/
142142
strcpy(g->Message, MSG(UPD_ZIP_NOT_IMP));
143143
return true;
@@ -152,7 +152,7 @@ bool ZIPFAM::OpenTableFile(PGLOBAL g)
152152
// Last = Nrec; // For ZBKFAM
153153
Tdbp->ResetSize();
154154
} else {
155-
sprintf(g->Message, MSG(NO_PART_DEL), "ZIP");
155+
sprintf(g->Message, MSG(NO_PART_DEL), "GZ");
156156
return true;
157157
} // endif filter
158158

@@ -196,7 +196,7 @@ bool ZIPFAM::OpenTableFile(PGLOBAL g)
196196
/* Allocate the line buffer. For mode Delete a bigger buffer has to */
197197
/* be allocated because is it also used to move lines into the file. */
198198
/***********************************************************************/
199-
bool ZIPFAM::AllocateBuffer(PGLOBAL g)
199+
bool GZFAM::AllocateBuffer(PGLOBAL g)
200200
{
201201
MODE mode = Tdbp->GetMode();
202202

@@ -223,33 +223,33 @@ bool ZIPFAM::AllocateBuffer(PGLOBAL g)
223223
/***********************************************************************/
224224
/* GetRowID: return the RowID of last read record. */
225225
/***********************************************************************/
226-
int ZIPFAM::GetRowID(void)
226+
int GZFAM::GetRowID(void)
227227
{
228228
return Rows;
229229
} // end of GetRowID
230230

231231
/***********************************************************************/
232232
/* GetPos: return the position of last read record. */
233233
/***********************************************************************/
234-
int ZIPFAM::GetPos(void)
234+
int GZFAM::GetPos(void)
235235
{
236236
return (int)Zpos;
237237
} // end of GetPos
238238

239239
/***********************************************************************/
240240
/* GetNextPos: return the position of next record. */
241241
/***********************************************************************/
242-
int ZIPFAM::GetNextPos(void)
242+
int GZFAM::GetNextPos(void)
243243
{
244244
return gztell(Zfile);
245245
} // end of GetNextPos
246246

247247
/***********************************************************************/
248248
/* SetPos: Replace the table at the specified position. */
249249
/***********************************************************************/
250-
bool ZIPFAM::SetPos(PGLOBAL g, int pos __attribute__((unused)))
250+
bool GZFAM::SetPos(PGLOBAL g, int pos __attribute__((unused)))
251251
{
252-
sprintf(g->Message, MSG(NO_SETPOS_YET), "ZIP");
252+
sprintf(g->Message, MSG(NO_SETPOS_YET), "GZ");
253253
return true;
254254
#if 0
255255
Fpos = pos;
@@ -267,7 +267,7 @@ bool ZIPFAM::SetPos(PGLOBAL g, int pos __attribute__((unused)))
267267
/***********************************************************************/
268268
/* Record file position in case of UPDATE or DELETE. */
269269
/***********************************************************************/
270-
bool ZIPFAM::RecordPos(PGLOBAL)
270+
bool GZFAM::RecordPos(PGLOBAL)
271271
{
272272
Zpos = gztell(Zfile);
273273
return false;
@@ -276,7 +276,7 @@ bool ZIPFAM::RecordPos(PGLOBAL)
276276
/***********************************************************************/
277277
/* Skip one record in file. */
278278
/***********************************************************************/
279-
int ZIPFAM::SkipRecord(PGLOBAL g, bool header)
279+
int GZFAM::SkipRecord(PGLOBAL g, bool header)
280280
{
281281
// Skip this record
282282
if (gzeof(Zfile))
@@ -293,7 +293,7 @@ int ZIPFAM::SkipRecord(PGLOBAL g, bool header)
293293
/***********************************************************************/
294294
/* ReadBuffer: Read one line from a compressed text file. */
295295
/***********************************************************************/
296-
int ZIPFAM::ReadBuffer(PGLOBAL g)
296+
int GZFAM::ReadBuffer(PGLOBAL g)
297297
{
298298
char *p;
299299
int rc;
@@ -357,7 +357,7 @@ int ZIPFAM::ReadBuffer(PGLOBAL g)
357357
/* WriteDB: Data Base write routine for ZDOS access method. */
358358
/* Update is not possible without using a temporary file (NIY). */
359359
/***********************************************************************/
360-
int ZIPFAM::WriteBuffer(PGLOBAL g)
360+
int GZFAM::WriteBuffer(PGLOBAL g)
361361
{
362362
/*********************************************************************/
363363
/* Prepare the write buffer. */
@@ -376,7 +376,7 @@ int ZIPFAM::WriteBuffer(PGLOBAL g)
376376
/***********************************************************************/
377377
/* Data Base delete line routine for ZDOS access method. (NIY) */
378378
/***********************************************************************/
379-
int ZIPFAM::DeleteRecords(PGLOBAL g, int)
379+
int GZFAM::DeleteRecords(PGLOBAL g, int)
380380
{
381381
strcpy(g->Message, MSG(NO_ZIP_DELETE));
382382
return RC_FX;
@@ -385,21 +385,21 @@ int ZIPFAM::DeleteRecords(PGLOBAL g, int)
385385
/***********************************************************************/
386386
/* Data Base close routine for DOS access method. */
387387
/***********************************************************************/
388-
void ZIPFAM::CloseTableFile(PGLOBAL, bool)
388+
void GZFAM::CloseTableFile(PGLOBAL, bool)
389389
{
390390
int rc = gzclose(Zfile);
391391

392392
if (trace)
393-
htrc("ZIP CloseDB: closing %s rc=%d\n", To_File, rc);
393+
htrc("GZ CloseDB: closing %s rc=%d\n", To_File, rc);
394394

395395
Zfile = NULL; // So we can know whether table is open
396396
//To_Fb->Count = 0; // Avoid double closing by PlugCloseAll
397397
} // end of CloseTableFile
398398

399399
/***********************************************************************/
400-
/* Rewind routine for ZIP access method. */
400+
/* Rewind routine for GZ access method. */
401401
/***********************************************************************/
402-
void ZIPFAM::Rewind(void)
402+
void GZFAM::Rewind(void)
403403
{
404404
gzrewind(Zfile);
405405
} // end of Rewind
@@ -409,7 +409,7 @@ void ZIPFAM::Rewind(void)
409409
/***********************************************************************/
410410
/* Constructors. */
411411
/***********************************************************************/
412-
ZBKFAM::ZBKFAM(PDOSDEF tdp) : ZIPFAM(tdp)
412+
ZBKFAM::ZBKFAM(PDOSDEF tdp) : GZFAM(tdp)
413413
{
414414
Blocked = true;
415415
Block = tdp->GetBlock();
@@ -421,7 +421,7 @@ ZBKFAM::ZBKFAM(PDOSDEF tdp) : ZIPFAM(tdp)
421421
BlkPos = tdp->GetTo_Pos();
422422
} // end of ZBKFAM standard constructor
423423

424-
ZBKFAM::ZBKFAM(PZBKFAM txfp) : ZIPFAM(txfp)
424+
ZBKFAM::ZBKFAM(PZBKFAM txfp) : GZFAM(txfp)
425425
{
426426
CurLine = txfp->CurLine;
427427
NxtLine = txfp->NxtLine;
@@ -505,7 +505,7 @@ int ZBKFAM::GetPos(void)
505505
/***********************************************************************/
506506
bool ZBKFAM::RecordPos(PGLOBAL /*g*/)
507507
{
508-
//strcpy(g->Message, "RecordPos not implemented for zip blocked tables");
508+
//strcpy(g->Message, "RecordPos not implemented for gz blocked tables");
509509
//return true;
510510
return RC_OK;
511511
} // end of RecordPos
@@ -515,7 +515,7 @@ bool ZBKFAM::RecordPos(PGLOBAL /*g*/)
515515
/***********************************************************************/
516516
int ZBKFAM::SkipRecord(PGLOBAL /*g*/, bool)
517517
{
518-
//strcpy(g->Message, "SkipRecord not implemented for zip blocked tables");
518+
//strcpy(g->Message, "SkipRecord not implemented for gz blocked tables");
519519
//return RC_FX;
520520
return RC_OK;
521521
} // end of SkipRecord
@@ -615,7 +615,7 @@ int ZBKFAM::WriteBuffer(PGLOBAL g)
615615

616616
/*********************************************************************/
617617
/* In Insert mode, blocs are added sequentialy to the file end. */
618-
/* Note: Update mode is not handled for zip files. */
618+
/* Note: Update mode is not handled for gz files. */
619619
/*********************************************************************/
620620
if (++CurNum == Rbuf) {
621621
/*******************************************************************/
@@ -703,7 +703,7 @@ void ZBKFAM::CloseTableFile(PGLOBAL g, bool)
703703
rc = gzclose(Zfile);
704704

705705
if (trace)
706-
htrc("ZIP CloseDB: closing %s rc=%d\n", To_File, rc);
706+
htrc("GZ CloseDB: closing %s rc=%d\n", To_File, rc);
707707

708708
Zfile = NULL; // So we can know whether table is open
709709
//To_Fb->Count = 0; // Avoid double closing by PlugCloseAll
@@ -854,7 +854,7 @@ int ZIXFAM::WriteBuffer(PGLOBAL g)
854854
{
855855
/*********************************************************************/
856856
/* In Insert mode, blocs are added sequentialy to the file end. */
857-
/* Note: Update mode is not handled for zip files. */
857+
/* Note: Update mode is not handled for gz files. */
858858
/*********************************************************************/
859859
if (++CurNum == Rbuf) {
860860
/*******************************************************************/
@@ -1062,7 +1062,7 @@ int ZLBFAM::GetNextPos(void)
10621062
/***********************************************************************/
10631063
bool ZLBFAM::SetPos(PGLOBAL g, int pos __attribute__((unused)))
10641064
{
1065-
sprintf(g->Message, MSG(NO_SETPOS_YET), "ZIP");
1065+
sprintf(g->Message, MSG(NO_SETPOS_YET), "GZ");
10661066
return true;
10671067
#if 0 // All this must be checked
10681068
if (pos < 0) {
@@ -1423,4 +1423,4 @@ void ZLBFAM::Rewind(void)
14231423
//Rbuf = 0; commented out in case we reuse last read block
14241424
} // end of Rewind
14251425

1426-
/* ------------------------ End of ZipFam ---------------------------- */
1426+
/* ------------------------ End of GzFam ---------------------------- */

0 commit comments

Comments
 (0)