← Back to team overview

maria-developers team mailing list archive

Igor please review: Rev 2929: BUG#693747: Assertion multi_range_read.cc:908: int DsMrr_impl::dsmrr_init in file:///home/psergey/dev2/5.3-2/]

 

Hello Igor,

Could you please review the below:

----- Forwarded message from Sergey Petrunya <psergey@xxxxxxxxxxxx> -----

From: Sergey Petrunya <psergey@xxxxxxxxxxxx>
To: commits@xxxxxxxxxxx
X-Mailer: mail (GNU Mailutils 1.2)
Date: Wed,  2 Mar 2011 00:17:53 +0300 (MSK)
Subject: [Commits] Rev 2929: BUG#693747: Assertion multi_range_read.cc:908:
	int DsMrr_impl::dsmrr_init in file:///home/psergey/dev2/5.3-2/

At file:///home/psergey/dev2/5.3-2/

------------------------------------------------------------
revno: 2929
revision-id: psergey@xxxxxxxxxxxx-20110301211747-8wvngodwxzr9i2e9
parent: psergey@xxxxxxxxxxxx-20110301072222-1rmapkelx9l1kw8u
committer: Sergey Petrunya <psergey@xxxxxxxxxxxx>
branch nick: 5.3-2
timestamp: Wed 2011-03-02 00:17:47 +0300
message:
  BUG#693747: Assertion multi_range_read.cc:908: int DsMrr_impl::dsmrr_init
  - Make DsMrr_impl::dsmrr_init() handle the case of 
     1. 1st MRR scan using DS-MRR strategy (i.e. doing key sorting and rowid sorting)
     2. 2nd MRR scan getting a buffer that's too small to fit one key element 
        and one rowid element, and so falling back to default MRR implementation
    In this case, dsmrr_init() is invoked with {primary_handler, secondary_handler}
    initialized for DS-MRR scan and have to reset them to be initialized for the
    default MRR scan.
=== modified file 'mysql-test/r/maria_mrr.result'
--- a/mysql-test/r/maria_mrr.result	2010-12-02 11:10:52 +0000
+++ b/mysql-test/r/maria_mrr.result	2011-03-01 21:17:47 +0000
@@ -403,3 +403,30 @@
 count(*)
 0
 drop table t1, t2;
+#
+# BUG#693747: Assertion multi_range_read.cc:908: int DsMrr_impl::dsmrr_init(
+#
+set @_save_join_cache_level= @@join_cache_level;
+set @_save_join_buffer_size= @@join_buffer_size;
+set join_cache_level=8;
+set join_buffer_size=10000;
+CREATE TABLE t1 (
+f1 int(11), f2 varchar(32) COLLATE latin1_swedish_ci, 
+f3 int(11), f4 varchar(1024) COLLATE utf8_bin, 
+f5 varchar(1024) COLLATE latin1_bin, 
+KEY (f5)
+) ENGINE=Aria TRANSACTIONAL=0 ;
+# Fill the table with some data
+SELECT alias2.f1 AS field1 , alias1.f2 AS field2
+FROM t1 AS alias1
+LEFT OUTER JOIN t1 AS alias2 ON alias1.f2 = alias2.f5
+WHERE alias2.f3 > 'k'
+AND alias2.f3 <= 'z'
+OR alias2.f4 IN ('o', 'y')
+AND alias2.f4 >= 'g' AND alias2.f4 < 'z';
+field1	field2
+Warnings:
+Warning	1292	Truncated incorrect DOUBLE value: 'k'
+set join_cache_level=@_save_join_cache_level;
+set join_buffer_size=@_save_join_buffer_size;
+drop table t1;

=== modified file 'mysql-test/t/maria_mrr.test'
--- a/mysql-test/t/maria_mrr.test	2010-11-09 16:02:08 +0000
+++ b/mysql-test/t/maria_mrr.test	2011-03-01 21:17:47 +0000
@@ -125,3 +125,81 @@
   table1.col_varchar_1024_latin1_key = table2.col_varchar_10_latin1 AND table1.pk<>0 ;
 
 drop table t1, t2;
+
+--echo #
+--echo # BUG#693747: Assertion multi_range_read.cc:908: int DsMrr_impl::dsmrr_init(
+--echo #
+set @_save_join_cache_level= @@join_cache_level;
+set @_save_join_buffer_size= @@join_buffer_size;
+
+set join_cache_level=8;
+set join_buffer_size=10000;
+
+CREATE TABLE t1 (
+  f1 int(11), f2 varchar(32) COLLATE latin1_swedish_ci, 
+  f3 int(11), f4 varchar(1024) COLLATE utf8_bin, 
+  f5 varchar(1024) COLLATE latin1_bin, 
+  KEY (f5)
+) ENGINE=Aria TRANSACTIONAL=0 ;
+
+--echo # Fill the table with some data
+--disable_query_log
+INSERT IGNORE INTO t1 VALUES 
+('0','cueikuirqr','0','okay','hcueikuirqrzflno'),('2009','her','0','ULWAH','ehcueikuirqrzfln'),
+('0','YKAOE','0','of','qieehcueikuirqrz'),('2009','you\'re','0','k','nkqieehcueikuirq'),
+('2003','b','0','bgsnkqieehcueiku','the'),('0','MGUDG','0','p','m'),
+('0','UXAGU','0','elfhjawbwbgsnkqi','HZXVA'),('2004','bwbgsnkqie','0','x','something'),
+('2007','s','0','okay','slelfhjawbwbgsnk'),('2007','the','0','or','if'),
+('2008','TDLKE','0','mean','MGWNJ'),('2006','do','0','KGFVV','see'),
+('2001','why','0','a','mean'),(NULL,'THKCG','0','no','YFLDY'),
+(NULL,'x','0','mean','e'),('2007','yncitaeysb','0','WDOSC','tgyncitaeysbgucs'),
+(NULL,'ZEOXX','0','awbwbgsnkqieehcu','jawbwbgsnkqieehc'),('2006','hjawbwbgsn','0','just','fhjawbwbgsnkqiee'),
+('0','all','0','k','sbgucsgqslelfhja'),('2009','the','0','f','would'),
+('2005','mtgyncitae','0','w','ISNQQ'),('2003','KNCUI','0','r','want'),
+('2006','is','0','j','i'),('2000','out','0','o','jvcmjlmtgyncitae'),
+('2001','it','0','txyjvcmjlmtgynci','you'),('2008','LHDIH','0','ZKFJK','txmtxyjvcmjlmtgy'),
+('0','z','0','the','ntxmtxyjvcmjlmtg'),(NULL,'vyhnmvgmcn','0','PWEYL','AIGQK'),
+('0','ytvyhnmvgm','0','gbytvyhnmvgmcntx','z'),('2002','t','0','just','on'),
+('2002','xqegbytvyh','0','to','ixqegbytvyhnmvgm'),('2004','WGVRU','0','GHBZB','h'),
+('0','b','0','yhnmvgmcntxmtxyj','z'),('2003','who','0','ddixqegbytvyhnmv','gddixqegbytvy'),
+('0','PMLFL','0','n','vgmcntxmtxyjvcmj'),(NULL,'back','0','FIXPA','n'),
+('2005','i','0','I\'ll','PZGUB'),('0','f','0','t','the'),
+(NULL,'PNXVP','0','t','v'),('2004','MAKKL','0','u','CGCWF'),
+('0','RMDAV','0','noypgddixqegbytv','v'),('0','l','0','ESAVW','n'),
+('2008','rhnoypgddi','0','s','VIZNE'),('2007','t','0','XZECS','a'),
+(NULL,'like','0','k','JSHPZ'),('2009','pskeywslmk','0','epskeywslmkdrhno','q'),
+(NULL,'QZZJJ','0','LOTFB','c'),('0','atlxepskey','0','b','YJRMA'),
+(NULL,'YUVOU','0','wslmkdrhnoypgddi','eywslmkdrhnoypgd'),('2006','some','0','can','r'),
+('2002','c','0','k','her'),(NULL,'o','0','ALBVZ','EMURT'),
+('0','if','0','okay','had'),('2006','when','0','e','CLVWT'),
+(NULL,'blfufrcdjm','0','ZAKUQ','IZCZN'),('2007','vutblfufrc','0','MPKMI','how'),
+(NULL,'why','0','UBUAG','I'),('2004','IXLYQ','0','ILPBE','weuwuvutblfufrcd'),
+('0','here','0','your','m'),(NULL,'ZOCTJ','0','GTPOO','IDSFD'),
+('0','kqsweuwuvu','0','CXQLW','oh'),('0','ykqsweuwuv','0','CLJWP','zykqsweuwuvutblf'),
+('0','zezykqsweu','0','had','t'),(NULL,'q','0','jisuzezykqsweuwu','o'),
+('2007','IBKAU','0','t','oh'),('0','ivjisuzezy','0','y','XHXKE'),
+('0','xsivjisuze','0','right','plxsivjisuzezykq'),('2009','have','0','so','uvplxsivjisuzezy'),
+('0','on','0','b','me'),('0','ijkfuvplxs','0','RZXDY','OGEHV'),
+('0','u','0','all','okay'),('0','i','0','s','pajzbbojshnijkfu'),
+('2001','of','0','xpajzbbojshnijkf','g'),('0','for','0','ITBAQ','I\'m'),
+('2006','or','0','now','ZOJHX'),('0','n','0','k','you'),
+(NULL,'that','0','suzezykqsweuwuvu','just'),('0','bbojshnijk','0','QGYOA','JYGSJ'),
+('2009','k','0','ajzbbojshnijkfuv','y'),('2007','k','0','affpegvavdgxpajz','y'),
+('2007','be','0','RCTIT','m'),('2000','fnbmxwicrk','0','lcfnbmxwicrkdyma','t'),
+('0','yaffpegvav','0','v','have'),('0','crkdymahya','0','icrkdymahyaffpeg','QQWQI'),
+('0','t','0','nijkfuvplxsivjis','hnijkfuvplxsivji'),('0','dgxpajzbbo','0','vdgxpajzbbojshni','vavdgxpajzbbojsh'),
+('2006','g','0','gvavdgxpajzbbojs','pegvavdgxpajzbbo'),('2007','I\'m','0','g','ffpegvavdgxpajzb');
+--enable_query_log
+
+
+SELECT alias2.f1 AS field1 , alias1.f2 AS field2
+FROM t1 AS alias1
+LEFT OUTER JOIN t1 AS alias2 ON alias1.f2 = alias2.f5
+WHERE alias2.f3 > 'k'
+AND alias2.f3 <= 'z'
+OR alias2.f4 IN ('o', 'y')
+AND alias2.f4 >= 'g' AND alias2.f4 < 'z';
+
+set join_cache_level=@_save_join_cache_level;
+set join_buffer_size=@_save_join_buffer_size;
+drop table t1;

=== modified file 'sql/multi_range_read.cc'
--- a/sql/multi_range_read.cc	2011-02-18 22:31:01 +0000
+++ b/sql/multi_range_read.cc	2011-03-01 21:17:47 +0000
@@ -907,7 +907,26 @@
   DBUG_RETURN(res);
 
 use_default_impl:
-  DBUG_ASSERT(primary_file->inited == handler::INDEX);
+  if (primary_file->inited != handler::INDEX)
+  {
+    /* We can get here when 
+       - we've previously successfully done a DS-MRR scan (and so have 
+         secondary_file!= NULL, secondary_file->inited= INDEX, 
+         primary_file->inited=RND)
+       - for this invocation, we haven't got enough buffer space, and so we
+         have to use the default MRR implementation.
+
+      note: primary_file->ha_index_end() will call dsmrr_close() which will
+      close/destroy the secondary_file, this is intentional. 
+      (Yes this is slow, but one can't expect performance with join buffer 
+       so small that it can accomodate one rowid and one index tuple)
+    */
+    if ((res= primary_file->ha_rnd_end()) || 
+        (res= primary_file->ha_index_init(keyno, test(mode & HA_MRR_SORTED))))
+    {
+      DBUG_RETURN(res);
+    }
+  }
   /* Call correct init function and assign to top level object */
   Mrr_simple_index_reader *s= &reader_factory.simple_index_reader;
   res= s->init(primary_file, seq_funcs, seq_init_param, n_ranges, mode, NULL, 

_______________________________________________
commits mailing list
commits@xxxxxxxxxxx
https://lists.askmonty.org/cgi-bin/mailman/listinfo/commits

----- End forwarded message -----

-- 
BR
 Sergey
-- 
Sergey Petrunia, Software Developer
Monty Program AB, http://askmonty.org
Blog: http://s.petrunia.net/blog



Follow ups