如何修复JetBrains Xodus数据库损坏的完整性?

时间:2018-07-13 12:19:19

标签: jetbrains-ide youtrack xodus

背景:我们的YouTrack数据库已损坏。相关的错误报告在此处:https://youtrack.jetbrains.com/issue/JT-48235#comment=27-2952375现在,我正在尝试修复YouTrack内部使用的Xodus数据库的损坏状态。

问题:数据库包含具有已删除实体链接的实体。我的问题是:如何删除或修复这些断开的链接?

关闭YouTrack后,我使用Xodus Entity Browser检查数据库。

我想出了两种可能的解决方案:

  1. 重新创建已删除的实体。在我的情况下是Sprint[86-191]。这是行不通的,因为创建新实体不允许我再次选择编号191。相反,它创建了Sprint[86-208]
  2. 删除断开的链接。无法工作,因为为了删除链接,Xodus期望数据库的一致性导致以下堆栈跟踪:
jetbrains.xodus.browser.web.EntityNotFoundException: jetbrains.exodus.entitystore.EntityRemovedInDatabaseException: Sprint was removed.                                                       
        at jetbrains.xodus.browser.web.db.StoreService.getEntity(StoreService.kt:204) ~[xodus-entity-browser.jar:na]                                                                          
        at jetbrains.xodus.browser.web.db.StoreService.access$getEntity(StoreService.kt:14) ~[xodus-entity-browser.jar:na]                                                                    
        at jetbrains.xodus.browser.web.db.StoreService$getEntity$1.invoke(StoreService.kt:168) ~[xodus-entity-browser.jar:na]                                                                 
        at jetbrains.xodus.browser.web.db.StoreService$getEntity$1.invoke(StoreService.kt:14) ~[xodus-entity-browser.jar:na]                                                                  
        at jetbrains.xodus.browser.web.db.StoreServiceKt$transactional$1.compute(StoreService.kt:229) ~[xodus-entity-browser.jar:na]                                                          
        at jetbrains.exodus.entitystore.PersistentEntityStoreImpl.computeInTransaction(PersistentEntityStoreImpl.java:596) ~[xodus-entity-browser.jar:na]                                     
        at jetbrains.xodus.browser.web.db.StoreServiceKt.transactional(StoreService.kt:229) ~[xodus-entity-browser.jar:na]                                                                    
        at jetbrains.xodus.browser.web.db.StoreService.transactional(StoreService.kt:218) ~[xodus-entity-browser.jar:na]                                                                      
        at jetbrains.xodus.browser.web.db.StoreService.getEntity(StoreService.kt:167) ~[xodus-entity-browser.jar:na]                                                                          
        at jetbrains.xodus.browser.web.resources.Entities$registerRouting$1$2.invoke(Entities.kt:37) ~[xodus-entity-browser.jar:na]                                                           
        at jetbrains.xodus.browser.web.resources.Entities$registerRouting$1$2.invoke(Entities.kt:10) ~[xodus-entity-browser.jar:na]                                                           
        at jetbrains.xodus.browser.web.WebConfigKt$safeGet$1.invoke(WebConfig.kt:61) ~[xodus-entity-browser.jar:na]                                                                           
        at jetbrains.xodus.browser.web.WebConfigKt$safeGet$1.invoke(WebConfig.kt) ~[xodus-entity-browser.jar:na]                                                                              
        at spark.kotlin.Http$get$1.handle(Http.kt:560) ~[xodus-entity-browser.jar:na]
        at spark.RouteImpl$1.handle(RouteImpl.java:72) ~[xodus-entity-browser.jar:na]
        at spark.http.matching.Routes.execute(Routes.java:61) ~[xodus-entity-browser.jar:na]
        at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:130) ~[xodus-entity-browser.jar:na]                                                                                  
        at spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50) [xodus-entity-browser.jar:na]                                                                               
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1568) [xodus-entity-browser.jar:na]                                                                    
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [xodus-entity-browser.jar:na]                                                                        
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) [xodus-entity-browser.jar:na]                                                                      
        at org.eclipse.jetty.server.Server.handle(Server.java:564) [xodus-entity-browser.jar:na]                                                                                              
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317) [xodus-entity-browser.jar:na]                                                                                    
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) [xodus-entity-browser.jar:na]                                                                          
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279) [xodus-entity-browser.jar:na]                                                          
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110) [xodus-entity-browser.jar:na]                                                                                    
        at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124) [xodus-entity-browser.jar:na]                                                                                 
        at org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:128) [xodus-entity-browser.jar:na]                                                                          
        at org.eclipse.jetty.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222) [xodus-entity-browser.jar:na]                                                                 
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294) [xodus-entity-browser.jar:na]                                                             
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:199) [xodus-entity-browser.jar:na]                                                                   
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:673) [xodus-entity-browser.jar:na]                                                                     
        at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:591) [xodus-entity-browser.jar:na]                                                                      
        at java.lang.Thread.run(Thread.java:748) [na:1.8.0_171]
Caused by: jetbrains.exodus.entitystore.EntityRemovedInDatabaseException: Sprint was removed.
        at jetbrains.exodus.entitystore.PersistentStoreTransaction.getEntity(PersistentStoreTransaction.java:276) ~[xodus-entity-browser.jar:na]                                              
        at jetbrains.xodus.browser.web.db.StoreService.getEntity(StoreService.kt:201) ~[xodus-entity-browser.jar:na]                                                                          
        ... 33 common frames omitted

有没有办法解决这种损坏的状态?

1 个答案:

答案 0 :(得分:2)

使用Java参数-Dexodus.entityStore.refactoring.heavyLinks=true启动YouTrack。您无需在每次启动时都强制进行此重构。