Search in sources :

Example 1 with LocalFileStorageService

use of com.facebook.presto.raptor.filesystem.LocalFileStorageService 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 LocalFileStorageService

use of com.facebook.presto.raptor.filesystem.LocalFileStorageService in project presto by prestodb.

the class TestShardEjector method setup.

@BeforeMethod
public void setup() {
    dbi = new DBI("jdbc:h2:mem:test" + System.nanoTime() + "_" + ThreadLocalRandom.current().nextInt());
    dummyHandle = dbi.open();
    createTablesWithRetry(dbi);
    shardManager = createShardManager(dbi);
    dataDir = createTempDir();
    storageService = new LocalFileStorageService(new LocalOrcDataEnvironment(), dataDir.toURI());
    storageService.start();
}
Also used : LocalOrcDataEnvironment(com.facebook.presto.raptor.filesystem.LocalOrcDataEnvironment) IDBI(org.skife.jdbi.v2.IDBI) DBI(org.skife.jdbi.v2.DBI) LocalFileStorageService(com.facebook.presto.raptor.filesystem.LocalFileStorageService) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 3 with LocalFileStorageService

use of com.facebook.presto.raptor.filesystem.LocalFileStorageService 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 4 with LocalFileStorageService

use of com.facebook.presto.raptor.filesystem.LocalFileStorageService in project presto by prestodb.

the class TestLocalFileStorageService method setup.

@BeforeMethod
public void setup() {
    temporary = createTempDir();
    store = new LocalFileStorageService(new LocalOrcDataEnvironment(), temporary.toURI());
    store.start();
}
Also used : LocalOrcDataEnvironment(com.facebook.presto.raptor.filesystem.LocalOrcDataEnvironment) LocalFileStorageService(com.facebook.presto.raptor.filesystem.LocalFileStorageService) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 5 with LocalFileStorageService

use of com.facebook.presto.raptor.filesystem.LocalFileStorageService 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)

Aggregations

LocalFileStorageService (com.facebook.presto.raptor.filesystem.LocalFileStorageService)7 LocalOrcDataEnvironment (com.facebook.presto.raptor.filesystem.LocalOrcDataEnvironment)7 BeforeMethod (org.testng.annotations.BeforeMethod)6 File (java.io.File)5 FileBackupStore (com.facebook.presto.raptor.backup.FileBackupStore)4 DBI (org.skife.jdbi.v2.DBI)4 IDBI (org.skife.jdbi.v2.IDBI)4 ShardManager (com.facebook.presto.raptor.metadata.ShardManager)3 TestDatabaseShardManager.createShardManager (com.facebook.presto.raptor.metadata.TestDatabaseShardManager.createShardManager)3 FileAssert.assertFile (org.testng.FileAssert.assertFile)3 URI (java.net.URI)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 RandomAccessFile (java.io.RandomAccessFile)1