-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65481/#review196897
-----------------------------------------------------------



Several comments addressing mostly the original scope of 
[OOZIE-3134](https://issues.apache.org/jira/browse/OOZIE-3134). As Rohini 
pointed out, this JIRA could be extended by 
[OOZIE-1980](https://issues.apache.org/jira/browse/OOZIE-1980) functionality. 
Please wait for her response before going on with the fix.


core/src/main/java/org/apache/oozie/util/db/FailingConnectionWrapper.java
Line 58 (original), 56 (patched)
<https://reviews.apache.org/r/65481/#comment276826>

    `@Nullable final Predicate predicate`



core/src/main/java/org/apache/oozie/util/db/FailingConnectionWrapper.java
Lines 59 (patched)
<https://reviews.apache.org/r/65481/#comment276829>

    Could go to `else` path.



core/src/main/java/org/apache/oozie/util/db/FailingHSQLDBDriverWrapper.java
Lines 40 (patched)
<https://reviews.apache.org/r/65481/#comment276848>

    I don't see calling `setDbPredicate()` or `unsetDbPredicate()` from 
anywhere else than test code.
    
    When using `ThreadLocal` we have to be very careful to unset after every 
use to avoid resource / memory leaks.



core/src/main/java/org/apache/oozie/util/db/ThreadVariables.java
Lines 23-37 (patched)
<https://reviews.apache.org/r/65481/#comment276850>

    I don't see calling `setDbPredicate()` or `unsetDbPredicate()` from 
anywhere else than test code.
    
    When using `ThreadLocal` we have to be very careful to unset after every 
use to avoid resource / memory leaks.
    
    Generally, I think it would be a better idea to inject a new DB predicate 
by other means - I would only go for `ThreadLocal` usage when most of the time 
I need different `dbPredicate` to every `Thread` - which is not the case here.
    
    Let's think a bit more on `Predicate` injecting scenarios apart from using 
`ThreadLocal`.



core/src/test/java/org/apache/oozie/sla/TestSLACalculatorMemory.java
Lines 1109-1110 (patched)
<https://reviews.apache.org/r/65481/#comment276851>

    Inside `try`.



core/src/test/java/org/apache/oozie/sla/TestSLACalculatorMemory.java
Lines 1111 (patched)
<https://reviews.apache.org/r/65481/#comment276852>

    Not needed when `fail(...)` is called from `catch`.



core/src/test/java/org/apache/oozie/sla/TestSLACalculatorMemory.java
Lines 1115 (patched)
<https://reviews.apache.org/r/65481/#comment276853>

    Not needed when `fail(...)` is called from `catch`.



core/src/test/java/org/apache/oozie/sla/TestSLACalculatorMemory.java
Lines 1120 (patched)
<https://reviews.apache.org/r/65481/#comment276854>

    Not needed when `fail(...)` is called from `catch`.



core/src/test/java/org/apache/oozie/sla/TestSLACalculatorMemory.java
Lines 1154-1155 (patched)
<https://reviews.apache.org/r/65481/#comment276844>

    Both should be part of `try`.



core/src/test/java/org/apache/oozie/sla/TestSLACalculatorMemory.java
Lines 1156 (patched)
<https://reviews.apache.org/r/65481/#comment276846>

    Not needed when `fail(...)` is called from `catch`.



core/src/test/java/org/apache/oozie/sla/TestSLACalculatorMemory.java
Lines 1161 (patched)
<https://reviews.apache.org/r/65481/#comment276843>

    Better call `fail(...)` here.



core/src/test/java/org/apache/oozie/sla/TestSLACalculatorMemory.java
Lines 1166 (patched)
<https://reviews.apache.org/r/65481/#comment276845>

    Not needed when `fail(...)` is called from `catch`.



core/src/test/java/org/apache/oozie/sla/TestSLACalculatorMemory.java
Lines 1173 (patched)
<https://reviews.apache.org/r/65481/#comment276838>

    `Boolean.TRUE.toString()`



core/src/test/java/org/apache/oozie/sla/TestSLACalculatorMemory.java
Lines 1175 (patched)
<https://reviews.apache.org/r/65481/#comment276824>

    Use `AlwaysFailingHSQLDBDriverMapper.class.getCanonicalName()` and we don't 
have to modify string values when renaming / moving.



core/src/test/java/org/apache/oozie/sla/TestSLACalculatorMemory.java
Lines 1183 (patched)
<https://reviews.apache.org/r/65481/#comment276839>

    `OPERATIONS`


- András Piros


On Feb. 6, 2018, 2:43 p.m., Kinga Marton wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65481/
> -----------------------------------------------------------
> 
> (Updated Feb. 6, 2018, 2:43 p.m.)
> 
> 
> Review request for oozie, András Piros and Attila Sasvari.
> 
> 
> Repository: oozie-git
> 
> 
> Description
> -------
> 
> Upon SLACalculatorMemory.addRegistration, Oozie puts an entry into an 
> in-memory concurrent hashmap ("slaMap"), and later persists it in the Oozie 
> database.
> However, if there is a failure during the database operation, a 
> JPAExecutorException is thrown, and the entry is not removed from the SLA map.
> It may introduce inconsistency between the Oozie database and the SLA map.
> To prevent this, a rollback mechanism (with proper logging) should be 
> implemented. It would also make sense to do more sanity/consistency check in 
> the Oozie server.
> 
> 
> Diffs
> -----
> 
>   core/src/main/java/org/apache/oozie/sla/SLACalculatorMemory.java ef019e73 
>   
> core/src/main/java/org/apache/oozie/util/db/AlwaysFailingHSQLDriverMapper.java
>  PRE-CREATION 
>   core/src/main/java/org/apache/oozie/util/db/FailingConnectionWrapper.java 
> 0e310253 
>   core/src/main/java/org/apache/oozie/util/db/FailingHSQLDBDriverWrapper.java 
> fe9f08b1 
>   core/src/main/java/org/apache/oozie/util/db/FailingMySQLDriverWrapper.java 
> f0e2b181 
>   core/src/main/java/org/apache/oozie/util/db/ThreadVariables.java 
> PRE-CREATION 
>   core/src/test/java/org/apache/oozie/sla/TestSLACalculatorMemory.java 
> ee906f45 
> 
> 
> Diff: https://reviews.apache.org/r/65481/diff/2/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Kinga Marton
> 
>

Reply via email to