View Issue Details

IDProjectCategoryView StatusLast Update
0020121mantisbtbugtrackerpublic2016-08-28 01:12
ReportercproensaAssigned Tocproensa 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.3.0-beta.3 
Target Version1.3.1Fixed in Version1.3.1 
Summary0020121: bug_cache_database_result does not update bugnote statistics
Description

function bug_cache_database_result in bug_api.php

when it is called to store bugnote statistics (array $p_stats)
if the bug is already in $g_cache_bug, statistics are not stored

This may not happen in standard code, but trying some modifications i have encountered this issue:

example:
filter_api reads a list of bugs. The first time it reads them, builds the bugnote stats array and stores in cache in the same call (thus working fine)
however, if in the process of building stats, a funcion of the kind "has access level" is called, this will store the bug in cache. Then when trying to store the actual stats, bug_cache_database_result will not do it

The issue would cause a repeated db query whenever bugnote stats are used (eg, for each bug in view_all_bug pages), because they cant be loaded from cache

Additional Information
function bug_cache_database_result( array $p_bug_database_result, array $p_stats = null ) {
    global $g_cache_bug;

    if( !is_array( $p_bug_database_result ) || isset( $g_cache_bug[(int)$p_bug_database_result['id']] ) ) {
        return $g_cache_bug[(int)$p_bug_database_result['id']];
    }

    return bug_add_to_cache( $p_bug_database_result, $p_stats );
}
TagsNo tags attached.

Activities

Related Changesets

MantisBT: master-1.3.x 6d6cd558

2015-09-17 14:03:18

cproensa


Committer: dregad Details Diff
Force storing empty bugnote statistics

(1) When a bug has no bugnotes, or visible ones, force storing a 'false'
value as bugnote stats in bug cache, to avoid querying the database again
later.

(2) Additionally, when the function bug_cache_database_result is called
with a stats array parameter, and the bug has already been cached, force
the creation of the stats index. Previously this wasn't possible if the
bug had already been cached without the bugnote stats.

Fixes 0020121
mod - core/bug_api.php Diff File
mod - core/filter_api.php Diff File

Issue History

Date Modified Username Field Change
2015-09-17 13:58 cproensa New Issue
2015-09-17 14:08 cproensa Note Added: 0051495
2016-08-19 09:58 dregad Changeset attached => MantisBT master-1.3.x 6d6cd558
2016-08-19 09:58 dregad Assigned To => dregad
2016-08-19 09:58 dregad Status new => resolved
2016-08-19 09:58 dregad Resolution open => fixed
2016-08-19 09:58 dregad Fixed in Version => 1.3.1
2016-08-19 10:00 dregad Assigned To dregad => cproensa
2016-08-19 10:00 dregad Target Version => 1.3.1
2016-08-28 01:12 vboctor Status resolved => closed