From 1d468ee0401576e5646cef5d4e4ced9dc5a51a2b Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Fri, 30 Jul 2021 10:45:26 +0200 Subject: Fix slow processing of pretty json files by BSON tables --- storage/connect/tabbson.cpp | 18 ++++++++++-------- storage/connect/tabbson.h | 2 ++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/storage/connect/tabbson.cpp b/storage/connect/tabbson.cpp index 3b1f1c84d1a..e372dd662cf 100644 --- a/storage/connect/tabbson.cpp +++ b/storage/connect/tabbson.cpp @@ -376,7 +376,7 @@ int BSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) } // endswitch ReadDB } else - jsp = bp->GetArrayValue(bdp, i); + jsp = bp->GetNext(jsp); if (!(row = (jsp) ? bp->GetObject(jsp) : NULL)) break; @@ -2185,7 +2185,9 @@ void BSONCOL::WriteColumn(PGLOBAL g) TDBBSON::TDBBSON(PGLOBAL g, PBDEF tdp, PTXF txfp) : TDBBSN(g, tdp, txfp) { Docp = NULL; + Docrow = NULL; Multiple = tdp->Multiple; + Docsize = 0; Done = Changed = false; Bp->SetPretty(2); } // end of TDBBSON standard constructor @@ -2193,7 +2195,9 @@ TDBBSON::TDBBSON(PGLOBAL g, PBDEF tdp, PTXF txfp) : TDBBSN(g, tdp, txfp) TDBBSON::TDBBSON(PBTDB tdbp) : TDBBSN(tdbp) { Docp = tdbp->Docp; + Docrow = tdbp->Docrow; Multiple = tdbp->Multiple; + Docsize = tdbp->Docsize; Done = tdbp->Done; Changed = tdbp->Changed; } // end of TDBBSON copy constructor @@ -2374,6 +2378,7 @@ int TDBBSON::MakeDocument(PGLOBAL g) } // endif jsp + Docsize = Bp->GetSize(Docp); Done = true; return RC_OK; } // end of MakeDocument @@ -2388,7 +2393,7 @@ int TDBBSON::Cardinality(PGLOBAL g) else if (Cardinal < 0) { if (!Multiple) { if (MakeDocument(g) == RC_OK) - Cardinal = Bp->GetSize(Docp); + Cardinal = Docsize; } else return 10; @@ -2530,12 +2535,9 @@ int TDBBSON::ReadDB(PGLOBAL) NextSame = false; M++; rc = RC_OK; - } else if (++Fpos < (signed)Bp->GetSize(Docp)) { - Row = Bp->GetArrayValue(Docp, Fpos); - - if (Row->Type == TYPE_JVAL) - Row = Bp->GetBson(Row); - + } else if (++Fpos < Docsize) { + Docrow = (Docrow) ? Bp->GetNext(Docrow) : Bp->GetArrayValue(Docp, Fpos); + Row = (Docrow->Type == TYPE_JVAL) ? Bp->GetBson(Docrow) : Docrow; SameRow = 0; M = 1; rc = RC_OK; diff --git a/storage/connect/tabbson.h b/storage/connect/tabbson.h index 7f41bba6bd9..1696f4dfdbc 100644 --- a/storage/connect/tabbson.h +++ b/storage/connect/tabbson.h @@ -318,7 +318,9 @@ protected: // Members PBVAL Docp; // The document array + PBVAL Docrow; // Document row int Multiple; // 0: No 1: DIR 2: Section 3: filelist + int Docsize; // The document size bool Done; // True when document parsing is done bool Changed; // After Update, Insert or Delete }; // end of class TDBBSON -- cgit v1.2.1 From 46fed496b6634248b37fbf2b80a6333aa3659873 Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Sat, 31 Jul 2021 11:20:09 +0200 Subject: Fix bson crash and mongo test --- storage/connect/mysql-test/connect/t/mongo.inc | 12 ++++++++++-- storage/connect/tabbson.cpp | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/storage/connect/mysql-test/connect/t/mongo.inc b/storage/connect/mysql-test/connect/t/mongo.inc index fab2ca84139..25c3f207696 100644 --- a/storage/connect/mysql-test/connect/t/mongo.inc +++ b/storage/connect/mysql-test/connect/t/mongo.inc @@ -1,3 +1,11 @@ -let $MONGO= C:/Applic/MongoDB/Server/3.6/bin/mongo; -let $MONGOIMPORT= C:/Applic/MongoDB/Server/3.6/bin/mongoimport; +#let $MONGO= C:/Applic/MongoDB/Server/3.6/bin/mongo; +#let $MONGOIMPORT= C:/Applic/MongoDB/Server/3.6/bin/mongoimport; +let $MONGO= mongo; +let $MONGOIMPORT= mongoimport; + + + + + + diff --git a/storage/connect/tabbson.cpp b/storage/connect/tabbson.cpp index e372dd662cf..2df84e852eb 100644 --- a/storage/connect/tabbson.cpp +++ b/storage/connect/tabbson.cpp @@ -2422,6 +2422,7 @@ void TDBBSON::ResetSize(void) MaxSize = Cardinal = -1; Fpos = -1; N = 0; + Docrow = NULL; Done = false; } // end of ResetSize @@ -2480,6 +2481,7 @@ bool TDBBSON::SetRecpos(PGLOBAL, int recpos) #endif // 0 Fpos = recpos - 1; + Docrow = NULL; return false; } // end of SetRecpos @@ -2495,6 +2497,7 @@ bool TDBBSON::OpenDB(PGLOBAL g) Fpos = -1; NextSame = false; SameRow = 0; + Docrow = NULL; return false; } // endif use -- cgit v1.2.1 From 94fb9d937785e602b6970fb30f8fd0b9257db179 Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Fri, 15 Oct 2021 12:20:33 +0200 Subject: Fix MDEV-24493 --- storage/connect/colblk.h | 2 +- storage/connect/odbconn.cpp | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/storage/connect/colblk.h b/storage/connect/colblk.h index f303528f982..03a467e9230 100644 --- a/storage/connect/colblk.h +++ b/storage/connect/colblk.h @@ -1,7 +1,7 @@ /*************** Colblk H Declares Source Code File (.H) ***************/ /* Name: COLBLK.H Version 1.7 */ /* */ -/* (C) Copyright to the author Olivier BERTRAND 2005-2015 */ +/* (C) Copyright to the author Olivier BERTRAND 2005-2019 */ /* */ /* This file contains the COLBLK and derived classes declares. */ /***********************************************************************/ diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp index 5b20b33e240..8ff8d3a84e1 100644 --- a/storage/connect/odbconn.cpp +++ b/storage/connect/odbconn.cpp @@ -1,7 +1,7 @@ /***********************************************************************/ -/* Name: ODBCONN.CPP Version 2.3 */ +/* Name: ODBCONN.CPP Version 2.4 */ /* */ -/* (C) Copyright to the author Olivier BERTRAND 1998-2017 */ +/* (C) Copyright to the author Olivier BERTRAND 1998-2021 */ /* */ /* This file contains the ODBC connection classes functions. */ /***********************************************************************/ @@ -1509,7 +1509,7 @@ int ODBConn::ExecDirectSQL(char *sql, ODBCCOL *tocols) ThrowDBX(MSG(COL_NUM_MISM)); // Now bind the column buffers - for (n = 1, colp = tocols; colp; colp = (PODBCCOL)colp->GetNext()) + for (colp = tocols; colp; colp = (PODBCCOL)colp->GetNext()) if (!colp->IsSpecial()) { buffer = colp->GetBuffer(m_RowsetSize); len = colp->GetBuflen(); @@ -1525,12 +1525,11 @@ int ODBConn::ExecDirectSQL(char *sql, ODBCCOL *tocols) htrc("Binding col=%u type=%d buf=%p len=%d slen=%p\n", n, tp, buffer, len, colp->GetStrLen()); - rc = SQLBindCol(hstmt, n, tp, buffer, len, colp->GetStrLen()); + rc = SQLBindCol(hstmt, colp->GetIndex(), tp, buffer, len, colp->GetStrLen()); if (!Check(rc)) ThrowDBX(rc, "SQLBindCol", hstmt); - n++; } // endif pcol } catch(DBX *x) { -- cgit v1.2.1 From ff3274dd7ce8b4ad7322422650b69f45b8307e62 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 27 Oct 2021 21:52:35 +0200 Subject: Fix message severity for "thread pool blocked" messages. Those messages don't indicate errors, they should be normal warnings. --- sql/threadpool_generic.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/threadpool_generic.cc b/sql/threadpool_generic.cc index 78b57340a6b..e84d96ace33 100644 --- a/sql/threadpool_generic.cc +++ b/sql/threadpool_generic.cc @@ -1793,9 +1793,9 @@ static void print_pool_blocked_message(bool max_threads_reached) if (now > pool_block_start + BLOCK_MSG_DELAY && !msg_written) { if (max_threads_reached) - sql_print_error(MAX_THREADS_REACHED_MSG); + sql_print_warning(MAX_THREADS_REACHED_MSG); else - sql_print_error(CREATE_THREAD_ERROR_MSG, my_errno); + sql_print_warning(CREATE_THREAD_ERROR_MSG, my_errno); sql_print_information("Threadpool has been blocked for %u seconds\n", (uint)((now- pool_block_start)/1000000)); -- cgit v1.2.1 From 1203b65849cd1ecefe5f2df07f3165b9aa5e2a9d Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 28 Oct 2021 09:18:22 +0200 Subject: compilation fixes for sys-devel/gcc-11.2.0:11 for example: sql/sql_prepare.cc:5714:63: error: 'static void Ed_result_set::operator delete(void*, MEM_ROOT*)' called on pointer returned from a mismatched allocation function [-Werror=mismatched-new-delete] --- sql/sql_cursor.h | 4 +++- sql/sql_prepare.h | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sql/sql_cursor.h b/sql/sql_cursor.h index 00b9cd4e67a..b9d0b41ea19 100644 --- a/sql/sql_cursor.h +++ b/sql/sql_cursor.h @@ -39,7 +39,7 @@ class JOIN; its base class. */ -class Server_side_cursor: protected Query_arena, public Sql_alloc +class Server_side_cursor: protected Query_arena { protected: /** Row destination used for fetch */ @@ -61,6 +61,8 @@ public: } virtual ~Server_side_cursor(); + static void *operator new(size_t size, MEM_ROOT *mem_root) + { return alloc_root(mem_root, size); } static void operator delete(void *ptr, size_t size); static void operator delete(void *, MEM_ROOT *){} }; diff --git a/sql/sql_prepare.h b/sql/sql_prepare.h index f1c4e5e4be9..acdaa9a67a7 100644 --- a/sql/sql_prepare.h +++ b/sql/sql_prepare.h @@ -115,7 +115,7 @@ class Ed_row; automatic type conversion. */ -class Ed_result_set: public Sql_alloc +class Ed_result_set { public: operator List&() { return *m_rows; } @@ -129,6 +129,8 @@ public: size_t get_field_count() const { return m_column_count; } + static void *operator new(size_t size, MEM_ROOT *mem_root) + { return alloc_root(mem_root, size); } static void operator delete(void *ptr, size_t size) throw (); static void operator delete(void *, MEM_ROOT *){} private: -- cgit v1.2.1 From b3cdf4168cbfd4b20db01b8296f5800529f5713f Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Thu, 28 Oct 2021 12:24:31 +0200 Subject: fix depricated pthread_yield() for tokudb --- storage/tokudb/PerconaFT/portability/toku_pthread.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/storage/tokudb/PerconaFT/portability/toku_pthread.cc b/storage/tokudb/PerconaFT/portability/toku_pthread.cc index fe8a4d485cd..c066a734bae 100644 --- a/storage/tokudb/PerconaFT/portability/toku_pthread.cc +++ b/storage/tokudb/PerconaFT/portability/toku_pthread.cc @@ -55,7 +55,9 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include int toku_pthread_yield(void) { -#if defined(HAVE_PTHREAD_YIELD) +#if defined(HAVE_SCHED_YIELD) + return sched_yield(); +#elif defined(HAVE_PTHREAD_YIELD) # if defined(PTHREAD_YIELD_RETURNS_INT) return pthread_yield(); # elif defined(PTHREAD_YIELD_RETURNS_VOID) -- cgit v1.2.1