← Back to team overview

maria-developers team mailing list archive

Re: Doubt in bin logging for CREATE VIEW

 

Hi All,

Indeed it is a bug.

Here is what I did to verify. I installed MariaDB at two paths on my
machine (I could have had multiple data dirs but that struck me later).
Wrote a DBUG_EXECUTE_IF as suggested by Kristian in mysql_register_view,
which returned ER_OUT_OF_RESOURCES.

Ran one mysql server as master and the other as slave. And the result was
clear. Even though CREATE VIEW returned error on the master, the VIEW was
replicated at the slave. Have not written the test case yet but verified it
manually.

During this verification I also figured out that there is a crash too. If
mysql_register_view returns ER_OUT_OF_RESOURCES. The *view->definer.host*
and *view->definer.user* are not set. And the current code tries to write
into bin log the details and crashes due to NULL pointer. Anyways, this
will be fixed once the bin log issue is resolved.

I have not yet figured out how to write automated test cases for
replication, but will do that soon.

Thanks,
Sriram


On Mon, Jun 23, 2014 at 3:01 PM, Sergei Golubchik <serg@xxxxxxxxxxx> wrote:

> Hi, Sriram!
>
> On Jun 19, sriram patil wrote:
> > Hi All,
> >
> > I was checking the behavior of bin logging in various methods. I found
> out
> > CREATE VIEW differs a little bit than others in bin logging.
> >
> > The query is written into bin log if query is executed successfully. If
> > there is any error the query is not logged. This behavior is observed
> > across all the commands.
> >
> > In case of CREATE VIEW (method: mysql_create_view file: sql/sql_view.cc),
> > while the bin logging is skipped for most of the errors by jumping to
> "err"
> > label, it is not skipped
> ...
> > Is there a specific reason why it is logged even though an error occurs?
> Or
> > is it a bug?
>
> Looks like a bug to me too. It's easy to see in the history -
> git blame shows that this binlog-writing chunk was added in
> commit e6eef5c1a765d27e1a8d1c7d707fb416dfa0ec2f.
>
> Commit comment and changes to other files in the same commit show that
> the goal was to move binlogging code inside mysql_create_view (and
> other similar functions), it was outside before. And before that commit
> no binlogging was done if mysql_create_view() failed.
>
> So, apparently that commit has introduced a bug that you've now found.
> Good job :)
>
> Regards,
> Sergei
>
>

Follow ups

References