Rollback

hi Folks,


I've just enabled rollback for the first time (in response to many requests etc) following the instructions in the guide http://manuals.matrix.squizsuite.net/server-administrator/chapters/rollback-management-script. i.e.


    
    $ emacs data/private/conf/main.inc 
    $ php scripts/rollback_management.php -s `pwd` --enable-rollback
    $ php install/step_02.php `pwd` 


And was testing it out so made a change. I then went to the history screen and tried to 'view' the previous version. Things didn't go well :-S I've copied this from the logs.

    
    [20-Feb-2011 15:09:27] PHP Fatal error:  Uncaught exception 'DALException' with message 'SQLSTATE[42883]: Undefined function: 7 ERROR:  function sq_rb_get_lineage_treeids(unknown, unknown, unknown, unknown) does not exist at character 49
    HINT:  No function matches the given name and argument types. You might need to add explicit type casts.' in /var/www/mysource_matrix/core/lib/DAL/DAL.inc:658
    Stack trace:
    #0 /var/www/mysource_matrix/core/include/asset_manager.inc(3660): DAL::executePdoAssoc(Object(PDOStatement))
    #1 /var/www/mysource_matrix/core/lib/asset_map/asset_map.inc(179): Asset_Manager->getLinkLineages('40')
    #2 /var/www/mysource_matrix/core/lib/asset_map/asset_map.inc(461): Asset_Map->_getInitialLineageSelection('complex')
    #3 /var/www/mysource_matrix/core/include/backend.inc(1276): Asset_Map->embedAssetMap('complex', 275)
    #4 /var/www/mysource_matrix/core/include/backend.inc(189): Backend->_printSideNav()
    #5 /var/www/mysource_matrix/core/include/mysource.inc(521): Backend->paint()
    #6 /var/www/mysource_matrix/core/web/index.php(30): MySource->s in /var/www/mysource_matrix/core/lib/DAL/DAL.inc on line 658
    [20-Feb-2011 15:09:27] PHP Fatal error:  Uncaught exception 'DALException' with message 'SQLSTATE[42883]: Undefined function: 7 ERROR:  function sq_rb_get_lineage_treeids(unknown, unknown, unknown, unknown) does not exist at character 49
    HINT:  No function matches the given name and argument types. You might need to add explicit type casts.' in /var/www/mysource_matrix/core/lib/DAL/DAL.inc:658
    Stack trace:
    #0 /var/www/mysource_matrix/core/include/asset_manager.inc(3660): DAL::executePdoAssoc(Object(PDOStatement))
    #1 /var/www/mysource_matrix/core/include/general.inc(1489): Asset_Manager->getLinkLineages(40, 5, NULL, 'name', true)
    #2 /var/www/mysource_matrix/core/include/asset_edit_interface.inc(723): get_asset_tag_line(40)
    #3 /var/www/mysource_matrix/core/include/asset.inc(4838): Asset_Edit_Interface->paint(Object(Site), Object(Backend_Outputter), false)
    #4 /var/www/mysource_matrix/core/include/asset_manager_edit_fns.inc(215): Asset->paintBackend(Object(Backend_Outputter))
    #5 /var/www/mysource_matrix/core/include/asset_manager.inc(8570): Asset_Manage in /var/www/mysource_matrix/core/lib/DAL/DAL.inc on line 658


I'm assuming reading that that there needs something else to be done to the database - but I cannot see that documented anywhere?

K

[quote]
hi Folks,



I've just enabled rollback for the first time (in response to many requests etc) following the instructions in the guide http://manuals.matrix.squizsuite.net/server-administrator/chapters/rollback-management-script. i.e.


    
    $ emacs data/private/conf/main.inc 
    $ php scripts/rollback_management.php -s `pwd` --enable-rollback
    $ php install/step_02.php `pwd` 


And was testing it out so made a change. I then went to the history screen and tried to 'view' the previous version. Things didn't go well :-S I've copied this from the logs.

    
    [20-Feb-2011 15:09:27] PHP Fatal error:  Uncaught exception 'DALException' with message 'SQLSTATE[42883]: Undefined function: 7 ERROR:  function sq_rb_get_lineage_treeids(unknown, unknown, unknown, unknown) does not exist at character 49
    HINT:  No function matches the given name and argument types. You might need to add explicit type casts.' in /var/www/mysource_matrix/core/lib/DAL/DAL.inc:658
    Stack trace:
    #0 /var/www/mysource_matrix/core/include/asset_manager.inc(3660): DAL::executePdoAssoc(Object(PDOStatement))
    #1 /var/www/mysource_matrix/core/lib/asset_map/asset_map.inc(179): Asset_Manager->getLinkLineages('40')
    #2 /var/www/mysource_matrix/core/lib/asset_map/asset_map.inc(461): Asset_Map->_getInitialLineageSelection('complex')
    #3 /var/www/mysource_matrix/core/include/backend.inc(1276): Asset_Map->embedAssetMap('complex', 275)
    #4 /var/www/mysource_matrix/core/include/backend.inc(189): Backend->_printSideNav()
    #5 /var/www/mysource_matrix/core/include/mysource.inc(521): Backend->paint()
    #6 /var/www/mysource_matrix/core/web/index.php(30): MySource->s in /var/www/mysource_matrix/core/lib/DAL/DAL.inc on line 658
    [20-Feb-2011 15:09:27] PHP Fatal error:  Uncaught exception 'DALException' with message 'SQLSTATE[42883]: Undefined function: 7 ERROR:  function sq_rb_get_lineage_treeids(unknown, unknown, unknown, unknown) does not exist at character 49
    HINT:  No function matches the given name and argument types. You might need to add explicit type casts.' in /var/www/mysource_matrix/core/lib/DAL/DAL.inc:658
    Stack trace:
    #0 /var/www/mysource_matrix/core/include/asset_manager.inc(3660): DAL::executePdoAssoc(Object(PDOStatement))
    #1 /var/www/mysource_matrix/core/include/general.inc(1489): Asset_Manager->getLinkLineages(40, 5, NULL, 'name', true)
    #2 /var/www/mysource_matrix/core/include/asset_edit_interface.inc(723): get_asset_tag_line(40)
    #3 /var/www/mysource_matrix/core/include/asset.inc(4838): Asset_Edit_Interface->paint(Object(Site), Object(Backend_Outputter), false)
    #4 /var/www/mysource_matrix/core/include/asset_manager_edit_fns.inc(215): Asset->paintBackend(Object(Backend_Outputter))
    #5 /var/www/mysource_matrix/core/include/asset_manager.inc(8570): Asset_Manage in /var/www/mysource_matrix/core/lib/DAL/DAL.inc on line 658


I'm assuming reading that that there needs something else to be done to the database - but I cannot see that documented anywhere?

K
[/quote]

Hi,

On your DB can you check if the stored procedure (function) sq_get_lineage_treeids exists? if it doesn't can u run step_02.php + compile_locale.php and try again. Also wondering when you first ran enable rollback script and step_02.php, did Matrix throw any errors?

Regards,

Ash

…excuse my ignorance - how do I check if the procedure exists?

[quote]
Hi,



On your DB can you check if the stored procedure (function) sq_get_lineage_treeids exists? if it doesn't can u run step_02.php + compile_locale.php and try again. Also wondering when you first ran enable rollback script and step_02.php, did Matrix throw any errors?



Regards,



Ash

[/quote]





…no there were no errors - it seemed to populate the rb_tables then step02 ran with no issues (didn't run compile_locale as that's not in the instructions :stuck_out_tongue:

[quote]
…excuse my ignorance - how do I check if the procedure exists?

[/quote]

If you are using PSQL you can use following command to find it



\df sq_get_lineage_treeids;

[quote]
…no there were no errors - it seemed to populate the rb_tables then step02 ran with no issues (didn't run compile_locale as that's not in the instructions :stuck_out_tongue:

[/quote]

Compile_local isnt really required. While running step_02.php it should come up with something like this

    
    ------------------------------------
    PGSQL STORED FUNCTIONS CREATED
    sq_grant_access Function
    sq_set_rollback_timestamp(TIMESTAMP) Function
    sq_set_rollback_timestamp Function
    sq_get_rollback_timestamp Function
    sq_get_lineage_from_url Function
    sq_get_parent_treeids(VARCHAR, INT, TIMESTAMP) Function
    sq_get_parent_treeids(VARCHAR, INT) Function
    sq_rb_get_parent_treeids(VARCHAR, INT) Function
    sq_get_lineage_treeids(VARCHAR, INT, TIMESTAMP, INT) Function
    sq_get_lineage_treeids(VARCHAR, INT) Function
    sq_rb_get_lineage_treeids(VARCHAR, INT) Function
    atoi Function
    asset_link_treeid_convert Function
    ------------------------------------
    

Yip has it

    mysource_matrix_live=# \df sq_get_lineage_treeids;                                                     
    List of functions  Schema |          Name          | Result data type |                       Argument data types                         --------+------------------------+------------------+------------------------------------------------------------------  
    public | sq_get_lineage_treeids | setof bytea      | character varying, integer  
    public | sq_get_lineage_treeids | setof bytea      | character varying, integer, timestamp without time zone 
    public | sq_get_lineage_treeids | setof bytea      | character varying, integer, timestamp without time zone, integer (3 rows)


[quote]
Compile_local isnt really required. While running step_02.php it should come up with something like this
    
    ------------------------------------
    PGSQL STORED FUNCTIONS CREATED
    sq_grant_access Function
    sq_set_rollback_timestamp(TIMESTAMP) Function
    sq_set_rollback_timestamp Function
    sq_get_rollback_timestamp Function
    sq_get_lineage_from_url Function
    sq_get_parent_treeids(VARCHAR, INT, TIMESTAMP) Function
    sq_get_parent_treeids(VARCHAR, INT) Function
    sq_rb_get_parent_treeids(VARCHAR, INT) Function
    sq_get_lineage_treeids(VARCHAR, INT, TIMESTAMP, INT) Function
    sq_get_lineage_treeids(VARCHAR, INT) Function
    sq_rb_get_lineage_treeids(VARCHAR, INT) Function
    atoi Function
    asset_link_treeid_convert Function
    ------------------------------------


[/quote]



tbh - I can't really remember if I would have see that or not - I guess that fact that they are set means I did?



K

[quote]
Yip has it


    mysource_matrix_live=# \df sq_get_lineage_treeids;                                                     
    List of functions  Schema |          Name          | Result data type |                       Argument data types                         --------+------------------------+------------------+------------------------------------------------------------------  
    public | sq_get_lineage_treeids | setof bytea      | character varying, integer  
    public | sq_get_lineage_treeids | setof bytea      | character varying, integer, timestamp without time zone 
    public | sq_get_lineage_treeids | setof bytea      | character varying, integer, timestamp without time zone, integer (3 rows)




tbh - I can't really remember if I would have see that or not - I guess that fact that they are set means I did?

K
[/quote]

Can you provide me with the version for asset_manager.inc file. From what i can see the function is surely there on DB. Not too sure why Matrix is complaining. Is it just this asset or any asset the rollback is failing on ?

[quote]
Can you provide me with the version for asset_manager.inc file. From what i can see the function is surely there on DB. Not too sure why Matrix is complaining. Is it just this asset or any asset the rollback is failing on ?

[/quote]


  • $Id: asset_manager.inc,v 1.820.2.5 2011-02-03 04:41:01 cupreti Exp $



    tried multiple assets…



    Fatal error: Uncaught exception 'DALException' with message 'SQLSTATE[42883]: Undefined function: 7 ERROR: function sq_rb_get_lineage_treeids(unknown, unknown, unknown, unknown) does not exist at character 49 HINT: No function matches the given name and argument types. You might need to add explicit type casts.' in /var/www/mysource_matrix/core/lib/DAL/DAL.inc:658 Stack trace: #0 /var/www/mysource_matrix/core/include/asset_manager.inc(3660): DAL::executePdoAssoc(Object(PDOStatement)) #1 /var/www/mysource_matrix/core/include/general.inc(1489): Asset_Manager->getLinkLineages(40, 5, NULL, 'name', true) #2 /var/www/mysource_matrix/core/include/asset_edit_interface.inc(723): get_asset_tag_line(40) #3 /var/www/mysource_matrix/core/include/asset.inc(4838): Asset_Edit_Interface->paint(Object(Site), Object(Backend_Outputter), false) #4 /var/www/mysource_matrix/core/include/asset_manager_edit_fns.inc(215): Asset->paintBackend(Object(Backend_Outputter)) #5 /var/www/mysource_matrix/core/include/asset_manager.inc(8570): Asset_Manage in /var/www/mysource_matrix/core/lib/DAL/DAL.inc on line 658



    I could try rerunning step02 and compile_locale - not tried that as the fucntions were there…



    K

…actually looking at the list of fucntions - there are 3 'sq_get_lineage_treeids'

    sq_get_lineage_treeids (character varying, integer) 	setof bytea 	matrix 	plpgsql 	Alter	Drop	Privileges	 
    sq_get_lineage_treeids (character varying, integer, timestamp without time zone) 	setof bytea 	matrix 	plpgsql 	Alter	Drop	Privileges	 
    sq_get_lineage_treeids (character varying, integer, timestamp without time zone, integer) 	setof bytea 	matrix 	plpgsql 	Alter	Drop	Privileges


but only one 'rb' version

    
    sq_rb_get_lineage_treeids (character varying, integer) 	setof bytea 	matrix 	plpgsql 	Alter	Drop	Privileges


As the error reports passing 4 params in and I cannot see one accepting 4 params (but matrix is the only time I've used postgres so not 100% sure what's going on)

K

[quote]

  • $Id: asset_manager.inc,v 1.820.2.5 2011-02-03 04:41:01 cupreti Exp $



    tried multiple assets…



    Fatal error: Uncaught exception 'DALException' with message 'SQLSTATE[42883]: Undefined function: 7 ERROR: function sq_rb_get_lineage_treeids(unknown, unknown, unknown, unknown) does not exist at character 49 HINT: No function matches the given name and argument types. You might need to add explicit type casts.' in /var/www/mysource_matrix/core/lib/DAL/DAL.inc:658 Stack trace: #0 /var/www/mysource_matrix/core/include/asset_manager.inc(3660): DAL::executePdoAssoc(Object(PDOStatement)) #1 /var/www/mysource_matrix/core/include/general.inc(1489): Asset_Manager->getLinkLineages(40, 5, NULL, 'name', true) #2 /var/www/mysource_matrix/core/include/asset_edit_interface.inc(723): get_asset_tag_line(40) #3 /var/www/mysource_matrix/core/include/asset.inc(4838): Asset_Edit_Interface->paint(Object(Site), Object(Backend_Outputter), false) #4 /var/www/mysource_matrix/core/include/asset_manager_edit_fns.inc(215): Asset->paintBackend(Object(Backend_Outputter)) #5 /var/www/mysource_matrix/core/include/asset_manager.inc(8570): Asset_Manage in /var/www/mysource_matrix/core/lib/DAL/DAL.inc on line 658



    I could try rerunning step02 and compile_locale - not tried that as the fucntions were there…



    K

    [/quote]





    Okie the bug i was looking at is already patched on the file version you have. I am sorry but we need to be looking at sq_rb_get_lineage_treeids function to be present on DB rather than what i first mentioned. Sorry for that as i was not looking in the right place. Can you double check for that?

    If that function DOES exists than everything is like it should be and you might need to lodge a support ticket as this might need investigation. And if it doesnt then running step_02.php might help.

[quote]
Okie the bug i was looking at is already patched on the file version you have. I am sorry but we need to be looking at sq_rb_get_lineage_treeids function to be present on DB rather than what i first mentioned. Sorry for that as i was not looking in the right place. Can you double check for that?

If that function DOES exists than everything is like it should be and you might need to lodge a support ticket as this might need investigation. And if it doesnt then running step_02.php might help.

[/quote]



Reran step02 and compile - same issue



Support call already lodged: PLG-91763-393



K

oh and output from step02

    
    ------------------------------------
    PGSQL STORED FUNCTIONS CREATED
    sq_grant_access Function
    sq_set_rollback_timestamp(TIMESTAMP) Function
    sq_set_rollback_timestamp Function
    sq_get_rollback_timestamp Function
    sq_get_lineage_from_url Function
    sq_get_parent_treeids(VARCHAR, INT, TIMESTAMP) Function
    sq_get_parent_treeids(VARCHAR, INT) Function
    sq_rb_get_parent_treeids(VARCHAR, INT) Function
    sq_get_lineage_treeids(VARCHAR, INT, TIMESTAMP, INT) Function
    sq_get_lineage_treeids(VARCHAR, INT) Function
    sq_rb_get_lineage_treeids(VARCHAR, INT) Function
    atoi Function
    asset_link_treeid_convert Function


K

[quote]
…actually looking at the list of fucntions - there are 3 'sq_get_lineage_treeids'


    sq_get_lineage_treeids (character varying, integer) 	setof bytea 	matrix 	plpgsql 	Alter	Drop	Privileges	 
    sq_get_lineage_treeids (character varying, integer, timestamp without time zone) 	setof bytea 	matrix 	plpgsql 	Alter	Drop	Privileges	 
    sq_get_lineage_treeids (character varying, integer, timestamp without time zone, integer) 	setof bytea 	matrix 	plpgsql 	Alter	Drop	Privileges


but only one 'rb' version

    
    sq_rb_get_lineage_treeids (character varying, integer) 	setof bytea 	matrix 	plpgsql 	Alter	Drop	Privileges


As the error reports passing 4 params in and I cannot see one accepting 4 params (but matrix is the only time I've used postgres so not 100% sure what's going on)

K
[/quote]

Ah well pointed. I over-looked that part trying to look into actual PHP side of Matrix. This looks like something to do with Bug # 4924 DB error when a design asset is notice linked to too many assets. Looks like ony the regular function was fixed/altered and not the rollback one thus causing the given problem. Stay tuned while we have a look into the issue on our local system.

Thank you for your patience and helping us.

Cheers,

Ash

…thanks Ash,


can you let me know when a patch/fix is available?



Cheers



K

[quote]
…thanks Ash,



can you let me know when a patch/fix is available?



Cheers



K

[/quote]



Hi,

This is now fixed and the patch are available.

You can get the patch yourself for file mysource_matrix/install/pgsql_functions.xml.

For 4.0.x version file version that is patched is 1.18.2.1. Alternately the patch can be viewed here, if you wish to apply it yourself. Once patched step_02.php will need to be run and rollback should work as expected then.



Any questions or comments, you know what to do.



Regards,



Ash

…thanks - patch fixed thigns :slight_smile: