org.apache.flink.runtime.state.StateBackendLoader Java Examples

The following examples show how to use org.apache.flink.runtime.state.StateBackendLoader. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TypeSerializerSnapshotMigrationITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
@Parameterized.Parameters(name = "Migrate Savepoint / Backend: {0}")
public static Collection<Tuple2<MigrationVersion, String>> parameters () {
	return Arrays.asList(
		Tuple2.of(MigrationVersion.v1_3, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_3, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_4, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_4, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_5, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_5, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_6, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_6, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_7, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_7, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_8, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_8, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME));
}
 
Example #2
Source File: StatefulJobSavepointMigrationITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
@Parameterized.Parameters(name = "Migrate Savepoint / Backend: {0}")
public static Collection<Tuple2<MigrationVersion, String>> parameters () {
	return Arrays.asList(
		Tuple2.of(MigrationVersion.v1_4, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_4, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_5, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_5, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_6, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_6, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_7, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_7, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_8, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_8, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_9, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_9, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME));
}
 
Example #3
Source File: TypeSerializerSnapshotMigrationITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
@Parameterized.Parameters(name = "Migrate Savepoint / Backend: {0}")
public static Collection<Tuple2<MigrationVersion, String>> parameters () {
	return Arrays.asList(
		Tuple2.of(MigrationVersion.v1_3, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_3, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_4, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_4, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_5, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_5, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_6, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_6, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_7, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_7, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_8, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_8, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_9, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_9, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME));
}
 
Example #4
Source File: LegacyStatefulJobSavepointMigrationITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
private String getSavepointPath(MigrationVersion savepointVersion, String backendType) {
	switch (backendType) {
		case StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME:
			return "stateful-udf-migration-itcase-flink" + savepointVersion + "-rocksdb-savepoint";
		case StateBackendLoader.MEMORY_STATE_BACKEND_NAME:
			return "stateful-udf-migration-itcase-flink" + savepointVersion + "-savepoint";
		default:
			throw new UnsupportedOperationException();
	}
}
 
Example #5
Source File: StatefulJobSavepointMigrationITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
private String getSavepointPath(MigrationVersion savepointVersion, String backendType) {
	switch (backendType) {
		case StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME:
			return "new-stateful-udf-migration-itcase-flink" + savepointVersion + "-rocksdb-savepoint";
		case StateBackendLoader.MEMORY_STATE_BACKEND_NAME:
			return "new-stateful-udf-migration-itcase-flink" + savepointVersion + "-savepoint";
		default:
			throw new UnsupportedOperationException();
	}
}
 
Example #6
Source File: StatefulJobSavepointMigrationITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Parameterized.Parameters(name = "Migrate Savepoint / Backend: {0}")
public static Collection<Tuple2<MigrationVersion, String>> parameters () {
	return Arrays.asList(
		Tuple2.of(MigrationVersion.v1_4, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_4, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_5, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_5, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_6, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_6, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_7, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_7, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_8, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_8, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME));
}
 
Example #7
Source File: TypeSerializerSnapshotMigrationITCase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Parameterized.Parameters(name = "Migrate Savepoint / Backend: {0}")
public static Collection<Tuple2<MigrationVersion, String>> parameters () {
	return Arrays.asList(
		Tuple2.of(MigrationVersion.v1_3, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_3, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_4, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_4, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_5, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_5, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_6, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_6, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_7, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_7, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME));
}
 
Example #8
Source File: StatefulJobWBroadcastStateMigrationITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Parameterized.Parameters(name = "Migrate Savepoint / Backend: {0}")
public static Collection<Tuple2<MigrationVersion, String>> parameters () {
	return Arrays.asList(
			Tuple2.of(MigrationVersion.v1_5, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
			Tuple2.of(MigrationVersion.v1_5, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
			Tuple2.of(MigrationVersion.v1_6, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
			Tuple2.of(MigrationVersion.v1_6, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
			Tuple2.of(MigrationVersion.v1_7, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
			Tuple2.of(MigrationVersion.v1_7, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
			Tuple2.of(MigrationVersion.v1_8, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
			Tuple2.of(MigrationVersion.v1_8, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME));
}
 
Example #9
Source File: StatefulJobWBroadcastStateMigrationITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
private String getBroadcastSavepointPath(MigrationVersion savepointVersion, String backendType) {
	switch (backendType) {
		case StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME:
			return "new-stateful-broadcast-udf-migration-itcase-flink" + savepointVersion + "-rocksdb-savepoint";
		case StateBackendLoader.MEMORY_STATE_BACKEND_NAME:
			return "new-stateful-broadcast-udf-migration-itcase-flink" + savepointVersion + "-savepoint";
		default:
			throw new UnsupportedOperationException();
	}
}
 
Example #10
Source File: PojoSerializerUpgradeTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Parameterized.Parameters(name = "StateBackend: {0}")
public static Collection<String> parameters () {
	return Arrays.asList(
			StateBackendLoader.MEMORY_STATE_BACKEND_NAME,
			StateBackendLoader.FS_STATE_BACKEND_NAME,
			StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME);
}
 
Example #11
Source File: RocksDBStateBackendFactoryTest.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Validates taking the application-defined file system state backend and adding with additional
 * parameters from the cluster configuration, but giving precedence to application-defined
 * parameters over configuration-defined parameters.
 */
@Test
public void testLoadFileSystemStateBackendMixed() throws Exception {
	final String appCheckpointDir = new Path(tmp.newFolder().toURI()).toString();
	final String checkpointDir = new Path(tmp.newFolder().toURI()).toString();
	final String savepointDir = new Path(tmp.newFolder().toURI()).toString();

	final String localDir1 = tmp.newFolder().getAbsolutePath();
	final String localDir2 = tmp.newFolder().getAbsolutePath();
	final String localDir3 = tmp.newFolder().getAbsolutePath();
	final String localDir4 = tmp.newFolder().getAbsolutePath();

	final boolean incremental = !CheckpointingOptions.INCREMENTAL_CHECKPOINTS.defaultValue();

	final Path expectedCheckpointsPath = new Path(appCheckpointDir);
	final Path expectedSavepointsPath = new Path(savepointDir);

	final RocksDBStateBackend backend = new RocksDBStateBackend(appCheckpointDir, incremental);
	backend.setDbStoragePaths(localDir1, localDir2);

	final Configuration config = new Configuration();
	config.setString(backendKey, "jobmanager"); // this should not be picked up
	config.setString(CheckpointingOptions.CHECKPOINTS_DIRECTORY, checkpointDir); // this should not be picked up
	config.setString(CheckpointingOptions.SAVEPOINT_DIRECTORY, savepointDir);
	config.setBoolean(CheckpointingOptions.INCREMENTAL_CHECKPOINTS, !incremental);  // this should not be picked up
	config.setString(RocksDBOptions.LOCAL_DIRECTORIES, localDir3 + ":" + localDir4);  // this should not be picked up

	final StateBackend loadedBackend =
			StateBackendLoader.fromApplicationOrConfigOrDefault(backend, config, cl, null);
	assertTrue(loadedBackend instanceof RocksDBStateBackend);

	final RocksDBStateBackend loadedRocks = (RocksDBStateBackend) loadedBackend;

	assertEquals(incremental, loadedRocks.isIncrementalCheckpointsEnabled());
	checkPaths(loadedRocks.getDbStoragePaths(), localDir1, localDir2);

	AbstractFileStateBackend fsBackend = (AbstractFileStateBackend) loadedRocks.getCheckpointBackend();
	assertEquals(expectedCheckpointsPath, fsBackend.getCheckpointPath());
	assertEquals(expectedSavepointsPath, fsBackend.getSavepointPath());
}
 
Example #12
Source File: StreamTask.java    From flink with Apache License 2.0 5 votes vote down vote up
private StateBackend createStateBackend() throws Exception {
	final StateBackend fromApplication = configuration.getStateBackend(getUserCodeClassLoader());

	return StateBackendLoader.fromApplicationOrConfigOrDefault(
			fromApplication,
			getEnvironment().getTaskManagerInfo().getConfiguration(),
			getUserCodeClassLoader(),
			LOG);
}
 
Example #13
Source File: LegacyStatefulJobSavepointMigrationITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
private String getSavepointPath(MigrationVersion savepointVersion, String backendType) {
	switch (backendType) {
		case StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME:
			return "stateful-udf-migration-itcase-flink" + savepointVersion + "-rocksdb-savepoint";
		case StateBackendLoader.MEMORY_STATE_BACKEND_NAME:
			return "stateful-udf-migration-itcase-flink" + savepointVersion + "-savepoint";
		default:
			throw new UnsupportedOperationException();
	}
}
 
Example #14
Source File: StatefulJobSavepointMigrationITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
private String getSavepointPath(MigrationVersion savepointVersion, String backendType) {
	switch (backendType) {
		case StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME:
			return "new-stateful-udf-migration-itcase-flink" + savepointVersion + "-rocksdb-savepoint";
		case StateBackendLoader.MEMORY_STATE_BACKEND_NAME:
			return "new-stateful-udf-migration-itcase-flink" + savepointVersion + "-savepoint";
		default:
			throw new UnsupportedOperationException();
	}
}
 
Example #15
Source File: StatefulJobWBroadcastStateMigrationITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Parameterized.Parameters(name = "Migrate Savepoint / Backend: {0}")
public static Collection<Tuple2<MigrationVersion, String>> parameters () {
	return Arrays.asList(
			Tuple2.of(MigrationVersion.v1_5, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
			Tuple2.of(MigrationVersion.v1_5, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
			Tuple2.of(MigrationVersion.v1_6, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
			Tuple2.of(MigrationVersion.v1_6, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
			Tuple2.of(MigrationVersion.v1_7, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
			Tuple2.of(MigrationVersion.v1_7, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
			Tuple2.of(MigrationVersion.v1_8, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
			Tuple2.of(MigrationVersion.v1_8, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
			Tuple2.of(MigrationVersion.v1_9, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
			Tuple2.of(MigrationVersion.v1_9, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME));
}
 
Example #16
Source File: StatefulJobWBroadcastStateMigrationITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
private String getBroadcastSavepointPath(MigrationVersion savepointVersion, String backendType) {
	switch (backendType) {
		case StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME:
			return "new-stateful-broadcast-udf-migration-itcase-flink" + savepointVersion + "-rocksdb-savepoint";
		case StateBackendLoader.MEMORY_STATE_BACKEND_NAME:
			return "new-stateful-broadcast-udf-migration-itcase-flink" + savepointVersion + "-savepoint";
		default:
			throw new UnsupportedOperationException();
	}
}
 
Example #17
Source File: PojoSerializerUpgradeTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Parameterized.Parameters(name = "StateBackend: {0}")
public static Collection<String> parameters () {
	return Arrays.asList(
			StateBackendLoader.MEMORY_STATE_BACKEND_NAME,
			StateBackendLoader.FS_STATE_BACKEND_NAME,
			StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME);
}
 
Example #18
Source File: RocksDBStateBackendFactoryTest.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Validates taking the application-defined file system state backend and adding with additional
 * parameters from the cluster configuration, but giving precedence to application-defined
 * parameters over configuration-defined parameters.
 */
@Test
public void testLoadFileSystemStateBackendMixed() throws Exception {
	final String appCheckpointDir = new Path(tmp.newFolder().toURI()).toString();
	final String checkpointDir = new Path(tmp.newFolder().toURI()).toString();
	final String savepointDir = new Path(tmp.newFolder().toURI()).toString();

	final String localDir1 = tmp.newFolder().getAbsolutePath();
	final String localDir2 = tmp.newFolder().getAbsolutePath();
	final String localDir3 = tmp.newFolder().getAbsolutePath();
	final String localDir4 = tmp.newFolder().getAbsolutePath();

	final boolean incremental = !CheckpointingOptions.INCREMENTAL_CHECKPOINTS.defaultValue();

	final Path expectedCheckpointsPath = new Path(appCheckpointDir);
	final Path expectedSavepointsPath = new Path(savepointDir);

	final RocksDBStateBackend backend = new RocksDBStateBackend(appCheckpointDir, incremental);
	backend.setDbStoragePaths(localDir1, localDir2);

	final Configuration config = new Configuration();
	config.setString(backendKey, "jobmanager"); // this should not be picked up
	config.setString(CheckpointingOptions.CHECKPOINTS_DIRECTORY, checkpointDir); // this should not be picked up
	config.setString(CheckpointingOptions.SAVEPOINT_DIRECTORY, savepointDir);
	config.setBoolean(CheckpointingOptions.INCREMENTAL_CHECKPOINTS, !incremental);  // this should not be picked up
	config.setString(RocksDBOptions.LOCAL_DIRECTORIES, localDir3 + ":" + localDir4);  // this should not be picked up

	final StateBackend loadedBackend =
			StateBackendLoader.fromApplicationOrConfigOrDefault(backend, config, cl, null);
	assertTrue(loadedBackend instanceof RocksDBStateBackend);

	final RocksDBStateBackend loadedRocks = (RocksDBStateBackend) loadedBackend;

	assertEquals(incremental, loadedRocks.isIncrementalCheckpointsEnabled());
	checkPaths(loadedRocks.getDbStoragePaths(), localDir1, localDir2);

	AbstractFileStateBackend fsBackend = (AbstractFileStateBackend) loadedRocks.getCheckpointBackend();
	assertEquals(expectedCheckpointsPath, fsBackend.getCheckpointPath());
	assertEquals(expectedSavepointsPath, fsBackend.getSavepointPath());
}
 
Example #19
Source File: StreamExecutionEnvironment.java    From flink with Apache License 2.0 5 votes vote down vote up
private StateBackend loadStateBackend(ReadableConfig configuration, ClassLoader classLoader) {
	try {
		return StateBackendLoader.loadStateBackendFromConfig(
			configuration,
			classLoader,
			null);
	} catch (DynamicCodeLoadingException | IOException e) {
		throw new WrappingRuntimeException(e);
	}
}
 
Example #20
Source File: StreamTask.java    From flink with Apache License 2.0 5 votes vote down vote up
private StateBackend createStateBackend() throws Exception {
	final StateBackend fromApplication = configuration.getStateBackend(getUserCodeClassLoader());

	return StateBackendLoader.fromApplicationOrConfigOrDefault(
			fromApplication,
			getEnvironment().getTaskManagerInfo().getConfiguration(),
			getUserCodeClassLoader(),
			LOG);
}
 
Example #21
Source File: StatefulJobWBroadcastStateMigrationITCase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Parameterized.Parameters(name = "Migrate Savepoint / Backend: {0}")
public static Collection<Tuple2<MigrationVersion, String>> parameters () {
	return Arrays.asList(
			Tuple2.of(MigrationVersion.v1_5, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
			Tuple2.of(MigrationVersion.v1_5, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
			Tuple2.of(MigrationVersion.v1_6, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
			Tuple2.of(MigrationVersion.v1_6, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
			Tuple2.of(MigrationVersion.v1_7, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
			Tuple2.of(MigrationVersion.v1_7, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME));
}
 
Example #22
Source File: LegacyStatefulJobSavepointMigrationITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Parameterized.Parameters(name = "Migrate Savepoint / Backend: {0}")
public static Collection<Tuple2<MigrationVersion, String>> parameters () {
	return Arrays.asList(
		Tuple2.of(MigrationVersion.v1_2, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_2, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_3, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_3, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_4, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_4, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME));
}
 
Example #23
Source File: LegacyStatefulJobSavepointMigrationITCase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Parameterized.Parameters(name = "Migrate Savepoint / Backend: {0}")
public static Collection<Tuple2<MigrationVersion, String>> parameters () {
	return Arrays.asList(
		Tuple2.of(MigrationVersion.v1_2, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_2, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_3, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_3, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_4, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_4, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME));
}
 
Example #24
Source File: StatefulJobSavepointMigrationITCase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private String getSavepointPath(MigrationVersion savepointVersion, String backendType) {
	switch (backendType) {
		case StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME:
			return "new-stateful-udf-migration-itcase-flink" + savepointVersion + "-rocksdb-savepoint";
		case StateBackendLoader.MEMORY_STATE_BACKEND_NAME:
			return "new-stateful-udf-migration-itcase-flink" + savepointVersion + "-savepoint";
		default:
			throw new UnsupportedOperationException();
	}
}
 
Example #25
Source File: StreamTask.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private StateBackend createStateBackend() throws Exception {
	final StateBackend fromApplication = configuration.getStateBackend(getUserCodeClassLoader());

	return StateBackendLoader.fromApplicationOrConfigOrDefault(
			fromApplication,
			getEnvironment().getTaskManagerInfo().getConfiguration(),
			getUserCodeClassLoader(),
			LOG);
}
 
Example #26
Source File: RocksDBStateBackendFactoryTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Validates taking the application-defined file system state backend and adding with additional
 * parameters from the cluster configuration, but giving precedence to application-defined
 * parameters over configuration-defined parameters.
 */
@Test
public void testLoadFileSystemStateBackendMixed() throws Exception {
	final String appCheckpointDir = new Path(tmp.newFolder().toURI()).toString();
	final String checkpointDir = new Path(tmp.newFolder().toURI()).toString();
	final String savepointDir = new Path(tmp.newFolder().toURI()).toString();

	final String localDir1 = tmp.newFolder().getAbsolutePath();
	final String localDir2 = tmp.newFolder().getAbsolutePath();
	final String localDir3 = tmp.newFolder().getAbsolutePath();
	final String localDir4 = tmp.newFolder().getAbsolutePath();

	final boolean incremental = !CheckpointingOptions.INCREMENTAL_CHECKPOINTS.defaultValue();

	final Path expectedCheckpointsPath = new Path(appCheckpointDir);
	final Path expectedSavepointsPath = new Path(savepointDir);

	final RocksDBStateBackend backend = new RocksDBStateBackend(appCheckpointDir, incremental);
	backend.setDbStoragePaths(localDir1, localDir2);

	final Configuration config = new Configuration();
	config.setString(backendKey, "jobmanager"); // this should not be picked up
	config.setString(CheckpointingOptions.CHECKPOINTS_DIRECTORY, checkpointDir); // this should not be picked up
	config.setString(CheckpointingOptions.SAVEPOINT_DIRECTORY, savepointDir);
	config.setBoolean(CheckpointingOptions.INCREMENTAL_CHECKPOINTS, !incremental);  // this should not be picked up
	config.setString(RocksDBOptions.LOCAL_DIRECTORIES, localDir3 + ":" + localDir4);  // this should not be picked up

	final StateBackend loadedBackend =
			StateBackendLoader.fromApplicationOrConfigOrDefault(backend, config, cl, null);
	assertTrue(loadedBackend instanceof RocksDBStateBackend);

	final RocksDBStateBackend loadedRocks = (RocksDBStateBackend) loadedBackend;

	assertEquals(incremental, loadedRocks.isIncrementalCheckpointsEnabled());
	checkPaths(loadedRocks.getDbStoragePaths(), localDir1, localDir2);

	AbstractFileStateBackend fsBackend = (AbstractFileStateBackend) loadedRocks.getCheckpointBackend();
	assertEquals(expectedCheckpointsPath, fsBackend.getCheckpointPath());
	assertEquals(expectedSavepointsPath, fsBackend.getSavepointPath());
}
 
Example #27
Source File: StatefulJobSavepointMigrationITCase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Parameterized.Parameters(name = "Migrate Savepoint / Backend: {0}")
public static Collection<Tuple2<MigrationVersion, String>> parameters () {
	return Arrays.asList(
		Tuple2.of(MigrationVersion.v1_4, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_4, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_5, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_5, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_6, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_6, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_7, StateBackendLoader.MEMORY_STATE_BACKEND_NAME),
		Tuple2.of(MigrationVersion.v1_7, StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME));
}
 
Example #28
Source File: LegacyStatefulJobSavepointMigrationITCase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private String getSavepointPath(MigrationVersion savepointVersion, String backendType) {
	switch (backendType) {
		case StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME:
			return "stateful-udf-migration-itcase-flink" + savepointVersion + "-rocksdb-savepoint";
		case StateBackendLoader.MEMORY_STATE_BACKEND_NAME:
			return "stateful-udf-migration-itcase-flink" + savepointVersion + "-savepoint";
		default:
			throw new UnsupportedOperationException();
	}
}
 
Example #29
Source File: PojoSerializerUpgradeTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Parameterized.Parameters(name = "StateBackend: {0}")
public static Collection<String> parameters () {
	return Arrays.asList(
			StateBackendLoader.MEMORY_STATE_BACKEND_NAME,
			StateBackendLoader.FS_STATE_BACKEND_NAME,
			StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME);
}
 
Example #30
Source File: StatefulJobWBroadcastStateMigrationITCase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private String getBroadcastSavepointPath(MigrationVersion savepointVersion, String backendType) {
	switch (backendType) {
		case StateBackendLoader.ROCKSDB_STATE_BACKEND_NAME:
			return "new-stateful-broadcast-udf-migration-itcase-flink" + savepointVersion + "-rocksdb-savepoint";
		case StateBackendLoader.MEMORY_STATE_BACKEND_NAME:
			return "new-stateful-broadcast-udf-migration-itcase-flink" + savepointVersion + "-savepoint";
		default:
			throw new UnsupportedOperationException();
	}
}