Skip to content

Commit

Permalink
MDEV-32884 backward compatibility fixes
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
vuvova committed Dec 12, 2023
1 parent 47f2b16 commit bb565ee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
6 changes: 2 additions & 4 deletions storage/maria/aria_s3_copy.cc
Expand Up @@ -220,17 +220,15 @@ int main(int argc, char** argv)

ms3_set_option(global_s3_client, MS3_OPT_BUFFER_CHUNK_SIZE, &block_size);

if (opt_protocol_version)
if (opt_protocol_version > 2)
{
uint8_t protocol_version;
switch (opt_protocol_version)
{
case 1: /* Legacy means v1 */
case 3: /* Legacy means v1 */
case 4: /* Path means v1 */
protocol_version= 1;
break;
case 2: /* Original means v2 */
case 3: /* Amazon means v2 */
case 5: /* Domain means v2 */
protocol_version= 2;
break;
Expand Down
8 changes: 3 additions & 5 deletions storage/maria/s3_func.c
Expand Up @@ -39,7 +39,7 @@ static int s3_read_file_from_disk(const char *filename, uchar **to,

/* Used by ha_s3.cc and tools to define different protocol options */

static const char *protocol_types[]= {"Auto", "Legacy", "Original", "Amazon", "Path", "Domain", NullS};
static const char *protocol_types[]= {"Auto", "Original", "Amazon", "Legacy", "Path", "Domain", NullS};
TYPELIB s3_protocol_typelib= {array_elements(protocol_types)-1,"",
protocol_types, NULL};

Expand Down Expand Up @@ -154,17 +154,15 @@ ms3_st *s3_open_connection(S3_INFO *s3)
errno, ms3_error(errno));
my_errno= HA_ERR_NO_SUCH_TABLE;
}
if (s3->protocol_version)
if (s3->protocol_version > 2)
{
uint8_t protocol_version;
switch (s3->protocol_version)
{
case 1: /* Legacy means v1 */
case 3: /* Legacy means v1 */
case 4: /* Path means v1 */
protocol_version= 1;
break;
case 2: /* Original means v2 */
case 3: /* Amazon means v2 */
case 5: /* Domain means v2 */
protocol_version= 2;
break;
Expand Down

0 comments on commit bb565ee

Please sign in to comment.