diff options
author | Markos Fountoulakis <44345837+mfundul@users.noreply.github.com> | 2019-05-20 21:31:56 +0300 |
---|---|---|
committer | Paul Emm. Katsoulakis <34388743+paulkatsoulakis@users.noreply.github.com> | 2019-05-20 21:31:56 +0300 |
commit | 06e16acdb01be318a6c5c6bd3a2a49d2f4458dba (patch) | |
tree | c97beb82abbb9c62b6bb3168ef3363dc4413ef9e /database/engine | |
parent | 0b75b7ccb5ce68013f203971ed02ca7e61936b7e (diff) |
Fix delete datafile error (#6057)
* Added print to debug failure to delete page during datafile deletion
* Detect case of corrupted pages not being in page cache when deleting file
Diffstat (limited to 'database/engine')
-rw-r--r-- | database/engine/pagecache.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/database/engine/pagecache.c b/database/engine/pagecache.c index b3438fa846..c90947a674 100644 --- a/database/engine/pagecache.c +++ b/database/engine/pagecache.c @@ -350,8 +350,14 @@ void pg_cache_punch_hole(struct rrdengine_instance *ctx, struct rrdeng_page_cach uv_rwlock_wrlock(&page_index->lock); ret = JudyLDel(&page_index->JudyL_array, (Word_t)(descr->start_time / USEC_PER_SEC), PJE0); - assert(1 == ret); uv_rwlock_wrunlock(&page_index->lock); + if (unlikely(0 == ret)) { + error("Page under deletion was not in index."); + if (unlikely(debug_flags & D_RRDENGINE)) + print_page_cache_descr(descr); + goto destroy; + } + assert(1 == ret); uv_rwlock_wrlock(&pg_cache->pg_cache_rwlock); ++ctx->stats.pg_cache_deletions; @@ -368,7 +374,7 @@ void pg_cache_punch_hole(struct rrdengine_instance *ctx, struct rrdeng_page_cach /* even a locked page could be dirty */ while (unlikely(descr->flags & RRD_PAGE_DIRTY)) { debug(D_RRDENGINE, "%s: Found dirty page, waiting for it to be flushed:", __func__); - if(unlikely(debug_flags & D_RRDENGINE)) + if (unlikely(debug_flags & D_RRDENGINE)) print_page_cache_descr(descr); pg_cache_wait_event_unsafe(descr); } @@ -383,6 +389,7 @@ void pg_cache_punch_hole(struct rrdengine_instance *ctx, struct rrdeng_page_cach uv_rwlock_wrunlock(&pg_cache->pg_cache_rwlock); } pg_cache_put(descr); +destroy: pg_cache_destroy_descr(descr); pg_cache_update_metric_times(page_index); } |