Hi Ingo,
this patch sounds much more interesting, but see inline...
On Mon, Feb 23, 2009 at 03:50:53PM +0000, Ingo Struewing wrote:
> #At file:///home2/mydev/bzrroot/mysql-6.0-bugs/ based on
> revid:ingo.struewing@stripped
>
> 2777 Ingo Struewing 2009-02-23
> Bug#43086 - MERGE engine related warnings on Windows debug build
>
> A windows debug build created warnings in the error log.
> In myisammrg_attach_children_callback() the variable 'myisam'
> could be used without being set.
>
> Added initialization to silence compilers.
> Fixed usage of my_errno along the way.
> @ storage/myisammrg/ha_myisammrg.cc
> Bug#43086 - MERGE engine related warnings on Windows debug build
> Initialized 'myisam'.
> Moved setting of my_errno to the end.
>
> modified:
> storage/myisammrg/ha_myisammrg.cc
> === modified file 'storage/myisammrg/ha_myisammrg.cc'
> --- a/storage/myisammrg/ha_myisammrg.cc 2009-02-13 12:48:06 +0000
> +++ b/storage/myisammrg/ha_myisammrg.cc 2009-02-23 15:50:46 +0000
> @@ -479,11 +479,9 @@ static MI_INFO *myisammrg_attach_childre
> TABLE *parent= ha_myrg->table_ptr();
> TABLE *child;
> TABLE_LIST *child_l;
> - MI_INFO *myisam;
> + MI_INFO *myisam= NULL;
> DBUG_ENTER("myisammrg_attach_children_callback");
>
> - my_errno= 0;
> -
> /* Get child list item. */
> child_l= ha_myrg->next_child_attach;
> if (!child_l)
I believe we're mostly interested in what happens in the one-line-above
if branch. According to the comment: @retval NULL, my_errno == 0
Ok, no more child tables.
So I'd say we should set my_errno to zero here, not below.
> @@ -544,11 +542,17 @@ static MI_INFO *myisammrg_attach_childre
> child));
> my_errno= HA_ERR_WRONG_MRG_TABLE_DEF;
> }
> + else
> + {
> + /* Assure that my_errno is set correctly on return. */
> + my_errno= 0;
> + }
> +
And we shouldn't do this here anymore, because we do not rely on
my_errno value, when we return from this function.
> DBUG_PRINT("myrg", ("MyISAM handle: %p my_errno: %d",
> myisam, my_errno));
>
> err:
> - DBUG_RETURN(my_errno ? NULL : myisam);
> + DBUG_RETURN(myisam);
As you fixed it here.
Regards,
Sergey
--
Sergey Vojtovich <svoj@stripped>
MySQL AB, Software Engineer
Izhevsk, Russia, www.mysql.com