mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
- Add a new CONNECT global variable allowing to tell whether or not
a temporary file should be used for UPDATE/DELETE of file tables. Also use the "sorted" argument of index_init to help decide if sorting of positions must be done. modified: storage/connect/checklvl.h storage/connect/connect.cc storage/connect/connect.h storage/connect/filamdbf.cpp storage/connect/filamfix.cpp storage/connect/filamfix.h storage/connect/filamtxt.cpp storage/connect/ha_connect.cc storage/connect/mysql-test/connect/r/part_table.result storage/connect/plgdbsem.h storage/connect/plgdbutl.cpp storage/connect/reldef.cpp storage/connect/tabdos.cpp storage/connect/tabdos.h storage/connect/tabfix.cpp storage/connect/tabfmt.cpp storage/connect/tabvct.cpp storage/connect/tabvct.h storage/connect/xindex.cpp - Fix a bug in TDBASE::ColDB that caused some special columns not to be found in the column list and reallocated without their Value causing a crash of some queries. modified: storage/connect/table.cpp - Fix a bug causing RestoreNrec to be called before closing a table causing a wrong value given to Spos modified: storage/connect/tabdos.cpp storage/connect/xindex.cpp - Add a new CONNECT global variable connect_exact_info. Set to ON, it tells CONNECT to return exact record numbers on info queries. If OFF it just gives an estimate. In version 10.0.13 this was unconditionally ON and caused info queries on remote tables to be extremely long and was the subject of MDEV-6612. modified: storage/connect/ha_connect.cc storage/connect/tabdos.cpp storage/connect/tabmysql.cpp storage/connect/tabodbc.cpp
This commit is contained in:
@@ -64,7 +64,10 @@
|
||||
/* DB static variables. */
|
||||
/***********************************************************************/
|
||||
int num_read, num_there, num_eq[2]; // Statistics
|
||||
extern "C" int trace;
|
||||
|
||||
extern "C" int trace;
|
||||
extern "C" USETEMP Use_Temp;
|
||||
extern bool xinfo;
|
||||
|
||||
/***********************************************************************/
|
||||
/* Size of optimize file header. */
|
||||
@@ -75,8 +78,8 @@ extern "C" int trace;
|
||||
/* Min and Max blocks contains zero ended fields (blank = false). */
|
||||
/* No conversion of block values (check = true). */
|
||||
/***********************************************************************/
|
||||
PVBLK AllocValBlock(PGLOBAL, void *, int, int, int len = 0, int prec = 0,
|
||||
bool check = true, bool blank = false, bool un = false);
|
||||
PVBLK AllocValBlock(PGLOBAL, void *, int, int, int len= 0, int prec= 0,
|
||||
bool check= true, bool blank= false, bool un= false);
|
||||
|
||||
/* --------------------------- Class DOSDEF -------------------------- */
|
||||
|
||||
@@ -313,7 +316,7 @@ bool DOSDEF::InvalidateIndex(PGLOBAL g)
|
||||
PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode)
|
||||
{
|
||||
// Mapping not used for insert
|
||||
USETEMP tmp = PlgGetUser(g)->UseTemp;
|
||||
USETEMP tmp = Use_Temp;
|
||||
bool map = Mapped && mode != MODE_INSERT &&
|
||||
!(tmp != TMP_NO && Recfm == RECFM_VAR
|
||||
&& mode == MODE_UPDATE) &&
|
||||
@@ -545,8 +548,8 @@ int TDBDOS::ResetTableOpt(PGLOBAL g, bool dop, bool dox)
|
||||
|
||||
if (dox && (rc == RC_OK || rc == RC_INFO)) {
|
||||
// Remake eventual indexes
|
||||
if (Mode != MODE_UPDATE)
|
||||
To_SetCols = NULL; // Only used on Update
|
||||
// if (Mode != MODE_UPDATE)
|
||||
To_SetCols = NULL; // Positions are changed
|
||||
|
||||
Columns = NULL; // Not used anymore
|
||||
Txfp->Reset(); // New start
|
||||
@@ -1722,7 +1725,7 @@ err:
|
||||
/***********************************************************************/
|
||||
/* Make a dynamic index. */
|
||||
/***********************************************************************/
|
||||
bool TDBDOS::InitialyzeIndex(PGLOBAL g, PIXDEF xdp)
|
||||
bool TDBDOS::InitialyzeIndex(PGLOBAL g, PIXDEF xdp, bool sorted)
|
||||
{
|
||||
int k, rc;
|
||||
bool brc, dynamic;
|
||||
@@ -1810,7 +1813,9 @@ bool TDBDOS::InitialyzeIndex(PGLOBAL g, PIXDEF xdp)
|
||||
To_BlkFil = NULL;
|
||||
} // endif AmType
|
||||
|
||||
if (!(To_Kindex= kxp)->IsSorted() &&
|
||||
To_Kindex= kxp;
|
||||
|
||||
if (!(sorted && To_Kindex->IsSorted()) &&
|
||||
((Mode == MODE_UPDATE && IsUsingTemp(g)) ||
|
||||
(Mode == MODE_DELETE && Txfp->GetAmType() != TYPE_AM_DBF)))
|
||||
Indxd = true;
|
||||
@@ -1891,7 +1896,7 @@ int TDBDOS::Cardinality(PGLOBAL g)
|
||||
|
||||
} // endif Mode
|
||||
|
||||
if (Mode == MODE_ANY) {
|
||||
if (Mode == MODE_ANY && xinfo) {
|
||||
// Using index impossible or failed, do it the hard way
|
||||
Mode = MODE_READ;
|
||||
To_Line = (char*)PlugSubAlloc(g, NULL, Lrecl + 1);
|
||||
@@ -2004,10 +2009,8 @@ int TDBDOS::EstimatedLength(PGLOBAL g)
|
||||
/***********************************************************************/
|
||||
bool TDBDOS::IsUsingTemp(PGLOBAL g)
|
||||
{
|
||||
USETEMP usetemp = PlgGetUser(g)->UseTemp;
|
||||
|
||||
return (usetemp == TMP_YES || usetemp == TMP_FORCE ||
|
||||
(usetemp == TMP_AUTO && Mode == MODE_UPDATE));
|
||||
return (Use_Temp == TMP_YES || Use_Temp == TMP_FORCE ||
|
||||
(Use_Temp == TMP_AUTO && Mode == MODE_UPDATE));
|
||||
} // end of IsUsingTemp
|
||||
|
||||
/***********************************************************************/
|
||||
@@ -2047,7 +2050,7 @@ bool TDBDOS::OpenDB(PGLOBAL g)
|
||||
Txfp = new(g) DOSFAM((PDOSDEF)To_Def);
|
||||
Txfp->SetTdbp(this);
|
||||
} else if (Txfp->Blocked && (Mode == MODE_DELETE ||
|
||||
(Mode == MODE_UPDATE && PlgGetUser(g)->UseTemp != TMP_NO))) {
|
||||
(Mode == MODE_UPDATE && Use_Temp != TMP_NO))) {
|
||||
/*******************************************************************/
|
||||
/* Delete is not currently handled in block mode neither Update */
|
||||
/* when using a temporary file. */
|
||||
@@ -2219,6 +2222,7 @@ void TDBDOS::CloseDB(PGLOBAL g)
|
||||
} // endif
|
||||
|
||||
Txfp->CloseTableFile(g, Abort);
|
||||
RestoreNrec();
|
||||
} // end of CloseDB
|
||||
|
||||
// ------------------------ DOSCOL functions ----------------------------
|
||||
@@ -2247,8 +2251,8 @@ DOSCOL::DOSCOL(PGLOBAL g, PCOLDEF cdp, PTDB tp, PCOL cp, int i, PSZ am)
|
||||
Deplac = cdp->GetOffset();
|
||||
Long = cdp->GetLong();
|
||||
To_Val = NULL;
|
||||
Clustered = 0;
|
||||
Sorted = 0;
|
||||
Clustered = cdp->GetOpt();
|
||||
Sorted = (cdp->GetOpt() == 2) ? 1 : 0;
|
||||
Ndv = 0; // Currently used only for XDB2
|
||||
Nbm = 0; // Currently used only for XDB2
|
||||
Min = NULL;
|
||||
|
Reference in New Issue
Block a user