Commit 82da7623 authored by pekka@sama.ndb.mysql.com's avatar pekka@sama.ndb.mysql.com
Browse files

ndb - bug#29390: if ScanFilter is too large, abort or optionally discard it

parent 87359889
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -1888,5 +1888,27 @@ set engine_condition_pushdown = 1;
SELECT fname, lname FROM t1 WHERE (fname like 'Y%') or (lname like 'F%');
fname	lname
Young	Foo
drop table t1;
create table t1 (a int, b int, c int, d int, primary key using hash(a))
engine=ndbcluster;
insert into t1 values (10,1,100,0+0x1111);
insert into t1 values (20,2,200,0+0x2222);
insert into t1 values (30,3,300,0+0x3333);
insert into t1 values (40,4,400,0+0x4444);
insert into t1 values (50,5,500,0+0x5555);
set engine_condition_pushdown = on;
select a,b,d from t1
where b in (0,1,2,5)
order by b;
a	b	d
10	1	4369
20	2	8738
50	5	21845
a	b	d
10	1	4369
20	2	8738
50	5	21845
Warnings:
Warning	4294	Scan filter is too large, discarded
set engine_condition_pushdown = @old_ecpd;
DROP TABLE t1,t2,t3,t4,t5;
+1025 −0

File changed.

Preview size limit exceeded, changes collapsed.

+1 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ public:
   * Length of signal
   */
  STATIC_CONST( StaticLength = 11 );
  STATIC_CONST( MaxTotalAttrInfo = 0xFFFF );

private:

+1 −0
Original line number Diff line number Diff line
@@ -1052,6 +1052,7 @@ class Ndb
  friend class NdbDictInterface;
  friend class NdbBlob;
  friend class NdbImpl;
  friend class NdbScanFilterImpl;
#endif

public:
+26 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#define NDB_SCAN_FILTER_HPP

#include <ndb_types.h>
#include <ndbapi_limits.h>

/**
 * @class NdbScanFilter
@@ -31,8 +32,13 @@ public:
  /**
   * Constructor
   * @param op  The NdbOperation that the filter belongs to (is applied to).
   * @param abort_on_too_large  abort transaction on filter too large
   *                            default: true
   * @param max_size  Maximum size of generated filter in words
   */
  NdbScanFilter(class NdbOperation * op);
  NdbScanFilter(class NdbOperation * op,
                bool abort_on_too_large = true,
                Uint32 max_size = NDB_MAX_SCANFILTER_SIZE_IN_WORDS);
  ~NdbScanFilter();
  
  /**
@@ -166,6 +172,25 @@ public:
  /** @} *********************************************************************/
#endif

  enum Error {
    FilterTooLarge = 4294
  };

  /**
   * Get filter level error.
   *
   * Most errors are set only on operation level, and they abort the
   * transaction.  The error FilterTooLarge is set on filter level and
   * by default it propagates to operation level and also aborts the
   * transaction.
   *
   * If option abort_on_too_large is set to false, then FilterTooLarge
   * does not propagate.  One can then either ignore this error (in
   * which case no filtering is done) or try to define a new filter
   * immediately.
   */
  const class NdbError & getNdbError() const;

private:
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
  friend class NdbScanFilterImpl;
Loading