Conversation
zonotope
left a comment
There was a problem hiding this comment.
This makes sense. If we are certain that we will only ever right raft related files to the local filesystem and not to something else like s3 (which seems like a safe assumption to me), then I don't think we need to use the storage protocol at all for this. The general read/write functions on the file system should work just fine.
I don't think it's a good idea for the store protocol to make its root directory available outside of the protocol as that breaks encapsulation.
I don't see an issue for having a storageRoot configuration option in the consensus entry of the config map when the protocol is "raft" that points to a directory that may or may not be the same as the root directory the connection uses for storing ledger files because storing ledger files and storing raft files are separate concerns. If something raft related needs access to some ledger files, then those files should be accessed through the storage protocol anyway.
So my vote would be we add something like this to the config:
{
"consensus": {
"protocol": "raft",
"storageRoot": "data/raft"
...
}
...
}
add a storage-root field to the fluree.server.consensus.raft/RaftGroup record, and then add functions to write to and read fro the different types of file that each takes a RaftGroup and writes to that record's storage-root field directly.
Raft has two directories - one being for raft stuff (logs, snapshots) - currently: The issue is if I think the easiest path might be to just copy this connection setting ( |
Then this sounds like the case I mentioned above where we'd using the storage protocol to allow the raft component to access the ledger files it needs to. The files that raft accesses using Eventually, we should have a dedicated |
This is what is there now, and caused the issue. Here is the file store You'll see it does a bunch of stuff, none of which is needed for consensus and it actually breaks consensus. There is only one line in all of that which is needed, and that is: So we could still use the store protocol, but will need a new method that doesn't do all of these things (this is option #3 I mentioned in the original post). |
sorry, I didn't understand the problem, but I think I get it now. In this case, I think we want option 4: another protocol because this defines different behavior that not all implementations will have (like ipfs for example). The current Then, all the current storage records would still implement the I think this would solve the issue if I understand it correctly. |
Yes it would, but feels a little heavy. The only thing we need for now is a write function... everything else the conn handles. We only need to call this: The only thing we are missing is the first argument - I actually am increasingly wondering if we want to move the base storage path out of the |
I agree that it's heavier than just making the absolute path available, but making the path available outside of the storage protocol and writing to it directly with different code breaks the encapsulation of the protocol and could lead to issues with keeping the implementation in sync further down the line. Having another protocol that the same record can implement preserves the abstraction of that record which helps keep the protocol implementations in sync over time, and gives us more flexibility in what we can do here in the future with less fears of breaking existing functionality. |
|
@zonotope I ended up implementing a :server config component that contains :storage-path. This really should be a server-level setting, not just for connections - but also raft and nameservice. This solves the encapsulation problem you mentioned on the connection, and we needed to add a new server-level config map anyhow for zero-trust setting, admin-pub-key, etc. and this will get used for more than just this one setting shortly. All these changes are in the latest commit: 68e2dbd |
How does this impact decoupling the component types and moving to generic connections as we've been discussing? Would we still be able to use, say, both an s3 nameservice along with an ipns nameservice in tandem, ipfs storage for commits, file storage for indexes, and control all of that from the configuration map alone? It doesn't feel like a server level config because where we store commits, transactions, indexes, and name service records don't have to be in the same path if these artifacts are always accessed through protocols. They don't even have to use the same storage substrate. |
In all of these cases you'd have a local nameservice on disk which is what the server directly relies on. This is already what Nexus does for IPFS - it uses both IPNS but has a local FS nameservice that combines both IPFS ledger and local/filesystem ledgers. The local NS is the "authority", it can sync/pull with any number of remote nameservices.
Yes, but in all cases the local NS record for the respective ledgers will point to where the files, indexes, etc. are (which can be anywhere). There is no reason I can think of why you'd ever have, or want to maintain, multiple local directories for the same fluree server instance. This is actually one of the things that broke Raft - that it was being maintained in two spots and if you didn't configure the identical value for both it wouldn't work. It sounds like that problem multiplied - thats a lot of stuff to get wrong for no value add. I'd like Fluree to just use the local storage directory I give it and do its thing - how Fluree uses that directory is mostly up to it. Optionally I may specify a different log directory as often the former will use block storage and the latter will use local drives. I can't think of a use case where that wouldn't work or be insufficient - and I don't see how that would impact any of the things you mentioned above either about using S3, IPFS etc. |
|
There is a new branch that will address the store protocol suggestions above. |
This fixes multi-server raft.
The new nameservice changes had presented an initial issue, but once that was addressed the new file store created a new problem which is addressed here.
The way files are written to disk is not the same when used in consensus. For now, this pull the root directory from the file store in the conn and then bypasses the storage protocol as it doesn't do what we need done here.
There are a few strategies that could make this better and need to be considered as we finalize the storage protocols.
4)??
Anyhow once we settle in on a method we can write up a ticket for it.
For now, it works again.