@Test
  public void useOldVSpecInducesExpectedFailure() throws Exception {
    VolumeSpecification volumeSpec;
    final Configuration configuration = _persistit.getConfiguration();
    _persistit.close();
    int remainingJournalFiles = 0;
    configuration.setUseOldVSpec(true);

    for (int i = 5; --i >= 0; ) {
      final Persistit db = new Persistit(_config);
      try {
        volumeSpec =
            new VolumeSpecification(
                DATA_PATH + "/hwdemo" + i, null, 16384, 1, 1000, 1, true, false, false);
        db.loadVolume(volumeSpec);
        final Exchange dbex = db.getExchange("hwdemo" + i, "greetings", true);
        dbex.getKey().append("Hello");
        dbex.getValue().put("World");
        dbex.store();
        dbex.getKey().to(Key.BEFORE);
        db.releaseExchange(dbex);
      } finally {
        if (i == 0) {
          db.copyBackPages();
        }
        remainingJournalFiles = db.getJournalManager().getJournalFileCount();
        db.close();
      }
    }
    assertTrue("Should be only one remaining journal file", remainingJournalFiles > 1);
  }
예제 #2
0
 @Override
 public JournalInfo getJournalInfo() {
   final JournalInfo info = new JournalInfo();
   _persistit.getJournalManager().populateJournalInfo(info);
   return info;
 }
예제 #3
0
 /**
  * Controls whether Persistit copies page from the journal back to their volumes as fast as
  * possible. Copying consumes disk I/O operations, so normally the copier thread pauses between
  * copy operations to avoid saturating the disk. Once all pages have been copied, the fast copying
  * flag is automatically turned off.
  *
  * @param fast <code>true</code> to copy pages at maximum speed.
  * @throws RemoteException
  */
 @Override
 public void setJournalCopyingFast(final boolean fast) throws RemoteException {
   _persistit.getJournalManager().setCopyingFast(fast);
 }
예제 #4
0
 /**
  * Controls whether Persistit will suspend the thread that copies pages from the journal back to
  * their respective Volumes. This flag is used by tools that provide on-line backup.
  *
  * @param suspended <code>true</code> to specify that Persistit will suspend journal copying;
  *     otherwise <code>false</code>.
  */
 @Override
 public void setAppendOnly(final boolean suspended) {
   _persistit.getJournalManager().setAppendOnly(suspended);
 }