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

more configurable datastore configs #3575

Merged
merged 18 commits into from
Sep 4, 2017
Merged

Conversation

whyrusleeping
Copy link
Member

@whyrusleeping whyrusleeping commented Jan 8, 2017

Closes #3575

@whyrusleeping
Copy link
Member Author

@Kubuxu could I get some early review on this?

@Kubuxu
Copy link
Member

Kubuxu commented Mar 17, 2017

This branch allows for usage for new experimental datastore (sbs). To use it you have to create new fresh repo.

ipfs init --empty-repo
ipfs config --json Datastore.Spec '{"mounts":[{"child":{"path":"blocks","type":"sbs"},"mountpoint":"/blocks","prefix":"flatfs.datastore","type":"measure"},{"child":{"compression":"none","path":"datastore","type":"levelds"},"mountpoint":"/","prefix":"leveldb.datastore","type":"measure"}],"type":"mount"}'

@whyrusleeping
Copy link
Member Author

@Kubuxu nice work so far :)

As an aside, we should look at adding json omitempty tags to the config fields we're deprecating, and start planning a migration path. I think we can pretty easily migrate people from the current format forward into the new format with an fs-repo-migration. At the same time we should adjust for 'new defaults' like the CORS thing that people who init'ed with old nodes might not have.

Perhaps with this migration, we even move the private key out of the config??

@whyrusleeping
Copy link
Member Author

Idea:

Maybe try and ship this code in 0.4.8 (perhaps minus the sbs stuff for now) but keep the default config the same. Then in 0.4.9 we can have a migration to update everyone to the new format

@whyrusleeping whyrusleeping modified the milestones: Ipfs 0.4.9, Ipfs 0.4.8 Mar 24, 2017
@whyrusleeping
Copy link
Member Author

sigh this keeps slipping. I really want to get it in soon...

@whyrusleeping whyrusleeping modified the milestones: Ipfs 0.4.10, Ipfs 0.4.9 May 8, 2017
@kevina
Copy link
Contributor

kevina commented May 8, 2017

@whyrusleeping is there anything I can do to help here?

@whyrusleeping
Copy link
Member Author

@kevina Yeah, if you want to take this over. Drop the 'sbs' commit from @Kubuxu, and add some tests. That would be wonderful

@kevina
Copy link
Contributor

kevina commented May 8, 2017

@whyrusleeping @Kubuxu Should I should drop the "--wip--" commit also?

type FlatDS struct {
Path string
ShardFunc string
Sync bool
Copy link
Contributor

Choose a reason for hiding this comment

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

So we changed this from NoSync to Sync, was this intentional? Is the default now not to enable Sync?

Copy link
Contributor

Choose a reason for hiding this comment

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

And and closer inspection it appears that this data structure isn't even used...

"child": map[string]interface{}{
"type": "flatfs",
"path": "blocks",
"nosync": false,
Copy link
Contributor

Choose a reason for hiding this comment

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

I might be misunderstanding something, but should't this be "sync": true now?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, this should probably be sync true now

Copy link
Contributor

@kevina kevina May 9, 2017

Choose a reason for hiding this comment

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

except we still check for "nosync" still in the code, one sec, I leave a comment by that code.

@kevina
Copy link
Contributor

kevina commented May 8, 2017

I dropped the last two commits, they are saved on feat/datastore-configs-wip for now.

@kevina
Copy link
Contributor

kevina commented May 8, 2017

A few notes before I am ready to finish this:

  1. The Datastore specific config structs do not appear to be used. Should we make use of them or delete them. Right now the FlatDS stuct is in accuance as the code is still checking for "nosync" even the the FlatDS uses sync.

  2. The config code doesn't seam to check for invalid keys (even outside the Datastore specific code) is this something we want to keep as is.

  3. I will add "json omitempty tag" to the fields marked depicted as per @whyrusleeping suggestion.

@whyrusleeping
Copy link
Member Author

@kevina yeah, i think we can remove the datastore specific structs. I wrote those before i figured out how this was gonna work. We can just use the interface map stuff.

Checking for 'disallowed keys' might be nice, though not super simple to do. If you want to, go ahead and add this checking, otherwise leave it unchecked.

your '3' SGTM

return nil, err
}

return flatfs.CreateOrOpen(p, shardFun, params["nosync"].(bool))
Copy link
Contributor

Choose a reason for hiding this comment

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

Okay so here is where we check for "nosync" except that CreateOrOpen parameter is to sync, no "nosync" so this is a bug as written and I am okay with changing it to "sync".

@kevina
Copy link
Contributor

kevina commented Aug 25, 2017

@whyrusleeping oops, forgot about that will push a fix shortly and update the conversion code

@kevina
Copy link
Contributor

kevina commented Aug 26, 2017

@whyrusleeping I am not sure I agree that "Spec" should be lowercase, the config now looks like this:

{
    "StorageMax": "10GB",
    "StorageGCWatermark": 90,
    "GCPeriod": "1h",
    "spec": {
      "mounts": [
        {
          "child": {
            "compression": "none",
            "path": "datastore",
            "type": "levelds"
          },
          "mountpoint": "/",
          "prefix": "leveldb.datastore",
          "type": "measure"
        },
        {
          "child": {
            "path": "blocks",
            "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
            "sync": true,
            "type": "flatfs"
          },
          "mountpoint": "/blocks",
          "prefix": "flatfs.datastore",
          "type": "measure"
        }
      ],
      "type": "mount"
    },
    "HashOnRead": false,
    "BloomFilterSize": 0
}

If you think that is better I will go ahead and push the change and fix the conversion code.

@kevina
Copy link
Contributor

kevina commented Aug 26, 2017

I don't think it is better because all the other fields under the Datastore config are title case (i.e capitalized) with just "spec" being lower case.

@whyrusleeping
Copy link
Member Author

@kevina hrm.... yeah... youre right. We definitely should (at some point in the future) make the config look nicer.

@kevina
Copy link
Contributor

kevina commented Aug 26, 2017

So leave things as they are for now, with "Spec" being capitalized?

@whyrusleeping
Copy link
Member Author

@kevina yeah.

This PR is RFM, would be nice to get an approval from @Kubuxu and @Stebalien, but once we have a release ready for the fs-repo-migrations (pending some config changes @lgierth wanted to add) we can ship this finally :)

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

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

LGTM (sorry, I thought I checked the approve checkbox before).

whyrusleeping and others added 15 commits September 3, 2017 14:08
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>

make things super customizable

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>

better json format

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>

Migrate to new flatfs

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
License: MIT
Signed-off-by: Kevin Atkinson <k@kevina.org>
License: MIT
Signed-off-by: Kevin Atkinson <k@kevina.org>
License: MIT
Signed-off-by: Kevin Atkinson <k@kevina.org>
License: MIT
Signed-off-by: Kevin Atkinson <k@kevina.org>
License: MIT
Signed-off-by: Kevin Atkinson <k@kevina.org>
License: MIT
Signed-off-by: Kevin Atkinson <k@kevina.org>
License: MIT
Signed-off-by: Kevin Atkinson <k@kevina.org>
License: MIT
Signed-off-by: Kevin Atkinson <k@kevina.org>
License: MIT
Signed-off-by: Kevin Atkinson <k@kevina.org>
License: MIT
Signed-off-by: Kevin Atkinson <k@kevina.org>
…ault

License: MIT
Signed-off-by: Kevin Atkinson <k@kevina.org>
License: MIT
Signed-off-by: Kevin Atkinson <k@kevina.org>
License: MIT
Signed-off-by: Kevin Atkinson <k@kevina.org>
License: MIT
Signed-off-by: Kevin Atkinson <k@kevina.org>
whyrusleeping and others added 3 commits September 3, 2017 15:20
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
@whyrusleeping whyrusleeping merged commit cbd13b6 into master Sep 4, 2017
@whyrusleeping whyrusleeping deleted the feat/datastore-configs branch September 4, 2017 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants