Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-11111

Redesign how embedded server is built and how it works



    • Type: Task
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: None
    • Labels:


      Currently, building embedded server requires special compilation. The EMBEDDED_SERVER preprocessor constant is quite intrusive, in that it affects the core structures of the server, includng but not limited to THD. Thus, almost the whole server (with very few exceptions) needs to be recompiled for embedded. Since developers prefer faster compilation and not likely to use embedded in the tests, the result is that embedded also does not have enough coverage.
      Also, it is unclear and problematic how embedded should be integrated with Connector C, which is since 10.2 the client we use (so far partially, not in embedded or server itself)

      What we can do instead is following: instead of special compilation for the server, make client start bona-fide server in a background thread (thread start function would be mysqld_main()).

      Even if client and server run in the same process, they still could still use IPC for communication such as "private" Unix domain socket with proper permission and unique name in the datadir, or Windows pipe .

      A server might want to know if it runs as embedded, and client has to know it as well,so both client and server could have boolean variables (is_client_embedded, is_server_embedded), set to true in the embedded library and false otherwise (this is a substitute for preprocessor constant EMBEDDED_SERVER).

      In addition, server or its plugins might want to communicate with other MySQL servers (federated, connect, replication, spider). Connector/C could export special flag MYSQL_OPT_NOT_EMBEDDED for mysql_real_connect() that would prevent internal connection even inside embedded library. Alternatively, it could export mysql_real_connect_notembedded() function for that purpose.


          Issue Links



              wlad Vladislav Vaintroub
              wlad Vladislav Vaintroub
              0 Vote for this issue
              3 Start watching this issue