Store.get() on invalidated objects should retrieve all fields rather than just checking the object is alive

Bug #697513 reported by James Henstridge
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Storm
Fix Released
Medium
James Henstridge

Bug Description

If we have an invalidated Python object for a given row in a table, Store.get() will return that object after calling Store._validate_alive(), which results in a query. None of the fields will be filled out at this point, so another query will be issued as soon as we try to use the object.

If we are going to suffer a database round trip anyway it would seem sensible to fill out the entire object in this case, since it is likely that the caller will want to use the object it has just requested.

Related branches

Revision history for this message
James Henstridge (jamesh) wrote :

Attached is a test program. In the first transaction, retrieving the object and accessing an attribute results in one query:

    SELECT foo.id, foo.name FROM foo WHERE foo.id = 1 LIMIT 1

The second transaction, which performs identical actions issues two queries:

    SELECT 1 FROM foo WHERE foo.id = 1
    SELECT foo.name FROM foo WHERE foo.id = 1

Changed in storm:
assignee: nobody → James Henstridge (jamesh)
importance: Undecided → Medium
milestone: none → 0.19
status: New → Confirmed
Revision history for this message
James Henstridge (jamesh) wrote :

Fix merged to trunk in r385.

Changed in storm:
status: Confirmed → Fix Committed
Barry Warsaw (barry)
Changed in storm:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.