'taxonomy:edge' comes with a core patch, labelled 'taxonomy-6.20.patch'. What version of Drupal core is required for the core patch?

If I'm appying it against Drupal core 6.24, it fails like so:

# patch < taxonomy-6.20.patch 
patching file taxonomy.module
Hunk #1 FAILED at 835.
Hunk #2 FAILED at 1130.
2 out of 2 hunks FAILED -- saving rejects to file taxonomy.module.rej

Thanks!

Comments

gielfeldt’s picture

Hi asb

Thanks for reporting this. I'll make a 6.21-24 patch soon. I think the .20 also works on .21 and .22 AFAIR.

/Thomas

gielfeldt’s picture

Hi again

Actually the patch seem to work. Try:

# patch -p1 < taxonomy-6.20.patch
asb’s picture

Hi Thomas,

thanks for the quick reply!

On the site where I'm trying 'taxonomy_edge', I had to downgrade to Drupal 6.23 because 6.24 results in a WSOD. Currently I'm running Pressflow 6.23 on this site, which is supposed to be API-compatible with Drupal core. However:

# patch -p1 < taxonomy-6.20.patch
patching file modules/taxonomy/taxonomy.module
Hunk #1 FAILED at 835.
Hunk #2 FAILED at 1130.
2 out of 2 hunks FAILED -- saving rejects to file modules/taxonomy/taxonomy.module.rej

Contents of taxonomy.module.rej:

# cat modules/taxonomy/taxonomy.module.rej
--- modules/taxonomy/taxonomy.module
+++ modules/taxonomy/taxonomy.module
@@ -835,6 +835,9 @@
  *   Results are statically cached.
  */
 function taxonomy_get_tree($vid, $parent = 0, $depth = -1, $max_depth = NULL) {
+  if (function_exists('taxonomy_edge_taxonomy_get_tree')) {
+    return taxonomy_edge_taxonomy_get_tree($vid, $parent, $depth, $max_depth);
+  }
   static $children, $parents, $terms;
 
   $depth++;
@@ -1130,6 +1133,9 @@
  *   A resource identifier pointing to the query results.
  */
 function taxonomy_select_nodes($tids = array(), $operator = 'or', $depth = 0, $pager = TRUE, $order = 'n.sticky DESC, n.created DESC') {
+  if (function_exists('taxonomy_edge_taxonomy_select_nodes')) {
+    return taxonomy_edge_taxonomy_select_nodes($tids, $operator, $depth, $pager, $order);
+  }
   if (count($tids) > 0) {
     // For each term ID, generate an array of descendant term IDs to the right depth.
     $descendant_tids = array();

Maybe this would qualify as an bug report against Pressflow, if they had an issue queue ;-/

mikeytown2’s picture

@asb
Just manually edit the taxonomy.module file to add this in at the top of taxonomy_get_tree() ~line:837

  if (function_exists('taxonomy_edge_taxonomy_get_tree')) {
    return taxonomy_edge_taxonomy_get_tree($vid, $parent, $depth, $max_depth);
  }

And this at the top of taxonomy_select_nodes() ~line:1135

  if (function_exists('taxonomy_edge_taxonomy_select_nodes')) {
    return taxonomy_edge_taxonomy_select_nodes($tids, $operator, $depth, $pager, $order);
  }
gielfeldt’s picture

Hi asb

Even though the Pressflow taxonomy.module is API compatible, the file may have changed too much for the patch to work.

I might create a patch for pressflow in the next release. Until then, I suggest you just manually add the patch like mikeytown2 suggests.

Remeber not to include the php open and close tags in the code above, they are just for syntax highlighting.

gielfeldt’s picture

Hmmm

I just tried downloading pressflow 6.23, and successfully applied the patch:

patch -p1 < sites/all/modules/taxonomy_edge/taxonomy-6.20.patch 
patching file modules/taxonomy/taxonomy.module
Hunk #1 succeeded at 834 (offset -1 lines).
Hunk #2 succeeded at 1132 (offset -1 lines).
mikeytown2’s picture

gielfeldt’s picture

Hi asb

Did you succeed in applying the patch?

asb’s picture

Status: Active » Postponed (maintainer needs more info)

Nope, and I really don't have time at the moment to educate myself why Github seems to deliver us different Pressflow packages, or if there might be another (official) way to obtain proper Pressflow releases (they don't answer on Launchpad). Sorry :-(

gielfeldt’s picture

Update: I believe #556842: taxonomy_get_tree() memory issues is the reason why the patch doesn't work. I'll have to create a pressflow patch for it to work. Also, I should implement this in Taxonomy Edge and see how it fits.

gielfeldt’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new1.21 KB

Here's a patch for pressflow...

asb’s picture

Sorry, fails with git apply when running from within the site's root folder, or from within ./modules/taxonomy.

patch -p0 < taxonomy-6.x-pressflow.patch
patching file b/modules/taxonomy/taxonomy.module
Hunk #1 FAILED at 863.
Hunk #2 FAILED at 1185.
2 out of 2 hunks FAILED -- saving rejects to file b/modules/taxonomy/taxonomy.module.rej

From ./modules/taxonomy:

# cat b/modules/taxonomy/taxonomy.module.rej 
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -863,6 +863,9 @@
  *   Results are statically cached.
  */
 function taxonomy_get_tree($vid, $parent = 0, $depth = -1, $max_depth = NULL) {
+  if (function_exists('taxonomy_edge_taxonomy_get_tree')) {
+    return taxonomy_edge_taxonomy_get_tree($vid, $parent, $depth, $max_depth);
+  }
   static $children, $parents, $terms;
 
   // We cache trees, so it's not CPU-intensive to call get_tree() on a term
@@ -1185,6 +1188,9 @@
  *   A resource identifier pointing to the query results.
  */
 function taxonomy_select_nodes($tids = array(), $operator = 'or', $depth = 0, $pager = TRUE, $order = 'n.sticky DESC, n.created DESC') {
+  if (function_exists('taxonomy_edge_taxonomy_select_nodes')) {
+    return taxonomy_edge_taxonomy_select_nodes($tids, $operator, $depth, $pager, $order);
+  }
   if (count($tids) > 0) {
     // For each term ID, generate an array of descendant term IDs to the right depth.
     $descendant_tids = array();
gielfeldt’s picture

Hi again

Sorry for the long wait.

Did you try with patch -p1 ? If this doesn't work, I'm not quite sure which version of taxonomy.module you have.

If all else fails, you can post your taxonomy.module here, I'll patch it manually for you.

asb’s picture

Thanks for your enormous patience in this matter. Yes, patch -p1 fails as well, at least when taxonomy-6.x-pressflow.patch is in ./modules/taxonomy, and patch -p1 is being called from within this directory. Too bad that taxonomy.module doesn't say in it's header what version it is, and too bad that Drupal isn't able to validate the integrity of it's files; but I'm afraid there is not much point in manually applying a patch that is supposed to apply cleanly, until I have figured out why it doesn't apply on my site.

gielfeldt’s picture

Ok. You need to be in the site root folder i think.

Is it ok to close this issue for now? You can open a new one if necessary.

Let me know if you get it to work and if it fits your usecase.

asb’s picture

Hm, I moved the path to Drupal's root folder and tried to appy it with -p1 from there, with the same result. Also the patch does neither apply with -p0, or without any options. So for me the initial question - "What version of Drupal core is required for the core patch?" - is still unanswered since I can't find a Drupal or Pressflow version where it applies (taxonomy-6.20.patch fails for me as well against an unaltered Drupal core 6.23).

However, I still have no clear idea if this module would solve my taxonomy-related performance issues, so it's probably best to uninstall and forget about it, and to not waste any more of your time.

gielfeldt’s picture

StatusFileSize
new1.06 KB
new1.06 KB
new1 KB
new1 KB
new1 KB

I just applied the patch successfully to 6.20-6.25. However, for some of the versions it gives a notice (offset and fuzz), which is probably an attempt to compensate for a patch that's not a 100% perfect.

So ... I applied the patch and created new patches, designed for those versions. They must be applied with -p0.

I'm hopeful that this will work for you, as there might have been a problem with the patch, which your patch-program was unable to handle.

cd /path/to/drupal-site-root/
patch -p0 < /path/to/taxonomy-6.??.patch
asb’s picture

Status: Needs review » Closed (fixed)

Yay, that's progress! taxonomy-6.23.patch applies cleanly (without any offset and fuzz notices) against a vanilla Drupal core 6.23, and taxonomy-6.24.patch applies cleanly against a vanilla Drupal core 6.24, as well. When diffing the patch files, there is a difference between taxonomy-6.23.patch and taxonomy-6.24.patch, but I don't see significant differences between taxonomy-6.22.patch and taxonomy-6.23.patch.

Differencees between taxonomy-6.23.patch and taxonomy-6.24.patch:

# diff taxonomy-6.23.patch taxonomy-6.24.patch 
1,3c1,3
< --- modules/taxonomy/taxonomy.module.orig     2012-02-01 22:26:13.000000000 +0100
< +++ modules/taxonomy/taxonomy.module  2012-03-14 18:46:42.000000000 +0100
< @@ -834,6 +834,9 @@
---
> --- modules/taxonomy/taxonomy.module.orig     2012-02-01 22:55:24.000000000 +0100
> +++ modules/taxonomy/taxonomy.module  2012-03-14 18:46:48.000000000 +0100
> @@ -846,6 +846,9 @@
12,13c12,13
<    $depth++;
< @@ -1129,6 +1132,9 @@
---
>    // We cache trees, so it's not CPU-intensive to call get_tree() on a term
> @@ -1181,6 +1184,9 @@

Differences between taxonomy-6.22.patch and taxonomy-6.23.patch:

# diff taxonomy-6.22.patch taxonomy-6.23.patch 
1,2c1,2
< --- modules/taxonomy/taxonomy.module.orig     2011-05-25 22:43:55.000000000 +0200
< +++ modules/taxonomy/taxonomy.module  2012-03-14 18:46:24.000000000 +0100
---
> --- modules/taxonomy/taxonomy.module.orig     2012-02-01 22:26:13.000000000 +0100
> +++ modules/taxonomy/taxonomy.module  2012-03-14 18:46:42.000000000 +0100

However, to some degree the patches seem to depend on the version of Drupal core, the same might apply for every iteration of Pressflow.

Now I need to figure out what this actually does ;)

My situation: I have a site where Drupal runs up to core version 6.23; starting with 6.24, the site completetely dies with a WSOD (all pages, including admin area). So obviously a regression was introduced with 6.24, and I suspect #556842: taxonomy_get_tree() memory issues to be the root cause. Simple test setup:

  • Drupal core 6.23 without Taxonomy Edge: runs fine (more or less)
  • Drupal core 6.23 with Taxonomy Edge: dito
  • Drupal core 6.24 without Taxonomy Edge: WSOD
  • Drupal core 6.24 with Taxonomy Edge: runs fine, including "Status report" page
  • Drupal core 6.25 without Taxonomy Edge: WSOD
  • Drupal core 6.25 with Taxonomy Edge: runs fine, including "Status report" page

Wow! That a) proves that "Taxonomy Edge" actually does something good, and b) migh suggest that #556842 should be thoroughly re-inspected, and c) might suggest that "Taxonomy Edge" could be considered to go into Drupal core.

Currently I'm running 6.25, and I'll monitor the site's behaviour for a while. Then I'll try Pressflow again, which might require new patches...

Thanks again for this fascinating module!

gielfeldt’s picture

Status: Closed (fixed) » Active

Hi asb

Glad to hear it worked. I'll commit the patches to 6.x-1.x-dev soon.

I'm interested to know if you noticed any performance improvements, since this is one of the main purposes of this module.

Btw, the reason that Taxonomy Edge doesn't WSOD, is probably because Taxonomy Edge's get_tree() function is based on Drupal 6.20. I was considering porting the new core get_tree() to Taxonomy Edge, but now I think I'll wait until the issue is resolved.

asb’s picture

Yes, the site feels slighty faster than with an unaltered Drupal core, judging from overall performance as a logged-in user (the effects of Pressflow plus APC and Memcache are far more noticable; anonymous users get static pages through 'boost', and there I can't tell any difference). Working with tools like 'Taxonomy Manager' or 'Taxonomy_VTN' does not feel faster, and accessing certain pages like ./taxonomy_vtn/voc/2 (an taxonomy_ctn index page) still times out after about 2.5 minutes. For me the main advantage is that the site runs on Drupal core 6.24+

If you have any suggestions for more objective tests, please feel free to share your ideas. I'm afraid, just running 'Apache Bench' against some taxonomy pages won't make much sense. However, I'd be interested in benchmarks as well since taxonomy might become a bottleneck on other sites as well.

gielfeldt’s picture

Ok. I don't know Taxonomy VTN, I'm checking it out now. If you say it times out, I'm sure it can be optimized perhaps by using Taxonomy Edge.

Btw: Taxonomy Manager is "somewhat" incompatible with Taxonomy Edge (among others) due to Taxonomy Manager not invoking taxonomy hooks @see #1131904: Move operation should also invoke hook_taxonomy.

I think it's limited to when you move terms (but I'm not sure). After moving terms with Taxonomy Manager, you need to do a "Rebuild edges" on the "/admin/content/taxonomy/edge" page.

Regarding performance, it's most noticable in setups with lots of terms in hierarchies and nodes tagged with these, as sub-tree searches are limited to the relevant terms only. Especially the taxonomy pages /taxonomy/term/%tid/all.

asb’s picture

OK, lots of terms in hierarchies and tagged nodes I *do* have on some of my sites, and yes, browsing through taxonomy pages like ./taxonomy/term/287/all?page=2 *is* faster (unpatched core: 4-6 sec., with 'Taxonomy Edge' 3-4 sec. (time to load the page, according to Opera's status bar).

Regarding modules from contrib like Taxonomy Manager oder Content Taxonomy: There are lots of problems with those when it comes to "large" vocabularies (> 10k of terms), but these modules are de facto abandoned, at least in the D6 branches. With Taxonomy VTN, there's at least a better chance to get proper patches into the repository. The vocabulary that times out with Taxonomy VTN is particulary interesting since 'Systeminfo' (./admin/reports/systeminfo/drupal) reports: 2,424 terms; Taxonomy VTN reports: 20,039 terms; with select tid,vid from term_data where vid=2;, issued from the MySQL shell, I get 2,424 rows. Whatever Taxonomy VTN counts, it counts something else than one might think (option checked: "Show count of terms", maybe it's the number of nodes tagged with a term from this vocabulary). Optimizing with Taxonomy Edge? Maybe, but I have it configured to page after 50 links per page, so theoretically it shouldn't even be able to time out.

Enough of this, we're going totally off topic… ;-/

gielfeldt’s picture

Status: Active » Fixed

:-). Ok. Glad to hear it works. I've committed the patches to 6.x-1.x-dev.

asb’s picture

Btw, taxonomy-6.25.patch also applies cleanly against the current Pressflow from Github, WTF-named "pressflow-6-pressflow-6.25.108-0-g3829e2f.zip".

Status: Fixed » Closed (fixed)

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