Skip to Content
author's profile photo Former Member
Former Member

FlexibleSearch Commit / Rollback in HAC

This was asked in the old forum as well, but never answered.

What does the Rollback / Commit function do in HAC FlexibleSearch? I seem to get the same results either way.

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 12, 2014 at 12:02 PM

    Hi Jim,

    As Vinay said (in an answer he has removed :) ) it determines whether your changes will affect database.

    As you can see there's a tab SQL Query next to Flexible Query in FlexibleSearch page where we can execute raw SQL queries including ones that update db. So if you set Rollback then all your changes will be rolled back.

    I've noticed one interesting thing that in Commit mode changes in db are reflected immediately, but in hmc (I suppose everywhere else as well in hybris) you won't see changes unless you run Update (you can run it without any options checked). Apparently changes made by direct SQL queries are performed omitting hybris cache which need to be updated accordingly.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 12, 2014 at 12:02 PM

    Hi,

    Good notice, this option is unnecessary on FlexibleSearch tab and doesn't change anything during search query execution. I think that this option should be disable.

    Commit/Rollback only makes sense on SQL Query tab where you can write UPDATE/DELETE/INSERT query.

    You can disable this in file /platform/ext/hac/web/webroot/WEB-INF/jsp/console/flexsearch.jsp by comment div tag in :

                                 <!-- <div class="onoffswitch-large" style="float:left;margin-top:7px">
                                     <input type="checkbox" class="onoffswitch-checkbox" id="commitCheckbox1"/>
                                     <label class="onoffswitch-label" for="commitCheckbox1">
                                         <div class="onoffswitch-inner" _on="COMMIT" _off="ROLLBACK"></div>
                                         <div class="onoffswitch-switch-large"></div>
                                     </label>
    
    
    

    Cheers!

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 12, 2014 at 04:36 PM

    Thanks Volodymyr and Tomasz for your answers. It makes sense that the "rollback" feature should be there in the case of direct SQL queries. I did a bit of research on when it might make sense to use this with SELECT queries. I'm posting this in case anybody else finds it useful.

    This is how the mechanism works at the database level:

    Rollback

    • autoCommit = false

    • run query

    • rollback

    Commit

    • autoCommit = true

    • run query

    • (commit)

    Ilmar Kerm explains "A little side-effect of having autocommit off in MySQL":

    The default transaction level for MySQL InnoDB is REPEATABLE READ (unlike Oracle, that has READ COMMITTED as default), that means that the SELECT query always returns the data at the time point when the transaction was started. If autocommit is off, then the first issued select statement will open the transaction and any subsequent select statement will return the data at the time point when the first select was issued, until transaction is ended with COMMIT/ROLLBACK. If autocommit is enabled, SELECT statement is run in a self-contained transaction, ending with COMMIT, so the end result is like READ COMMITTED isolation level in Oracle.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.