Skip to content
Permalink
Browse files
S3 plugin fails to load depending on loaded storage engines
storage engines are generally initialized in some random order
(by iterating the hash of plugin names).

S3 fails if it's initialized before Aria.

But it looks that while S3 needs Aria, it does not need
Aria to be initialized before S3. S3 copies maria_hton and then
overwrites every single member of it, so it can handle Aria being
initialized after S3.
  • Loading branch information
vuvova committed Oct 24, 2020
1 parent e764d11 commit d8515c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
@@ -72,7 +72,7 @@ const char *zerofill_error_msg=
corrupted.
*/
ulonglong maria_recover_options= HA_RECOVER_NONE;
handlerton __attribute__((visibility("default"))) *maria_hton;
handlerton *maria_hton;

/* bits in maria_recover_options */
const char *maria_recover_names[]=
@@ -51,7 +51,11 @@
but the stored block will be the size of the compressed block.
Implementation:
The s3 engine inherits from the ha_maria handler
The s3 engine inherits from the ha_maria handler.
It uses Aria code and relies on Aria being enabled. We don't have to check
that Aria is enabled though, because Aria is a mandatory plugin, and
the server will refuse to start if Aria failed to initialize.
s3 will use it's own page cache to not interfere with normal Aria
usage but also to ensure that the S3 page cache is large enough
@@ -996,14 +1000,7 @@ static int ha_s3_init(void *p)
bool res;
static const char *no_exts[]= { 0 };

/* This can happen if Aria fails to start */
if (!maria_hton)
return HA_ERR_INITIALIZATION;

s3_hton= (handlerton *)p;

/* Use Aria engine as a base */
memcpy(s3_hton, maria_hton, sizeof(*s3_hton));
s3_hton->db_type= DB_TYPE_S3;
s3_hton->create= s3_create_handler;
s3_hton->panic= s3_hton_panic;

0 comments on commit d8515c8

Please sign in to comment.