-
Notifications
You must be signed in to change notification settings - Fork 4k
storage: enable switching env through encryption flags #20225
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
Conversation
cafb525 to
6f96ae4
Compare
77ea557 to
f01fd80
Compare
efcab4a to
010f3cd
Compare
|
Pulled in some commits from other WIP (and closed others). See commit descriptions. |
3b6e04a to
42e6632
Compare
|
I'd appreciate a look, I need this functionality to keep going on the libroach side. |
|
Looking, sorry for the delay! |
pkg/base/store_spec.go
Outdated
| // EncryptionSpec is non-nil after MatchStoreAndEncryptionSpecs if there is an encryption | ||
| // spec with matching path. | ||
| // EncryptionSpec *StoreEncryptionSpec | ||
| ExtraFields map[string]string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw: this clearly needs to go, it's not like we can easily pass a string->string map to cgo, and even if we could, that's a bit fragile.
I'm still trying to figure out if I can have some blind CCLOptions of some type, but it's a bit tricky.
|
Looks good so far! The meat of my comments are predictably in the area of ccl-oss glueing. I'll hold off on looking at the The C++ looked mostly trivial so far, but if there's any subtlety in then, I have missed it. I'm also not an experienced C++ programmer (or one at all). Reviewed 9 of 9 files at r1, 7 of 7 files at r2, 13 of 13 files at r3, 5 of 5 files at r4. c-deps/libroach/db.cc, line 101 at r1 (raw file):
Comment needs an update now that there are two envs. What is the role of each? c-deps/libroach/env_switching.cc, line 22 at r1 (raw file):
and a similar cone at the top. I had to scratch my head for a couple dozen seconds. c-deps/libroach/env_switching.cc, line 30 at r1 (raw file):
Do we ever call this without an env? If not, probably safer to disallow it. pkg/base/store_spec.go, line 69 at r3 (raw file):
What's happening here? pkg/base/store_spec.go, line 170 at r3 (raw file):
const path = "path"and then use that twice below. pkg/base/store_spec.go, line 69 at r4 (raw file):
Needs explanation. pkg/base/store_spec.go, line 73 at r4 (raw file): Previously, mberhault (marc) wrote…
Ack, I'll just ignore this part for now. pkg/ccl/baseccl/encryption_spec.go, line 39 at r3 (raw file):
Why not https://golang.org/pkg/net/url/#URL and avoid a hand-rolled format (simply strip the pkg/ccl/baseccl/encryption_spec.go, line 129 at r3 (raw file):
I'm confused why this returns the hardcoded flag name. pkg/ccl/baseccl/encryption_spec.go, line 161 at r4 (raw file):
The comment doesn't mention that we're going to manipulate the store spec list. Should this be called pkg/ccl/cliccl/start.go, line 40 at r3 (raw file):
Just do wrapped := cli.StartCmd.PersistentPreRunE
cli.StartCmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error {
if err := wrapped(cmd, args); err != nil {
return err
}
return matchStoreEncryptionSpecs(cmd, args)
}and there is no need for To make this independent of init order, you can make both setters to pkg/ccl/cliccl/start.go, line 46 at r3 (raw file):
Instead of exposing all of pkg/cli/context.go, line 61 at r3 (raw file):
Not exclusively, I believe. pkg/cli/start.go, line 654 at r3 (raw file):
Ignoring for now. pkg/storage/engine/enginepb/registry.proto, line 40 at r2 (raw file):
Add a comment specifying if this is a relative or absolute path. I suppose it's relative (to what?) to allow moving of mount points. Comments from Reviewable |
|
Thanks for the review. I'll loop back around when I've sorted out how to properly pass CCL options through rocksdb, most likely not the The only trick in the C++ code is who owns what for deletion. The envs aren't actually used by And if it makes you feel better: I don't know any experienced C++ programmers, just gray-haired ones. Review status: all files reviewed at latest revision, 15 unresolved discussions, all commit checks successful. c-deps/libroach/db.cc, line 101 at r1 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Done. I still need to figure out exactly who will own what. Right now, they're only passed to the c-deps/libroach/env_switching.cc, line 22 at r1 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Done. I used straight lines because it otherwise breaks single-line comments. c-deps/libroach/env_switching.cc, line 30 at r1 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
pkg/base/store_spec.go, line 69 at r3 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
uh. oops, old comment. Replaced with a relevant one. pkg/base/store_spec.go, line 170 at r3 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Done and in the pkg/base/store_spec.go, line 69 at r4 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Done. pkg/ccl/baseccl/encryption_spec.go, line 39 at r3 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
I'm following the StoreSpec. I want to keep the same behavior, but I especially want to make sure the parsing is exactly the same as we need to match paths. pkg/ccl/baseccl/encryption_spec.go, line 129 at r3 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Ported over from pkg/ccl/baseccl/encryption_spec.go, line 161 at r4 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Done. Renamed to pkg/ccl/cliccl/start.go, line 40 at r3 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Good idea. Done here and in pkg/ccl/cliccl/start.go, line 46 at r3 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Done with a warning. pkg/cli/context.go, line 61 at r3 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
ugh. Right you are. dropped the comment anyway now that it's no longer public. pkg/storage/engine/enginepb/registry.proto, line 40 at r2 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Most likely relative but the Env doesn't get relative paths so I'll have to generate those myself. Comments from Reviewable |
b9b05c0 to
b34cb90
Compare
|
Review status: 18 of 28 files reviewed at latest revision, 15 unresolved discussions, all commit checks successful. pkg/base/store_spec.go, line 73 at r4 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
@petermattis, @bdarnell: any thoughts on the best way to pass go-CCL objects blindly through Comments from Reviewable |
|
Without looking at this code: pass an encoded protobuf. I’ll take a look
tomorrow.
…On Wed, Nov 29, 2017 at 9:54 PM marc ***@***.***> wrote:
Review status: 18 of 28 files reviewed at latest revision, 15 unresolved
discussions, all commit checks successful.
------------------------------
*pkg/base/store_spec.go, line 73 at r4
<https://reviewable.io:443/reviews/cockroachdb/cockroach/20225#-L-7IR0AC778-MlT7fQq-r4-73:-L-9p7Vzzz8KDJX1seDu:bkj1ug>
(raw file
<https://github.com/cockroachdb/cockroach/blob/42e6632b956ab718197529b9e828d85811fc4b4c/pkg/base/store_spec.go#L73>):*
*Previously, tschottdorf (Tobias Schottdorf) wrote…*
Ack, I'll just ignore this part for now.
@petermattis <https://github.com/petermattis>, @bdarnell
<https://github.com/bdarnell>: any thoughts on the best way to pass
go-CCL objects blindly through rocksdb.go::open() and into libroach-CCL?
I'll poke at trying to pass a C++ object that's only known in libroachccl,
but I'm not sure go will be too happy about that.
------------------------------
*Comments from Reviewable
<https://reviewable.io:443/reviews/cockroachdb/cockroach/20225>*
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#20225 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AF6f94xz-eH27aGflGZ83ROKoJGXGMxyks5s7hjIgaJpZM4Qnm7_>
.
|
|
That's one option and it would work fine for opaque config settings (eg: the encryption flag). My other problem is figuring out how to have go-CCL setup cpp-CCL hooks into libroach for CCL-only code. Between overridden env and all the communication (stats reporting, periodic loops, etc..) we'll have a lot of CCL code spread between go and cpp that needs to communicate. Review status: 18 of 28 files reviewed at latest revision, 15 unresolved discussions, all commit checks successful. Comments from Reviewable |
|
Reviewed 11 of 11 files at r5. c-deps/libroach/db.cc, line 101 at r1 (raw file): Previously, mberhault (marc) wrote…
Ok. I assume that'll be done by the end of this PR? Otherwise, please insert a TODO. c-deps/libroach/env_switching.cc, line 22 at r1 (raw file): Previously, mberhault (marc) wrote…
💓 pkg/base/store_spec.go, line 73 at r4 (raw file): Previously, mberhault (marc) wrote…
Like Pete said, a protobuf comes to mind. Or you can use a URL if human readable is preferred. pkg/ccl/baseccl/encryption_spec.go, line 39 at r3 (raw file): Previously, mberhault (marc) wrote…
Ah. That makes sense, but then it seems to makes sense to have a method that is called by both which parses the pkg/ccl/baseccl/encryption_spec.go, line 129 at r3 (raw file): Previously, mberhault (marc) wrote…
Hmm, pkg/cli/context.go, line 70 at r5 (raw file):
should -> you and while you're here anyway, insert a newline before the warning. pkg/cli/flags.go, line 164 at r5 (raw file):
Optional nit: you could even factor this out, // AddPersistentPreRunE adds the given hook after any existing pre run hooks for the command.
// This allows hooks to be set without wiping out an existing hook.
func AddPersistentPreRunE(cmd *cobra.Command, hook func(*cobra.Command, []string) error) {
wrapped := cmd.PersistentPreRunE
cmd.PersistentPreRunE = func(c *cobra.Command, a []string) error {
if wrapped != nil {
if err := wrapped(c, a); err != nil { return err }
}
return hook(c, a)
}
}which makes it easy to grep for the "other" half of the hook setting and creates a distinguished place for explaining what's happening. pkg/storage/engine/enginepb/registry.proto, line 40 at r2 (raw file): Previously, mberhault (marc) wrote…
Interesting. And that just works on Windows? Worth making a note to test if nothing else. Comments from Reviewable |
|
Review status: all files reviewed at latest revision, 8 unresolved discussions, all commit checks successful. pkg/base/store_spec.go, line 73 at r4 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
For options, I would go with comma separated, semicolon separated or query-components (ampersand separated). I might not have enough context here to be giving good advice, though. Comments from Reviewable |
b34cb90 to
aa89def
Compare
|
Review status: 4 of 28 files reviewed at latest revision, 9 unresolved discussions. c-deps/libroach/db.cc, line 101 at r1 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Adding a TODO for now. Implementing the Switching Env is probably done separately. pkg/base/store_spec.go, line 73 at r4 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Yeah, my bigger concern is that a lot of the encryption objects on the C++ side will be CCL. This mean initializing them in go-ccl code, then passing them through somehow. I'm still investigating, so I'll take the pkg/ccl/baseccl/encryption_spec.go, line 39 at r3 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
True, hence why I'm sharing path parsing. Another kink is that the pkg/ccl/baseccl/encryption_spec.go, line 129 at r3 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Changed the pkg/cli/context.go, line 70 at r5 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Done. pkg/cli/flags.go, line 164 at r5 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Good idea, done. pkg/cli/start.go, line 654 at r3 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
I'm taking this out for now. pkg/storage/engine/enginepb/registry.proto, line 40 at r2 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Done. Comments from Reviewable |
|
Ok, I'm removing the extra fields and will leave this to a subsequent PR. I'd like to merge this one as is, then refactor some of the cli flags and spec parsing. Review status: 4 of 28 files reviewed at latest revision, 9 unresolved discussions, some commit checks pending. Comments from Reviewable |
|
Drive by comment: Little known fact that Windows will handle forward
slashes in paths just fine, save for maybe some real obscure APIs. It’s
drive letters (ie, constructing absolute paths) that really cause trouble.
…On Thu, Nov 30, 2017 at 11:56 AM Peter Mattis ***@***.***> wrote:
Review status: all files reviewed at latest revision, 8 unresolved
discussions, all commit checks successful.
------------------------------
*pkg/base/store_spec.go, line 73 at r4
<https://reviewable.io:443/reviews/cockroachdb/cockroach/20225#-L-7IR0AC778-MlT7fQq-r4-73:-L-Cq_UZ3Y-j-tAFh6FL:b3zm7vv>
(raw file
<https://github.com/cockroachdb/cockroach/blob/42e6632b956ab718197529b9e828d85811fc4b4c/pkg/base/store_spec.go#L73>):*
*Previously, tschottdorf (Tobias Schottdorf) wrote…*
Like Pete said, a protobuf comes to mind. Or you can use a URL if human
readable is preferred. ear://<path>?<key>=<val>&<key>=<val>.
For options, I would go with comma separated, semicolon separated or
query-components (ampersand separated). I might not have enough context
here to be giving good advice, though.
------------------------------
*Comments from Reviewable
<https://reviewable.io:443/reviews/cockroachdb/cockroach/20225>*
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#20225 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA15IGI1T0AvFQPSTfI3YJTEy9EHC7RMks5s7t5HgaJpZM4Qnm7_>
.
|
|
LGTM
On Thu, Nov 30, 2017 at 12:01 PM Nikhil Benesch <notifications@github.com>
wrote:
Drive by comment: Little known fact that Windows will handle forward
slashes in paths just fine, save for maybe some real obscure APIs. It’s
drive letters (ie, constructing absolute paths) that really cause trouble.
On Thu, Nov 30, 2017 at 11:56 AM Peter Mattis ***@***.***>
wrote:
> Review status: all files reviewed at latest revision, 8 unresolved
> discussions, all commit checks successful.
> ------------------------------
>
> *pkg/base/store_spec.go, line 73 at r4
> <
https://reviewable.io:443/reviews/cockroachdb/cockroach/20225#-L-7IR0AC778-MlT7fQq-r4-73:-L-Cq_UZ3Y-j-tAFh6FL:b3zm7vv
>
> (raw file
> <
https://github.com/cockroachdb/cockroach/blob/42e6632b956ab718197529b9e828d85811fc4b4c/pkg/base/store_spec.go#L73
>):*
> *Previously, tschottdorf (Tobias Schottdorf) wrote…*
>
> Like Pete said, a protobuf comes to mind. Or you can use a URL if human
> readable is preferred. ear://<path>?<key>=<val>&<key>=<val>.
>
> For options, I would go with comma separated, semicolon separated or
> query-components (ampersand separated). I might not have enough context
> here to be giving good advice, though.
> ------------------------------
>
> *Comments from Reviewable
> <https://reviewable.io:443/reviews/cockroachdb/cockroach/20225>*
>
> —
> You are receiving this because your review was requested.
> Reply to this email directly, view it on GitHub
> <
#20225 (comment)
>,
> or mute the thread
> <
https://github.com/notifications/unsubscribe-auth/AA15IGI1T0AvFQPSTfI3YJTEy9EHC7RMks5s7t5HgaJpZM4Qnm7_
>
> .
>
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#20225 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AE135ILDbBSUuV6FTRkKLr_snnW2hC08ks5s7t9OgaJpZM4Qnm7_>
.
--
…-- Tobias
|
aa89def to
d44fe30
Compare
encryption-at-rest work. Add --enterprise-encryption flag and match it to stores. Enabling encryption forces the use of the "Switching Env" store version. If encryption is not requested, we do not bump the version. This is to allow downgrades to older binaries that do not support the switching env. This will be changed after "a few" releases.
d44fe30 to
dc0e674
Compare
Part of encryption work. See Encryption RFC
Add --enterprise-encryption flag and match it to stores.
Enabling encryption forces the use of the "Switching Env"
store version.
If encryption is not requested, we do not bump the version. This is
to allow downgrades to older binaries that do not support the switching
env. This will be changed after "a few" releases.