Tarantool development patches archive
 help / color / mirror / Atom feed
* [PATCH] replication: fix exit with ER_NO_SUCH_USER during bootstrap
@ 2018-08-23 12:57 Serge Petrenko
  2018-08-23 13:29 ` Vladimir Davydov
  0 siblings, 1 reply; 2+ messages in thread
From: Serge Petrenko @ 2018-08-23 12:57 UTC (permalink / raw)
  To: vdavydov.dev; +Cc: tarantool-patches, Serge Petrenko

When replication is configured via some user created in box.once()
function and box.once() takes more than replication_timeout seconds
to execute, appliers recieve ER_NO_SUCH_USER error, which they don't
handle. This leads to occasional test failures in replication suite.
Fix this by handling the aforementioned case in applier_f().

Closes #3637
---
https://github.com/tarantool/tarantool/issues/3637
https://github.com/tarantool/tarantool/tree/sp/gh-3637-replication-tests-fix

 src/box/applier.cc | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/box/applier.cc b/src/box/applier.cc
index dbb4d05f9..740778e80 100644
--- a/src/box/applier.cc
+++ b/src/box/applier.cc
@@ -607,6 +607,14 @@ applier_f(va_list ap)
 				applier_log_error(applier, e);
 				applier_disconnect(applier, APPLIER_DISCONNECTED);
 				goto reconnect;
+			} else if (e->errcode() == ER_NO_SUCH_USER) {
+				/*
+				 * Probably box.once() hasn't finished
+				 * on bootstrap leader yet.
+				 */
+				applier_log_error(applier, e);
+				applier_disconnect(applier, APPLIER_DISCONNECTED);
+				goto reconnect;
 			} else if (e->errcode() == ER_SYSTEM) {
 				/* System error from master instance. */
 				applier_log_error(applier, e);
-- 
2.15.2 (Apple Git-101.1)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] replication: fix exit with ER_NO_SUCH_USER during bootstrap
  2018-08-23 12:57 [PATCH] replication: fix exit with ER_NO_SUCH_USER during bootstrap Serge Petrenko
@ 2018-08-23 13:29 ` Vladimir Davydov
  0 siblings, 0 replies; 2+ messages in thread
From: Vladimir Davydov @ 2018-08-23 13:29 UTC (permalink / raw)
  To: Serge Petrenko; +Cc: tarantool-patches

On Thu, Aug 23, 2018 at 03:57:43PM +0300, Serge Petrenko wrote:
> When replication is configured via some user created in box.once()
> function and box.once() takes more than replication_timeout seconds
> to execute, appliers recieve ER_NO_SUCH_USER error, which they don't
> handle. This leads to occasional test failures in replication suite.
> Fix this by handling the aforementioned case in applier_f().
> 
> Closes #3637
> ---
> https://github.com/tarantool/tarantool/issues/3637
> https://github.com/tarantool/tarantool/tree/sp/gh-3637-replication-tests-fix
> 
>  src/box/applier.cc | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/src/box/applier.cc b/src/box/applier.cc
> index dbb4d05f9..740778e80 100644
> --- a/src/box/applier.cc
> +++ b/src/box/applier.cc
> @@ -607,6 +607,14 @@ applier_f(va_list ap)
>  				applier_log_error(applier, e);
>  				applier_disconnect(applier, APPLIER_DISCONNECTED);
>  				goto reconnect;
> +			} else if (e->errcode() == ER_NO_SUCH_USER) {
> +				/*
> +				 * Probably box.once() hasn't finished
> +				 * on bootstrap leader yet.
> +				 */
> +				applier_log_error(applier, e);
> +				applier_disconnect(applier, APPLIER_DISCONNECTED);
> +				goto reconnect;

This piece of code isn't covered by any test, see

https://coveralls.io/builds/18630789/source?filename=src/box/applier.cc#L610

Please add a test case. I think it should be pretty easy to do: start a
replica with a small value of box.cfg.replication_timeout which tries to
connect to the default instance as a non-existent user, then wait a bit,
create the user, and make sure it finally connects.

Also, I think that you should share the code with ER_ACCESS_DENIED
case, because these two errors have the same nature - missing or invalid
configuration:

	if (e->errcode() == ER_ACCESS_DENIED ||
	    e->errcode() == ER_NO_SUCH_USER) {
		/* Invalid configuration */
		applier_log_error(applier, e);
		applier_disconnect(applier, APPLIER_DISCONNECTED);
		goto reconnect;
	}

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-23 13:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-23 12:57 [PATCH] replication: fix exit with ER_NO_SUCH_USER during bootstrap Serge Petrenko
2018-08-23 13:29 ` Vladimir Davydov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox