Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Tweak swing-store export example code to show process synchronization #8174

Merged
merged 1 commit into from
Oct 5, 2023

Conversation

gibson042
Copy link
Member

Elaborates on the somewhat handwavey "exporter now has a txn, parent process is free to proceed forward".

@gibson042 gibson042 requested a review from warner August 10, 2023 21:30
@gibson042 gibson042 requested a review from mhofman October 5, 2023 04:27
Copy link
Member

@mhofman mhofman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding these synchronization details.

Comment on lines -99 to +110
if (value) {
iavl.set(iavlKey, value);
} else {
iavl.delete(iavlKey); // value===undefined means delete
}
}
const swingStore = openSwingStore(dirPath, { exportCallback });
...
await controller.run();
hostStorage.commit();

// now, if the validator is configured to publish state-sync snapshots,
// and if this block height is one of the publishing points,
// do the following:

// spawn a child process

// child process does:
const exporter = makeSwingStoreExporter(dirPath);
// note: no exporter.getExportData(), the first-stage data is already in IAVL
const artifacts = new Map();
for (const name of exporter.getArtifactNames()) {
artifacts.set(name, exporter.getArtifact(name));
const dirPath = '.../swing-store';
const iavl = ...;
function exportCallback(key, value) {
const iavlKey = `ssed.${key}`; // 'ssed' is short for SwingStoreExportData
if (value === undefined) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good call!

@gibson042 gibson042 added the automerge:rebase Automatically rebase updates, then merge label Oct 5, 2023
@gibson042 gibson042 force-pushed the gibson-2023-08-swing-store-export-docs branch 2 times, most recently from db9ca0e to 5a9c0b1 Compare October 5, 2023 18:53
@mhofman mhofman removed the automerge:rebase Automatically rebase updates, then merge label Oct 5, 2023
@mhofman
Copy link
Member

mhofman commented Oct 5, 2023

Sorry need to kick this off the queue

@mhofman mhofman added the automerge:rebase Automatically rebase updates, then merge label Oct 5, 2023
@gibson042 gibson042 force-pushed the gibson-2023-08-swing-store-export-docs branch from 5a9c0b1 to b1cdf0c Compare October 5, 2023 19:35
@mergify mergify bot merged commit a0c5f45 into master Oct 5, 2023
71 checks passed
@mergify mergify bot deleted the gibson-2023-08-swing-store-export-docs branch October 5, 2023 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:rebase Automatically rebase updates, then merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants