Skip to content

Latest commit

 

History

History
93 lines (59 loc) · 5.64 KB

File metadata and controls

93 lines (59 loc) · 5.64 KB

@fluid-internal/replay-tool

Replay-tool replays ops from op files generated by fetch-tool. It generates snapshots with specified frequency.

IMPORTANT: This package is intended strictly as an implementation detail of the Fluid Framework and is not intended for public consumption. We make no stability guarantees regarding its APIs.

Usage

Run from packages/tools/replay-tool:
    node .\dist\replayTool.js [OPTIONS]
Run it without any arguments to get usage and argument description.

Example

node .\dist\replayTool.js --filename messages.json --to 100 --snapfreq 20
It will replay the ops from 0 to 100 and will take a snapshot after every 20th op and will write it in Output directory.

Snapshot

The snapshots will just appear in the --outdir in current directory. Filenames for snapshot will be like Snapshot_last_op_50.json and so on.
The snapshot service will take snapshot for the individual data store in the container and then the snapshot of the whole state will be taken.
The snapshot for container will appear in --outdir/container and the snapshot for data store will appear in --outdir/dataStoreName/.

Investigating snapshot bugs

If you are invesigating document corruption bugs, please start with Fluid Debugger workflow. Using debugger, you can quickly isolate if the issue reproduces when playing ops (form seq #0, i.e. not using snapshots). If not all ops are available, you might need to start with some distant shapshot. If you repro the bug using ops, you can use debugger to isolate further where issue (which op) is.

If, however, bug does not reproduce when playing ops, it likely points to a fact that saving and loading snapshot (at some point in time) causes trouble, i.e. it's not preserving information and causes client starting from snapshot have different in-memory representation of document.

You can leverage replay tool to find such bugs. As you replay ops, use --snapfreq flag to specify how ofter to generate snapshots (you can start with once in 100 ops, and tune it down up to snapshot per each op - that's best in finding bugs, but might be too slow for big documents). Each time snapshot is generated (for a given reference op), two files are written out - snapshot.json & snapshot_2.json. The first file is result of snapshotting document. The second file is result of initializing new container with such snapshot (i.e. loading from snapshot) and generating another snapshot from that container (disabling optimizations around reusing existing content in storage), without processing any ops. The two files should be exactly the same! If they differ, that very likely points to a bug (and diff will point you where the bug is)! Occasionally we may need to change runtime to write out snapshots in predictable way (i.e. sort order matters to do efficient diffs, like order of data stores in snapshot, or order of blobs - these things do not matter to runtime, but matter a lot when doing diffing of two snapshots).

Contribution Guidelines

There are many ways to contribute to Fluid.

Detailed instructions for working in the repo can be found in the Wiki.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services. Use of these trademarks or logos must follow Microsoft’s Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.

Help

Not finding what you're looking for in this README? Check out fluidframework.com.

Still not finding what you're looking for? Please file an issue.

Thank you!

Trademark

This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.

Use of these trademarks or logos must follow Microsoft's Trademark & Brand Guidelines.

Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.