From: Claudio V. C. <cv...@us...> - 2006-06-01 06:07:14
|
> -----Original Message----- > From: fir...@li... > [mailto:fir...@li...]On Behalf Of > Richard Wesley > Sent: Martes, 30 de Mayo de 2006 16:05 > > I have a case where asking for a query plan for a prepared select > statement returns no data, just a single isc_info_end block. No > truncation, no errors, just an empty result block. The request > almost always works, but I have a reproducible case where it does > not. For the time being I can put a band aid on it and return an > empty string (it is just for logging purposes) but I would really > like to know what is going on here. With your schema, your query and isql SET PLANONLY command it's easy to see what happens inside the engine: due to the IN clause, the plan is very big, because dump_index() internally has to show that the same index was indeed used many times. The default internal buffer is 256. We go throw several layers, but the request fails due to lack of space. The "inf" module, responsible of handling those requests, assumes the optimizer will fit the answer in 256 bytes. If not, it reallocated to 2048 and says "nah, it can't be longer". But it is! case isc_info_access_path: /* the access path has the potential to be large, so if the default buffer is not big enough, allocate a really large one--don't continue to allocate larger and larger, because of the potential for a bug which would bring the server to its knees */ if (!OPT_access_path(request, buffer_ptr, sizeof(buffer), &length)) { buffer_ptr = FB_NEW(*getDefaultMemoryPool()) char[BUFFER_XLARGE]; OPT_access_path(request, buffer_ptr, BUFFER_XLARGE, &length); } break; Obviously it should validate the second call and put the isc_info_truncated byte itself or find a way to convince INF_put_item of doing so. The current way may cause a crash in the dsql module that called this routine from get_plan_info(). (And yes, I did debug until I found the point of failure when the buffer was full.) C. |