Conversation
Contributor
Author
|
This has only been tested using a filesystem nameserver, there may be some kinks to work out with other nameserver methods. |
3f4ed7f to
3e48712
Compare
I made a ledger using db at rev a2c7903, just before we changed the SID encoding. I then tried to read its head commit using main HEAD, and it didn't work. These are the minimal changes necessary to support lookup on that style of legacy ledger.
This introduces a private opt :time for jld-ledger/commit!. If you call commit! via the iCommit protocol the :time opt will be dropped and generated, making it unavailable to users of the public api. The commit time is now generated in `enrich-commit-opts` if it is not supplied via internal api. I also restructured the enriched commit-opts to make it more clear what options are used where.
For some reason we were generating this twice, once in jld-ledger/commit! and then again when we were creating the base commit. This removes the redundant one.
When migrating a ledger that doesn't have a genesis commit, we create the genesis commit. Unfortunately that hardcodes the genesis commit's time to the moment when the migration was run, which would be newer than the rest of the commits on the ledger. In order to maintain consistent commit times, this adds the ability to backdate the genesis commit to the time of the original first commit. It is done via an internal-only opt to jld-ledger/create*. If the opt is passed in via the public api it will be removed by `parse-ledger-options`.
This is what users will actually have in hand, according to at least one user.
This corresponds with updated logging in server to make tracking migration progress easier.
7f114c6 to
6c80802
Compare
In order to tell the difference between ledgers that have run the sid migration and those that have not, this bumps the commit version. These are the changes the new version number represents: - omit f:author key when transaction is unsigned - include the f:namespaces key in the data file when new namespace codes are generated - update index nodes to encode identifiers as SIDs - use the new ledger nameserver record - use new syntax to address a ledger
Unless it is overridden by the user supplying the `force` argument, skip migrating a ledger if the commit version indicates it has already been migrated.
6c80802 to
eaf4201
Compare
zonotope
approved these changes
Aug 14, 2024
| [ledger branch tuples-chans] | ||
| (go-try | ||
| (loop [[[commit-tuple ch] & r] tuples-chans | ||
| db (<? (async-db/deref-async (jld-ledger/current-db ledger)))] |
Contributor
There was a problem hiding this comment.
it's possible that current db is a FlakeDB. I think you're going to have to check what kind of db it is before trying to deref it.
Contributor
Author
There was a problem hiding this comment.
This ledger is a brand new one returned from a call to jld-ledger/create* with no data transacted into it, so I think it will always be an AsyncDB the first time you call current-db on it, but I'll add a guard just in case.
| [fluree.db.async-db :as async-db] | ||
| [fluree.db.connection :as connection] | ||
| [fluree.db.constants :as const] | ||
| [fluree.db.flake.flake-db :as db] |
Contributor
There was a problem hiding this comment.
I think this alias should be flake-db so it's more clear what the full namespace is when it's used.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We've changed several things since v3, and this is a tool to bring existing v3 ledgers up to compatibility with main.
When this migration is run, it will:
Afterwards the old files will be left behind in the
<ledger>/<branch>directory, which can be safely delete manually once everything is confirmed to be working correctly. We may write an additional migration in the future to delete the legacy data directory.