Skip to content

encryption: let diskSideloadStorage read from RocksDB env.#25806

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
windchan7:encryption
May 23, 2018
Merged

encryption: let diskSideloadStorage read from RocksDB env.#25806
craig[bot] merged 1 commit intocockroachdb:masterfrom
windchan7:encryption

Conversation

@windchan7
Copy link
Copy Markdown
Contributor

diskSideloadStorage used to read directly from the disk through os.ReadFile().
However, after encryption at rest is introduced, the content read directly from
the disk will be garbage. This commit addresses this issue by letting it read
through RocksDB's env, which decrypts the content as it reads it.

Release note: None

@windchan7 windchan7 requested a review from a team May 22, 2018 15:32
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@windchan7 windchan7 requested a review from mberhault May 22, 2018 15:33
rocksdb::unique_ptr<rocksdb::RandomRWFile> file;
uint64_t filesize;

status = this->rep->GetEnv()->FileExists(ToString(path));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can replace pretty much all of this by just calling Status rocksdb::ReadFileToString(Env* env, const std::string& fname, std::string* data)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good to know there's such a function. I will update shortly.

`diskSideloadStorage` used to read directly from the disk through `os.ReadFile()`.
However, after encryption at rest is introduced, the content read directly from
the disk will be garbage. This commit addresses this issue by letting it read
through RocksDB's env, which decrypts the content as it reads it.

Release note: None
@windchan7
Copy link
Copy Markdown
Contributor Author

@mberhault Updated! Thanks!

Copy link
Copy Markdown
Contributor

@mberhault mberhault left a comment

Choose a reason for hiding this comment

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

LGTM

@mberhault mberhault mentioned this pull request May 23, 2018
29 tasks
@windchan7
Copy link
Copy Markdown
Contributor Author

bors r+

craig bot pushed a commit that referenced this pull request May 23, 2018
25806: encryption: let `diskSideloadStorage` read from RocksDB env. r=windchan7 a=windchan7

`diskSideloadStorage` used to read directly from the disk through `os.ReadFile()`.
However, after encryption at rest is introduced, the content read directly from
the disk will be garbage. This commit addresses this issue by letting it read
through RocksDB's env, which decrypts the content as it reads it.

Release note: None

Co-authored-by: Victor Chen <victor@cockroachlabs.com>
@craig
Copy link
Copy Markdown
Contributor

craig bot commented May 23, 2018

Build succeeded

@craig craig bot merged commit 3e550e0 into cockroachdb:master May 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants