@BreakpointHandler("removeProperty")
 public static void handleRemoveProperty(
     @BreakpointHandler("commitPropertyMaps") BreakPoint exitCommit, DebugInterface di) {
   if (readerThread == null) {
     removerThread = di.thread().suspend(null);
   }
   exitCommit.enable();
 }
 @BreakpointHandler("setProperties")
 public static void handleSetProperties(BreakPoint self, DebugInterface di) {
   self.disable();
   if (removerThread != null) {
     removerThread.resume();
     removerThread = null;
   }
   readerThread = di.thread().suspend(DebuggerDeadlockCallback.RESUME_THREAD);
 }
 @BreakpointHandler("readNextChunk")
 public static void onReadNextChunk(BreakPoint self, DebugInterface di) throws Exception {
   // Check because the interfering thread will trigger this too
   if (txCopyingThread != null && di.thread().name().equals(txCopyingThread.name())) {
     txCopyingThread.suspend(null);
     interferingThread.resume();
     self.disable();
   }
 }
 @BreakpointHandler("makeSureNextTransactionIsFullyFetched")
 public static void onStartingStoreCopy(
     BreakPoint self,
     DebugInterface di,
     @BreakpointHandler("readNextChunk") BreakPoint onReadNextChunk)
     throws Exception {
   // Wait for the other thread to recycle the channel
   latch.await();
   txCopyingThread = di.thread();
   self.disable();
 }
Beispiel #5
0
  /*
   * 1) Do a 2PC transaction, crash when both resource have been prepared and txlog
   *    says "mark as committing" for that tx.
   * 2) Do recovery and then crash again.
   * 3) Do recovery and see so that all data is in there.
   * Also do an incremental backup just to make sure that the logs have gotten the
   * right records injected.
   */
  @Test
  public void crashAfter2PCMarkAsCommittingThenCrashAgainAndRecover() throws Exception {
    String backupDirectory = "target/var/backup-db";
    FileUtils.deleteRecursively(new File(backupDirectory));
    OnlineBackup.from(InetAddress.getLocalHost().getHostAddress()).full(backupDirectory);
    for (BreakPoint bp : breakpoints(0)) bp.enable();
    runInThread(new WriteTransaction());
    afterWrite.await();
    startSubprocesses();
    runInThread(new Crash());
    afterCrash.await();
    startSubprocesses();
    OnlineBackup.from(InetAddress.getLocalHost().getHostAddress()).incremental(backupDirectory);
    run(new Verification());

    GraphDatabaseAPI db =
        (GraphDatabaseAPI) new GraphDatabaseFactory().newEmbeddedDatabase(backupDirectory);
    try {
      new Verification().run(db);
    } finally {
      db.shutdown();
    }
  }
 @Test
 public void rotateLogAtTheSameTimeInitializeIndexWriters() throws Exception {
   run(new CreateInitialStateTask());
   restart();
   commitIndexWriter.enable();
   run(new LoadIndexesTask(2, false));
   RotateIndexLogTask rotateTask = new RotateIndexLogTask();
   runInThread(rotateTask);
   barrier1.await();
   run(new LoadIndexesTask(3, true));
   resumeFlushThread();
   barrier2.await();
   run(new Verifier());
 }
 @Override
 protected BreakPoint[] breakpoints(int id) {
   return new BreakPoint[] {commitIndexWriter, resumeFlushThread.enable(), done.enable()};
 }
 @BreakpointHandler(value = "commitPropertyMaps")
 public static void exitCommitPropertyMaps(BreakPoint self, DebugInterface di) {
   self.disable();
   readerThread.resume();
   readerThread = null;
 }
 @Override
 protected BreakPoint[] breakpoints(int id) {
   return new BreakPoint[] {
     doCommit, enableBreakPoint.enable(), resumeThread.enable(), done.enable()
   };
 }
 @Override
 protected void callback(DebugInterface debug) throws KillSubProcess {
   doCommit.enable();
 }