[h2] MVStore and interrupts?
I've been going down this road: https://github.com/h2database/h2database/issues/227 trying to figure out how to work around interrupts with MVStore. Everyone just says use 'retry' or don't interrupt... not interrupting is easier said than done with other libraries. I can't figure out the syntax for "retry". I've tried something like this: this.store = new MVStore.Builder().fileName("retry:" + new File(mvFolder, MV_STORE + ".mv").getAbsolutePath()).open(); But that doesn't work: Directory does not exist: nio:retry:/mnt. I've been poking around in the source code, trying to figure out how to pass it in, and I'm quite confused. In the the maven packaged jar for 1.4.197, there is no class named FilePathRetryOnInterrupt which is what is supposed to provide the scheme, as far as I can tell. It looks like that class is only included in the H2 jar file? If MV Store is what gets broken, why isn't the fix / workaround included in the MV Store jar? This issue / workaround might be a good thing to add to the FAQ, as well. Thanks, Dan -- 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 and interrupts?
Hi, Try this: "retry:nio:" + ... See also TestConcurrent.testInterruptReopen() (It would be good to improve documentation for this I guess). Regards, Thomas On Thu, Jun 28, 2018 at 9:59 AM Dan wrote: > I've been going down this road: > https://github.com/h2database/h2database/issues/227 trying to figure out > how to work around interrupts with MVStore. > > Everyone just says use 'retry' or don't interrupt... not interrupting is > easier said than done with other libraries. > > I can't figure out the syntax for "retry". > > I've tried something like this: > > this.store = new MVStore.Builder().fileName("retry:" + new File(mvFolder, > MV_STORE + ".mv").getAbsolutePath()).open(); > > But that doesn't work: > > Directory does not exist: nio:retry:/mnt. > > I've been poking around in the source code, trying to figure out how to > pass it in, and I'm quite confused. > > In the the maven packaged jar for 1.4.197, there is no class named > FilePathRetryOnInterrupt > which is what is supposed to provide the scheme, as far as I can tell. > > It looks like that class is only included in the H2 jar file? > > If MV Store is what gets broken, why isn't the fix / workaround included > in the MV Store jar? > > This issue / workaround might be a good thing to add to the FAQ, as well. > > Thanks, > > Dan > > -- > 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] MVStore and interrupts?
On 2018/06/28 9:59 AM, Dan wrote: I've been going down this road: https://github.com/h2database/h2database/issues/227 trying to figure out how to work around interrupts with MVStore. Everyone just says use 'retry' or don't interrupt... not interrupting is easier said than done with other libraries. The easiest approach is just to run H2 as a TCP server. Even if it's just inside the same process, the TCP stack will act as a cut-out. -- 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 and interrupts?
Hi, > not interrupting is easier said than done with other libraries. Yes... One case, that was biting us, is using java.util.concurrent.ExecutorService.shutdownNow(). This was calling Thread.interrupt() in our case. It was relatively easy to resolve: now we use shutdown() instead. See https://issues.apache.org/jira/browse/SLING-5416 Regards, Thomas On Thu, Jun 28, 2018 at 10:32 AM Noel Grandin wrote: > > > On 2018/06/28 9:59 AM, Dan wrote: > > I've been going down this road: > https://github.com/h2database/h2database/issues/227 trying to figure out > how to work > > around interrupts with MVStore. > > > > Everyone just says use 'retry' or don't interrupt... not interrupting is > easier said than done with other libraries. > > The easiest approach is just to run H2 as a TCP server. Even if it's just > inside the same process, the TCP stack will > act as a cut-out. > > -- > 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.
[h2] Date_trunc function and ResultSetMetaData getColumnType() problem
Hi, I am using H2 version "1.4.197" While trying to get the column type with ResultSetMetaData getColumnType() of a query like: SELECT date_trunc('MONTH', "Date_Column") I get the value 0 (Null as defined in JDBC Types) 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.
[h2] Re: Date_trunc function and ResultSetMetaData getColumnType() problem
Hello. This function in H2 does not have exact return type, it may return TIMESTAMP, TIMESTAMP WITH TIME ZONE, DATE, or TIME depending on type of the second argument. That's why its return type is not defined. You can add an explicit cast. SELECT CAST(DATE_TRUNC('MONTH', column) AS TIMESTAMP) This construction looks ugly, but it should return an expected column type in meta data. -- 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: Date_trunc function and ResultSetMetaData getColumnType() problem
Thank you for the answer. I am looking at the source code H2 more specific Function.java and I see that a couple of functions are initially set with Value.NULL (since at that time the return data type is not known) Although there is a method called optimize that is used that for some functions the correct return data type is calculated. Could the same be done to the formula DATE_TRUNC in optimize? Do you agree? Our system connects to multiple database systems and depends a lot on the data type being returned (the SQL code is written by our users). In my view, a NULL data type is a bit ambiguous for this cases comparing with other systems with the same function date_trunc like PostgreSQL that always returns the correct type. Thank you for your time. Pedro On Thursday, 28 June 2018 14:31:39 UTC+1, Evgenij Ryazanov wrote: > > Hello. > > This function in H2 does not have exact return type, it may return > TIMESTAMP, TIMESTAMP WITH TIME ZONE, DATE, or TIME depending on type of the > second argument. That's why its return type is not defined. You can add an > explicit cast. > SELECT CAST(DATE_TRUNC('MONTH', column) AS TIMESTAMP) > This construction looks ugly, but it should return an expected column type > in meta data. > -- 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 and interrupts?
Yea, a quick search of my classpath shows about 5 different libraries doing an interrupt at one point or another, and I'm not even sure yet which one was biting me. I'm not trying to use H2, I'm just trying to use the MVStore directly. The MVStore jar package doesn't contain the classes necessary to use the Retry workaround... I had to add the H2 jar files to my classpath to get it to work - at least, I think I have it working right now. I need to test more. FYI, I've been doing a compare of Xodus vs MV Store for my use pattern, and so far, MVStore is way faster than Xodus :) The one thing I don't have a good handle on with MVStore, however, is how the versions work if I don't want any versions beyond current. The documentation for .setVersionsToKeep(0); only references inMemory stores for disk stores, I'm a little lost. Does it work to set it to 0? Or, do I also need to call store.compactMoveChunks() at some interval? Thanks, Dan On Thursday, June 28, 2018 at 5:18:25 AM UTC-5, Thomas Mueller Graf wrote: > > Hi, > > > not interrupting is easier said than done with other libraries. > > Yes... One case, that was biting us, is using > java.util.concurrent.ExecutorService.shutdownNow(). This was calling > Thread.interrupt() in our case. It was relatively easy to resolve: now we > use shutdown() instead. See > https://issues.apache.org/jira/browse/SLING-5416 > > Regards, > Thomas > > On Thu, Jun 28, 2018 at 10:32 AM Noel Grandin > wrote: > >> >> >> On 2018/06/28 9:59 AM, Dan wrote: >> > I've been going down this road: >> https://github.com/h2database/h2database/issues/227 trying to figure out >> how to work >> > around interrupts with MVStore. >> > >> > Everyone just says use 'retry' or don't interrupt... not interrupting >> is easier said than done with other libraries. >> >> The easiest approach is just to run H2 as a TCP server. Even if it's just >> inside the same process, the TCP stack will >> act as a cut-out. >> >> -- >> 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.