Unable to change branch permissions - server error

Joshua Collins June 11, 2018

Hi, 

 

I am trying to change branch permissions for a repository (in this case specifically master -> 'Prevent changes without a pull request' but the error occurs for all repositories/branchees/permissions I have tested). When I do this I get a popup saying:

 

An error occurred while processing the request. Check the server logs for more information.

 

In the logs I get this:


2018-06-11 17:22:04,467 DEBUG [http-nio-80-exec-4] joshua.collins@lecip.se @1AFQLM1x1042x33757x2 1irs5w9 192.168.0.53 "GET /rest/api/latest/profile/recent/repos HTTP/1.1" c.a.s.i.p.GrantedPermissionVoterProvider Permission voter for user joshua.collins@lecip.se has expired and will be recalculated
2018-06-11 17:22:13,862 DEBUG [http-nio-80-exec-10] joshua.collins@lecip.se @1AFQLM1x1042x33759x0 1irs5w9 192.168.0.53 "GET /rest/branch-utils/latest/projects/ARCB/repos/arcb4/branchmodel HTTP/1.1" c.a.s.i.p.GrantedPermissionVoterProvider Permission voter for user joshua.collins@lecip.se has expired and will be recalculated
2018-06-11 17:22:15,650 DEBUG [http-nio-80-exec-9] joshua.collins@lecip.se @1AFQLM1x1042x33760x0 1irs5w9 192.168.0.53 "POST /rest/branch-permissions/latest/projects/ARCB/repos/arcb4/restrictions HTTP/1.1" c.a.s.i.p.GrantedPermissionVoterProvider Permission voter for user joshua.collins@lecip.se has expired and will be recalculated
2018-06-11 17:22:15,653 DEBUG [http-nio-80-exec-9] joshua.collins@lecip.se @1AFQLM1x1042x33760x0 1irs5w9 192.168.0.53 "POST /rest/branch-permissions/latest/projects/ARCB/repos/arcb4/restrictions HTTP/1.1" c.a.s.i.e.TransactionAwareEventPublisher Deferring publishing for AnalyticsRefRestrictionUpdatedEvent until AFTER_COMMIT
2018-06-11 17:22:15,658 ERROR [http-nio-80-exec-9] joshua.collins@lecip.se @1AFQLM1x1042x33760x0 1irs5w9 192.168.0.53 "POST /rest/branch-permissions/latest/projects/ARCB/repos/arcb4/restrictions HTTP/1.1" c.a.s.i.r.e.DefaultUnhandledExceptionMapperHelper Unhandled exception while processing REST request: "POST /rest/branch-permissions/latest/projects/ARCB/repos/arcb4/restrictions HTTP/1.1"
com.atlassian.activeobjects.internal.ActiveObjectsSqlException: There was a SQL exception thrown by the Active Objects library:
Database:
- name:MySQL
- version:5.6.17
- minor version:6
- major version:5
Driver:
- name:MySQL Connector Java
- version:mysql-connector-java-5.1.30 ( Revision: alexander.soklakov@oracle.com-20140310090514-8xt1yoht5ksg2e7c )

java.sql.SQLException: Field 'REPOSITORY_ID' doesn't have a default value
at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.create(EntityManagedActiveObjects.java:102)
at com.atlassian.activeobjects.osgi.TenantAwareActiveObjects.create(TenantAwareActiveObjects.java:271)
at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56)
at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60)
at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70)
at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53)
at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57)
at com.atlassian.stash.internal.repository.ref.restriction.dao.AoRefRestrictionDao.create(AoRefRestrictionDao.java:62)
at com.atlassian.stash.internal.repository.ref.restriction.DefaultRefRestrictionService.lambda$setRestriction$13(DefaultRefRestrictionService.java:404)
at com.atlassian.sal.core.transaction.HostContextTransactionTemplate$1.doInTransaction(HostContextTransactionTemplate.java:21)
at com.atlassian.stash.internal.sal.spi.HostContextAccessorImpl.doInTransaction(HostContextAccessorImpl.java:54)
at com.atlassian.sal.core.transaction.HostContextTransactionTemplate.execute(HostContextTransactionTemplate.java:18)
at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56)
at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60)
at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70)
at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53)
at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57)
at com.atlassian.stash.internal.repository.ref.restriction.DefaultRefRestrictionService.setRestriction(DefaultRefRestrictionService.java:388)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at com.atlassian.stash.internal.repository.ref.restriction.DefaultRefRestrictionService.lambda$setRestrictions$14(DefaultRefRestrictionService.java:421)
at com.atlassian.sal.core.transaction.HostContextTransactionTemplate$1.doInTransaction(HostContextTransactionTemplate.java:21)
at com.atlassian.stash.internal.sal.spi.HostContextAccessorImpl.doInTransaction(HostContextAccessorImpl.java:54)
at com.atlassian.sal.core.transaction.HostContextTransactionTemplate.execute(HostContextTransactionTemplate.java:18)
at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56)
at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60)
at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70)
at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53)
at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57)
at com.atlassian.stash.internal.repository.ref.restriction.DefaultRefRestrictionService.setRestrictions(DefaultRefRestrictionService.java:421)
at com.atlassian.stash.internal.repository.ref.restriction.rest.RefRestrictionResourceHelper.createRestrictions(RefRestrictionResourceHelper.java:115)
at com.atlassian.stash.internal.repository.ref.restriction.rest.RefRestrictionRepositoryResource.createRestrictions(RefRestrictionRepositoryResource.java:137)
at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
at com.atlassian.analytics.client.filter.UniversalAnalyticsFilter.doFilter(UniversalAnalyticsFilter.java:92)
at com.atlassian.analytics.client.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:39)
at com.atlassian.bitbucket.internal.xcode.web.XcodeUserAgentFilter.doFilter(XcodeUserAgentFilter.java:36)
at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
at com.atlassian.plugin.connect.plugin.auth.scope.ApiScopingFilter.doFilter(ApiScopingFilter.java:81)
at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
at com.atlassian.stash.internal.spring.security.StashAuthenticationFilter.doFilter(StashAuthenticationFilter.java:85)
at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doInsideSpringSecurityChain(BeforeLoginPluginAuthenticationFilter.java:112)
at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:75)
at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:94)
at com.atlassian.oauth.serviceprovider.internal.servlet.OAuthFilter.doFilter(OAuthFilter.java:67)
at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
at com.atlassian.plugin.connect.plugin.auth.oauth2.DefaultSalAuthenticationFilter.doFilter(DefaultSalAuthenticationFilter.java:69)
at com.atlassian.plugin.connect.plugin.auth.user.ThreeLeggedAuthFilter.doFilter(ThreeLeggedAuthFilter.java:109)
at com.atlassian.jwt.internal.servlet.JwtAuthFilter.doFilter(JwtAuthFilter.java:32)
at com.atlassian.analytics.client.filter.DefaultAnalyticsFilter.doFilter(DefaultAnalyticsFilter.java:38)
at com.atlassian.analytics.client.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:39)
at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doBeforeBeforeLoginFilters(BeforeLoginPluginAuthenticationFilter.java:90)
at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:73)
at com.atlassian.stash.internal.request.DefaultRequestManager.doAsRequest(DefaultRequestManager.java:89)
at com.atlassian.stash.internal.hazelcast.ConfigurableWebFilter.doFilter(ConfigurableWebFilter.java:38)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.lang.Thread.run(Thread.java:745)
... 320 frames trimmed
Caused by: java.sql.SQLException: Field 'REPOSITORY_ID' doesn't have a default value
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1084)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4232)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4164)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2838)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2082)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2334)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2262)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2246)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java)
at net.java.ao.DatabaseProvider.executeInsertReturningKey(DatabaseProvider.java:1947)
at net.java.ao.DatabaseProvider.insertReturningKey(DatabaseProvider.java:1861)
at net.java.ao.EntityManager.create(EntityManager.java:366)
at net.java.ao.EntityManager.create(EntityManager.java:399)
at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.create(EntityManagedActiveObjects.java:100)
... 68 common frames omitted

 

I think this error has started happening since we moved over to using Crowd for managing logins to our server. We used to be able to do this with no issues. I have tried to do this logged in via a CrowdID login as well as using a local bitbucket user login and in both cases have the same issue.

Has anyone else experience this issue?

1 answer

1 accepted

0 votes
Answer accepted
Caterina Curti
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 12, 2018

Hi @Joshua Collins,

From the log snippet, it looks like another Bitbucket Server environment (maybe a Dev one) may have been connected to the production database and upgraded the schema.

To confirm that, we can run the following query and this will tell us which changes have been applied to the database and when:

select * from databasechangelog order by dateexecuted desc;

To resolve this issue, I see the following two options:

  • Restore a backup of Bitbucket Server. The backup will need to include both the home directory and the database and should have been taken using one of the Data recovery and backups strategies
    • Can you confirm if a backup is available?
  • Upgrade this instance so that the database schema will match the expected structure again.

 

Cheers,

Caterina - Atlassian

Joshua Collins June 13, 2018

Hi Caterina,

Thanks for the reply. Here is the output of the query: (I have removed data from prior to Nov 2017 due to this form accepting a max of 20,000 characters) 

ID AUTHOR FILENAME DATEEXECUTED ORDEREXECUTED EXECTYPE MD5SUM DESCRIPTION COMMENTS TAG LIQUIBASE CONTEXTS LABELS DEPLOYMENT_ID
BSERV-2642-1 bturner liquibase/r5_10/upgrade.xml 2018-06-04 11:35:11 580 EXECUTED 7:d0c7805675f6f03854680fc273dea59d addColumn tableName=sta_repo_push_activity NULL 3.5.3 NULL NULL 8104910813
BSERV-2642-2 bturner liquibase/r5_10/upgrade.xml 2018-06-04 11:35:11 581 EXECUTED 7:2f478a904b793114169272e3836573f7 update tableName=sta_repo_push_activity NULL 3.5.3 NULL NULL 8104910813
BSERV-2642-3 bturner liquibase/r5_10/upgrade.xml 2018-06-04 11:35:11 582 EXECUTED 7:c8a9221aa75e9d237958f0f98581dab3 addNotNullConstraint columnName=trigger_id, tableName=sta_repo_push_activity NULL 3.5.3 NULL NULL 8104910813
BBSDEV-16221-1 bplump liquibase/r5_11/upgrade.xml 2018-06-04 11:35:11 583 EXECUTED 7:48fda74bcffab8e4e1d91ec40d093bd2 createTable tableName=bb_pr_commit NULL 3.5.3 NULL NULL 8104910813
BBSDEV-16221-2 bplump liquibase/r5_11/upgrade.xml 2018-06-04 11:35:11 584 EXECUTED 7:c8a0f10973698e4132c66b5581897f59 createIndex indexName=idx_bb_pr_commit_commit_id, tableName=bb_pr_commit NULL 3.5.3 NULL NULL 8104910813
BSERVDEV-16266-1 mstudman liquibase/r5_9/upgrade.xml 2018-03-23 07:04:57 573 EXECUTED 7:74b3d91522d633758189b3237560939b createTable tableName=bb_alert A table for InternalAlert instances. NULL 3.5.3 NULL NULL 1785096997
BSERVDEV-16266-2 mstudman liquibase/r5_9/upgrade.xml 2018-03-23 07:04:57 574 EXECUTED 7:0f932b11b613c7d1d58bc4756386ddcf createIndex indexName=bb_alert_timestamp, tableName=bb_alert NULL 3.5.3 NULL NULL 1785096997
BSERVDEV-16266-3 mstudman liquibase/r5_9/upgrade.xml 2018-03-23 07:04:57 575 EXECUTED 7:d43a9c81512410ee6ee20d85d8048ecc createIndex indexName=bb_alert_issue, tableName=bb_alert NULL 3.5.3 NULL NULL 1785096997
BSERVDEV-16266-4 mstudman liquibase/r5_9/upgrade.xml 2018-03-23 07:04:57 576 EXECUTED 7:deb53a8a6331ac9f192f2dc7baf3f5da createIndex indexName=bb_alert_issue_component, tableName=bb_alert NULL 3.5.3 NULL NULL 1785096997
BSERVDEV-16266-5 mstudman liquibase/r5_9/upgrade.xml 2018-03-23 07:04:57 577 EXECUTED 7:53f189f9666fcbf1168814b835e6e1dd createIndex indexName=bb_alert_node_lower, tableName=bb_alert NULL 3.5.3 NULL NULL 1785096997
BSERVDEV-16266-6 mstudman liquibase/r5_9/upgrade.xml 2018-03-23 07:04:57 578 EXECUTED 7:7cde0e9fc65781db3dc7bd98c344ff43 createIndex indexName=bb_alert_plugin_lower, tableName=bb_alert NULL 3.5.3 NULL NULL 1785096997
BSERVDEV-16266-7 mstudman liquibase/r5_9/upgrade.xml 2018-03-23 07:04:57 579 EXECUTED 7:e8aea875d3ee75daaef914642acba045 createIndex indexName=bb_alert_severity, tableName=bb_alert NULL 3.5.3 NULL NULL 1785096997
BSERVDEV-16158-1 bturner liquibase/r5_6/upgrade.xml 2018-01-18 08:12:46 570 EXECUTED 7:ebc5a3aa3d30b4ee992af791390ecf93 addColumn tableName=plugin_state NULL 3.5.3 NULL NULL 6259565650
BSERVDEV-16158-2 bturner liquibase/r5_6/upgrade.xml 2018-01-18 08:12:46 571 EXECUTED 7:b8ba0b3ba30e2b51acd7afb475f2eebc update tableName=plugin_state NULL 3.5.3 NULL NULL 6259565650
BSERVDEV-16158-3 bturner liquibase/r5_6/upgrade.xml 2018-01-18 08:12:46 572 EXECUTED 7:a292236ea4840fab1a1a508100e017b2 addNotNullConstraint columnName=updated_timestamp, tableName=plugin_state NULL 3.5.3 NULL NULL 6259565650
BSERVDEV-16024-4 spetrucev liquibase/r5_4/upgrade.xml 2017-11-24 16:17:38 566 EXECUTED 7:4fe538e5b9254544b4d4ff6467a3e284 dropTable tableName=sta_pr_diff_comment_anchor Drop the deprecated sta_pr_diff_comment_anchor table, which was replaced by bb_comment_thread in 5.0\n (BSERVDEV-8489) NULL 3.5.3 NULL NULL 1536656705
BSERVDEV-16024-5 spetrucev liquibase/r5_4/upgrade.xml 2017-11-24 16:17:38 567 EXECUTED 7:b8704b31d5c8f4d70254738c3cd69b43 dropTable tableName=sta_diff_comment_anchor Drop the deprecated sta_diff_comment_anchor table, which was replaced by bb_comment_thread in 5.0\n (BSERVDEV-8489) NULL 3.5.3 NULL NULL 1536656705
BSERVDEV-16024-6 spetrucev liquibase/r5_4/upgrade.xml 2017-11-24 16:17:38 568 EXECUTED 7:b5fc7c0f1a2331d051942bf9bbb70b99 dropTable tableName=sta_comment Drop the deprecated sta_comment table, which was replaced by bb_comment in 5.0 (BSERVDEV-8489) NULL 3.5.3 NULL NULL 1536656705
BSERVDEV-16024-7 spetrucev liquibase/r5_4/upgrade.xml 2017-11-24 16:17:38 569 EXECUTED 7:d55ab2526b463bc7dce08761fe1c05eb delete tableName=id_sequence; delete tableName=id_sequence Drop ID sequences for legacy comment tables NULL 3.5.3 NULL NULL 1536656705
BSERV-9918-1 jpalacios liquibase/r5_0/upgrade.xml 2017-11-24 16:17:37 553 MARK_RAN 7:d7f5916d2a1bfd76841aa8f2c226781c sql Create comment threads for commit general comments NULL 3.5.3 NULL NULL 1536656705
BSERVDEV-14855-1 jthomas liquibase/r5_2/upgrade.xml 2017-11-24 16:17:37 558 EXECUTED 7:297c7d42d32e13197b0dba3f2fdd73dc addColumn tableName=sta_repo_hook; addForeignKeyConstraint baseTableName=sta_repo_hook, constraintName=fk_sta_repo_hook_proj, referencedTableName=project Add project column to repository hooks NULL 3.5.3 NULL NULL 1536656705
BSERVDEV-14855-2 jthomas liquibase/r5_2/upgrade.xml 2017-11-24 16:17:37 559 EXECUTED 7:965e6166dafbb993abfafbedd769556f dropNotNullConstraint columnName=repository_id, tableName=sta_repo_hook Drop not null constraint on repository_id NULL 3.5.3 NULL NULL 1536656705
BSERVDEV-14855-3 jthomas liquibase/r5_2/upgrade.xml 2017-11-24 16:17:37 560 EXECUTED 7:567be77b9f4e8be04c8de11b3399817c createIndex indexName=idx_sta_repo_hook_proj_id, tableName=sta_repo_hook Create a index on project_id NULL 3.5.3 NULL NULL 1536656705
BSERVDEV-14855-4 jthomas liquibase/r5_2/upgrade.xml 2017-11-24 16:17:37 561 EXECUTED 7:f447c065144714c3efa386aaa0d55da3 dropUniqueConstraint constraintName=uq_sta_repo_hook_repo_hook_key, tableName=sta_repo_hook Drop existing unique constraint on repository_id NULL 3.5.3 NULL NULL 1536656705
BSERVDEV-14855-5 jthomas liquibase/r5_2/upgrade.xml 2017-11-24 16:17:37 562 EXECUTED 7:caa7126c69f040cecd34ef60262e3353 addUniqueConstraint constraintName=uq_sta_repo_hook_scope_hook, tableName=sta_repo_hook Add unique constraint on project_id, repository_id and hook_key NULL 3.5.3 NULL NULL 1536656705
BSERVDEV-15569-1 fhaehnel liquibase/r5_0/p05.xml 2017-11-24 16:17:37 554 EXECUTED 7:fe364159735d0bba31bb7341c0da9132 dropForeignKeyConstraint baseTableName=sta_cmt_disc_comment_anchor, constraintName=fk_sta_cmt_disc_com_anc_disc NULL 3.5.3 NULL NULL 1536656705
BSERVDEV-15569-2 fhaehnel liquibase/r5_0/p05.xml 2017-11-24 16:17:37 555 EXECUTED 7:12f005299f20b77de26404863438281c sql De-duplicate pull request commit-level review comment activities.\n During the 5.0 migration, we failed to differentiate between Commit comment activities (with no pull request)\n and Pull request commit comment activities; we ... NULL 3.5.3 NULL NULL 1536656705
BSERVDEV-15989-1 pathompson liquibase/r2_2/m01.xml 2017-11-24 16:17:37 549 MARK_RAN 7:2996486130b8365d0a458960fd43180f dropForeignKeyConstraint baseTableName=cwd_application_address, constraintName=FK_APPLICATION_ADDRESS The foreign key between cwd_application_address and cwd_application is using the primary key as the basis\n for the index on the side of cwd_application_address. Therefore we have to drop the foreign key relationship\n while we... NULL 3.5.3 NULL NULL 1536656705
BSERVDEV-15989-2 pathompson liquibase/r2_2/m01.xml 2017-11-24 16:17:37 550 MARK_RAN 7:be587088faf7a64165ea129b93013e7c dropPrimaryKey constraintName=SYS_PK_10100, tableName=cwd_application_address remote_address_binary and remote_address_mask are part of the primary key for cwd_application_address,\n so the primary key must be dropped before the columns are dropped. NULL 3.5.3 NULL NULL 1536656705
BSERVDEV-15989-3 pathompson liquibase/r2_2/m01.xml 2017-11-24 16:17:37 551 MARK_RAN 7:0f14233816fbc85f0b5de74e8ea6fb47 addPrimaryKey constraintName=SYS_PK_10100, tableName=cwd_application_address Recreate the primary key on cwd_application_address now that the binary and mask columns have been dropped. NULL 3.5.3 NULL NULL 1536656705
BSERVDEV-15989-4 pathompson liquibase/r2_2/m01.xml 2017-11-24 16:17:37 552 MARK_RAN 7:0cd5e6edc066d995137f7804ebba0493 addForeignKeyConstraint baseTableName=cwd_application_address, constraintName=fk_application_address, referencedTableName=cwd_application Mysql was using the primary key as the basis for the foreign key relationship, so we have to remove it\n and then recreate it after the primary key comes back. NULL 3.5.3 NULL NULL 1536656705
BSERVDEV-15994-1 spetrucev liquibase/r5_0/p08.xml 2017-11-24 16:17:37 556 EXECUTED 7:c08396b1675f69fe227d5cf76aee68e6 dropForeignKeyConstraint baseTableName=sta_comment, constraintName=fk_sta_comment_parent Dropping FK constraints on deprecated comment tables to prevent non-monotonic comment rows from\n interfering with database restores and migrations (see BSERVDEV-8452 also) NULL 3.5.3 NULL NULL 1536656705
BSERVDEV-15994-2 spetrucev liquibase/r5_0/p08.xml 2017-11-24 16:17:37 557 EXECUTED 7:2f8acd62b8a4fa63cb91d190d48b89c8 dropForeignKeyConstraint baseTableName=sta_comment, constraintName=fk_sta_comment_root Dropping FK constraints on deprecated comment tables to prevent non-monotonic comment rows from\n interfering with database restores and migrations (see BSERVDEV-8452 also) NULL 3.5.3 NULL NULL 1536656705
BSERVDEV-16024-1 spetrucev liquibase/r5_4/upgrade.xml 2017-11-24 16:17:37 563 EXECUTED 7:b73c00a3a0633a37ca6a38131ef5dc03 dropTable tableName=sta_cmt_disc_comment_activity Drop the deprecated sta_cmt_disc_comment_activity table, which was replaced by bb_cmt_disc_comment_activity\n in 5.0 (BSERVDEV-8489) NULL 3.5.3 NULL NULL 1536656705
BSERVDEV-16024-2 spetrucev liquibase/r5_4/upgrade.xml 2017-11-24 16:17:37 564 EXECUTED 7:617f02b56c52595441f81188e2bf8efd dropTable tableName=sta_pr_comment_activity Drop the deprecated sta_pr_comment_activity table, which was replaced by bb_pr_comment_activity in 5.0\n (BSERVDEV-8489) NULL 3.5.3 NULL NULL 1536656705
BSERVDEV-16024-3 spetrucev liquibase/r5_4/upgrade.xml 2017-11-24 16:17:37 565 EXECUTED 7:ecab1b0cdd5acc73a458a76fa94846df dropTable tableName=sta_cmt_disc_comment_anchor Drop the deprecated sta_cmt_disc_comment_anchor table, which was replaced by bb_comment_thread in 5.0\n (BSERVDEV-8489) NULL 3.5.3 NULL NULL 1536656705


I'm not sure that restoring from a backup is possible. We have been experiencing this issue for a while (I have not had time to investigate until now) and there has been much activity on our repositories since then so if restoring the home directory would revert this I do not think that is possible.

Upgrade this instance so that the database schema will match the expected structure again.

Do you mean just update BitBucket as per these instructions: https://confluence.atlassian.com/bitbucketserver/bitbucket-server-upgrade-guide-776640551.html? If so, I have already tried this (we are running Bitbucket 5.11.1 now) but this has not fixed the issue.

Caterina Curti
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 13, 2018

Hi @Joshua Collins,

 

I see. Since the upgrade to 5.11.1 did not help, can you please also share the following?

The output of this query:

SELECT * FROM plugin_setting WHERE key_name like '%AO_6978BB%'

The table structure (in particular the available columns) of the following table:

AO_6978BB_RESTRICTED_REF
Joshua Collins June 13, 2018

Hi Caterina,

 

Here is the output of the first query:

+---------------------------+-------------+-----------+-----+
| namespace | key_name | key_value | id |
+---------------------------+-------------+-----------+-----+
| bitbucket.global.settings | AO_6978BB_# | 2 | 466 |
+---------------------------+-------------+-----------+-----+

 

And the output of running

show columns from AO_6978BB_RESTRICTED_REF

 Is:

+------------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------------+--------------+------+-----+---------+----------------+
| REF_ID | int(11) | NO | PRI | NULL | auto_increment |
| REF_TYPE | varchar(255) | NO | MUL | NULL | |
| REF_VALUE | varchar(255) | NO | MUL | NULL | |
| RESTRICTION_TYPE | varchar(255) | NO | | NULL | |
| SCOPE_TYPE | varchar(255) | NO | | NULL | |
| RESOURCE_ID | int(11) | NO | MUL | NULL | |
| REPOSITORY_ID | int(11) | NO | | NULL | |
+------------------+--------------+------+-----+---------+----------------+
Caterina Curti
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 13, 2018

This is very interesting, the REPOSITORY_ID column should have been removed as part of the 5.4+ upgrade.

 

Can you check if there are any values?

Joshua Collins June 13, 2018

Hi Caterina,

 

Here is the output from running

select REPOSITORY_ID from AO_6978BB_RESTRICTED_REF
 +---------------+
| REPOSITORY_ID |
+---------------+
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
+---------------+
Caterina Curti
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 14, 2018

Hi @Joshua Collins,

 

Let me start by saying that this is an exception and we don't support database changes to the Bitbucket Server schema. However, I discussed this with the developers and under the current circumstances, to resolve the problem we will need to drop that column.

 

For anyone else reading this, the following instructions only apply if:

- the stack trace matches exactly

- the Bitbucket Server version is 5.11.1

- the table structure matches exactly the above

- all REPOSITORY_ID values are 0

 

Here is what we need to do:

  1. take a full back up of Bitbucket Server (instructions are here). This is just in case we need to perform a restore.
  2. Stop Bitbucket Server
  3. Drop the REPOSITORY_ID column
  4. Start Bitbucket Server
  5. Validate that everything is working as expected (including branch permissions)

 

This is not related to this issue, but can you also check if there is a REPOSITORY_ID column in the AO_9DEC2A_PR_CONDITION table?

 

Cheers,

Caterina

Like Steven F Behnke likes this
Joshua Collins June 14, 2018

Hi Caterina,

 

Thank you very much for your support. The issue seems to be resolved now!

 

I have confirmed that the REPOSITORY_ID is indeed also present in the AO_9DEC2A_PR_CONDITION table. However this table does not seem to have any entries for REPOSITORY_ID.

 

If I can provide any more information to help you identify why the REPOSITORY_ID was not removed as part of the update (logs etc) please let me know.

 

Cheers,

Josh

Caterina Curti
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 20, 2018

Hi @Joshua Collins,

Let's fix also the AO_9DEC2A_PR_CONDITION table then.

 

As mentioned above, for anyone else reading this, the following instructions only apply if:

- the Bitbucket Server version is 5.11.1

- the AO_9DEC2A_PR_CONDITION table contains a REPOSITORY_ID column

- all REPOSITORY_ID values are 0/empty

 

Here is what we need to do:

  1. take a full back up of Bitbucket Server (instructions are here). This is just in case we need to perform a restore.
  2. Stop Bitbucket Server
  3. Drop the REPOSITORY_ID column from the AO_9DEC2A_PR_CONDITION
  4. Start Bitbucket Server
  5. Validate that everything is working as expected (including the Default reviewers feature, which is controlled by this table)

 

Cheers,

Caterina

Like Steven F Behnke likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events