• We collect Bitbucket feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      Add support for MariaDB to Stash

      Currently Stash supports MySQL as described in the Supported platforms. However, Stash is not tested against variants of MySQL like Percona and MariaDB. For support, you should switch to a normal MySQL installation as per the document's description.

      This issue intends to engage us on a research about the viability of adding full support to MariaDB.

      Currently we mapped two scenarios:

      Scenario 1

      When trying to upload to a Git repository, the following error is displayed:

      [xxx@attlasin_server git_project]# git push origin master
      Password:
      Counting objects: 21183, done.
      Delta compression using up to 3 threads.
      Compressing objects: 100% (8287/8287), done.
      Writing objects: 100% (21183/21183), 20.18 MiB | 8.28 MiB/s, done.
      Total 21183 (delta 12854), reused 20762 (delta 12433)
      remote: Hook com.atlassian.stash.hooks.permissions.internal.BranchPermissionHook failed. Error:
      remote: There was a SQL exception thrown by the Active Objects library:
      remote: Database:
      remote:         - name:MySQL
      remote:         - version:5.5.5-10.0.4-MariaDB
      remote:         - minor version:5
      remote:         - major version:5
      remote: Driver:
      remote:         - name:MySQL Connector Java
      remote:         - version:mysql-connector-java-5.1.25 ( Revision: ${bzr.revision-id} )
      remote:
      remote: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes
      

      Workaround for Scenario 1

      • Find query in the log:
      2013-10-25 16:55:01,169 ERROR [threadpool:thread-7] marek.knappe 1014x21271x1 1vmdfi9 122.99.118.175 "POST /scm/cg/compass-gateway.git/git-receive-pack HTTP/1.1" net.java.ao.sql Exception executing SQL update <CREATE INDEX index_ao_6978bb_res847341420 ON AO_6978BB_RESTRICTED_REF(REF_VALUE)>
      
      • Execute the query manually:
      MariaDB [ecc_stash]> CREATE INDEX index_ao_6978bb_res847341420 ON AO_6978BB_RESTRICTED_REF(REF_VALUE);
      Query OK, 0 rows affected, 1 warning (0.06 sec)
      Records: 0  Duplicates: 0  Warnings: 1
      
      • Probable root cause:

      It's likely that 1 warning part is the culprit. The JDBC driver probably doesn't differentiate between warnings and errors, so either is probably treated as the SQL statement failing.

      Scenario 2

      "An error occurred" pops up on all repo pages. The details state "An error occurred while processing the request. Check the server logs for more information."

      2013-10-24 04:36:27,940 ERROR [http-bio-7994-exec-2] kdonarski 276x4235x1 1kh3kc1 79.173.31.46 "GET /rest/sync/latest/projects/OSA/repos/osa HTTP/1.1" net.java.ao.sql Exception executing SQL update <CREATE INDEX index_ao_02a6c0_rej1887153917 ON AO_02A6C0_REJECTED_REF(REF_ID)>
      java.sql.SQLException: Index column size too large. The maximum column size is 767 bytes.
      ...
      
      2013-10-24 04:36:27,967 ERROR [http-bio-7994-exec-2] kdonarski 276x4235x1 1kh3kc1 79.173.31.46 "GET /rest/sync/latest/projects/OSA/repos/osa HTTP/1.1" c.a.s.r.e.UnhandledExceptionMapper Unhandled exception while processing REST call
      com.atlassian.activeobjects.internal.ActiveObjectsSqlException: There was a SQL exception thrown by the Active Objects library:
      Database:
      	- name:MySQL
      	- version:5.5.30-MariaDB
      	- minor version:5
      	- major version:5
      Driver:
      	- name:MySQL-AB JDBC Driver
      	- version:mysql-connector-java-5.1.23 ( Revision: ${bzr.revision-id} )
      
      java.sql.SQLException: Index column size too large. The maximum column size is 767 bytes.
      ...
      Caused by: java.sql.SQLException: Index column size too large. The maximum column size is 767 bytes.
      

      Workaround for Scenario 2

      At the moment the immediate workaround is to disable the Ref Syncing plugin that is affected by this error. To do that, go to Administration -> Manage Add-ons and select 'Show all' in the drop-down for filtering plugins. Find a plugin named Atlassian Stash Repository Ref Synchronizer and disable that plugin. This should cause the error to disappear from your repository pages.

          Form Name

            [BSERV-4012] Add support for MariaDB to Stash

            iT Vissim,

            This issue is already closed as fixed, and Bitbucket Server, formerly Stash, has supported MariaDB since 3.6.0, released in January of 2015.

            Are you perhaps looking for support in another product?

            Best regards,
            Bryan Turner
            Atlassian Bitbucket

            Bryan Turner (Inactive) added a comment - iT Vissim, This issue is already closed as fixed, and Bitbucket Server, formerly Stash, has supported MariaDB since 3.6.0, released in January of 2015. Are you perhaps looking for support in another product? Best regards, Bryan Turner Atlassian Bitbucket

            IT Vissim added a comment -

            +1 for MariaDB - it is replacement of MySQL that was bought by Oracle and doesn't comply with GPL2 licence anymore - like MariaDB does. Many linux distributions switching to MariaDB - Debian, RedHat, ...

             

            I see this as a must for Atlassian to add support for MariaDB

            IT Vissim added a comment - +1 for MariaDB - it is replacement of MySQL that was bought by Oracle and doesn't comply with GPL2 licence anymore - like MariaDB does. Many linux distributions switching to MariaDB - Debian, RedHat, ...   I see this as a must for Atlassian to add support for MariaDB

            Nick added a comment -

            jvaughn Stash 3.6.0 supports MariaDB as mentioned on the Support Platforms page. No need to wait for the 3.6.1

            Nick added a comment - jvaughn Stash 3.6.0 supports MariaDB as mentioned on the Support Platforms page. No need to wait for the 3.6.1

            Should we wait until 3.6.1 or whatever is next, or are we good to use MariaDB on 3.6?

            Jonathan Vaughn added a comment - Should we wait until 3.6.1 or whatever is next, or are we good to use MariaDB on 3.6?

            Bryan Turner (Inactive) added a comment - - edited

            Starting from 3.6, Stash now includes MariaDB 5.5 in its test matrix. This means all subsequent releases of Stash will be continuously verified against MariaDB 5.5, and we now consider it a supported platform.

            I have manually verified MariaDB 10.0.15, the current GA release from the 10.0 branch, and Stash's tests also pass on that version. However, MariaDB 10.0 will not be considered supported until it's added to our test matrix. I'll update this issue again when that work is complete.

            MariaDB 10.1 is currently an alpha release, and is not supported. Both SkySQL Ab and Atlassian discourage customers running 10.1 alpha releases in production, and we will not be able to provide any support should running MariaDB 10.1 eat your baby children.

            Best regards,
            Bryan Turner
            Atlassian Stash

            Edit: One further note. Both MySQL and MariaDB remain unsupported for Stash Data Center. Data Center customers should use Oracle, PostgreSQL or SQL Server instead.

            Bryan Turner (Inactive) added a comment - - edited Starting from 3.6, Stash now includes MariaDB 5.5 in its test matrix. This means all subsequent releases of Stash will be continuously verified against MariaDB 5.5, and we now consider it a supported platform. I have manually verified MariaDB 10.0.15, the current GA release from the 10.0 branch, and Stash's tests also pass on that version. However, MariaDB 10.0 will not be considered supported until it's added to our test matrix. I'll update this issue again when that work is complete. MariaDB 10.1 is currently an alpha release, and is not supported . Both SkySQL Ab and Atlassian discourage customers running 10.1 alpha releases in production, and we will not be able to provide any support should running MariaDB 10.1 eat your baby children. Best regards, Bryan Turner Atlassian Stash Edit: One further note. Both MySQL and MariaDB remain unsupported for Stash Data Center. Data Center customers should use Oracle, PostgreSQL or SQL Server instead.

            For anyone attempting to use the MariaDB Java Client instead of MySQL Connector/J, this is not curently possible. It turns out the MariaDB connector fails when used with Stash because of a bug in the connector (not in Stash). Specifically, the tinyInt1isBit flag (which is on by default) is not correctly applied in the MariaDB connector, which claims to support it, but it is correctly applied in the Oracle MySQL connector.

            In the MariaDB driver, org.mariadb.jdbc.MySQLDatabaseMetaData.getColumns(String, String, String, String) does not apply tinyInt1isBit translation when it retrieves column types. It looks like a bug in dataTypeClause(String) at line 99 in the 1.1.5 (current) version of the driver. The line after it, for year, applies the yearIsDateType flag, and it seems like the "tinyint" WHEN entry should be doing something similar.

            Because of this, when using the MariaDB driver, Hibernate fails to validate the schema:

            Caused by: org.hibernate.HibernateException: Wrong column type in stash.plugin_state for column enabled. Found: tinyint, expected: bit
            	at org.hibernate.mapping.Table.validateColumns(Table.java:373) ~[hibernate-core-4.2.5.Final.jar:4.2.5.Final]
            

            I've opened CONJ-72 in their issue tracker, with a proposed fix.

            Best regards,
            Bryan Turner
            Atlassian Stash

            Bryan Turner (Inactive) added a comment - For anyone attempting to use the MariaDB Java Client instead of MySQL Connector/J, this is not curently possible. It turns out the MariaDB connector fails when used with Stash because of a bug in the connector (not in Stash). Specifically, the tinyInt1isBit flag ( which is on by default ) is not correctly applied in the MariaDB connector, which claims to support it , but it is correctly applied in the Oracle MySQL connector. In the MariaDB driver, org.mariadb.jdbc.MySQLDatabaseMetaData.getColumns(String, String, String, String) does not apply tinyInt1isBit translation when it retrieves column types. It looks like a bug in dataTypeClause(String) at line 99 in the 1.1.5 (current) version of the driver. The line after it, for year, applies the yearIsDateType flag, and it seems like the "tinyint" WHEN entry should be doing something similar. Because of this, when using the MariaDB driver, Hibernate fails to validate the schema: Caused by: org.hibernate.HibernateException: Wrong column type in stash.plugin_state for column enabled. Found: tinyint, expected: bit at org.hibernate.mapping.Table.validateColumns(Table.java:373) ~[hibernate-core-4.2.5.Final.jar:4.2.5.Final] I've opened CONJ-72 in their issue tracker, with a proposed fix. Best regards, Bryan Turner Atlassian Stash

            Brad Apps added a comment -
            MariaDB [(none)]> show global variables like 'innodb_file_format%';
            +--------------------------+----------+
            | Variable_name            | Value    |
            +--------------------------+----------+
            | innodb_file_format       | Antelope |
            | innodb_file_format_check | ON       |
            | innodb_file_format_max   | Antelope |
            +--------------------------+----------+
            

            But yes, i didn't notice the 1 warning, and forgot to do show warnings, thanks that propably why it works via mysql commandline and didn't work by git
            anyway, now when i see that warning, i can investigate it more, will let you know. thanks

            Brad Apps added a comment - MariaDB [(none)]> show global variables like 'innodb_file_format%' ; +--------------------------+----------+ | Variable_name | Value | +--------------------------+----------+ | innodb_file_format | Antelope | | innodb_file_format_check | ON | | innodb_file_format_max | Antelope | +--------------------------+----------+ But yes, i didn't notice the 1 warning, and forgot to do show warnings, thanks that propably why it works via mysql commandline and didn't work by git anyway, now when i see that warning, i can investigate it more, will let you know. thanks

            Marek,

            It's likely that 1 warning part is the culprit. The JDBC driver probably doesn't differentiate between warnings and errors, so either is probably treated as the SQL statement failing. Again, just a guess.

            Best regards,
            Bryan Turner
            Atlassian Stash

            Bryan Turner (Inactive) added a comment - Marek, It's likely that 1 warning part is the culprit. The JDBC driver probably doesn't differentiate between warnings and errors, so either is probably treated as the SQL statement failing. Again, just a guess. Best regards, Bryan Turner Atlassian Stash

            Marek,

            We actively test Stash against standard MySQL 5.1 and 5.5, and the schema works correctly on both. We do not test variants, though, so I can't really provide much insight as to why they would fail; innodb_large_prefix was just a best guess based on previous issues customers have run into.

            Two more settings you may consider are innodb_file_format and innodb_file_format_max:

            mysql> show global variables like 'innodb_file_format%';
            +--------------------------+----------+
            | Variable_name            | Value    |
            +--------------------------+----------+
            | innodb_file_format       | Antelope |
            | innodb_file_format_check | ON       |
            | innodb_file_format_max   | Antelope |
            +--------------------------+----------+
            3 rows in set (0.00 sec)
            

            innodb_file_format_check is likely not important, but the other two may be. Again, the settings above are from a standard MySQL 5.5 installation. It's possible just switching to Barracuda format may reproduce the issue you're seeing.

            You can turn on SQL logging for Stash by adding the following to stash-config.properties in your STASH_HOME directory:

            #hibernate.show_sql=true #You probably don't need to add this one
            logging.logger.net.java.ao.sql=DEBUG
            

            Branch permissions use ActiveObjects to access the database, since they are implemented as a plugin (That said, it's likely your log files already contain the exact SQL the system was trying to run when it got the error above, without needing to enable SQL logging). Core code uses Hibernate. I have already modified the core schema to use prefix indexes on MySQL (STASH-3133), which is why you don't see any errors starting Stash. I don't have as much control over ActiveObjects, which is a cross-product plugin used by all Atlassian products, however.

            Note that, if you don't care about branch permissions, you may be able to disable that plugin to work around this issue. Under Administration > Manage Add-ons, you can select "System" from the filter drop-down and disable "Atlassian Stash Branch Permissions Plugin". However, disabling this plugin will disable a few others as well.

            Best regards,
            Bryan Turner
            Atlassian Stash

            Bryan Turner (Inactive) added a comment - Marek, We actively test Stash against standard MySQL 5.1 and 5.5, and the schema works correctly on both. We do not test variants, though, so I can't really provide much insight as to why they would fail; innodb_large_prefix was just a best guess based on previous issues customers have run into. Two more settings you may consider are innodb_file_format and innodb_file_format_max : mysql> show global variables like 'innodb_file_format%'; +--------------------------+----------+ | Variable_name | Value | +--------------------------+----------+ | innodb_file_format | Antelope | | innodb_file_format_check | ON | | innodb_file_format_max | Antelope | +--------------------------+----------+ 3 rows in set (0.00 sec) innodb_file_format_check is likely not important, but the other two may be. Again, the settings above are from a standard MySQL 5.5 installation. It's possible just switching to Barracuda format may reproduce the issue you're seeing. You can turn on SQL logging for Stash by adding the following to stash-config.properties in your STASH_HOME directory: #hibernate.show_sql= true #You probably don't need to add this one logging.logger.net.java.ao.sql=DEBUG Branch permissions use ActiveObjects to access the database, since they are implemented as a plugin (That said, it's likely your log files already contain the exact SQL the system was trying to run when it got the error above, without needing to enable SQL logging). Core code uses Hibernate. I have already modified the core schema to use prefix indexes on MySQL ( STASH-3133 ), which is why you don't see any errors starting Stash. I don't have as much control over ActiveObjects, which is a cross-product plugin used by all Atlassian products, however. Note that, if you don't care about branch permissions, you may be able to disable that plugin to work around this issue. Under Administration > Manage Add-ons, you can select "System" from the filter drop-down and disable "Atlassian Stash Branch Permissions Plugin". However, disabling this plugin will disable a few others as well. Best regards, Bryan Turner Atlassian Stash

            Brad Apps added a comment - - edited

            Funny thing, now it imported all right, but i predict more errors, as when i go to stash repo by webpage i got error and need to do on database:

            CREATE INDEX index_ao_02a6c0_rej1887153917 ON AO_02A6C0_REJECTED_REF(REF_ID)
            

            Anyway, that's just test instance so i will play a little with that, and maybe later if any problems will move it to normal mysql 5.5

            anyway case can be closed, maybe someone will like my workaround
            the query i got i have from the log after turning on debugging/profiling

            Brad Apps added a comment - - edited Funny thing, now it imported all right, but i predict more errors, as when i go to stash repo by webpage i got error and need to do on database: CREATE INDEX index_ao_02a6c0_rej1887153917 ON AO_02A6C0_REJECTED_REF(REF_ID) Anyway, that's just test instance so i will play a little with that, and maybe later if any problems will move it to normal mysql 5.5 anyway case can be closed, maybe someone will like my workaround the query i got i have from the log after turning on debugging/profiling

              Unassigned Unassigned
              8a3f0aa1ab39 Brad Apps
              Votes:
              18 Vote for this issue
              Watchers:
              26 Start watching this issue

                Created:
                Updated:
                Resolved: