Commit 7a8336be authored by unknown's avatar unknown
Browse files

wl2135 - index restart


mysql-test/r/ndb_index_ordered.result:
  test case
mysql-test/t/ndb_index_ordered.test:
  test case
ndb/include/kernel/signaldata/ScanTab.hpp:
  Split exclusive/keyinfo
ndb/include/ndbapi/NdbIndexScanOperation.hpp:
  Add possibility retreive sorted flag
ndb/include/ndbapi/NdbOperation.hpp:
  Add possibility retreive lock mode
ndb/include/ndbapi/NdbResultSet.hpp:
  Add possibility to get operation
ndb/src/common/debugger/signaldata/ScanTab.cpp:
  Split exclusive/keyinfo
ndb/src/kernel/blocks/dbtc/Dbtc.hpp:
  Store flags in ScanFragReq::requestInfo format
ndb/src/kernel/blocks/dbtc/DbtcMain.cpp:
  Store flags in ScanFragReq::requestInfo format
ndb/src/ndbapi/NdbOperationDefine.cpp:
  Keep theLockMode up-to-date
ndb/src/ndbapi/NdbScanOperation.cpp:
  Keep theLockMode up-to-date
sql/ha_ndbcluster.cc:
  Use NdbIndexScanOperation::reset_bounds when
    performing second index access
parent 7cf1c4d5
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -37,6 +37,14 @@ a b c
1	2	3
2	3	5
3	4	6
select tt1.* from t1 as tt1, t1 as tt2 use index(b) where tt1.b = tt2.b order by tt1.c;
a	b	c
6	7	2
5	6	2
1	2	3
2	3	5
3	4	6
4	5	8
update t1 set c = 3 where b = 3;
select * from t1 order by a;
a	b	c
+3 −0
Original line number Diff line number Diff line
@@ -23,6 +23,9 @@ select * from t1 where b > 4 order by b;
select * from t1 where b < 4 order by b;
select * from t1 where b <= 4 order by b;

# Test of reset_bounds
select tt1.* from t1 as tt1, t1 as tt2 use index(b) where tt1.b = tt2.b order by tt1.c;

#
# Here we should add some "explain select" to verify that the ordered index is 
# used for these queries.
+21 −1
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ private:
  static Uint8 getHoldLockFlag(const UintR & requestInfo);
  static Uint8 getReadCommittedFlag(const UintR & requestInfo);
  static Uint8 getRangeScanFlag(const UintR & requestInfo);
  static Uint8 getKeyinfoFlag(const UintR & requestInfo);
  static Uint16 getScanBatch(const UintR & requestInfo);

  /**
@@ -85,6 +86,7 @@ private:
  static void setHoldLockFlag(UintR & requestInfo, Uint32 flag);
  static void setReadCommittedFlag(UintR & requestInfo, Uint32 flag);
  static void setRangeScanFlag(UintR & requestInfo, Uint32 flag);
  static void setKeyinfoFlag(UintR & requestInfo, Uint32 flag);
  static void setScanBatch(Uint32& requestInfo, Uint32 sz);
};

@@ -95,12 +97,13 @@ private:
 l = Lock mode             - 1  Bit 8
 h = Hold lock mode        - 1  Bit 10
 c = Read Committed        - 1  Bit 11
 k = Keyinfo               - 1  Bit 12
 x = Range Scan (TUX)      - 1  Bit 15
 b = Scan batch            - 10 Bit 16-25 (max 1023)

           1111111111222222222233
 01234567890123456789012345678901
 ppppppppl hc   xbbbbbbbbbb
 ppppppppl hck  xbbbbbbbbbb
*/

#define PARALLELL_SHIFT     (0)
@@ -112,6 +115,9 @@ private:
#define HOLD_LOCK_SHIFT     (10)
#define HOLD_LOCK_MASK      (1)

#define KEYINFO_SHIFT       (12)
#define KEYINFO_MASK        (1)

#define READ_COMMITTED_SHIFT     (11)
#define READ_COMMITTED_MASK      (1)

@@ -206,6 +212,20 @@ ScanTabReq::setScanBatch(Uint32 & requestInfo, Uint32 flag){
  requestInfo |= (flag << SCAN_BATCH_SHIFT);
}

inline
Uint8
ScanTabReq::getKeyinfoFlag(const UintR & requestInfo){
  return (Uint8)((requestInfo >> KEYINFO_SHIFT) & KEYINFO_MASK);
}

inline
void 
ScanTabReq::setKeyinfoFlag(UintR & requestInfo, Uint32 flag){
  ASSERT_BOOL(flag, "ScanTabReq::setKeyinfoFlag");
  requestInfo |= (flag << KEYINFO_SHIFT);
}


/**
 * 
 * SENDER:  Dbtc
+1 −0
Original line number Diff line number Diff line
@@ -125,6 +125,7 @@ public:
   */
  int reset_bounds();
  
  bool getSorted() const { return m_ordered; }
private:
  NdbIndexScanOperation(Ndb* aNdb);
  virtual ~NdbIndexScanOperation();
+3 −1
Original line number Diff line number Diff line
@@ -717,6 +717,8 @@ public:
    NotDefined                    ///< Internal for debugging
  };

  LockMode getLockMode() const { return theLockMode; }

protected:
/******************************************************************************
 * These are the methods used to create and delete the NdbOperation objects.
@@ -893,7 +895,7 @@ protected:
		       			   // currently defined   
  OperationType	  theOperationType;        // Read Request, Update Req......   

  Uint8        theLockMode;	   // Can be set to WRITE if read operation 
  LockMode        theLockMode;	   // Can be set to WRITE if read operation 
  OperationStatus theStatus;	   // The status of the operation.	
  Uint32         theMagicNumber;  // Magic number to verify that object 
                                   // is correct
Loading