-
Notifications
You must be signed in to change notification settings - Fork 54
DeviceManager/lvm: Remove device from cache on delete #408
Conversation
yes, I noticed this when idempotency-enabled testing in #393 started to fail after uuid->hash change. Problem remained hidden before because we always used fresh uuid so old entries did not surface in checking. With repeatable hash as VolumeID, we hit the previous entry in the cache. But about LV entry cache: do we really need this? Is it meant for performance? |
Yes, When doing this change I felt like, almost every operation in LVM mode has the need to fetch the current list of devices from lvm. So instead of parsing
Information at the Controller is different from Node.
I agree.
Because it's not executing |
true, I was just counting where we create some data entries when a Volume is created.
The players are Node, Controller, and k8s (and possibly even more, some sidecars). |
I fully agree. |
Before we add complex code for the sake of performance we have to have:
|
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.
Can we clean up the Go style before merging?
pkg/pmem-device-manager/pmd-lvm.go
Outdated
@@ -156,12 +156,18 @@ func (lvm *pmemLvm) DeleteDevice(name string, flush bool) error { | |||
if err != nil { | |||
return err | |||
} | |||
if err := ClearDevice(device, flush); err != nil { | |||
if err = ClearDevice(device, flush); err != nil { |
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.
Please use err :=
, it's better Go style.
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.
Done.
pkg/pmem-device-manager/pmd-lvm.go
Outdated
return err | ||
} | ||
|
||
_, err = pmemexec.RunCommand("lvremove", "-fy", device.Path) | ||
return err | ||
if _, err = pmemexec.RunCommand("lvremove", "-fy", device.Path); err != nil { |
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.
Same here.
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.
Done
LVM device manager caches the devices that it creates, but not cleaning up those device references on delete. This change fixes this issue.
c7a518f
to
e09d8da
Compare
LVM device manager caches the devices that it creates, but not cleaning up those
device references on delete. This change fixes this issue.