maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #09142
Re: [Commits] 2b3bffb: MDEV-8491 - On shutdown, report the user and the host executed that.
Hi Sergei,
On Thu, Nov 26, 2015 at 02:55:49PM +0100, Sergei Golubchik wrote:
> Hi, Sergey!
>
> On Nov 26, Sergey Vojtovich wrote:
> > > > +
> > > > + if ((user= my_strdup(user_host_buff, MYF(0))) &&
> > > > + !my_atomic_casptr((void **) &shutdown_user,
> > > > + (void **) &expected_shutdown_user, user))
> > > > + my_free(user);
> > > > +}
> > >
> > > Interesting. Why is that?
> > It supposed to be safe concurrent shutdown.
>
> Okay, but please add a comment about it.
Ok.
>
> > > > @@ -1888,7 +1912,13 @@ static void __cdecl kill_server(int sig_ptr)
> > > > if (sig != 0) // 0 is not a valid signal number
> > > > my_sigset(sig, SIG_IGN); /* purify inspected */
> > > > if (sig == MYSQL_KILL_SIGNAL || sig == 0)
> > > > - sql_print_information(ER_DEFAULT(ER_NORMAL_SHUTDOWN),my_progname);
> > > > + {
> > > > + char *user= (char *) my_atomic_loadptr((void**) &shutdown_user);
> > > > + sql_print_information(ER_DEFAULT(ER_NORMAL_SHUTDOWN), my_progname,
> > > > + user ? user : "unknown");
> > >
> > > can it, really, be "unknown" here? when?
> > Yes, in a few cases. E.g. killed by signal.
>
> Oh, right, sorry. I thought that if() filters that out (because signals
> have a special message ER_DEFAULT(ER_GOT_SIGNAL) below).
>
> Any other cases? Otherwise I'd suggest
>
> - user ? user : "unknown");
> + user ? user : STRINGIFY_ARG(MYSQL_KILL_SIGNAL))
No user info in following cases:
- if listening socket is closed and SIGNALS_DONT_BREAK_READ is defined (which
is never seem to be defined), kill_server is called with MYSQL_KILL_SIGNAL
- if signal SIG{TERM|QUIT|KILL} received and USE_ONE_SIGNAL_HAND defined (is it
guaranteed to be defined properly, kill_server is called with 0
- special handling of SIGINT
- wsrep applier thread may call kill_server() without thd, but that's probably
fixable
Regards,
Sergey
References