-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
gx: Update badgerds to 1.0 #4327
Conversation
Should we wait for the badger guys to resolve the 'minor issues' they mentioned before merging this? I guess its pretty easy to update again anyways |
Yep, we definitely want to wait.. Just finished converting one of my nodes, ds-convert used current ds-badger (0.4.1), then tried to start ipfs daemon with 1.0, got this:
I need to dig a bit deeper here as it worked for other nodes. |
So it didn't work on that nodes either, it only seemed to do so, did some more testing:
Datastore opens without errors, but the data is lost. Using current version on it's own works just fine. I'm assuming the 'minor issues' include this one. |
Hrm... thats quite odd... cc @manishrjain |
The key expectations have changed since v0.8, so previous repos won't work with v1.0. I think we might have forgotten to update the magic number, but we can't update it anymore now. Can you try building data with master and then reading it back? |
Using badger master works as expected, the only problem is when switching version from 0.8 to current master. We can increment the magic number in our fork to at least mitigate unexpected data loss. @manishrjain Is there some migration tool we can use to upgrade badger disk format? |
@magik6k IMO we should not fork badger, this will lead to more confusion. |
Yeah, forking isnt a great option... @manishrjain what do you suggest here? is there any way we can tell an old disk format from a new one? |
We're working on providing a backup and restore tool. But, that'd be aimed at v1.0 and onwards. I don't have full context here about how you control the data storage. If you do, I'd suggest doing a key-value iteration over the DB in v0.8, dumping out the key-values, and re-importing them in v1.0. |
@manishrjain users have used an older version of badger to store data. Now we're updating to a newer version, if users who used the old version run the new version, they lose data. How do we avoid this? |
doing what you suggest would mean that ipfs would have to import two different versions of badger, and even then, we would have a hard time telling what an 'old' badger install was and what a 'new' one is to know when we need to even do the conversion. |
Before a user updates IPFS to pull in updated Badger, would it be possible to get their data exported to some file? And then, reimport it when IPFS runs? |
Not easily, most users update by simply running a new binary. We have no way of telling if they updated, or if they just started a new repository with the updated code. Basically, we need a way to tell when to run the process you describe (of exporting the data and reimporting it into the new badger). Even if we don't decide to support that (because we marked the feature as experimental), we still need to be able to know that we need to reset all the data in a given repository and start over with the new badger instance. |
I'm starting to think our only real option is (as @magik6k said) to fork badger, update the magic number, and then just maintain that moving forward. |
Maybe we can update the magic number in Badger, at the same time as we release v1.0; which should be soon. CC: @deepakjois |
Just checking to see if dgraph-io/badger#282 will help you folks here. If so, we can prioritise it for v1.0. Otherwise, we don’t want to make this change in the run-up to v1.0 |
@deepakjois Yes, it will definitely help, we well be able to tell users to upgrade instead of losing data. |
@magik6k The change itself is trivial, so I will probably send out a PR for it soon. But before we merge it, I want to confirm it will offer you a clear benefit. So when you say,
could you please elaborate what you mean by telling users to upgrade. You still have to take care of the data that was recorded in the Badger DB with an older version, isn't it (either rewrite it in the new db with the newer magic version, or just ignore it)? Do you already take care of this situation somehow? |
We have a datastore conversion tool, the plan here is to create a script which will first migrate data from old badger to flatfs/level and then to new badger. When badger-ds detects unsupported magic number error it will then simply point users to that script, allowing them to convert to newer format |
@deepakjois currently, if a user with the latest release of ipfs is using badger, and then updates to this PR, They will lose data without warning. At the very least we will need to warn them. |
After a bit of discussion internally, we have decided to provide a way to backup for v1.0 after all, both for v0.8, and pre v1.0 users. So there will be a change in the magic number and a way to backup/restore. The details are being worked out: dgraph-io/badger#291 |
License: MIT Signed-off-by: Łukasz Magiera <[email protected]>
b750568
to
b3589c8
Compare
This PR updates badgerds to use new transaction API. On-disk format hasn't changed (at least this is what I observed)
Fixes #4322