Example #1
0
    def test_get_set_number_of_transfering_threads(self):

        state_backend = RocksDBStateBackend("file://var/checkpoints/")

        state_backend.set_number_of_transfering_threads(7)

        self.assertEqual(state_backend.get_number_of_transfering_threads(), 7)
Example #2
0
    def test_get_set_db_storage_paths(self):
        if on_windows():
            checkpoints_path = "file:/C:/var/checkpoints/"
            storage_path = [
                "file:/C:/var/db_storage_dir1/",
                "file:/C:/var/db_storage_dir2/",
                "file:/C:/var/db_storage_dir3/"
            ]
            expected = [
                "C:\\var\\db_storage_dir1", "C:\\var\\db_storage_dir2",
                "C:\\var\\db_storage_dir3"
            ]
        else:
            checkpoints_path = "file://var/checkpoints/"
            storage_path = [
                "file://var/db_storage_dir1/", "file://var/db_storage_dir2/",
                "file://var/db_storage_dir3/"
            ]
            expected = [
                "/db_storage_dir1", "/db_storage_dir2", "/db_storage_dir3"
            ]

        state_backend = RocksDBStateBackend(checkpoints_path)
        state_backend.set_db_storage_paths(*storage_path)
        self.assertEqual(state_backend.get_db_storage_paths(), expected)
Example #3
0
    def test_get_checkpoint_backend(self):

        state_backend = RocksDBStateBackend("file://var/checkpoints/")

        checkpoint_backend = state_backend.get_checkpoint_backend()

        self.assertIsInstance(checkpoint_backend, FsStateBackend)
        self.assertEqual(checkpoint_backend.get_checkpoint_path(), "file://var/checkpoints")
Example #4
0
    def test_create_rocks_db_state_backend(self):

        self.assertIsNotNone(RocksDBStateBackend("file://var/checkpoints/"))

        self.assertIsNotNone(RocksDBStateBackend("file://var/checkpoints/", True))

        self.assertIsNotNone(RocksDBStateBackend("file://var/checkpoints/", False))

        self.assertIsNotNone(RocksDBStateBackend(
            checkpoint_stream_backend=FsStateBackend("file://var/checkpoints/")))
Example #5
0
    def test_get_set_db_storage_paths(self):

        state_backend = RocksDBStateBackend("file://var/checkpoints/")

        state_backend.set_db_storage_paths("file://var/db_storage_dir1/",
                                           "file://var/db_storage_dir2/",
                                           "file://var/db_storage_dir3/")

        self.assertEqual(
            state_backend.get_db_storage_paths(),
            ['/db_storage_dir1', '/db_storage_dir2', '/db_storage_dir3'])
Example #6
0
    def test_get_set_ttl_compaction_filter(self):

        state_backend = RocksDBStateBackend("file://var/checkpoints/")

        self.assertTrue(state_backend.is_ttl_compaction_filter_enabled())

        state_backend.disable_ttl_compaction_filter()

        self.assertFalse(state_backend.is_ttl_compaction_filter_enabled())
Example #7
0
    def test_get_set_options(self):

        state_backend = RocksDBStateBackend("file://var/checkpoints/")

        self.assertIsNone(state_backend.get_options())

        state_backend.set_options(
            "org.apache.flink.contrib.streaming.state.DefaultConfigurableOptionsFactory")

        self.assertEqual(state_backend.get_options(),
                         "org.apache.flink.contrib.streaming.state."
                         "DefaultConfigurableOptionsFactory")
Example #8
0
    def test_get_set_predefined_options(self):

        state_backend = RocksDBStateBackend("file://var/checkpoints/")

        self.assertEqual(state_backend.get_predefined_options(),
                         PredefinedOptions.DEFAULT)

        state_backend.set_predefined_options(
            PredefinedOptions.SPINNING_DISK_OPTIMIZED_HIGH_MEM)

        self.assertEqual(state_backend.get_predefined_options(),
                         PredefinedOptions.SPINNING_DISK_OPTIMIZED_HIGH_MEM)

        state_backend.set_predefined_options(
            PredefinedOptions.SPINNING_DISK_OPTIMIZED)

        self.assertEqual(state_backend.get_predefined_options(),
                         PredefinedOptions.SPINNING_DISK_OPTIMIZED)

        state_backend.set_predefined_options(
            PredefinedOptions.FLASH_SSD_OPTIMIZED)

        self.assertEqual(state_backend.get_predefined_options(),
                         PredefinedOptions.FLASH_SSD_OPTIMIZED)

        state_backend.set_predefined_options(PredefinedOptions.DEFAULT)

        self.assertEqual(state_backend.get_predefined_options(),
                         PredefinedOptions.DEFAULT)