deptofdefense / safelock

A golang package for locking files used by distributed services
Other
4 stars 5 forks source link

Node & Session aware locking #62

Open sam-ulrich1 opened 2 years ago

sam-ulrich1 commented 2 years ago

I am looking at implementing a node and session aware version of this lib. Would you be interested in a PR instead?

Goal: In the case that a node is improperly terminated, deadlocks on the fs can be detected and automatically repaired at runtime.

Changes:

sam-ulrich1 commented 2 years ago

@chrisgilmerproj I completed my modifications. Are you interested in a PR?

chrisgilmerproj commented 2 years ago

Yes please!

sam-ulrich1 commented 2 years ago

Great to hear! I'll get it over by the end of the day

sam-ulrich1 commented 2 years ago

So I private forked it and made the mods here https://github.com/Gage-Technologies/safelock

I'm going to personally fork it and copy the changes so I can PR easily

sam-ulrich1 commented 2 years ago

@chrisgilmerproj not sure if you saw it but here's the pr https://github.com/deptofdefense/safelock/pull/63 No worries if you're just busy!

sam-ulrich1 commented 2 years ago

@chrisgilmerproj I found a bug in the latest merge. The usage of newline for separation can have collisions with the little endian endcoded session ids. It's common enough that after about 4 million file locks I've found 50k deadlocks. I've traded out the separator for __::__ in our repo. I can send another PR soon if you'd like

chrisgilmerproj commented 2 years ago

No problem @sam-ulrich1 . Send a PR and I'll approve it.

sam-ulrich1 commented 2 years ago

@chrisgilmerproj https://github.com/deptofdefense/safelock/pull/72

chrisgilmerproj commented 2 years ago

Reviewed and merged!