mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-31 10:56:12 +01:00 
			
		
		
		
	 38cbef8b3f
			
		
	
	
	38cbef8b3f
	
	
	
		
			
			The problem was in the Aria part of the range optimizer, maria_records_in_range(), which wrong concluded that there was no rows in the range. This error would happen in the unlikely case when searching for a range on a partial key and there was a match for the first key part in the upper part of the b-tree (node) and also a match in the underlying node page. In other words, for this bug to happen one have to use Aria, have a multi part key with a lot of identical values for the first key part and do a range search on the second part of the key. Fixed by ensuring that we do not stop searching for partial keys found on node. Other things: - Added some comments - Changed a variable name to more clearly explain it's purpose. - Fixed wrong cast in _ma_record_pos() that could cause problems on 32 bit systems.
		
			
				
	
	
		
			22 lines
		
	
	
	
		
			630 B
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
	
		
			630 B
		
	
	
	
		
			Text
		
	
	
	
	
	
| --source include/have_sequence.inc
 | |
| 
 | |
| --echo #
 | |
| --echo # MDEV-22935 Erroneous Aria Index / Optimizer behaviour
 | |
| --echo #
 | |
| 
 | |
| create table t1 (a char(255), b datetime, primary key(a,b)) engine=aria transactional=0 pack_keys=0;
 | |
| insert into t1 select concat("hello world hello world", truncate(seq/100,0)),from_unixtime(seq+1) from seq_1_to_20000;
 | |
| 
 | |
| let $i= 200;
 | |
| --disable_query_log
 | |
| while ($i)
 | |
| {
 | |
|   let $tmp= `select count(*) from t1 where a="hello world hello world$i" and b <= from_unixtime($i*100+1)`;
 | |
|   if (`SELECT $tmp != 1`)
 | |
|   {
 | |
|     --echo "Found $tmp rows, expected 1, for value $i"
 | |
|   }  
 | |
|   dec $i;
 | |
| }
 | |
| --enable_query_log
 | |
| drop table t1;
 |