-
Notifications
You must be signed in to change notification settings - Fork 22
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
NBS-4681: cache DA sessions in a file #41
Conversation
1581c42
to
56d27ab
Compare
ed5f8bb
to
9df623b
Compare
@@ -455,6 +460,8 @@ TFuture<TInitializeResult> TDiskAgentState::Initialize( | |||
Logging->CreateLog("BLOCKSTORE_DISK_AGENT")); | |||
|
|||
InitRdmaTarget(std::move(rdmaTargetConfig)); | |||
|
|||
RestoreSessions(*DeviceClient); |
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.
DeviceClient
it's already member of TDiskAgentState so you can avoid passing it to member functions RestoreSessions
and UpdateSessionCache
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.
This is a feature :) Inside RestoreSessions
and UpdateSessionCache
there is no need to check the validity of DeviceClient
.
std::make_move_iterator(session.MutableDeviceIds()->begin()), | ||
std::make_move_iterator(session.MutableDeviceIds()->end())); | ||
|
||
CheckError(client.AcquireDevices( |
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.
Before calling to client.AcquireDevices
we need to filter out uuids from old devices that were removed from the disk agent.
Otherwise disk agent can be stopped and some change in config will remove device. Then we will try to acquire the old device from the saved sessions file and it will fail because of the code here https://github.com/ydb-platform/nbs/blob/main/cloud/blockstore/libs/storage/disk_agent/model/device_client.cpp#L40
Also if we won't prune old devices that stopped to be part of the disk agent config we might end with large sessions file containing sessions with invalid device uuids
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.
I've tweaked the code so that only broken sessions will be rejected now. There is no problem with old devices because UpdateSessionCache
rewrites the cache file completely with actual sessions.
9df623b
to
e8cdd81
Compare
e8cdd81
to
1174fc4
Compare
@@ -21,6 +21,51 @@ TDeviceClient::TDeviceClient( | |||
, Log(std::move(log)) | |||
{} | |||
|
|||
TVector<NProto::TDiskAgentDeviceSession> TDeviceClient::GetSessions() const | |||
{ | |||
THashMap<TString, NProto::TDiskAgentDeviceSession> sessions; |
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.
а зачем дедупликация через мапу? разве у нас могут быть дубли?
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.
Это группировка по clientId:
uuid-1 : writer-1, reader-1
uuid-2 : writer-2
uuid-3 : writer-1, reader-1
в
reader-1: uuid-1, uuid-3
writer-1: uuid-1, uuid-3
writer-2: uuid-2
1174fc4
to
f094392
Compare
NBS-4681: cache DA sessions in a file (#41)
No description provided.