-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
storage/engine: add FS interface and sanitize handling of aux-dir #42034
Comments
Btw, my rationale for wanting to separate out the FS interface (besides a nod to cleanliness) is because that will force examination of all of the code which uses that functionality. |
The SQL execution folks would like |
Some clarifying questions:
|
Yes. I think all of these direct uses of
I'm not sure this is all being done correctly. The combined usage of
I was assuming no. As you note, we need
I think
I think the whole file operations could be emulated by writing the entire file in one chunk and then performing a close. So 1 cgo call becomes 3: Open/Write/Close. I'm pretty sure the cost of the Write will overwhelm the extra cgo calls. |
The interface is not identical to Pebble's vfs.FS and missing some of the functionality due to the need to implement this also via the RocksDB Env. But it does include File.ReadAt that is mentioned in cockroachdb#42034. Release note: None
The interface is not identical to Pebble's vfs.FS and missing some of the functionality due to the need to implement this also via the RocksDB Env. But it does include File.ReadAt that is mentioned in cockroachdb#42034. And added some tests for both existing and new functionality. Release note: None
The interface is not identical to Pebble's vfs.FS and missing some of the functionality due to the need to implement this also via the RocksDB Env. But it does include File.ReadAt that is mentioned in cockroachdb#42034. And added some tests for both existing and new functionality. Release note: None
42995: storage/engine: add basic FS interface r=sumeerbhola a=sumeerbhola The interface is not identical to Pebble's vfs.FS and missing some of the functionality due to the need to implement this also via the RocksDB Env. But it does include File.ReadAt that is mentioned in #42034. Release note: None Co-authored-by: sumeerbhola <sumeer@cockroachlabs.com>
@jbowens We've added the Another cleanup: |
Just noticed this discrepancy between the cockroach/pkg/storage/fs/fs.go Lines 62 to 64 in 33a86b2
cockroach/pkg/storage/pebble.go Lines 989 to 991 in 33a86b2
|
Yes. I think we could invert this and have RocksDB special case not return an error. It would just require elbow grease to plumb that behavior change (I think it affects tests, but I'm not sure of that). |
Update filesystem access to always go through the storage engine's filesystem interface, which ensures correctness for in-mem and encrypted filesystems Also, add a Stat function to the storage/fs.FS interface. The RocksDB implementation is still a hack, because the RocksDB Env doesn't expose sufficient information for implementing. For on-disk RocksDB engines, this implementation circumvents the Env, performing a direct os.Stat of the filesystem. For in-memory RocksDB engines, it provides a mocked os.FileInfo implementation. Fixes cockroachdb#42034. Related to cockroachdb#31913. Release note: None
#31913 looks related, although #49717 doesn't exactly fix the mentioned fact that file size reads aren't threaded all the way through to the RocksDB Env. IIRC, Env does have a getFileAttributes method that includes file size. I'm not sure if we care about that bit of cleanup since it's RocksDB-only and the encrypted file sizes are equal? |
Update filesystem access to always go through the storage engine's filesystem interface, which ensures correctness for in-mem and encrypted filesystems Also, add a Stat function to the storage/fs.FS interface. The RocksDB implementation is still a hack, because the RocksDB Env doesn't expose sufficient information for implementing. For on-disk RocksDB engines, this implementation circumvents the Env, performing a direct os.Stat of the filesystem. For in-memory RocksDB engines, it provides a mocked os.FileInfo implementation that panics when any of its methods are invoked. This is sufficient for existing call sites that use Stat to check for existence. Fixes cockroachdb#42034. Related to cockroachdb#31913. Release note: None
I don't particular mind that the file size retrieval isn't thread all the way through to RocksDB, but we should definitely be using a method on |
49717: kvserver: use engine's filesystem r=jbowens a=jbowens Update filesystem access to always go through the storage engine's filesystem interface, which ensures correctness for in-mem and encrypted filesystems Also, add a Stat function to the storage/fs.FS interface. The RocksDB implementation is still a hack, because the RocksDB Env doesn't expose sufficient information for implementing. For on-disk RocksDB engines, this implementation circumvents the Env, performing a direct os.Stat of the filesystem. For in-memory RocksDB engines, it provides a mocked os.FileInfo implementation. Fixes #42034. Related to #31913. Release note: None Co-authored-by: Jackson Owens <jackson@cockroachlabs.com>
The handling of
Engine.GetAuxiliaryDir
is a bit of a mess.diskSideloadStorage
, andSSTSnapshotStorage
both use the aux dir for storage, but assume that the filesystem routines inos
will work on them. This is not true for in-memory engines and it tests only accidentally work because the RocksDBMemEnv
does not implement full filesystem semantics (a parent directory is auto-created when a file is created).In addition to cleaning up the handling of aux-dir, we should separate out the
Engine.*File
routines to their own interface. Thepebble/vfs.FS
interface is a good one to model on, though I think we only need a subset of that interface. For example,FS.Lock
andFS.List
do not appear to be needed.The text was updated successfully, but these errors were encountered: