You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Miro Walker <mi...@gmail.com> on 2006/12/08 19:20:07 UTC

Transactions & DB Persistence Managers

Hi,

We've been doing some thinking about how to get round an issue we're
having that's causing lots of grief and I thought I'd see what you
guys reckon. Please correct me if I'm wrong in my understanding.

The way jackrabbit is currently structured, if versioning is enabled
it is not possible to achieve a truly transactionally secure
repository.

The reason for this is that the version history and the workspace(s)
in which data are stored use seperate database connections. This means
that when performing a versioning operation (e.g. checkIn) two
seperate transactions are executed. If the second one of these fails,
the system will only rollback this one, not the first, leaving the
repository corrupted to an extent that it can't be recovered using the
JCR API. E.g. a node in a workspace contains a reference to a base
version that does not exist in the version history.

This has happened to us on numerous occasions in production, resulting
in many hours worth of lost author time, slipped publication deadlines
and considerable frustration.

There appear to be two ways to resolve this issue (that I can think of):

1. Implement distributed transactions across the two database
connections - this would have a large overhead in terms of performance
and would introduce some complex dependencies on an external
distributed transaction manager. It seems like overkill within a
single application - perhaps useful if one were using JR and an
external DB within the same user transaction, but not for a single
user txn.

2. Allow jackrabbit to use a single database connection/transaction
for a single user transaction.

Without thinking about how JR has been implemented, if there is truly
an accepted use case for a transactional repository as suggested by
the spec, then the latter approach seems natural - it would seem crazy
for any other single persistence application to require multiple
database connections for a single user transaction.

However, the way things stand at the moment, JR was built on the
assumption that people would be using different data sources for
versioning, workspaces, blob storage, etc. This means that each
workspace / version history gets its own (single, shared, but that's
another issue :-)) DB connection. I wonder how valid this assumption
really is? Is anyone out there really doing this with their
applications? I can see the demand for a super-fast non-transactional
persistence mechanism and I obviously know the demand for the other
extreme - what about the mixed model?

How about the use of a DB persistence manager in combination with a DB
FileSystem? Is this a common use case? We are using it because we have
a requirement to have all non-transient data stored in a database (for
backup / DR purposes). Suggestions we've made in the past to make it
easier to administer have been rejected, however, so perhaps it's not
being used much elsewhere?

I'd like to suggest an improvement to rework JR to allow a truly
transactionally safe persistence model, but I thought I'd chuck this
out for consideration first.

Any comments / thoughts?

Miro

Re: Transactions & DB Persistence Managers

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On 12/11/06, Miro Walker <mi...@gmail.com> wrote:
> On 12/11/06, Jukka Zitting <ju...@gmail.com> wrote:
> > 3. Rearrange the versioning operations so that modifications in the
> > version storage are always committed before modifications in the
> > normal workspace.
>
> Yeah - we discussed this as well, and it seems like a sensible
> short-term workaround although it's masking rather than solving the
> issue.

Agreed.

> The rather worrying thing at the moment is that all of the
> transaction roll-backs we've seen have been software rather than
> hardware or network failures (NPEs, etc.).

Good point.

> > I think the DB PM/FS configuration is most often covered by the
> > externalBLOBs configuration option that will get all ItemState content
> > stored in the configured PM database.
>
> The real issue for us has been around workspace management - if a
> workspace is created on the fly (as we do using workspaces to model
> releases), then the DB FS is essential. In a single-workspace
> environment, I can see how it might be less interesting.

OK, understood.

> Have you or anyone else started thinking about a wish-list for a next
> major release and/or a timeframe? I'm guessing you're waiting to be
> driven by jsr-283?

My current thinking is to model Jackrabbit 2.0 as a feature release
for JSR-283. We will need to get started with the new features already
well before JSR-283 is final, since the Jackrabbit codebase will
likely be used for the reference implementation just like in JSR-170.

Other than JSR-283 there are however a number of features (both
functional and non-functional) that would be very nice to plan for
2.0/3.0. I however avoid making too extensive wish lists or tight
roadmaps for the future releases, since the open development process
makes it hard to estimate when, how, or by whom various features are
implemented. In other words, the Jackrabbit release plans follow the
implementation efforts, not the other way around.

So, the best way to get major new features or changes included in
future releases is to file Jira issues and start discussing the
changes on this list. Once an effort is substantial enough I'll most
likely get it included in the tentative release plans and it will
actually start affecting the release date and contents.

BR,

Jukka Zitting

Re: Transactions & DB Persistence Managers

Posted by Miro Walker <mi...@gmail.com>.
Hi Jukka,

On 12/11/06, Jukka Zitting <ju...@gmail.com> wrote:
> I'll add a third one that doesn't really solve the underlying issue
> about transactions, but would avoid the content integrity problems:
>
> 3. Rearrange the versioning operations so that modifications in the
> version storage are always committed before modifications in the
> normal workspace. Since there are no references from the version
> storage to the normal workspace, this cannot introduce consistency
> issues.

Yeah - we discussed this as well, and it seems like a sensible
short-term workaround although it's masking rather than solving the
issue. The rather worrying thing at the moment is that all of the
transaction roll-backs we've seen have been software rather than
hardware or network failures (NPEs, etc.).

> I think the DB PM/FS configuration is most often covered by the
> externalBLOBs configuration option that will get all ItemState content
> stored in the configured PM database.

The real issue for us has been around workspace management - if a
workspace is created on the fly (as we do using workspaces to model
releases), then the DB FS is essential. In a single-workspace
environment, I can see how it might be less interesting.

> Anyway, I'm open to alternatives in this area as I agree that while
> the current persistence model does work very well for the core
> features, there are features that are adversely affected by the
> current design. Any rework in this area will however need to take the
> installed base of Jackrabbit repositories in account. Upgrades to the
> persistence model would most likely mean major version updates for
> Jackrabbit.

Have you or anyone else started thinking about a wish-list for a next
major release and/or a timeframe? I'm guessing you're waiting to be
driven by jsr-283?

Cheers,

miro

Re: Transactions & DB Persistence Managers

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On 12/8/06, Miro Walker <mi...@gmail.com> wrote:
> The way jackrabbit is currently structured, if versioning is enabled
> it is not possible to achieve a truly transactionally secure
> repository.

Agreed.

> The reason for this is that the version history and the workspace(s)
> in which data are stored use seperate database connections. This means
> that when performing a versioning operation (e.g. checkIn) two
> seperate transactions are executed. If the second one of these fails,
> the system will only rollback this one, not the first, leaving the
> repository corrupted to an extent that it can't be recovered using the
> JCR API. E.g. a node in a workspace contains a reference to a base
> version that does not exist in the version history.
> [...]
> There appear to be two ways to resolve this issue (that I can think of):

I'll add a third one that doesn't really solve the underlying issue
about transactions, but would avoid the content integrity problems:

3. Rearrange the versioning operations so that modifications in the
version storage are always committed before modifications in the
normal workspace. Since there are no references from the version
storage to the normal workspace, this cannot introduce consistency
issues.

> How about the use of a DB persistence manager in combination with a DB
> FileSystem? Is this a common use case? We are using it because we have
> a requirement to have all non-transient data stored in a database (for
> backup / DR purposes). Suggestions we've made in the past to make it
> easier to administer have been rejected, however, so perhaps it's not
> being used much elsewhere?

I think the DB PM/FS configuration is most often covered by the
externalBLOBs configuration option that will get all ItemState content
stored in the configured PM database.

Anyway, I'm open to alternatives in this area as I agree that while
the current persistence model does work very well for the core
features, there are features that are adversely affected by the
current design. Any rework in this area will however need to take the
installed base of Jackrabbit repositories in account. Upgrades to the
persistence model would most likely mean major version updates for
Jackrabbit.

BR,

Jukka Zitting