Search in sources :

Example 1 with FileBackupStore

use of com.facebook.presto.raptor.backup.FileBackupStore in project presto by prestodb.

the class TestOrcStorageManager method createOrcStorageManager.

public static OrcStorageManager createOrcStorageManager(IDBI dbi, File temporary, int maxShardRows) {
    URI directory = new File(temporary, "data").toURI();
    StorageService storageService = new LocalFileStorageService(new LocalOrcDataEnvironment(), 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 LocalOrcDataEnvironment(), new TestingNodeManager(), shardManager, MISSING_SHARD_DISCOVERY, 10);
    return createOrcStorageManager(storageService, backupStore, recoveryManager, new InMemoryShardRecorder(), maxShardRows, MAX_FILE_SIZE);
}
Also used : FileBackupStore(com.facebook.presto.raptor.backup.FileBackupStore) FileBackupStore(com.facebook.presto.raptor.backup.FileBackupStore) BackupStore(com.facebook.presto.raptor.backup.BackupStore) TestingNodeManager(com.facebook.presto.testing.TestingNodeManager) LocalOrcDataEnvironment(com.facebook.presto.raptor.filesystem.LocalOrcDataEnvironment) ShardManager(com.facebook.presto.raptor.metadata.ShardManager) TestDatabaseShardManager.createShardManager(com.facebook.presto.raptor.metadata.TestDatabaseShardManager.createShardManager) URI(java.net.URI) FileAssert.assertFile(org.testng.FileAssert.assertFile) File(java.io.File) LocalFileStorageService(com.facebook.presto.raptor.filesystem.LocalFileStorageService) LocalFileStorageService(com.facebook.presto.raptor.filesystem.LocalFileStorageService)

Example 2 with FileBackupStore

use of com.facebook.presto.raptor.backup.FileBackupStore in project presto by prestodb.

the class TestShardCleaner method setup.

@BeforeMethod
public void setup() {
    dbi = new DBI("jdbc:h2:mem:test" + System.nanoTime() + "_" + ThreadLocalRandom.current().nextInt());
    dummyHandle = dbi.open();
    createTablesWithRetry(dbi);
    temporary = createTempDir();
    File directory = new File(temporary, "data");
    storageService = new LocalFileStorageService(new LocalOrcDataEnvironment(), directory.toURI());
    storageService.start();
    File backupDirectory = new File(temporary, "backup");
    backupStore = new FileBackupStore(backupDirectory);
    ((FileBackupStore) backupStore).start();
    ticker = new TestingTicker();
    ShardCleanerConfig config = new ShardCleanerConfig();
    cleaner = new ShardCleaner(new DaoSupplier<>(dbi, H2ShardDao.class), "node1", true, ticker, storageService, Optional.of(backupStore), new LocalOrcDataEnvironment(), config.getMaxTransactionAge(), config.getTransactionCleanerInterval(), config.getLocalCleanerInterval(), config.getLocalCleanTime(), config.getBackupCleanerInterval(), config.getBackupCleanTime(), config.getBackupDeletionThreads(), config.getMaxCompletedTransactionAge());
}
Also used : FileBackupStore(com.facebook.presto.raptor.backup.FileBackupStore) TestingTicker(com.facebook.airlift.testing.TestingTicker) LocalOrcDataEnvironment(com.facebook.presto.raptor.filesystem.LocalOrcDataEnvironment) IDBI(org.skife.jdbi.v2.IDBI) DBI(org.skife.jdbi.v2.DBI) DaoSupplier(com.facebook.presto.raptor.util.DaoSupplier) File(java.io.File) LocalFileStorageService(com.facebook.presto.raptor.filesystem.LocalFileStorageService) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 3 with FileBackupStore

use of com.facebook.presto.raptor.backup.FileBackupStore in project presto by prestodb.

the class TestOrcStorageManager method setup.

@BeforeMethod
public void setup() {
    temporary = createTempDir();
    URI directory = new File(temporary, "data").toURI();
    storageService = new LocalFileStorageService(new LocalOrcDataEnvironment(), 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() + "_" + ThreadLocalRandom.current().nextInt());
    dummyHandle = dbi.open();
    createTablesWithRetry(dbi);
    ShardManager shardManager = createShardManager(dbi);
    Duration discoveryInterval = new Duration(5, TimeUnit.MINUTES);
    recoveryManager = new ShardRecoveryManager(storageService, backupStore, new LocalOrcDataEnvironment(), nodeManager, shardManager, discoveryInterval, 10);
    shardRecorder = new InMemoryShardRecorder();
}
Also used : IDBI(org.skife.jdbi.v2.IDBI) FileBackupStore(com.facebook.presto.raptor.backup.FileBackupStore) LocalOrcDataEnvironment(com.facebook.presto.raptor.filesystem.LocalOrcDataEnvironment) DBI(org.skife.jdbi.v2.DBI) IDBI(org.skife.jdbi.v2.IDBI) ShardManager(com.facebook.presto.raptor.metadata.ShardManager) TestDatabaseShardManager.createShardManager(com.facebook.presto.raptor.metadata.TestDatabaseShardManager.createShardManager) Duration(io.airlift.units.Duration) URI(java.net.URI) FileAssert.assertFile(org.testng.FileAssert.assertFile) File(java.io.File) LocalFileStorageService(com.facebook.presto.raptor.filesystem.LocalFileStorageService) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 4 with FileBackupStore

use of com.facebook.presto.raptor.backup.FileBackupStore in project presto by prestodb.

the class TestShardRecovery method setup.

@BeforeMethod
public void setup() {
    temporary = createTempDir();
    File directory = new File(temporary, "data");
    File backupDirectory = new File(temporary, "backup");
    backupStore = new FileBackupStore(backupDirectory);
    backupStore.start();
    storageService = new LocalFileStorageService(new LocalOrcDataEnvironment(), directory.toURI());
    storageService.start();
    IDBI dbi = new DBI("jdbc:h2:mem:test" + System.nanoTime() + "_" + ThreadLocalRandom.current().nextInt());
    dummyHandle = dbi.open();
    createTablesWithRetry(dbi);
    ShardManager shardManager = createShardManager(dbi);
    recoveryManager = createShardRecoveryManager(storageService, Optional.of(backupStore), shardManager);
}
Also used : IDBI(org.skife.jdbi.v2.IDBI) FileBackupStore(com.facebook.presto.raptor.backup.FileBackupStore) LocalOrcDataEnvironment(com.facebook.presto.raptor.filesystem.LocalOrcDataEnvironment) IDBI(org.skife.jdbi.v2.IDBI) DBI(org.skife.jdbi.v2.DBI) ShardManager(com.facebook.presto.raptor.metadata.ShardManager) TestDatabaseShardManager.createShardManager(com.facebook.presto.raptor.metadata.TestDatabaseShardManager.createShardManager) File.createTempFile(java.io.File.createTempFile) File(java.io.File) LocalFileStorageService(com.facebook.presto.raptor.filesystem.LocalFileStorageService) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

FileBackupStore (com.facebook.presto.raptor.backup.FileBackupStore)4 LocalFileStorageService (com.facebook.presto.raptor.filesystem.LocalFileStorageService)4 LocalOrcDataEnvironment (com.facebook.presto.raptor.filesystem.LocalOrcDataEnvironment)4 File (java.io.File)4 ShardManager (com.facebook.presto.raptor.metadata.ShardManager)3 TestDatabaseShardManager.createShardManager (com.facebook.presto.raptor.metadata.TestDatabaseShardManager.createShardManager)3 DBI (org.skife.jdbi.v2.DBI)3 IDBI (org.skife.jdbi.v2.IDBI)3 BeforeMethod (org.testng.annotations.BeforeMethod)3 URI (java.net.URI)2 FileAssert.assertFile (org.testng.FileAssert.assertFile)2 TestingTicker (com.facebook.airlift.testing.TestingTicker)1 BackupStore (com.facebook.presto.raptor.backup.BackupStore)1 DaoSupplier (com.facebook.presto.raptor.util.DaoSupplier)1 TestingNodeManager (com.facebook.presto.testing.TestingNodeManager)1 Duration (io.airlift.units.Duration)1 File.createTempFile (java.io.File.createTempFile)1