Search in sources :

Example 1 with FileBackupStore

use of io.trino.plugin.raptor.legacy.backup.FileBackupStore in project trino by trinodb.

the class TestRaptorStorageManager method createRaptorStorageManager.

public static RaptorStorageManager createRaptorStorageManager(Jdbi dbi, File temporary, int maxShardRows) {
    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 createRaptorStorageManager(storageService, backupStore, recoveryManager, new InMemoryShardRecorder(), maxShardRows, MAX_FILE_SIZE);
}
Also used : FileBackupStore(io.trino.plugin.raptor.legacy.backup.FileBackupStore) BackupStore(io.trino.plugin.raptor.legacy.backup.BackupStore) FileBackupStore(io.trino.plugin.raptor.legacy.backup.FileBackupStore) TestingNodeManager(io.trino.testing.TestingNodeManager) TestDatabaseShardManager.createShardManager(io.trino.plugin.raptor.legacy.metadata.TestDatabaseShardManager.createShardManager) ShardManager(io.trino.plugin.raptor.legacy.metadata.ShardManager) FileAssert.assertFile(org.testng.FileAssert.assertFile) File(java.io.File)

Example 2 with FileBackupStore

use of io.trino.plugin.raptor.legacy.backup.FileBackupStore in project trino by trinodb.

the class TestRaptorStorageManager method setup.

@BeforeMethod
public void setup() throws IOException {
    temporary = createTempDirectory(null);
    File directory = temporary.resolve("data").toFile();
    storageService = new FileStorageService(directory);
    storageService.start();
    File backupDirectory = temporary.resolve("backup").toFile();
    fileBackupStore = new FileBackupStore(backupDirectory);
    fileBackupStore.start();
    backupStore = Optional.of(fileBackupStore);
    Jdbi dbi = createTestingJdbi();
    dummyHandle = dbi.open();
    createTablesWithRetry(dbi);
    ShardManager shardManager = createShardManager(dbi);
    Duration discoveryInterval = new Duration(5, TimeUnit.MINUTES);
    recoveryManager = new ShardRecoveryManager(storageService, backupStore, nodeManager, shardManager, discoveryInterval, 10);
    shardRecorder = new InMemoryShardRecorder();
}
Also used : FileBackupStore(io.trino.plugin.raptor.legacy.backup.FileBackupStore) DatabaseTesting.createTestingJdbi(io.trino.plugin.raptor.legacy.DatabaseTesting.createTestingJdbi) Jdbi(org.jdbi.v3.core.Jdbi) TestDatabaseShardManager.createShardManager(io.trino.plugin.raptor.legacy.metadata.TestDatabaseShardManager.createShardManager) ShardManager(io.trino.plugin.raptor.legacy.metadata.ShardManager) Duration(io.airlift.units.Duration) FileAssert.assertFile(org.testng.FileAssert.assertFile) File(java.io.File) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 3 with FileBackupStore

use of io.trino.plugin.raptor.legacy.backup.FileBackupStore in project trino by trinodb.

the class TestShardRecovery method setup.

@BeforeMethod
public void setup() throws IOException {
    temporary = createTempDirectory(null);
    File directory = temporary.resolve("data").toFile();
    File backupDirectory = temporary.resolve("backup").toFile();
    backupStore = new FileBackupStore(backupDirectory);
    backupStore.start();
    storageService = new FileStorageService(directory);
    storageService.start();
    Jdbi dbi = createTestingJdbi();
    dummyHandle = dbi.open();
    createTablesWithRetry(dbi);
    ShardManager shardManager = createShardManager(dbi);
    recoveryManager = createShardRecoveryManager(storageService, Optional.of(backupStore), shardManager);
}
Also used : FileBackupStore(io.trino.plugin.raptor.legacy.backup.FileBackupStore) DatabaseTesting.createTestingJdbi(io.trino.plugin.raptor.legacy.DatabaseTesting.createTestingJdbi) Jdbi(org.jdbi.v3.core.Jdbi) ShardManager(io.trino.plugin.raptor.legacy.metadata.ShardManager) TestDatabaseShardManager.createShardManager(io.trino.plugin.raptor.legacy.metadata.TestDatabaseShardManager.createShardManager) File(java.io.File) Files.createTempFile(java.nio.file.Files.createTempFile) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 4 with FileBackupStore

use of io.trino.plugin.raptor.legacy.backup.FileBackupStore in project trino by trinodb.

the class TestShardCleaner method setup.

@BeforeMethod
public void setup() throws IOException {
    dbi = createTestingJdbi();
    dummyHandle = dbi.open();
    createTablesWithRetry(dbi);
    temporary = createTempDirectory(null);
    File directory = temporary.resolve("data").toFile();
    storageService = new FileStorageService(directory);
    storageService.start();
    File backupDirectory = temporary.resolve("backup").toFile();
    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), config.getMaxTransactionAge(), config.getTransactionCleanerInterval(), config.getLocalCleanerInterval(), config.getLocalCleanTime(), config.getBackupCleanerInterval(), config.getBackupCleanTime(), config.getBackupDeletionThreads(), config.getMaxCompletedTransactionAge());
}
Also used : FileBackupStore(io.trino.plugin.raptor.legacy.backup.FileBackupStore) TestingTicker(io.airlift.testing.TestingTicker) FileStorageService(io.trino.plugin.raptor.legacy.storage.FileStorageService) DaoSupplier(io.trino.plugin.raptor.legacy.util.DaoSupplier) File(java.io.File) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

FileBackupStore (io.trino.plugin.raptor.legacy.backup.FileBackupStore)4 File (java.io.File)4 ShardManager (io.trino.plugin.raptor.legacy.metadata.ShardManager)3 TestDatabaseShardManager.createShardManager (io.trino.plugin.raptor.legacy.metadata.TestDatabaseShardManager.createShardManager)3 BeforeMethod (org.testng.annotations.BeforeMethod)3 DatabaseTesting.createTestingJdbi (io.trino.plugin.raptor.legacy.DatabaseTesting.createTestingJdbi)2 Jdbi (org.jdbi.v3.core.Jdbi)2 FileAssert.assertFile (org.testng.FileAssert.assertFile)2 TestingTicker (io.airlift.testing.TestingTicker)1 Duration (io.airlift.units.Duration)1 BackupStore (io.trino.plugin.raptor.legacy.backup.BackupStore)1 FileStorageService (io.trino.plugin.raptor.legacy.storage.FileStorageService)1 DaoSupplier (io.trino.plugin.raptor.legacy.util.DaoSupplier)1 TestingNodeManager (io.trino.testing.TestingNodeManager)1 Files.createTempFile (java.nio.file.Files.createTempFile)1