I wrote the code, it's mine, and I'm contributing it to H2 for distribution 
multiple-licensed under the MPL 2.0, and the EPL 1.0 
(http://h2database.com/html/license.html).

On Sunday, April 30, 2017 at 12:19:01 AM UTC-5, Sungkeun Kim wrote:
>
>
> Hi all,
> I have reported this bug on the github, and I would like to discuss this 
> issue with you guys.
> Please take a look my report.
>
> This is test code and patch
> https://github.com/h2database/h2database/pull/500
>
>
> Test Version: 1.4.194Precondition:
>    
>    1. Test databse
>
> CREATE TABLE test ( entity_id INTEGER NOT NULL PRIMARY KEY,  lastUpdated 
> INTEGER NOT NULL)
> INSERT INTO test (entity_id, lastUpdated) VALUES (1, 100)
>
>
>    1. DB URL
>
> jdbc:h2:mem:qed;DB_CLOSE_DELAY=-1;MVCC=TRUE;LOCK_TIMEOUT=120000;MULTI_THREADED=TRUE")
>
> Reproduction scenario:
>
> Launch multiple threads which are executing query "select for update" in a 
> infinite loop.
>
> SELECT * FROM test WHERE entity_id = 1 FOR UPDATE
> Problem:
>
> row with "entity_id = 1" disappeard
> Cause:
>
> When a thread commits its transaction, a row with null value is remove. 
> problem is that if the transaction id of the row with null value is not 
> same as current committing transaction id, the row should be preserved.
> Relative code
>
> // src/main/org/h2/mvstore/db/TransactionStore.java
>  void commit(Transaction t, long maxLogId) {
>
>  
>  } else if (value.value == null) {
>          // remove the value
>          map.remove(key);
> }
>
> My Suggestion
>
> Remove a row with null value only if its transaction id is same as current 
> one
>
> // src/main/org/h2/mvstore/db/TransactionStore.java
>  void commit(Transaction t, long maxLogId) {
>
>    } else if (value.value == null) {
>           int tx = getTransactionId(value.operationId);
>           if (tx == t.transactionId) {
>                  // remove the value only if it's transaction id is same as 
> current transaction id
>                  map.remove(key);
>           }
>   }
>
> ## Relative Issue
> I found this is when I debugging the issue #180 
> <https://github.com/h2database/h2database/issues/180>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to