On 18 November 2017 at 17:12, Stuart McMillan <[email protected]> wrote:
> Noel,
>
> Yes - certainly the session locking (system or connection session) is one
> issue I have been wrestling with - especially when the CTE persistent views
> have to join the parent views lifecycle - I did a hacky-fix which I am not
> happy about to bypass that (and might not pass a code review).
>
there a couple of tricks we use in other places that might help.
(1) we tie the lifetime of stuff to the lifetime of the top-level
statement, not to the lifetime of the parent object. When dealing with
circular stuff, this helps
(2) when deleting these things, we use a loop that looks like
while (true)
progress = false
for each live object
progress |= try to delete object
if (!progress) break
>
> If we sidestep (ignore for the time being) my hacky attempts to bypass
> that issue - the next stumbling block was making the persistent views truly
> persistent - even across database reconnections. The blocker there is in
> reviving the cte views from their db persisted state - which fails dismally
> while using the plan SQL to re-create the cte views. I have to admit I was
> at a loss at how to fix that, since I do not understand the mechanism in
> which permanent DB-objects are persisted in H2. Which classes and fields
> are persisted in the db across connections/db-restarts for views and tables?
>
>
It's actually (mostly) simple. We just store the SQL required to re-create
each object, and then we re-parse and re-execute each chunk of SQL at
startup. There is a couple of stages to make this work, and some flags to
say things like "this is db init, do not try doing validation/compile/etc
yet"
And this all runs sequentially on the system session.
--
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.