ehcache / ehcache3

Ehcache 3.x line
http://www.ehcache.org
Apache License 2.0
2.02k stars 581 forks source link

Enhancement implemented #2954 : Recover from fatal invalid cache state #3103

Closed jitendra-nalwaya closed 1 year ago

jhouserizer commented 1 year ago

Hi @jitendra-nalwaya ,

Could you please explain the purpose of using two sentinel files ("cleanShutdown" and "unCleanShutdown")?

What does using two files rather than one provide? why can't the presence of "unCleanShutdown" indicate non-clean, and the absence of it represent clean? or why can't the presence of "cleanShutdown" represent clean, and the absence represent non-clean?

Managing two files is non-atomic, and therefore more prone to leaving one behind when it need not be, or etc.?

There may be an advantage to using two files, and if so, can you please explain?

jitendra-nalwaya commented 1 year ago

Hi @jhouserizer,

Used two sentinel files to identify last shutdown status in below scenarios -

1) When customer upgrade their environment with this enhancement. 2) Remove directory structure explicitly by customer. 3) Remove directory structure using destroy/destroyall methods.

On startup,

We can use single sentinel file as well if we write some content in it to identify the last shutdown state.

Could you please elaborate below statement - Managing two files is non-atomic, and therefore more prone to leaving one behind when it need not be, or etc.?

jitendra-nalwaya commented 1 year ago

@chrisdennis Creating a single "clean" marker on shutdown and verifying on startup (and then delete it). Please review.

jitendra-nalwaya commented 1 year ago

@chrisdennis Introduce new API isClean() to identify state(normal/abnormal) of stopped service, please review.

jitendra-nalwaya commented 1 year ago

@chrisdennis I addressed review comments. Please review.

jitendra-nalwaya commented 1 year ago

@chrisdennis New pull request is created with 2 commits - https://github.com/ehcache/ehcache3/pull/3161

jitendra-nalwaya commented 1 year ago

Enhancement #2954 implemented by https://github.com/ehcache/ehcache3/pull/3161