NdbScanOperation.hpp, NdbScanOperation.cpp, ha_ndbcluster.cc:

  bug#25821  Excessive partition pruning for multi-range index scan in NDB API: added multi_range error checking in end_of_bound
ha_ndbcluster.h:
  Removed stray mthod declaration
parent 259d3dce
...@@ -38,7 +38,8 @@ class NdbScanOperation : public NdbOperation { ...@@ -38,7 +38,8 @@ class NdbScanOperation : public NdbOperation {
public: public:
/** /**
* Scan flags. OR-ed together and passed as second argument to * Scan flags. OR-ed together and passed as second argument to
* readTuples. * readTuples. Note that SF_MultiRange has to be set if several
* ranges (bounds) are to be passed.
*/ */
enum ScanFlag { enum ScanFlag {
SF_TupScan = (1 << 16), // scan TUP SF_TupScan = (1 << 16), // scan TUP
......
...@@ -1718,6 +1718,12 @@ NdbIndexScanOperation::reset_bounds(bool forceSend){ ...@@ -1718,6 +1718,12 @@ NdbIndexScanOperation::reset_bounds(bool forceSend){
int int
NdbIndexScanOperation::end_of_bound(Uint32 no) NdbIndexScanOperation::end_of_bound(Uint32 no)
{ {
DBUG_ENTER("end_of_bound");
DBUG_PRINT("info", ("Range number %u", no));
/* Check that SF_MultiRange has been specified if more
than one range is specified */
if (no > 0 && !m_multi_range)
DBUG_RETURN(-1);
if(no < (1 << 13)) // Only 12-bits no of ranges if(no < (1 << 13)) // Only 12-bits no of ranges
{ {
Uint32 bound_head = * m_first_bound_word; Uint32 bound_head = * m_first_bound_word;
...@@ -1726,9 +1732,9 @@ NdbIndexScanOperation::end_of_bound(Uint32 no) ...@@ -1726,9 +1732,9 @@ NdbIndexScanOperation::end_of_bound(Uint32 no)
m_first_bound_word = theKEYINFOptr + theTotalNrOfKeyWordInSignal;; m_first_bound_word = theKEYINFOptr + theTotalNrOfKeyWordInSignal;;
m_this_bound_start = theTupKeyLen; m_this_bound_start = theTupKeyLen;
return 0; DBUG_RETURN(0);
} }
return -1; DBUG_RETURN(-1);
} }
int int
......
...@@ -1996,8 +1996,7 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op, ...@@ -1996,8 +1996,7 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op,
DBUG_PRINT("error", ("key %d unknown flag %d", j, p.key->flag)); DBUG_PRINT("error", ("key %d unknown flag %d", j, p.key->flag));
DBUG_ASSERT(FALSE); DBUG_ASSERT(FALSE);
// Stop setting bounds but continue with what we have // Stop setting bounds but continue with what we have
op->end_of_bound(range_no); DBUG_RETURN(op->end_of_bound(range_no));
DBUG_RETURN(0);
} }
} }
} }
...@@ -2044,8 +2043,7 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op, ...@@ -2044,8 +2043,7 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op,
tot_len+= part_store_len; tot_len+= part_store_len;
} }
op->end_of_bound(range_no); DBUG_RETURN(op->end_of_bound(range_no));
DBUG_RETURN(0);
} }
/* /*
......
...@@ -661,7 +661,6 @@ static void set_tabname(const char *pathname, char *tabname); ...@@ -661,7 +661,6 @@ static void set_tabname(const char *pathname, char *tabname);
const NdbOperation *first, const NdbOperation *first,
const NdbOperation *last, const NdbOperation *last,
uint errcode); uint errcode);
bool key_fields_not_in_write_set(THD *thd, const KEY* key_info);
int peek_indexed_rows(const byte *record, bool check_pk); int peek_indexed_rows(const byte *record, bool check_pk);
int unique_index_read(const byte *key, uint key_len, int unique_index_read(const byte *key, uint key_len,
byte *buf); byte *buf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment