Guarantee consistency when handling expired tombstones and lock objects #1445
Labels
No labels
P0
P1
P2
P3
badger
frostfs-adm
frostfs-cli
frostfs-ir
frostfs-lens
frostfs-node
good first issue
triage
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-node#1445
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The task is based on several bugs that have appeared recently.
Problem
Suppose a locked object and its lock are placed on separate shards. While handling expired lock objects, the GC deletes the expired lock object but doesn't unlock the associated object if it's on a read-only shard. As a result, the original object remains locked infinitely on that node.
Since the GC needs to access all shards when handling a expired locks, it uses callbacks provided by the storage engine. Then the GC accesses each shards separately, which leads to the problem described above.
The same problem may occur when a shard with the lock was detached and then attached after the GC have already handled the expired lock object.
Tombstones and graves are handled similarly and may have same problems.
Different behavior of garbage collector
The garbage collector handles expired tombstone and grave, lock object and locks differently:
As a result:
Proposed solution
Append expiration epoch to graves and locks
From now on, each grave or lock must include an expiration epoch.
Inhume
andLock
operations will require an expiration epoch to be passed along with other arguments and will store the expiration epoch together with the grave or lock.Modify behavior of garbage collector
If every graves and locks had expiration epoch, the GC behavior would be very simple, it would have three routines: one for deleting expired objects of all types, other one for deleting expired graves, last one for deleting expired locks. However, before metabase migration (about migration see below) is applied, the GC should handle graves and locks of both old and new formats. The following GC behavior is proposed:
Additionally, handling expired objects of different types can be united into one routine.
Apply metabase migration
Appending expiration epoch to graves and lock requires applying metabase migration. The following approach is suggested.
Asynchronous migration with policer
Since determining the expiration epoch for a grave or lock may require searching for a tombstone or lock object on other nodes, synchronous migration is not easy and fast enough. A policer is proposed to find tombstones and lock objects and append the missing expiration epochs to graves and locks.
However, it's not guaranteed that every tombstone or lock object can be found. Some may have been lost.
Synchronous migration in the future
After a sufficient period, when most graves and locks have already had their expiration epochs appended, a synchronous migration can be applied.
Handling newly created metabases differently
Newly created metabases will already all graves and locks with expiration epochs. Therefore, the policer can skip migration for these metabases. Additionally, the GC behavior will be much simpler: it can delete graves and tombstones separately, as well as locks and lock objects.
Progress
a-savchuk referenced this issue2024-11-08 09:54:58 +00:00
LockPrm
andLockRes
to store Lock operation parameters and results #1556Make GC handle expired lockers/tombstones correctly while some shards are read-onlyto Guarantee consistency when handling expired tombstones and lock objectsfrostfs-lens meta explore
#1416