datastore: drop bogus last_update stale-cache mechanism

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2022-06-03 10:04:16 +02:00
parent 9f19057036
commit 9c12e82006
1 changed files with 2 additions and 8 deletions

View File

@ -60,7 +60,6 @@ pub struct DataStoreImpl {
verify_new: bool, verify_new: bool,
chunk_order: ChunkOrder, chunk_order: ChunkOrder,
last_generation: usize, last_generation: usize,
last_update: i64,
} }
impl DataStoreImpl { impl DataStoreImpl {
@ -74,7 +73,6 @@ impl DataStoreImpl {
verify_new: false, verify_new: false,
chunk_order: ChunkOrder::None, chunk_order: ChunkOrder::None,
last_generation: 0, last_generation: 0,
last_update: 0,
}) })
} }
} }
@ -127,7 +125,6 @@ impl DataStore {
) -> Result<Arc<DataStore>, Error> { ) -> Result<Arc<DataStore>, Error> {
let version_cache = ConfigVersionCache::new()?; let version_cache = ConfigVersionCache::new()?;
let generation = version_cache.datastore_generation(); let generation = version_cache.datastore_generation();
let now = proxmox_time::epoch_i64();
let (config, _digest) = pbs_config::datastore::config()?; let (config, _digest) = pbs_config::datastore::config()?;
let config: DataStoreConfig = config.lookup("datastore", name)?; let config: DataStoreConfig = config.lookup("datastore", name)?;
@ -147,7 +144,7 @@ impl DataStore {
// reuse chunk store so that we keep using the same process locker instance! // reuse chunk store so that we keep using the same process locker instance!
let chunk_store = if let Some(datastore) = &entry { let chunk_store = if let Some(datastore) = &entry {
if datastore.last_generation == generation && now < (datastore.last_update + 60) { if datastore.last_generation == generation {
return Ok(Arc::new(Self { return Ok(Arc::new(Self {
inner: Arc::clone(datastore), inner: Arc::clone(datastore),
operation, operation,
@ -158,7 +155,7 @@ impl DataStore {
Arc::new(ChunkStore::open(name, &config.path)?) Arc::new(ChunkStore::open(name, &config.path)?)
}; };
let datastore = DataStore::with_store_and_config(chunk_store, config, generation, now)?; let datastore = DataStore::with_store_and_config(chunk_store, config, generation)?;
let datastore = Arc::new(datastore); let datastore = Arc::new(datastore);
map.insert(name.to_string(), datastore.clone()); map.insert(name.to_string(), datastore.clone());
@ -205,7 +202,6 @@ impl DataStore {
Arc::new(chunk_store), Arc::new(chunk_store),
config, config,
0, 0,
0,
)?); )?);
if let Some(operation) = operation { if let Some(operation) = operation {
@ -219,7 +215,6 @@ impl DataStore {
chunk_store: Arc<ChunkStore>, chunk_store: Arc<ChunkStore>,
config: DataStoreConfig, config: DataStoreConfig,
last_generation: usize, last_generation: usize,
last_update: i64,
) -> Result<DataStoreImpl, Error> { ) -> Result<DataStoreImpl, Error> {
let mut gc_status_path = chunk_store.base_path(); let mut gc_status_path = chunk_store.base_path();
gc_status_path.push(".gc-status"); gc_status_path.push(".gc-status");
@ -249,7 +244,6 @@ impl DataStore {
verify_new: config.verify_new.unwrap_or(false), verify_new: config.verify_new.unwrap_or(false),
chunk_order, chunk_order,
last_generation, last_generation,
last_update,
}) })
} }