Re: [h2] Asc order problem in a Date Data type Column using Pluggable / User-Defined Table

2016-12-21 Thread Noel Grandin

I just pushed an updated unit test to GitHub.

Sorry, I can see anything obviously wrong with your code.

--
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] Concurrency at org.h2.store.fs.FileBase.read()

2016-12-21 Thread Anatolii K
Test attached

On Wednesday, December 21, 2016 at 8:41:44 PM UTC+5, Thomas Mueller Graf 
wrote:
>
> Hi,
>
> I guess that bug would be on my plate... I recently made changes there 
> (trying to improve concurrency). I'm sorry about that. Having a test case 
> would be great!
>
> Regards,
> Thomas
>
>
>
> On Wed, Dec 21, 2016 at 3:56 PM, Noel Grandin  > wrote:
>
>> Can we get a full stack trace for that failure.​
>>
>> -- 
>> 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 h2-database...@googlegroups.com .
>> To post to this group, send email to h2-da...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/h2-database.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Bug_H2_4 {

static String dbUrl = "jdbc:h2:nioMemLZF:db;DB_CLOSE_DELAY=-1;MULTI_THREADED=1 ";
static String user = "sa", pwd = "";
static int threadCount = 100;

public static void main(String args[]) throws InterruptedException, SQLException {
Arte[] artes = new Arte[threadCount];
Connection dbConnect;
try {
Class.forName("org.h2.Driver");
dbConnect = DriverManager.getConnection(dbUrl, user, pwd);
DbPreparator.prepareScheme(dbConnect);
System.out.println("DB scheme prepared");

DbPreparator.populate(dbConnect);
System.out.println("DB populated");

for (int i = 0; i < threadCount; i++) {
artes[i] = new Arte(DriverManager.getConnection(dbUrl, user, pwd));
}
System.out.println("ARTEs created");
} catch (ClassNotFoundException | SQLException e) {
System.out.println("DB Connection Failed: " + dbUrl);
e.printStackTrace();
return;
}

ExecutorService threadPool = Executors.newFixedThreadPool(threadCount);
for (int i = 0; i < threadCount; i++) {
threadPool.submit(artes[i]);
}

while (true) {
Thread.sleep(100);
}
}

static class DbPreparator {

public static final int OBJ_CNT = 1;
private static final String[] SQLs = new String[]{
"CREATE TABLE IF NOT EXISTS "
+ "ACCOUNT (\n"
+ "	ID NUMBER(18,0) not null PRIMARY KEY,\n"
+ "	BALANCE NUMBER null)\n"
};

public static void prepareScheme(Connection db) throws SQLException {
for (String sql : SQLs) {
db.createStatement().execute(sql);
db.commit();
}
}

public static void populate(Connection db) throws SQLException {
PreparedStatement mergeAcctStmt = db.prepareStatement("MERGE INTO Account(id, balance) key (id) VALUES (?, ?)");
for (int i = 0; i < OBJ_CNT; i++) {
mergeAcctStmt.setLong(1, i);
mergeAcctStmt.setBigDecimal(2, BigDecimal.ZERO);
mergeAcctStmt.addBatch();
}
mergeAcctStmt.executeBatch();
db.commit();
}
}

static class Arte implements Callable {

Connection db;
PreparedStatement updateAcctStmt;

public Arte(Connection db_) throws SQLException {
db = db_;
db.setAutoCommit(false);
updateAcctStmt = db.prepareStatement("UPDATE account set balance = ? where id = ?");
}

@Override
public Integer call() {
try {
while (true) {
updateAcctStmt.setDouble(1, Math.random());
updateAcctStmt.setLong(2, (int) (Math.random() * DbPreparator.OBJ_CNT));
updateAcctStmt.execute();
db.commit();
}
} catch (SQLException e) {
System.out.println("DB write error: ");
e.printStackTrace();
System.exit(0);
}
return null;
}
}

}


Re: [h2] Concurrency at org.h2.store.fs.FileBase.read()

2016-12-21 Thread Anatolii K
org.h2.jdbc.JdbcSQLException: General error: 
"java.nio.BufferUnderflowException"; SQL statement:
UPDATE account set balance = ? where id = ? [5-193]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:168)
at org.h2.message.DbException.convert(DbException.java:295)
at org.h2.command.Command.executeUpdate(Command.java:266)
at org.h2.jdbc.JdbcPreparedStatement.execute(JdbcPreparedStatement.java:201)
at org.radixware.imdb_test.Arte.updateAcct(Arte.java:137)
at org.radixware.imdb_test.Arte.call(Arte.java:68)
at org.radixware.imdb_test.Arte.call(Arte.java:11)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.nio.BufferUnderflowException
at java.nio.Buffer.nextGetIndex(Buffer.java:500)
at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:249)
at org.h2.compress.CompressLZF.expand(CompressLZF.java:427)
at org.h2.store.fs.FileNioMemData.expand(FilePathNioMem.java:555)
at org.h2.store.fs.FileNioMemData.readWrite(FilePathNioMem.java:659)
at org.h2.store.fs.FileNioMem.read(FilePathNioMem.java:332)
at org.h2.mvstore.DataUtils.readFully(DataUtils.java:421)
at org.h2.mvstore.FileStore.readFully(FileStore.java:98)
at org.h2.mvstore.Page.read(Page.java:190)
at org.h2.mvstore.MVStore.readPage(MVStore.java:1959)
at org.h2.mvstore.MVMap.readPage(MVMap.java:800)
at org.h2.mvstore.Page.getChildPage(Page.java:217)
at org.h2.mvstore.Cursor.min(Cursor.java:129)
at org.h2.mvstore.Cursor.hasNext(Cursor.java:36)
at 
org.h2.mvstore.db.TransactionStore$TransactionMap$1.fetchNext(TransactionStore.java:1221)
at 
org.h2.mvstore.db.TransactionStore$TransactionMap$1.(TransactionStore.java:1217)
at 
org.h2.mvstore.db.TransactionStore$TransactionMap.keyIterator(TransactionStore.java:1212)
at 
org.h2.mvstore.db.TransactionStore$TransactionMap.keyIterator(TransactionStore.java:1200)
at org.h2.mvstore.db.MVSecondaryIndex.find(MVSecondaryIndex.java:309)
at org.h2.mvstore.db.MVSecondaryIndex.find(MVSecondaryIndex.java:254)
at org.h2.index.BaseIndex.find(BaseIndex.java:128)
at org.h2.index.IndexCursor.find(IndexCursor.java:169)
at org.h2.table.TableFilter.next(TableFilter.java:467)
at org.h2.command.dml.Update.update(Update.java:102)
at org.h2.command.CommandContainer.update(CommandContainer.java:98)
at org.h2.command.Command.executeUpdate(Command.java:258)
... 8 more


On Wednesday, December 21, 2016 at 7:57:41 PM UTC+5, Noel Grandin wrote:
>
> Can we get a full stack trace for that failure.​
>

-- 
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] Concurrency at org.h2.store.fs.FileBase.read()

2016-12-21 Thread Anatolii K
The bug is reproduced only in multi-thread application

On Wednesday, December 21, 2016 at 8:41:44 PM UTC+5, Thomas Mueller Graf 
wrote:
>
> Hi,
>
> I guess that bug would be on my plate... I recently made changes there 
> (trying to improve concurrency). I'm sorry about that. Having a test case 
> would be great!
>
> Regards,
> Thomas
>
>
>
> On Wed, Dec 21, 2016 at 3:56 PM, Noel Grandin  > wrote:
>
>> Can we get a full stack trace for that failure.​
>>
>> -- 
>> 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 h2-database...@googlegroups.com .
>> To post to this group, send email to h2-da...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/h2-database.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] Asc order problem in a Date Data type Column using Pluggable / User-Defined Table

2016-12-21 Thread Pedro Almeida
Here it is a very minimal project where the issue can be verified.

https://github.com/UlTriX/h2problem

I appreciate any help. Thank you

Pedro 

On Wednesday, 21 December 2016 14:49:02 UTC, Noel Grandin wrote:
>
> I updated our unit tests to test this case, and it seems to be working 
> fine. 
>
> If you are convinced the problem lies in H2, try creating a small 
> standalone test case, and then we could help you debug it. 
>

-- 
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] Asc order problem in a Date Data type Column using Pluggable / User-Defined Table

2016-12-21 Thread Pedro Almeida
Hi Noel,

thank you very much for the quick response I am working in isolating the 
code and the problem.

>From what I gather so far I strongly believe the problem lies in H2 when 
working with the TableFilter

The Cursor I implemented (that is returned by public Cursor find(Session 
session, SearchRow first, SearchRow last) ) correctly sets the dates as 
ValueDate. It seems the problem is when H2 applies the transformations on 
the Cursor afterwards.

In the meantime I can't seem to find the test you added on 
https://github.com/h2database/h2database
Is it pushed yet?

Pedro

On Wednesday, 21 December 2016 14:49:02 UTC, Noel Grandin wrote:
>
> I updated our unit tests to test this case, and it seems to be working 
> fine. 
>
> If you are convinced the problem lies in H2, try creating a small 
> standalone test case, and then we could help you debug it. 
>

-- 
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] Concurrency at org.h2.store.fs.FileBase.read()

2016-12-21 Thread Thomas Mueller Graf
Hi,

I guess that bug would be on my plate... I recently made changes there
(trying to improve concurrency). I'm sorry about that. Having a test case
would be great!

Regards,
Thomas



On Wed, Dec 21, 2016 at 3:56 PM, Noel Grandin  wrote:

> Can we get a full stack trace for that failure.​
>
> --
> 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 h2-database+unsubscr...@googlegroups.com.
> To post to this group, send email to h2-database@googlegroups.com.
> Visit this group at https://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] Concurrency at org.h2.store.fs.FileBase.read()

2016-12-21 Thread Noel Grandin
Can we get a full stack trace for that failure.​

-- 
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] Concurrency at org.h2.store.fs.FileBase.read()

2016-12-21 Thread Anatolii K
Without split it also failed (url  jdbc:h2:nioMemLZF:db):

Caused by: java.nio.BufferUnderflowException
at java.nio.Buffer.nextGetIndex(Buffer.java:500)

On Wednesday, December 21, 2016 at 7:50:31 PM UTC+5, Noel Grandin wrote:
>
> then let's fix that problem, but I'm not really keen on trying to fix a 
> combination crash like that. 
>

-- 
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] Concurrency at org.h2.store.fs.FileBase.read()

2016-12-21 Thread Noel Grandin

then let's fix that problem, but I'm not really keen on trying to fix a 
combination crash like that.

--
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] Concurrency at org.h2.store.fs.FileBase.read()

2016-12-21 Thread Anatolii K
I have very big in-memory database ~ 1TB. Without split H2 crashes 


On Wednesday, December 21, 2016 at 7:43:13 PM UTC+5, Noel Grandin wrote:
>
> I'm sorry, but that's just a silly combination to be using. 
>
> You should only using be "split:" for FAT filesystems, and you should 
> certainly not be using it in combination with 
> "nioMemLZF:" 
>
>

-- 
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] Asc order problem in a Date Data type Column using Pluggable / User-Defined Table

2016-12-21 Thread Noel Grandin

I updated our unit tests to test this case, and it seems to be working fine.

If you are convinced the problem lies in H2, try creating a small standalone 
test case, and then we could help you debug it.

--
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] Concurrency at org.h2.store.fs.FileBase.read()

2016-12-21 Thread Noel Grandin

I'm sorry, but that's just a silly combination to be using.

You should only using be "split:" for FAT filesystems, and you should certainly not be using it in combination with 
"nioMemLZF:"


--
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] Concurrency at org.h2.store.fs.FileBase.read()

2016-12-21 Thread Anatolii K
After applying this patch I'm getting following error with nioMemLZF 
(url= jdbc:h2:split:30:nioMemLZF:db):

org.h2.jdbc.JdbcSQLException: General error: 
"java.nio.BufferUnderflowException"; SQL statement:
UPDATE account set balance = ? where id = ? [5-193]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:168)
at org.h2.message.DbException.convert(DbException.java:295)
at org.h2.command.Command.executeUpdate(Command.java:266)
at org.h2.jdbc.JdbcPreparedStatement.execute(JdbcPreparedStatement.java:201)
at org.radixware.imdb_test.Arte.updateAcct(Arte.java:137)
at org.radixware.imdb_test.Arte.call(Arte.java:68)
at org.radixware.imdb_test.Arte.call(Arte.java:11)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.nio.BufferUnderflowException
at java.nio.Buffer.nextGetIndex(Buffer.java:500)
at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:249)
at org.h2.compress.CompressLZF.expand(CompressLZF.java:427)
at org.h2.store.fs.FileNioMemData.expand(FilePathNioMem.java:555)
at org.h2.store.fs.FileNioMemData.readWrite(FilePathNioMem.java:659)
at org.h2.store.fs.FileNioMem.read(FilePathNioMem.java:332)
at org.h2.store.fs.FileSplit.read(FilePathSplit.java:296)
at org.h2.mvstore.DataUtils.readFully(DataUtils.java:421)
at org.h2.mvstore.FileStore.readFully(FileStore.java:98)
at org.h2.mvstore.Page.read(Page.java:190)
at org.h2.mvstore.MVStore.readPage(MVStore.java:1952)
at org.h2.mvstore.MVMap.readPage(MVMap.java:738)
at org.h2.mvstore.Page.getChildPage(Page.java:217)
at org.h2.mvstore.MVMap.binarySearch(MVMap.java:470)
at org.h2.mvstore.MVMap.binarySearch(MVMap.java:471)
at org.h2.mvstore.MVMap.get(MVMap.java:452)


On Wednesday, December 21, 2016 at 4:01:40 PM UTC+5, Anatolii K wrote:
>
> Thank you for quick help!
>
> On Wednesday, December 21, 2016 at 3:55:32 PM UTC+5, Noel Grandin wrote:
>>
>> It appears I was wrong about this, we already implement reading/writing 
>> without synchronisation for all of our other 
>> file implementations, I just missed that you are using the "split:" 
>> stuff. 
>>
>> I have pushed a fix for this. 
>>
>

-- 
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Asc order problem in a Date Data type Column using Pluggable / User-Defined Table

2016-12-21 Thread Pedro Almeida
Hello,

I am using H2 Version 1.4.193 and I am creating a Pluggable / User-Defined 
Table with ENGINE "..."

Just to sum up it is a Table that gathers data from a REST Endpoint.

I have implemented the Table, Index and Cursor everything is working in 
order 
and simple queries like SELECT * FROM TableName work as expected.

The problem is when I send a SQL query to sort by a column of data type DATE
in ascending order the data returned is not correctly sorted 

In descending order works fine!

SELECT * FROM TableName ORDER BY DateColumn ASC

Sorting asc and desc in Numeric Columns works fine too.

Is this a possible bug on the H2 code? or maybe I forgot to implement 
something?

Any ideas will be appreciated. Thanks.

Pedro

-- 
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] Missing lob entry on concurrent update read of a row

2016-12-21 Thread Noel Grandin
yes, because you are not holding the transaction open while reading the LOB, so the LOB is disappearing while you are 
reading it.


i.e.

connection.setAutoCommit(false);
 read the LOB completely here..
connection.commit();

--
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] Missing lob entry on concurrent update read of a row

2016-12-21 Thread Mayank Tankhiwale
Hi Noel,

The update thread and the read thread each have separate 
transactions/connections(ThreadLocal) to the database.
So while the read thread is open, the update thread comes and 
updates/writes to the row. (currently the table has single row) and one of 
the column in CLOB.

Our observation is that the issue always occurs while reading the clob from 
resultset after update. 

- Mayank


-- 
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] autoCommitDelay and SET WRITE_DELAY

2016-12-21 Thread pichulines
Hi all, sorry for reopen such an old thread... but this is also happening 
to me working with last release 1.4.193.

The MVStore background thread seems to eat a lot of cpu with no operation 
being performed. Setting the WRITE_DELAY as a connection parameter does the 
trick.

Thanks for your help.

--
-- THREAD DUMP ---

2016-12-21 12:18:20
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.102-b14 mixed mode):

"MVStore background writer nio:/opt/H2/DATA/Database.mv.db" #77 daemon 
prio=5 os_prio=0 tid=0x7fef38038800 nid=0x544e in Object.wait() 
[0x7fef616e5000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at org.h2.mvstore.MVStore$BackgroundWriterThread.run(MVStore.java:2689)
- locked <0xc0166560> (a java.lang.Object)

   Locked ownable synchronizers:
- None

"H2 TCP Server (tcp://127.0.1.1:9092) thread" #75 prio=5 os_prio=0 
tid=0x7fef3c00f800 nid=0x544c runnable [0x7fef7020e000]
   java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:170)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
- locked <0xc016e6d8> (a java.io.BufferedInputStream)
at java.io.DataInputStream.readInt(DataInputStream.java:387)
at org.h2.value.Transfer.readInt(Transfer.java:153)
at org.h2.server.TcpServerThread.process(TcpServerThread.java:256)
at org.h2.server.TcpServerThread.run(TcpServerThread.java:158)
at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
- None

"Attach Listener" #70 daemon prio=9 os_prio=0 tid=0x7fef58001000 
nid=0x53f3 waiting on condition [0x]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
- None

"DestroyJavaVM" #17 prio=5 os_prio=0 tid=0x7fef80009800 nid=0x535d 
waiting on condition [0x]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
- None

"H2 Console Server (http://127.0.1.1:8082)" #13 prio=5 os_prio=0 
tid=0x7fef80296800 nid=0x536c runnable [0x7fef705e1000]
   java.lang.Thread.State: RUNNABLE
at java.net.PlainSocketImpl.socketAccept(Native Method)
at 
java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:409)
at java.net.ServerSocket.implAccept(ServerSocket.java:545)
at java.net.ServerSocket.accept(ServerSocket.java:513)
at org.h2.server.web.WebServer.listen(WebServer.java:352)
at org.h2.tools.Server.run(Server.java:578)
at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
- None

"H2 PG Server (pg://127.0.1.1:5435)" #10 prio=5 os_prio=0 
tid=0x7fef80289000 nid=0x5369 runnable [0x7fef707e3000]
   java.lang.Thread.State: RUNNABLE
at java.net.PlainSocketImpl.socketAccept(Native Method)
at 
java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:409)
at java.net.ServerSocket.implAccept(ServerSocket.java:545)
at java.net.ServerSocket.accept(ServerSocket.java:513)
at org.h2.server.pg.PgServer.listen(PgServer.java:196)
at org.h2.tools.Server.run(Server.java:578)
at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
- None

"H2 TCP Server (tcp://127.0.1.1:9092)" #9 prio=5 os_prio=0 
tid=0x7fef80285000 nid=0x5368 runnable [0x7fef708e4000]
   java.lang.Thread.State: RUNNABLE
at java.net.PlainSocketImpl.socketAccept(Native Method)
at 
java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:409)
at java.net.ServerSocket.implAccept(ServerSocket.java:545)
at java.net.ServerSocket.accept(ServerSocket.java:513)
at org.h2.server.TcpServer.listen(TcpServer.java:250)
at org.h2.tools.Server.run(Server.java:578)
at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
- None

"Service Thread" #7 daemon prio=9 os_prio=0 tid=0x7fef800cc000 
nid=0x5366 runnable [0x]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
- None

"C1 CompilerThread1" #6 daemon prio=9 os_prio=0 tid=0x7fef800b7000 
nid=0x5365 waiting on condition [0x]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
- None

"C2 CompilerThread0" #5 daemon prio=9 os_prio=0 tid=0x7fef800b4800 
nid=0x5364 waiting on condition [0x]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
- None

"Signal Dispatcher" #4 daemon prio=9 os_prio=0 tid=0x7fef800b3000 
nid=0x5363 runnable [0x]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
  

Re: [h2] autoCommitDelay and SET WRITE_DELAY

2016-12-21 Thread pichulines
Hi all, sorry for reopen such an old thread... but this is also happening 
to me working with last release 1.4.193.

The MVStore background thread seems to eat a lot of cpu with no operation 
being performed. Setting the WRITE_DELAY as a connection parameter does the 
trick.

Thanks for your help.


 
THREAD DUMP ---

2016-12-21 12:18:20
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.102-b14 mixed mode):

"MVStore background writer 
nio:/opt/invsight_solvency/H2/DATA/Solvency.mv.db" #77 daemon prio=5 
os_prio=0 tid=0x7fef38038800 nid=0x544e in Object.wait() 
[0x7fef616e5000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at org.h2.mvstore.MVStore$BackgroundWriterThread.run(MVStore.java:2689)
- locked <0xc0166560> (a java.lang.Object)

   Locked ownable synchronizers:
- None

"H2 TCP Server (tcp://127.0.1.1:9092) thread" #75 prio=5 os_prio=0 
tid=0x7fef3c00f800 nid=0x544c runnable [0x7fef7020e000]
   java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:170)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
- locked <0xc016e6d8> (a java.io.BufferedInputStream)
at java.io.DataInputStream.readInt(DataInputStream.java:387)
at org.h2.value.Transfer.readInt(Transfer.java:153)
at org.h2.server.TcpServerThread.process(TcpServerThread.java:256)
at org.h2.server.TcpServerThread.run(TcpServerThread.java:158)
at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
- None

"Attach Listener" #70 daemon prio=9 os_prio=0 tid=0x7fef58001000 
nid=0x53f3 waiting on condition [0x]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
- None

"DestroyJavaVM" #17 prio=5 os_prio=0 tid=0x7fef80009800 nid=0x535d 
waiting on condition [0x]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
- None

"H2 Console Server (http://127.0.1.1:8082)" #13 prio=5 os_prio=0 
tid=0x7fef80296800 nid=0x536c runnable [0x7fef705e1000]
   java.lang.Thread.State: RUNNABLE
at java.net.PlainSocketImpl.socketAccept(Native Method)
at 
java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:409)
at java.net.ServerSocket.implAccept(ServerSocket.java:545)
at java.net.ServerSocket.accept(ServerSocket.java:513)
at org.h2.server.web.WebServer.listen(WebServer.java:352)
at org.h2.tools.Server.run(Server.java:578)
at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
- None

"H2 PG Server (pg://127.0.1.1:5435)" #10 prio=5 os_prio=0 
tid=0x7fef80289000 nid=0x5369 runnable [0x7fef707e3000]
   java.lang.Thread.State: RUNNABLE
at java.net.PlainSocketImpl.socketAccept(Native Method)
at 
java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:409)
at java.net.ServerSocket.implAccept(ServerSocket.java:545)
at java.net.ServerSocket.accept(ServerSocket.java:513)
at org.h2.server.pg.PgServer.listen(PgServer.java:196)
at org.h2.tools.Server.run(Server.java:578)
at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
- None

"H2 TCP Server (tcp://127.0.1.1:9092)" #9 prio=5 os_prio=0 
tid=0x7fef80285000 nid=0x5368 runnable [0x7fef708e4000]
   java.lang.Thread.State: RUNNABLE
at java.net.PlainSocketImpl.socketAccept(Native Method)
at 
java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:409)
at java.net.ServerSocket.implAccept(ServerSocket.java:545)
at java.net.ServerSocket.accept(ServerSocket.java:513)
at org.h2.server.TcpServer.listen(TcpServer.java:250)
at org.h2.tools.Server.run(Server.java:578)
at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
- None

"Service Thread" #7 daemon prio=9 os_prio=0 tid=0x7fef800cc000 
nid=0x5366 runnable [0x]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
- None

"C1 CompilerThread1" #6 daemon prio=9 os_prio=0 tid=0x7fef800b7000 
nid=0x5365 waiting on condition [0x]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
- None

"C2 CompilerThread0" #5 daemon prio=9 os_prio=0 tid=0x7fef800b4800 
nid=0x5364 waiting on condition [0x]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
- None

"Signal Dispatcher" #4 daemon prio=9 os_prio=0 tid=0x7fef800b3000 
nid=0x5363 runnable [0x]
   java.lang.Thread.State: RUNNABLE

   Locked 

Re: [h2] Concurrency at org.h2.store.fs.FileBase.read()

2016-12-21 Thread Anatolii K
Thank you for quick help!

On Wednesday, December 21, 2016 at 3:55:32 PM UTC+5, Noel Grandin wrote:
>
> It appears I was wrong about this, we already implement reading/writing 
> without synchronisation for all of our other 
> file implementations, I just missed that you are using the "split:" stuff. 
>
> I have pushed a fix for this. 
>

-- 
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] Concurrency at org.h2.store.fs.FileBase.read()

2016-12-21 Thread Noel Grandin
It appears I was wrong about this, we already implement reading/writing without synchronisation for all of our other 
file implementations, I just missed that you are using the "split:" stuff.


I have pushed a fix for this.

--
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: The last stable release Version 1.3.176 was published at 2014-04-05, when will 1.4.x stable version release?

2016-12-21 Thread Steve McLeod
Leon,

Although not marked stable, 1.4 with the page store (MV_STORE=false in JDBC 
URL) works better than 1.3.176 in many ways, and as good as 1.3.176 in all 
other ways.

I'm willing to state this because my product (Poker Copilot) has been using 
H2 since 2009 with thousands of users. As of January 2016 we switched to H2 
1.4 (with the page store only) and have had no H2 problems.




On Wednesday, 21 December 2016 03:48:35 UTC+1, Consu Leon wrote:
>
> I have this same question.
>
> Is H2 still a product you can base any level of 'production' on, 
> considering no stable release for years and still have to build with now 
> completely obsolete java 1.6 (I removed some lines from the pom and was 
> able to build with java7 but don't want to use such build till it's marked 
> stable).
>
> We run still somewhat happily with h2-1.3.176.jar, but after inserting a 
> few 10 records a drop of all tables takes literally forever. Only 
> stopping the server and removing the files then gives a quick solution. 
> This is probably the main reason we advise our customers not to run 
> production with H2.
>
> Once I attempted to switched to h2-1.4.187.jar but even the first tests 
> failed quickly: SQL's we execute on 1.3 version yield different query 
> results - some bugs in the query engine I guess - and back to 1.3.
>
> Then we decided to wait till a stable release of 1.4 -but it never came.
>
> Currently testing with h2-1.4.193.jar, initial impression is good; but 
> further testing is needed to confirm.
>
> Main point here is that it's obvious that h2 database is used in many 
> places and often in 'production' situations where installing one of the big 
> database players would be overkill (probably slower) or too expensive.
>
> Those users then have to consider that their only choice is to run a 
> 'stable' version with known problems or a beta version that's 'nearly 
> stable' but still built with completely obsolete java6.
>
> Looking at the great performance we achieve with H2 and the ease of use my 
> wish for 2017 is deliver a stable 1.4 version built with java8!
>
> Best season wishes,
>
> Leon
>
> On Wednesday, December 7, 2016 at 5:14:44 AM UTC+1, Felix Lee wrote:
>>
>> The last stable release Version 1.3.176 was published at 2014-04-05, when 
>> will 1.4.x stable version release? My company's internal policy is 
>> forbidden 'beta' version to be used in production...
>>
>

-- 
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] MVStore -- can I ignore it?

2016-12-21 Thread Noel Grandin



On 2016/12/21 10:26 AM, SkiAddict wrote:


How do we migrate to the MV_STORE format?



Dump and restore.

--
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] MVStore -- can I ignore it?

2016-12-21 Thread SkiAddict
On Wednesday, 21 December 2016 20:15:40 UTC+13, Noel Grandin wrote:
>
> MV_STORE is a completely separate storage engine from the old PageStore.
>
> The old PageStore engine generates files with a .h2.db extension, the new 
> MV_STORE engine generates files with a .mv.db extension.
>
> So it's not possible to mix and match opening the same files with the 
> different engines.
>
> I and some other people currently use MV_STORE in production, but there 
> may still be some issues. If you have .h2.db database files from the 1.3 
> series that you want to carry on using, then you will need to use the old 
> PageStore engine.
> ​
>
Thanks Noel for such a clear explanation of the situation :-)

As I understand it, eventually all h2 databases will be MV_STORE ones?  In 
which case I'm going to need to migrate my .h2.db file sooner or later?  
IOW I may as well do it now, esp since 1.3.176 gives me an error and I'd 
rather move beyond 1.3.167.

How do we migrate to the MV_STORE format?

-- 
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.