Re: SchemaUpdateStrategy

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Jun 10 2009 - 09:32:00 EDT

  • Next message: Andrey Razumovsky: "Re: [jira] Resolved: (CAY-1167) Create model schema XSD"

    Hi Tore,

    We definitely looked at DbMerger, but for the implementation it was
    decided to go a parallel way, essentially because most strategies are
    using a much smaller subset of JDBC metadata operations for its schema
    analysis, and the analysis flow needed to be flexible. E.g. we don't
    care if there are extra tables in the DB, and we don't want to fetch
    the columns for those. Attribute rules checking is fairly lax (null/
    not null mismatch is ignored). All or nothing strategies would abort
    out early if they detect a certain single object presence/absence.
    Things like that, all affecting application startup speed (not only on
    Oracle).

    Finally we decided against including a partial update strategy for the
    reasons we discussed before - production schema upgrade may require
    data migration, something the strategy won't know anything about. So
    essentially the conclusion was that the main strength of DbMerger
    wasn't applicable for the problem at hand. Users can still implement
    such strategy. With the help of DbMerger it will be trivial indeed.

    I am open to reconciling the two, just thought that it will be too
    invasive on the DbMerger end. So is there optimized API for Step #1,
    or does it still get all tokens with DbLoader, and then throws away
    unsafe ones?

    Andrus

    On Jun 10, 2009, at 4:10 PM, Tore Halset wrote:

    > Hello.
    >
    > I just took a look at this new feature for the first time. It is
    > nice to be able to set a SchemaUpdateStrategy in the model. From my
    > perspective, it is a little strange that this functionality is not
    > based on the DbMerger.
    >
    > There is one hint to the reason for this in CAY-1193: "This version
    > non use DBMerger for ThrowOnPartialSchemaStrategy and
    > ThrowOnPartialOrCreateSchemaStrategy. In this strategy used new
    > StrategyAnalyser, which can speed up implementation in oracle."
    >
    > If StrategyAnalyser is faster than DbMerger on oracle, is it
    > possible to make DbMerger faster as well? I do not have access to
    > Oracle, and know metadata fetching in Oracle is super slow.
    >
    > Is it ok if I create a new SchemaUpdateStrategy that use the
    > DbMerger? It will be a "safe" version that only adds tables and
    > columns, not remove them. And expand, but not shrink column length.
    >
    > Some people are already using DbMerger for auto-upgrade during
    > startup. I do this in 3 steps. The first step could fit in a
    > SchemaUpdateStrategy.
    > 1. Use DbMerger and issue all the safe tokens. That is all tokens
    > that does not remove information.
    > 2. Use cayenne code to fill/update content of database. This is
    > application specific.
    > 3. Offer the user to "clean up" the database using all the unsafe
    > tokens that typically remove columns and so on.
    >
    > Regards,
    > - Tore.
    >



    This archive was generated by hypermail 2.0.0 : Wed Jun 10 2009 - 09:32:35 EDT