Exemplo n.º 1
0
  protected void setUp() throws DatabaseException, IOException {

    /* Remove files to start with a clean slate. */
    TestUtils.removeFiles("Setup", envHome, FileManager.JE_SUFFIX);

    EnvironmentConfig envConfig = TestUtils.initEnvConfig();
    DbInternal.disableParameterValidation(envConfig);
    envConfig.setConfigParam(
        EnvironmentParams.LOG_FILE_MAX.getName(), new Integer(FILE_SIZE).toString());
    /* Yank the cache size way down. */
    envConfig.setConfigParam(EnvironmentParams.LOG_FILE_CACHE_SIZE.getName(), "3");
    envConfig.setAllowCreate(true);
    envImpl = new EnvironmentImpl(envHome, envConfig);

    /* Make a standalone file manager for this test. */
    envImpl.close();
    envImpl.open(); /* Just sets state to OPEN. */
    fileManager = new FileManager(envImpl, envHome, false);

    /*
     * Remove any files after the environment is created again!  We want to
     * remove the files made by recovery, so we can test the file manager
     * in controlled cases.
     */
    TestUtils.removeFiles("Setup", envHome, FileManager.JE_SUFFIX);
  }
  private EnvironmentConfig makeEnvConfig() {

    EnvironmentConfig envConfig = new EnvironmentConfig();
    envConfig.setAllowCreate(true);
    envConfig.setTransactional(true);
    DbInternal.disableParameterValidation(envConfig);
    envConfig.setConfigParam(EnvironmentParams.LOG_FILE_MAX.getName(), "10000");
    /* Control cleaning explicitly. */
    envConfig.setConfigParam(EnvironmentParams.ENV_RUN_CLEANER.getName(), "false");
    return envConfig;
  }
  private void configureForMaxCleaning(int size) {
    for (int i = 0; i < size; i++) {

      /*
       * Obsolete right away for test purposes, so that the max CBVLSN
       * is effectively the global CBVLSN
       */
      repEnvInfo[i].getRepConfig().setConfigParam(RepParams.REP_STREAM_TIMEOUT.getName(), "0");

      repEnvInfo[i].getRepConfig().setConfigParam(RepParams.MIN_RETAINED_VLSNS.getName(), "100");

      /* Make it easy to create cleaner fodder. */
      repEnvInfo[i]
          .getEnvConfig()
          .setConfigParam(EnvironmentParams.LOG_FILE_MAX.getName(), "10000");
      repEnvInfo[i]
          .getEnvConfig()
          .setConfigParam(EnvironmentParams.CLEANER_MIN_UTILIZATION.getName(), "90");
      repEnvInfo[i]
          .getEnvConfig()
          .setConfigParam(EnvironmentParams.CLEANER_MIN_FILE_UTILIZATION.getName(), "90");
    }
  }