예제 #1
0
  public static OrcStorageManager createOrcStorageManager(
      IDBI dbi, File temporary, int maxShardRows) throws IOException {
    File directory = new File(temporary, "data");
    StorageService storageService = new FileStorageService(directory);
    storageService.start();

    File backupDirectory = new File(temporary, "backup");
    FileBackupStore fileBackupStore = new FileBackupStore(backupDirectory);
    fileBackupStore.start();
    Optional<BackupStore> backupStore = Optional.of(fileBackupStore);

    ShardManager shardManager = createShardManager(dbi);
    ShardRecoveryManager recoveryManager =
        new ShardRecoveryManager(
            storageService,
            backupStore,
            new TestingNodeManager(),
            shardManager,
            MISSING_SHARD_DISCOVERY,
            10);
    return createOrcStorageManager(
        storageService,
        backupStore,
        recoveryManager,
        new InMemoryShardRecorder(),
        maxShardRows,
        MAX_FILE_SIZE);
  }
예제 #2
0
  @BeforeMethod
  public void setup() throws Exception {
    temporary = createTempDir();
    File directory = new File(temporary, "data");
    storageService = new FileStorageService(directory);
    storageService.start();

    File backupDirectory = new File(temporary, "backup");
    fileBackupStore = new FileBackupStore(backupDirectory);
    fileBackupStore.start();
    backupStore = Optional.of(fileBackupStore);

    IDBI dbi = new DBI("jdbc:h2:mem:test" + System.nanoTime());
    dummyHandle = dbi.open();
    ShardManager shardManager = createShardManager(dbi);
    Duration discoveryInterval = new Duration(5, TimeUnit.MINUTES);
    recoveryManager =
        new ShardRecoveryManager(
            storageService, backupStore, nodeManager, shardManager, discoveryInterval, 10);

    shardRecorder = new InMemoryShardRecorder();
  }