summaryrefslogtreecommitdiff
path: root/sql/sql_load.cc
diff options
context:
space:
mode:
authorPraveenkumar Hulakund <praveenkumar.hulakund@oracle.com>2014-03-19 12:30:30 +0530
committerPraveenkumar Hulakund <praveenkumar.hulakund@oracle.com>2014-03-19 12:30:30 +0530
commit95e99e12639f8cde87bba555dcb72cd8cc6542ad (patch)
treea2441dbcdaa7a3ec12e21d50071b027c87b20d48 /sql/sql_load.cc
parentc8b8d00947e4e67ebaa87405dd48b93501c2d67d (diff)
downloadmariadb-git-95e99e12639f8cde87bba555dcb72cd8cc6542ad.tar.gz
Bug#11759519 - INFINITE HANG WITH 100% CPU USAGE WITH LOAD DATA
LOCAL AND IMPORT ERRORS Description: ----------- This bug happens due to the fact that current algorithm is designed that in the case of LOCAL load of data, in case of the error, the remaining part of the file is read in order to return the proper error message to the client side. But, the problem with current implementation is that data stream for the client side is cleared only in the case where line delimiters exist, which is not a case with, for example fixed width fields. Fix: ---- Ported patch provided by Sinisa Milivojevic n bug report for this issue to 5.5+ versions. As part of this patch code is changed to clear the data stream by calling new member function "READ_INFO::skip_data_till_eof".
Diffstat (limited to 'sql/sql_load.cc')
-rw-r--r--sql/sql_load.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index b593412c559..7f962520dd6 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -56,6 +56,9 @@ XML_TAG::XML_TAG(int l, String f, String v)
}
+#define GET (stack_pos != stack ? *--stack_pos : my_b_get(&cache))
+#define PUSH(A) *(stack_pos++)=(A)
+
class READ_INFO {
File file;
uchar *buffer, /* Buffer for read text */
@@ -110,6 +113,15 @@ public:
either the table or THD value
*/
void set_io_cache_arg(void* arg) { cache.arg = arg; }
+
+ /**
+ skip all data till the eof.
+ */
+ void skip_data_till_eof()
+ {
+ while (GET != my_b_EOF)
+ ;
+ }
};
static int read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
@@ -534,8 +546,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
if (error)
{
if (read_file_from_client)
- while (!read_info.next_line())
- ;
+ read_info.skip_data_till_eof();
#ifndef EMBEDDED_LIBRARY
if (mysql_bin_log.is_open())
@@ -1392,10 +1403,6 @@ READ_INFO::~READ_INFO()
}
-#define GET (stack_pos != stack ? *--stack_pos : my_b_get(&cache))
-#define PUSH(A) *(stack_pos++)=(A)
-
-
inline int READ_INFO::terminator(char *ptr,uint length)
{
int chr=0; // Keep gcc happy