[ 
https://issues.apache.org/jira/browse/LENS-1308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15498498#comment-15498498
 ] 

Puneet Gupta edited comment on LENS-1308 at 9/17/16 7:55 AM:
-------------------------------------------------------------

Lets keep auto commit false by default and have explicit commit (like we are 
doing in org.apache.lens.server.query.LensServerDAO#insertFinishedQuery). Or 
else we need to follow a different model where we can keep autocommit true by 
default and turn it off wherever we need transactions (may be very few places).
{noformat}
boolean autoCommit = conn.getAutoCommit();
conn.setAutoCommit(false);
try
{
…some logic...
insert one row ..
insert another row..
conn.commit();
} catch(Exception e) { 
  Log .....
} 
finally {
conn.setAutoCommit(autoCommit) ; // since this is a pooled connection , lets 
set it back to original state
}
{noformat}
between 1st and 2nd  row if there is an error we should not commit

Note sure if below are working in current state without any explicit commits. 
1. org.apache.lens.server.query.LensServerDAO#createFinishedQueriesTable and 
2. org.apache.lens.server.query.LensServerDAO#dropFinishedQueriesTable


was (Author: puneet884):
Lets keep auto commit false by default and have explicit commit (like we are 
doing in org.apache.lens.server.query.LensServerDAO#insertFinishedQuery). Or 
else we need to follow a different model where we can keep autocommit true by 
default and turn it off wherever we need transactions (may be very few places).
{noformat}
boolean autoCommit = conn.getAutoCommit();
conn.setAutoCommit(false);
try
{
…some logic...
insert one row ..
insert another row..
conn.commit();
} Exception { 
  Log .....
} 
finally {
conn.setAutoCommit(autoCommit) ; // since this is a pooled connection , lets 
set it back to original state
}
{noformat}
between 1st and 2nd  row if there is an error we should not commit

Note sure if below are working in current state without any explicit commits. 
1. org.apache.lens.server.query.LensServerDAO#createFinishedQueriesTable and 
2. org.apache.lens.server.query.LensServerDAO#dropFinishedQueriesTable

> User config loader database calls not inserting entries
> -------------------------------------------------------
>
>                 Key: LENS-1308
>                 URL: https://issues.apache.org/jira/browse/LENS-1308
>             Project: Apache Lens
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: Rajat Khandelwal
>            Assignee: Rajat Khandelwal
>             Fix For: 2.7
>
>         Attachments: LENS-1308.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to