Closed (fixed)
Project:
Pressflow Transaction
Version:
5.x-1.1
Component:
Documentation
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
5 Jan 2008 at 02:53 UTC
Updated:
23 Apr 2008 at 20:39 UTC
This is an interesting bug, and I'm not sure what is causing it. I suspect it is something in variable_set (like clearing the caches) which causes this problem. Anyway, it is easy to repeat and is consistently repeatable for me:
1. Install PressFlow Transaction
2. Create a new page node that has a php input format with the following body:
// Begin transaction
$txn = new pressflow_transaction();
db_query("INSERT INTO {variable} (name, value) values ('a', 'b')");
$txn->rollback();
variable_set('something', 'value');
3. Preview the node
Expected results:
Run the query: select * from variable where name = 'a'; should return an empty set
Actual results:
The record is inserted and returns a value when that select is run.
Comments
Comment #1
gregglesAfter discussing this in IRC, it appears that there's nothing that can be done since variable_set uses LOCK which causes an autocommit.
I suggest adding some docs like on the project page that say
"Due to the use of LOCKS in various parts of Drupal there are certain operations which will force an autocommit if they are done before a rollback. Examples include variable_set and..."
Comment #2
david straussI've updated documentation with the suggested warning.