MySQL checkpoints
If your application already uses MySQL, use it to save the progress of conversations, approvals, and other workflows. Use MySQL 8.0 with InnoDB tables.
New deployments
- Initialize the new schema with the migration account and
CREATE_IF_NOT_EXISTS. New checkpoint tables use the new format by default. - Start the application with
CREATE_NONE. To offload payloads or save deltas, build the saver and blob store with the sameDataSource. Use the sameDataSourcefor parent and child graphs you need to fork together.
import com.alibaba.cloud.ai.graph.checkpoint.savers.mysql.CreateOption;
import com.alibaba.cloud.ai.graph.checkpoint.savers.mysql.MysqlCheckpointBlobStore;
import com.alibaba.cloud.ai.graph.checkpoint.savers.mysql.MysqlSaver;
var saver = MysqlSaver.builder()
.dataSource(dataSource)
.createOption(CreateOption.CREATE_NONE)
.build();
var blobs = new MysqlCheckpointBlobStore(dataSource, "support-workflow");
Register saver with your graph. If you created blobs, follow the large state guide to select the keys to optimize. For large documents, size max_allowed_packet on both MySQL and Connector/J for the largest payload plus encoding overhead.
Upgrade existing checkpoints
- Back up the database and schedule a schema update window. Use the migration account to initialize the existing schema with
managedCheckpoints(true)andCREATE_IF_NOT_EXISTS. The migration account needs permission to create and alter tables and create triggers. Check whether the target server’s binary logging settings allow that account to create triggers. - Follow the rolling upgrade guide to upgrade all readers and writers. With the old application, check the progress saved by the new application during the compatibility period.
- Drain and isolate old writers, then call
activateManagedCheckpointWrites()in the same schema. Restart the application or rebuild the saver and recompile the graph. Resume with the originalthreadIdand serializer. Existing checkpoints can stay as they are.
Keep workflow history
Set your policy for active history and archives first. Blob garbage collection defaults to observation only. See retention, collection, and monitoring.