Login  Register

[State Processor API] how to convert savepoint back to broadcast state

Posted by Eleanore Jin on Jan 23, 2020; 12:12am
URL: http://apache-flink.370.s1.nabble.com/State-Processor-API-how-to-convert-savepoint-back-to-broadcast-state-tp1640.html

Hi there,

I would like to read the savepoints (for broadcast state) back into the
broadcast state, how should I do it?

// load the existingSavepoint;
ExistingSavepoint existingSavepoint = Savepoint.load(environment,
"file:///tmp/new_savepoints", new MemoryStateBackend());

// read state from existing savepoint
dataSet = existingSavepoint.readBroadcastState(OPERATOR_UID,
"largeKeySetStateDescription", BasicTypeInfo.STRING_TYPE_INFO,
BasicTypeInfo.STRING_TYPE_INFO);

// TODO in BoradcastProcessFunction, how can I put the savepoint
dataset back into BroadcastState?

Thanks!

Eleanore