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

need a safe way to truncate local datastore #245

Open
jbenet opened this issue Oct 31, 2014 · 11 comments
Open

need a safe way to truncate local datastore #245

jbenet opened this issue Oct 31, 2014 · 11 comments
Labels
exp/novice Someone with a little familiarity can pick up kind/enhancement A net-new feature or improvement to an existing feature topic/commands Topic commands topic/icebox Topic icebox topic/repo Topic repo

Comments

@jbenet
Copy link
Member

jbenet commented Oct 31, 2014

rm -rf $IPFS_DIR/datastore will break things

@jbenet jbenet added help wanted Seeking public contribution on this issue kind/enhancement A net-new feature or improvement to an existing feature ready labels Oct 31, 2014
@whyrusleeping
Copy link
Member

just yesterday i was thinking we needed an ipfs db reset command

@whyrusleeping
Copy link
Member

@jbenet what problems exactly would just deleting the datastore directory cause?

@jbenet
Copy link
Member Author

jbenet commented Oct 31, 2014

Depends on whether we store keys in it that we expect for normal operation.


Sent from Mailbox

On Fri, Oct 31, 2014 at 11:52 AM, Jeromy Johnson notifications@github.com
wrote:

@jbenet what problems exactly would just deleting the datastore directory cause?

Reply to this email directly or view it on GitHub:
#245 (comment)

@whyrusleeping
Copy link
Member

this would still be nice to have:

$ ipfs repo reset
Are you sure you want to delete all of your ipfs data? [y/N]

@whyrusleeping
Copy link
Member

this could essentially just be:

for key in node.Blockstore.KeysChan() {
    node.Blockstore.Delete(key)
}

@RichardLitt RichardLitt added exp/novice Someone with a little familiarity can pick up and removed difficulty: easy labels Feb 2, 2016
@whyrusleeping
Copy link
Member

Revision:

  • remove all pins on all data
  • iterate all blocks and remove them

@rascalking
Copy link

Hi, I'm trying to pick this up for hacktoberfest, but I cannot for the life of me figure out how to get the confirmation prompt to fire on the client side. Anyone have any pointers?

@Stebalien
Copy link
Member

@rascalking It should be possible to do that in a PreRun function (that is run on the client).

However, I'd like to get some input from @magik6k and @schomatis as we'll need to think about the design a bit. The "just delete every block" method works fine for the flatfs datastore but will have terrible performance on badger. For that, we'd almost want to just migrate everything except the blocks to a new datastore and repalace the existing one wholesale. However, we'd need to do that in offline mode.

Thoughts? Am I being paranoid here?

@schomatis
Copy link
Contributor

The "just delete every block" method works fine for the flatfs datastore but will have terrible performance on badger.

Iterating doesn't seem that expensive in Badger since we're basically doing a serial read of big files (the most expensive part would be decoding the headers of each value block) but don't quote me on this, I should run a few test to be sure.

Out of ignorance, we can't just delete the Badger DB because it's storing more than just the files that the user added, right? Some metadata?

@Stebalien
Copy link
Member

Out of ignorance, we can't just delete the Badger DB because it's storing more than just the files that the user added, right? Some metadata?

Yes. We'd have to either just delete the blocks or migrate everything but the blocks to a new datastore and then delete the old one.

Iterating doesn't seem that expensive in Badge

IIRC, badger has behaves really poorly when deleting a ton of data. @magik6k?

@schomatis
Copy link
Contributor

IIRC, badger has behaves really poorly when deleting a ton of data. @magik6k?

Actually you're right, deleting itself is not the most expensive part (although you'll be creating new delete records for every value stored) but purging the db after deleting everything (which implies a search for every delete key and many compact operations) is very cpu intensive.

@eingenito eingenito added topic/icebox Topic icebox and removed help wanted Seeking public contribution on this issue labels May 16, 2019
ariescodescream pushed a commit to ariescodescream/go-ipfs that referenced this issue Oct 23, 2021
* Rework TestFindPeersQuery

Unravel the logic and create a minimal test case that isn't flaky.

* Use testing.T.Logf

* Skip the original test in short mode

* Add comments for the arguments to testFindPeerQuery

* Qualify aberrant package name

* Use redundant package names

* gx import testify 1.3.0.
@aschmahmann aschmahmann mentioned this issue Dec 1, 2021
80 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exp/novice Someone with a little familiarity can pick up kind/enhancement A net-new feature or improvement to an existing feature topic/commands Topic commands topic/icebox Topic icebox topic/repo Topic repo
Projects
None yet
Development

No branches or pull requests

8 participants