← Back to team overview

maria-discuss team mailing list archive

Re: openbsd switched libmysqlclient back to older mysql one

 

Colin Charles <colin@xxxxxxxxxxxxxxxx> writes:

> I noticed this:
> 	http://www.openbsd.org/cgi-bin/cvsweb/ports/databases/mariadb/Makefile?rev=1.4
>
> Revert back to using MySQL 5.1 for the time being. MariaDB 5.5 introduces
> a new libmysqlclient non-blocking API which utilizes co-routines. The X86
> specific GCC ASM co-routine support hid the fact that there was an issue.
> The only fallback code so far is POSIX user contexts which OpenBSD does not
> support.
>
> Is this something we can fix to ensure that OpenBSD users can continue to use our libmysqlclient?

The patch below disables the non-blocking API (all the calls will return
error) if no co-routine support is available.

But you will have to find someone else to:

 - Implement the CMake check (HAVE_UCONTEXT)

 - Fix the test suite to not attempt to the use non-blocking API when it is
   not available

 - Test this on various platforms

 - Merge it up from 5.5 through 10.0

 - Document it

(I am totally occupied dealing with our mad feature race in replication and
will not have time to clean this up).

To actually support the non-blocking client API on a given platform requires
co-routine support. The best option is asm stubs, but that needs to be done
anew for each architecture. There appears to be a way using sigaltstack
(MDEV-4601), but it's rather hackish. Another portable fallback possibility is
pthreads, but that is even more hackish. All of them requires some work to
integrate, though the meat of it should be possible to take from other
software that have been fixed for *BSD (for example qemu). Only the code in
my_context.c and my_context.h needs to be modified.

 - Kristian.

=== modified file 'client/mysqltest.cc'
--- client/mysqltest.cc	2013-04-17 17:42:34 +0000
+++ client/mysqltest.cc	2013-06-13 09:16:50 +0000
@@ -5933,7 +5933,8 @@ void do_connect(struct st_command *comma
     mysql_options(con_slot->mysql, MYSQL_OPT_CONNECT_TIMEOUT,
                   (void *) &opt_connect_timeout);
 
-  mysql_options(con_slot->mysql, MYSQL_OPT_NONBLOCK, 0);
+  if (mysql_options(con_slot->mysql, MYSQL_OPT_NONBLOCK, 0))
+    die("Failed to initialise non-blocking API");
   if (opt_compress || con_compress)
     mysql_options(con_slot->mysql, MYSQL_OPT_COMPRESS, NullS);
   mysql_options(con_slot->mysql, MYSQL_OPT_LOCAL_INFILE, 0);

=== modified file 'include/my_context.h'
--- include/my_context.h	2012-02-23 14:42:21 +0000
+++ include/my_context.h	2013-06-13 09:20:28 +0000
@@ -31,8 +31,10 @@
 #define MY_CONTEXT_USE_X86_64_GCC_ASM
 #elif defined(__GNUC__) && __GNUC__ >= 3 && defined(__i386__)
 #define MY_CONTEXT_USE_I386_GCC_ASM
-#else
+#elif defined(HAVE_UCONTEXT)
 #define MY_CONTEXT_USE_UCONTEXT
+#else
+#define MY_CONTEXT_DISABLE
 #endif
 
 #ifdef MY_CONTEXT_USE_WIN32_FIBERS
@@ -103,6 +105,13 @@ struct my_context {
 };
 #endif
 
+
+#ifdef MY_CONTEXT_DISABLE
+struct my_context {
+  int dummy;
+};
+#endif
+
 
 /*
   Initialize an asynchroneous context object.

=== modified file 'mysys/my_context.c'
--- mysys/my_context.c	2012-11-04 21:20:04 +0000
+++ mysys/my_context.c	2013-06-13 09:00:28 +0000
@@ -726,3 +726,37 @@ my_context_continue(struct my_context *c
 }
 
 #endif  /* MY_CONTEXT_USE_WIN32_FIBERS */
+
+#ifdef MY_CONTEXT_DISABLE
+int
+my_context_continue(struct my_context *c)
+{
+  return -1;
+}
+
+
+int
+my_context_spawn(struct my_context *c, void (*f)(void *), void *d)
+{
+  return -1;
+}
+
+
+int
+my_context_yield(struct my_context *c)
+{
+  return -1;
+}
+
+int
+my_context_init(struct my_context *c, size_t stack_size)
+{
+  return -1;                                  /* Out of memory */
+}
+
+void
+my_context_destroy(struct my_context *c)
+{
+}
+
+#endif



References