Skip to content
This repository has been archived by the owner on Jun 14, 2022. It is now read-only.

Commit

Permalink
Add MariaDB 10.5 to list of officially supported flavors
Browse files Browse the repository at this point in the history
All tests pass on the latest release of 10.5. This commit also adds support
for considering column alterations between the binary(16) type and MariaDB
10.5's new inet6 type to be safe.
  • Loading branch information
evanelias committed Jul 20, 2020
1 parent 0daf745 commit a478b3a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Tagged releases are tested against the following databases, all running on Linux

* MySQL 5.5, 5.6, 5.7, 8.0
* Percona Server 5.5, 5.6, 5.7, 8.0
* MariaDB 10.1, 10.2, 10.3, 10.4
* MariaDB 10.1, 10.2, 10.3, 10.4, 10.5

Outside of a tagged release, every commit to the main branch is automatically tested against MySQL 5.6 and 5.7.

Expand Down
7 changes: 7 additions & 0 deletions alterclause.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,13 @@ func (mc ModifyColumn) Unsafe() bool {
return newStringSize < oldStringSize
}

// MariaDB 10.5+ conversions between the new inet6 type and binary(16) are
// always safe, as per manual description in
// https://mariadb.com/kb/en/inet6/#migration-between-binary16-and-inet6
if (oldType == "binary(16)" && newType == "inet6") || (oldType == "inet6" && newType == "binary(16)") {
return false
}

// Conversions between variable-length binary types (varbinary, *blob):
// unsafe if new size < old size
// Note: This logic intentionally does not handle fixed-length binary(x)
Expand Down
4 changes: 4 additions & 0 deletions alterclause_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ func TestModifyColumnUnsafe(t *testing.T) {
{"tinyblob", "longtext"},
{"binary(5)", "binary(10)"},
{"bit(10)", "bit(9)"},
{"binary(17)", "inet6"},
{"inet6", "varbinary(16)"},
}
for _, types := range expectUnsafe {
assertUnsafe(types[0], types[1], true)
Expand Down Expand Up @@ -143,6 +145,8 @@ func TestModifyColumnUnsafe(t *testing.T) {
{"varchar(200)", "tinytext"},
{"char(30)", "varchar(30)"},
{"bit(10)", "bit(11)"},
{"binary(16)", "inet6"},
{"inet6", "binary(16)"},
}
for _, types := range expectSafe {
assertUnsafe(types[0], types[1], false)
Expand Down
8 changes: 6 additions & 2 deletions flavor.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ var FlavorMariaDB103 = Flavor{VendorMariaDB, 10, 3, 0}
// number; avoid direct equality comparisons and ideally only use this in tests.
var FlavorMariaDB104 = Flavor{VendorMariaDB, 10, 4, 0}

// FlavorMariaDB105 represents MariaDB 10.5.x. This constant omits a patch
// number; avoid direct equality comparisons and ideally only use this in tests.
var FlavorMariaDB105 = Flavor{VendorMariaDB, 10, 5, 0}

// NewFlavor returns a Flavor value based on its inputs, which should be
// supplied in one of these forms:
// NewFlavor("vendor", major, minor)
Expand Down Expand Up @@ -242,8 +246,8 @@ func (fl Flavor) Supported() bool {
// Currently support 5.5.0 through 8.0.x
return fl.MySQLishMinVersion(5, 5) && !fl.MySQLishMinVersion(8, 1)
case VendorMariaDB:
// Currently support 10.1.0 through 10.4.x
return fl.Major == 10 && fl.Minor >= 1 && fl.Minor <= 4
// Currently support 10.1.0 through 10.5.x
return fl.Major == 10 && fl.Minor >= 1 && fl.Minor <= 5
}
return false
}
Expand Down
3 changes: 2 additions & 1 deletion instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ func (s TengoIntegrationSuite) TestInstanceFlavorVersion(t *testing.T) {
"mariadb:10.2": FlavorMariaDB102,
"mariadb:10.3": FlavorMariaDB103,
"mariadb:10.4": FlavorMariaDB104,
"mariadb:10.5": FlavorMariaDB105,
}

// Determine expected Flavor value of the Dockerized instance being tested
Expand All @@ -244,7 +245,7 @@ func (s TengoIntegrationSuite) TestInstanceFlavorVersion(t *testing.T) {
}
}
if expected == FlavorUnknown {
t.Skip("No image map defined for", s.d.Image)
t.Skip("SKIPPING TEST - no image map defined for", s.d.Image)
}
if actualFlavor := s.d.Flavor().Family(); actualFlavor != expected {
t.Errorf("Expected image=%s to yield flavor=%s, instead found %s", s.d.Image, expected, actualFlavor)
Expand Down

0 comments on commit a478b3a

Please sign in to comment.