Download & Extend

Only capture certain views in the relationship table

Project:Boost
Version:6.x-1.x-dev
Component:Views
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Help to reduce the bloat of the boost_cache_relationship table

Comments

#1

current hard-coded way to not count nodes in a view block.

AttachmentSize
boost-785766.patch 839 bytes

#2

Status:active» needs work

#3

Attached is a patch for configuring which views get excluded from {boost_cache_relationships} in admin/settings/performance/boost (against DRUPAL-6--1-18). Is that sort of what you were going for?

AttachmentSize
785766-exclude-views-boost-cache-relationships.patch.txt 2.53 KB

#4

Looking at the code, looks like its the right idea. Nice find with views_get_all_views(). I'll have in incorporate that into the code elsewhere.

I would like to do this one more level of granularity; being able to select which displays get used in the view. The original patch excludes all block displays which is surprisingly effective. Something along this with blocks excluded as the default sounds like the correct way to go about this.

Thanks for the patch BTW. I'll play with it in a couple of days.

#5

The attached patch allows the administrator to configure individual displays for exclusion from {boost_cache_relationships}. Maybe the form could use some work, including a button that selects all displays in a view?

Again, this patch applies to DRUPAL-6--1--18.

AttachmentSize
785766-exclude-views-displays-boost-cache-relationships.patch.txt 3.07 KB

#6

prototype code. Show views that have a path, can be cached by boost & anonymous users can access

<?php
 
echo timer_read('page');
 
$account = user_load(0);
 
$views = views_get_all_views();
 
$list = array();
  foreach (
$views as $key => $view) {
   
// disabled views get nothing.
   
if (!empty($view->disabled)) {
      unset(
$views[$key]);
      continue;
    }

   
$view->init_display();
    foreach (
$view->display as $display_id => $display) {
     
// Make sure view has a path
      // Anonymous users can access view
     
if (isset($display->display_options['path']) && $view->access($display_id, $account)) {
       
// Path is cacheable via boost & does not take arguments
       
if (boost_is_cacheable($display->display_options['path']) && !stristr($display->display_options['path'], '%')) {
         
$list[$key][$display_id] = array(
           
'enabled' => TRUE,
           
'path' => $display->display_options['path'],
          );
        }
       
// Path is not cacheable via boost
       
else {
         
$list[$key][$display_id] = array(
           
'enabled' => FALSE,
           
'path' => $display->display_options['path'],
          );
        }
      }
    }
  }
  echo
'<br>' . timer_read('page');
  echo
str_replace('    ', '&nbsp;&nbsp;&nbsp;&nbsp;', nl2br(htmlentities(print_r($list, TRUE))));
?>

#7

Game plan:
Use the above code as the default set of views that will get searched. If the view takes an argument in the path, it will not be run when searching for the new/changed node in a view. In the long run I need to save the arguments the view takes otherwise bad things (performance wise) happen to your taxonomy/term/% view. Another idea is to search the boost_cache for the list of arguments in use; this won't have 100% coverage of new things though.

When new views get added; operate one of two ways:
A.) run it through the default code
B.) disable until admin has enabled it

List of views takes about a second to generate for me; thus I will save the views & ID's to use in the variables table. If option A is selected then it will update the list on cron. If option B then it only gets updated when the admin saves a new one.

#8

Status:needs work» needs review

very untested patch; mainly been working on the UI.

AttachmentSize
boost-785766.patch 12.61 KB

#9

this patch has been tested more

AttachmentSize
boost-785766.patch 21.32 KB

#10

Solving the taxonomy/term/% view issue is really only an issue if your using an external cache like varnish & your using the expire module. I would need to save all tids that I get from boost_expire_node() in a global so it will be available in the _boost_view_insert() shutdown function. Once there I pass the tid as an argument into the view; if I get a match, I then run that path taxonomy/term/5 through the url function to get the alias. I can then pass that along as a path that needs to be expired.

#11

Right now I'm making the assumption that your taxonomy term pages are filtered based off of domain access. This happens in the boost_expire_node function. If you ignore domain access for taxonomy/term then boost will not function correctly with the latest changes; it will not expire the correct taxonomy terms.

Quick hack is to load up the taxonomy/term/% view and see if it contains a domain access filter.
Complicated stuff...
Attached is the latest changes to the patch.

AttachmentSize
boost-785766.patch 25.22 KB

#12

Includes the quick hack

AttachmentSize
boost-785766.patch 27.13 KB

#13

I think its safe to assume that if the node shows up on a view without the domain access filters, it will appear on all domains. Modified patch to take this into account.

AttachmentSize
boost-785766.patch 27.33 KB

#14

Status:needs review» fixed

committed.

#15

After updating to 28 Aug dev version, I'm now getting

Fatal error: Call to undefined function domain_domains() in /home/showbuzz/public_html/sites/all/modules/boost/boost.module on line 954

when visiting certain pages as authenticated user. Am not using domain access module.

#16

opps.
here's the patch to fix that; its been committed.
http://drupalcode.org/viewvc/drupal/contributions/modules/boost/boost.mo...

AttachmentSize
boost-785766.patch 1.47 KB

#17

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#18

Can you please reupload the boost with the patch you created and link it here. The link on #16 is giving me a 404 page not found error.

Need this badly because mysql file size is growing too much that it takes forever to back it up.

#19

Status:closed (fixed)» active

Can anyone verify which one of these patches will help with the table size?

nobody click here