Commit graph

22 commits

Author SHA1 Message Date
Marko Mäkelä
7d4077cc11 Merge 10.5 into 10.6 2024-11-29 12:37:46 +02:00
ParadoxV5
cf2d49ddcf Extract some of #3360 fixes to 10.5.x
That PR uncovered countless issues on `my_snprintf` uses.
This commit backports a squashed subset of their fixes.
2024-11-21 22:43:56 +11:00
Monty
3ae4ecbfc5 MDEV-34867 engine S3 cause 500 error for huawei buckets
Add support for removing the Content-Type header to the S3 engine. This
is required for compatibility with some S3 providers.

This also adds a provider option to the S3 engine which will turn on
relevant compatibility options for specific providers.

This was required for getting MariaDB S3 engine to work with "Huawei
Cloud S3".
To get Huawei S3 storage to work on has set one of the following
S3 options:
s3_provider=Huawei
s3_ssl_no_verify=1

Author: Andrew Hutchings <andrew@mariadb.org>
2024-09-11 16:15:37 +03:00
Sergei Golubchik
bb565ee566 MDEV-32884 backward compatibility fixes
* restore old ENUM values order, in case someone used
  SET @@s3_protocol_version=1

* restore old behavior for Original and Amazon protocol values,
  they behave as "Auto" and do not force a specific protocol version

Approved by Andrew Hutchings <andrew@mariadb.org>
2023-12-12 15:21:28 +01:00
Andrew Hutchings
bc5e904043 MDEV-32884 Improve S3 options comaptibility
The previous commit for MDEV-32884 fixed the s3_protocol_version option,
which was previous only using "Auto", no matter what it was set to. This
patch does several things to keep the old behaviour whilst correcting
for new behaviour and laying the groundwork for the future. This
includes:

* `Original` now means v2 protocol, which it would have been due to the
  option not working, so upgrades will stil work.
* A new `Legacy` option has been added to mean v1 protocol.
* Options `Path` and `Domain` have been added, these will be the only
  two options apart from `Auto` in a future release, and are more
  aligned with what this variable means.
* Fixed the s3.debug test so that it works with v2 protocol.
* Fixed the s3.amazon test so that it works with region subdomains.
* Added additional modes to the s3.amazon test.
* Added s3.not_amazon test for the remaining modes.

This replaces PR #2902.
2023-12-07 15:57:43 +01:00
Andrew Hutchings
690fcfbd29 Fix S3 engine Coverity hits
Very minor hits found by Coverity for the S3 engine.
2023-02-14 16:27:21 +00:00
Sergei Golubchik
2ca3861b55 MDEV-28106 S3 tries to include thread.h while compiling on Windows
S3 engine and libmarias3 don't compile on Windows

also fixes:
MDEV-28104 Typo in storage/maria/s3_func.c: 'FN_DECVHAR
2022-03-23 17:42:15 +01:00
Monty
6bdc03ebcc Added options s3_port and s3_use_http to aria_s3_copy
These options was needed in some cases, like when using minio that require
the port option, to be able to connect to the S3 storage.
The sympthom was that one could get the error
"Table t1.MAI doesn't exist in s3"
even if the table did exits.

Other things:
- Improved error message for non existing S3 files
2021-09-01 13:34:46 +03:00
Sergei Petrunia
e38ac39104 MDEV-23662: Make S3 Storage Engine usable with MinIO
Add @@s3_port and @@s3_use_http. One can set these to access the
local MinIO, for example.
2020-09-08 13:42:55 +03:00
Eugene Kosov
65b93cef38 fix clang build 2020-06-25 13:59:25 +03:00
Monty
1a49c5eb4d Cleanup's and more DBUG_PRINT's
- Rewrote bool Query_compressed_log_event::write() to make it more readable
  (no logic changes).
- Changed DBUG_PRINT of 'is_error:' to 'is_error():' to make it easier to
  find error: in traces.
- Ensure that 'db' is never null in Query_log_event (Simplified code).
2020-06-19 12:03:13 +03:00
Sergei Golubchik
baff3ba6e3 S3 compilation error on x86 2020-06-18 09:44:05 +02:00
Monty
eca5c2c67f Added support for more functions when using partitioned S3 tables
MDEV-22088 S3 partitioning support

All ALTER PARTITION commands should now work on S3 tables except

REBUILD PARTITION
TRUNCATE PARTITION
REORGANIZE PARTITION

In addition, PARTIONED S3 TABLES can also be replicated.
This is achived by storing the partition tables .frm and .par file on S3
for partitioned shared (S3) tables.

The discovery methods are enchanced by allowing engines that supports
discovery to also support of the partitioned tables .frm and .par file

Things in more detail

- The .frm and .par files of partitioned tables are stored in S3 and kept
  in sync.
- Added hton callback create_partitioning_metadata to inform handler
  that metadata for a partitoned file has changed
- Added back handler::discover_check_version() to be able to check if
  a table's or a part table's definition has changed.
- Added handler::check_if_updates_are_ignored(). Needed for partitioning.
- Renamed rebind() -> rebind_psi(), as it was before.
- Changed CHF_xxx hadnler flags to an enum
- Changed some checks from using table->file->ht to use
  table->file->partition_ht() to get discovery to work with partitioning.
- If TABLE_SHARE::init_from_binary_frm_image() fails, ensure that we
  don't leave any .frm or .par files around.
- Fixed that writefrm() doesn't leave unusable .frm files around
- Appended extension to path for writefrm() to be able to reuse to function
  for creating .par files.
- Added DBUG_PUSH("") to a a few functions that caused a lot of not
  critical tracing.
2020-04-19 17:33:51 +03:00
Monty
736998cb75 Cleanups & indentation changes
- Only indentation changes in sql_rename.cc
- Ignore some WSREP error messages when there isn't a internet connection
- Force restart of stat_tables_part.test to make result stable
- Fixed compiler warnings in CONNECT
2020-03-24 21:00:02 +02:00
Monty
6a9e24d046 Added support for replication for S3
MDEV-19964 S3 replication support

Added new configure options:
s3_slave_ignore_updates
"If the slave has shares same S3 storage as the master"

s3_replicate_alter_as_create_select
"When converting S3 table to local table, log all rows in binary log"

This allows on to configure slaves to have the S3 storage shared or
independent from the master.

Other thing:
Added new session variable '@@sql_if_exists' to force IF_EXIST to DDL's.
2020-03-24 21:00:02 +02:00
Monty
5754ea2eca Fixed compiler failures with gcc 7.4.1 and new my_malloc code 2020-03-14 15:24:13 +02:00
Monty
1b5e5bdef3 MDEV-20306 Assert when converting encrypted Aria table to S3
Changes:
- maria_create() now uses a bit in the parameter flags to check if table
  should be encrypted instead of using maria_encrypted_tables.
- Don't encrypt tables that are to be converted to S3
- Added encrypted flag to ARIA_TABLE_CAPABILITIES
- maria_chk --description now prints if table is encrypted. Other
  operations is not allowed on encrypted tables.
2019-08-23 22:02:39 +02:00
Monty
6c50875a38 MDEV-20279 Increase Aria index length limit
Limit increased from 1000 to 2000.

Avoiding stack overflow by only storing keys and pages on the stack in
recursive functions if there is plenty of space on it.

Other things:
- Use less stack space for b-tree operations as we now only allocate as
  much space as needed instead of always allocating HA_MAX_KEY_LENGTH.
- Replaced most usage of my_safe_alloca() in Aria with the stack_alloc
  interface.
- Moved my_setstacksize() to mysys/my_pthread.c
2019-08-23 11:26:04 +02:00
Monty
8e2a24bb33 Added s3_protocol_version=auto 2019-06-26 23:39:13 +03:00
Vlad Lesin
878ad986fd MDEV-19464: Altering partitioned table into S3 causes an obscure error
The error occured because aria_copy_to_s3() function tried to copy .frm file
of partition, but partition does not have it's own .frm file. The same is true
for aria_rename_s3().

To fix this issue the new parameter was added to those two functions to specify
if .frm file must be copied or not. The parameter is set to 'false' for
partitions.

Also there was other issue with EXCHANGE PARTITION. Briefly, there is the
following sequence of operations(see  exchange_name_with_ddl_log() for details):
1) rename swap table to temporary table,
2) rename partition to swap table,
3) rename temporary table to partition.

On step (1) .frm file is renamed too. On step (2) the swap table does not
have .frm file, as partition does not have it. On step (3) partition will have
.frm file, because it will be renamed from temporary table. All of this causes
error on different stages of the table access. To fix it, .frm is not touched
at all for s3 during EXCHANGE PARTITION operation. This is implemented in
ha_s3::rename_table() by additional checking of
current_thd->lex->alter_info.partition_flags(see also ALTER_PARTITION_EXCHANGE
in sql_yacc.yy).
2019-06-26 13:01:32 +03:00
Monty
c51f615bf5 Added options --s3-protocol-version and --s3-host-name 2019-06-01 15:21:50 +03:00
Monty
ab38b7511b MDEV-17841 S3 storage engine
A read-only storage engine that stores it's data in (aws) S3

To store data in S3 one could use ALTER TABLE:
ALTER TABLE table_name ENGINE=S3

libmarias3 integration done by Sergei Golubchik
libmarias3 created by Andrew Hutchings
2019-05-23 02:28:23 +03:00