seungjin-an commented on code in PR #24276:
URL: https://github.com/apache/beam/pull/24276#discussion_r1036734527
##########
runners/samza/src/main/java/org/apache/beam/runners/samza/translation/SamzaPipelineTranslator.java:
##########
@@ -105,6 +106,38 @@ public static void createConfig(
pipeline.traverseTopologically(visitor);
}
+ /** Rewrite user store configs if there exists same state ids with multiple
ParDos. */
+ public static void rewriteConfigWithMultiParDoStateId(
+ SamzaPipelineOptions options,
+ Map<String, String> multiParDoStateIdMap,
+ ConfigBuilder configBuilder) {
+ multiParDoStateIdMap.forEach(
+ (stateId, value) -> {
+ // rewrite single parDo state configs into multiple parDo state
+ String multiParDoStateId = String.join("-", stateId, value);
+ // replace old single parDo store configs with new storeId mapping
appended with parDo
+ // name
+ configBuilder.remove("stores." + stateId + ".factory");
+ configBuilder.remove("stores." + stateId + ".key.serde");
+ configBuilder.remove("stores." + stateId + ".msg.serde");
+ configBuilder.remove("stores." + stateId + ".rocksdb.compression");
+ // put new config with multi pardo config
+ configBuilder.put(
+ "stores." + multiParDoStateId + ".factory",
+
"org.apache.samza.storage.kv.RocksDbKeyValueStorageEngineFactory");
Review Comment:
Hi Daniel, could you elaborate more on what you mean by "already including
the package?" Thanks! We do have some occurences of using these classnames in
other places where we add the configs.
##########
runners/samza/src/main/java/org/apache/beam/runners/samza/runtime/SamzaStoreStateInternals.java:
##########
@@ -149,37 +139,39 @@ static <K> Factory<K> createStateInternalsFactory(
TaskContext context,
SamzaPipelineOptions pipelineOptions,
ExecutableStage executableStage) {
-
- Set<String> stateIds =
+ // TODO: handle same stateIds in multiple ParDos for portable mode
+ Map<String, String> stateIds =
executableStage.getUserStates().stream()
.map(UserStateReference::localName)
- .collect(Collectors.toSet());
+ .collect(Collectors.toMap(Function.identity(),
Function.identity()));
Review Comment:
Thanks, made the change!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]