Monday, October 12, 2009

Sunday: still on the same kick

One of the advantages of membership of the Jet Lag Junta is that I had already been awake for several hours when Tom Kyte kicked off Oracle Develop at 09:00 on Sunday morning. The topic of Tom's talk was What are we still doing wrong? It was a good mix of insight and humour. He covered:

  1. Underestimating complexity
  2. Not knowing how to ask for help
  3. We write/generate way too much code
  4. We pretend everything will be alright
  5. Security matters.
I think Tom would be the first to admit that most of these are things he has been banging on about for years. That is rather the point. His talk was peppered with recent examples of badly-formed code, useless error messages, poorly-asked forum questions and other horrors. One pertinent item concerned the T-Mobile Sidekick (a kind of mobile phone) which stores all its - i.e. your - information in the cloud. Only their storage provider applied an upgrade to the production server without taking a backup. And in the process lost everybody's data - contacts, photos, the lot. Doh!

Tom got a spontaneous round of applause for an extended riff on when others then null which ended "if it's okay for all of your code to not run some of the time then it's okay for it to never run. So take it out." I think if he had included a "Can I get a 'Amen'?" in there he would have got one those too.

My session went pretty well. I think. It was standing room only, which was nice. Both Steven Feuerstein and Bryn Llewellyn were in the audience, which was a bit daunting. I opted for the lectern microphone, which was a mistake; I occasionally misjudged the distance, so the sound levels on the recording will probably be wild. The annoying thing was a problem with the projectors, which washed out the slides. Some were virtually invisible. Fortunately they were mainly there as supporting wallpaper for my talk but it was still frustrating after all the effort I had put in to them. There were no questions at the end, which worries me slightly. But on the other hand hardly anybody walked out, so I hope they got something from it.

I stayed with the Design Patterns thing by going to hear Robin Smith and Shailendra Mishra talk about Design Patterns for Complex Event Processing. As it turned out there were not really any design patterns as such, just an introduction to Oracle's CEP implementation. They have extended ANSI 92 SQL to include a temporal component. This means we can query a STREAM of events using a SELECT ... FROM statement just like a database table. Furthermore we can use WHERE clauses and even join the out put from a stream with regular database tables. Plus the demo included a Google Maps plug-in which the changed colours of the pins in real time. Cool!

Then I went to hear Bryn Llewellyn's talk on Edition-Based Redefinition. This is a very exciting new feature of 11gR2 It will allow us to apply changes to database code and structures online, in production, invisibly to the users. The key to this is running the old code and the new code in parallel. This is achieved with Editions. An Edition is basically a copy of a set of database objects. We can change some of them in the new Edition. Items such as tables are not editionable, so they need to have structures which support both the old and the new edition. DML changes are applied transparently to both using Cross Edition triggers and the data is retrieved using Editioned Views.

We can run both Editions in parallel for as long as we like, in a period rather sexily called Hot Rollover. But eventually we switch all our users over to the new Edition and we can drop the remnants of the old edition in slow time. Oracle are marketing this as a High Availability feature but I think the main attraction for developers will be the chance to put an end to Upgrade Failure Misery. Editions give us the opportunity to get the code in place, migrate the data and generally make sure everything is working properly before we announce the release of 2.1 to our users.

There are some interesting limitations. There is no ability to reference an object by Edition. We can set the Edition for a session, programmatically, but all the objects we see are determined by the set Edition. Tables are not - and never will be - editionable. A non-Editioned item cannot depend on an Editioned item. That means that tables cannot use an Editioned Type and function-based indexes cannot use an Editioned function.

I thought Edition-Based Redefinition is such a cool feature that it would be a Chargeable Optional, like all the other recent cool features (yes, RAT, I'm talking about you). But in fact the opposite is true. Not only is Editions not an option it is mandatory: when we install 11gR2 our database has a default Edition. But if we want to make use of the Redefinition capability we have to do some work to re-jig the schema (rename all the tables, put in Editioned views with the old table names). That has to happen offline. But Bryn promises us it will be the last offline upgrade we'll ever do.

1 comment:

Michael Seiwert said...

Was your talk recorded ? Do you know a link to a streaming video of your talk ? Thanks Michael