Database Corruption - Unable to complete delayed deletion

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

症状

We see this type of errors in the Bamboo logs:

2012-01-09 15:25:49,605 INFO [QuartzScheduler_Worker-6] [DeletionServiceImpl] Deleting 1 TopLevelPlan(s) marked for deletion
2012-01-09 15:25:49,605 INFO [QuartzScheduler_Worker-6] [DeletionServiceImpl] Deleting MMM-STSTST
2012-01-09 15:25:50,587 ERROR [QuartzScheduler_Worker-6] [DeletionServiceImpl] Unable to complete delayed deletion: 
com.google.common.collect.ComputationException: org.springframework.orm.hibernate.HibernateObjectRetrievalFailureException: No row with the given identifier exists: 5439505, of class: com.atlassian.bamboo.repository.RepositoryDefinitionEnt
ityImpl; nested exception is net.sf.hibernate.UnresolvableObjectException: No row with the given identifier exists: 5439505, of class: com.atlassian.bamboo.repository.RepositoryDefinitionEntityImpl
    at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.compute(ComputingConcurrentHashMap.java:167)
    at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.compute(ComputingConcurrentHashMap.java:116)
    at com.google.common.collect.ComputingConcurrentHashMap.apply(ComputingConcurrentHashMap.java:67)
    at com.google.common.collect.MapMaker$ComputingMapAdapter.get(MapMaker.java:623)
    at com.atlassian.bamboo.build.CachedBuildDefinitionManagerImpl.getBuildDefinition(CachedBuildDefinitionManagerImpl.java:59)
    at com.atlassian.bamboo.plan.AbstractPlan.getBuildDefinition(AbstractPlan.java:277)
    at com.atlassian.bamboo.schedule.DefaultPlanScheduler$1.run(DefaultPlanScheduler.java:30)
    at com.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:333)
    at com.atlassian.bamboo.schedule.DefaultPlanScheduler.removeSchedulingJobs(DefaultPlanScheduler.java:26)
    at com.atlassian.bamboo.deletion.DeletionServiceImpl$1$3.call(DeletionServiceImpl.java:399)
...
Caused by: org.springframework.orm.hibernate.HibernateObjectRetrievalFailureException: No row with the given identifier exists: 5439505, of class: com.atlassian.bamboo.repository.RepositoryDefinitionEntityImpl; nested exception is net.sf.h
ibernate.UnresolvableObjectException: No row with the given identifier exists: 5439505, of class: com.atlassian.bamboo.repository.RepositoryDefinitionEntityImpl
    at org.springframework.orm.hibernate.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:584)
    at org.springframework.orm.hibernate.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:353)
    at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:375)
    at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:337)
    at com.atlassian.bamboo.repository.PlanRepositoryLinkHibernateDao.getPlanRepositoryLinks(PlanRepositoryLinkHibernateDao.java:35)
    at com.atlassian.bamboo.repository.RepositoryDefinitionManagerImpl.getRepositoryDefinitionsForPlan(RepositoryDefinitionManagerImpl.java:58)
    at com.atlassian.bamboo.repository.RepositoryDefinitionManagerImpl.getRepositoryDefinitionMapForPlan(RepositoryDefinitionManagerImpl.java:79)
...
Caused by: net.sf.hibernate.UnresolvableObjectException: No row with the given identifier exists: 5439505, of class: com.atlassian.bamboo.repository.RepositoryDefinitionEntityImpl
    at net.sf.hibernate.UnresolvableObjectException.throwIfNull(UnresolvableObjectException.java:38)
    at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1962)
    at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:69)
    at net.sf.hibernate.type.EntityType.resolveIdentifier(EntityType.java:208)
    at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:2217)
    at net.sf.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:319)
    at net.sf.hibernate.loader.Loader.doQuery(Loader.java:309)
...

原因

Bamboo database runs deletion tasks on the background, and sometimes it fails causing database corruption.

ソリューション

The resolution of this type of database corruptions can be running SQL queries to delete the records from the database that refer to the fields that don't exist. This can be done by following the steps below:

  1. Run Bamboo, and see on which field it is failing (usually Bamboo shows the table names, column names and the names of the constraints involved)
  2. It might be a good idea to run a search on the whole DB dump file to see if the specified identifier exists, and in which tables.
  3. Shut down Bamboo,
  4. After making sure that you have a DB backup, delete the rows mentioned in the previous step.
  5. Start Bamboo, and if there are any other errors, go to step 1.

Each specific DB corruption case might be different - involving different tables. This SQL quires might be useful to clean the DB (make sure to use the correct ID mentioned in the Bamboo log in case you have exactly the same type of problem):

delete from PLAN_VCS_LOCATION where VCS_LOCATION_ID=5439505;
delete from build where build_id=2326531; 
最終更新日 2013 年 7 月 5 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.