Return-Path: X-Original-To: apmail-avro-dev-archive@www.apache.org Delivered-To: apmail-avro-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4C5B8DBB0 for ; Wed, 11 Jul 2012 00:57:36 +0000 (UTC) Received: (qmail 78016 invoked by uid 500); 11 Jul 2012 00:57:36 -0000 Delivered-To: apmail-avro-dev-archive@avro.apache.org Received: (qmail 77967 invoked by uid 500); 11 Jul 2012 00:57:36 -0000 Mailing-List: contact dev-help@avro.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@avro.apache.org Delivered-To: mailing list dev@avro.apache.org Received: (qmail 77959 invoked by uid 99); 11 Jul 2012 00:57:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Jul 2012 00:57:36 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jay.kreps@gmail.com designates 209.85.160.171 as permitted sender) Received: from [209.85.160.171] (HELO mail-gh0-f171.google.com) (209.85.160.171) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Jul 2012 00:57:27 +0000 Received: by ghy10 with SMTP id 10so905913ghy.30 for ; Tue, 10 Jul 2012 17:57:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=eN/0jetxAnFqh8jHasXeFwv5/xHqtmfUBjkwaD6cO+k=; b=CaNjE5k0M1I3MHAuu7qy+Nc8+ZnAt5nDp6m4fGpeNxspt4XKx+7/CilL3Iicih3pNH mNL9V/J7lScC2P6J1BGA9L4W4hUHQX9YrQ6eLb640o7NnAmFegxbyOhkdNW/2fa3A4IC SNAVaAgaS8I1e85egQZbeE8stctxBMs1HncyxLzKxEY4phhgRotQSNItiCfknil6wB3A R8zZ+WXKs2nQVYk6hZXmbEoc1iNzp5P+aBEPLRjUKiHmOw85flNJUE5iZaCT/Xt7Mryr 6cZZe7esoxA1XWZMstUuKR0O7nkHRatpxlUMTzGc0+gn2wgabYIDtPHrkd5jE9plutou Buew== MIME-Version: 1.0 Received: by 10.50.219.194 with SMTP id pq2mr12913217igc.25.1341968226797; Tue, 10 Jul 2012 17:57:06 -0700 (PDT) Received: by 10.231.43.206 with HTTP; Tue, 10 Jul 2012 17:57:06 -0700 (PDT) In-Reply-To: References: Date: Tue, 10 Jul 2012 17:57:06 -0700 Message-ID: Subject: Re: schema repositories? From: Jay Kreps To: dev@avro.apache.org Content-Type: multipart/alternative; boundary=14dae93411cd75481104c4835382 --14dae93411cd75481104c4835382 Content-Type: text/plain; charset=ISO-8859-1 Cool, I will write up a more detailed proposal and include it in a JIRA. WRT the "source" yes, we originally started versioning things by the record name, and we generally still use the convention that record name matches the topic/table name. However two things lead us to generalize this. First is the issue Scott points out there are schemas that may be shared across many tables/topics, but may evolve at slightly different rates. Secondly a generic utility that needs to handle many such sources must know the source name (or else how could it get data) but may not know the type of records in the source. At that point we realized "source" is just a generic key for a sequence of schemas which may or may not have some computability guarantees between them. The key can be the record name or any other string so long as it is consistent. I will try to flesh out some of these details as well as some details around id generation, in the proposal. -Jay On Tue, Jul 10, 2012 at 2:54 PM, Scott Carey wrote: > > > On 7/10/12 11:25 AM, "Doug Cutting" wrote: > > >Jay, > > > >This sounds to me like something of general utility that would make a > >great addition to Avro. > > > >To be clear, I assume you mean contributing this as source code for a > >service that folks can deploy, right? For example, it might be a Java > >project that builds a WAR file that, when deployed, presents a REST > >front end and talks to a backing persistence layer where the schemas > >are stored. Is that right? > > > >Also note that Avro recently added a standard facility for defining > >Schema fingerprints that might be used as Schema IDs in such a > >service: > > > > > http://avro.apache.org/docs/current/spec.html#Parsing+Canonical+Form+for+S > >chemas > > > >This has currently been implemented in Java and C#: > > > > > http://avro.apache.org/docs/current/api/java/org/apache/avro/SchemaNormali > >zation.html > > > >I like the notion of a Schema source for the uses you describe. For > >records might this simply be the fully-qualified record name? For > >unions and other unnamed types it might take the same form as a record > >name. We could use the "long form" for primitives and always supply a > >name so that an string schema might be {"type":"string", > >"name":"org.foo.Bar"}. Would this work, or is there some other > >structure and use of sources for which schema names are not a good > >match? > > If your source is a database table, or pub-sub topic, then multiple > sources might have overlapping schemas at different points of time. Two > topics might share a schema, and their schema evolution may or may not > diverge over time. The FQDN of a record might be appropriate in some > cases to capture this, but not all. > Capturing the sequence allows you to eagerly ensure that your current > schema is compatible with the entire history of the source's schema > evolution. > > I suppose there could be support for fingerprints here, but it does not > seem to be required and in some cases a generated sequential ID will take > up a lot less space if stored with each record. A typical source might > only change its schema once a month, each record needs to have the id > portion of a (source, id) pair stored with it, which will typically be 1 > to 2 bytes. > > > > >Cheers, > > > >Doug > > > >On Tue, Jul 10, 2012 at 10:53 AM, Jay Kreps wrote: > >> I noticed in AVRO-1006 there was a mention of standardizing on some > >>kind of > >> schema repository that would maintain a central set of all versions of a > >> schema and allow a way to reference schemas by id. > >> > >> At LinkedIn we have standardized (almost) all of our persistent data on > >> Avro and we have a repository like this for managing schemas. Messages > >>are > >> stored with the schema in Hadoop, but for systems that store rows > >> independently like databases or messaging we instead store a schema id > >>with > >> each row/message. We would love for there to be an open source version > >>of > >> this to make it possible to open up our other tools > >> for compatibility checking, etl and other things that depend on service. > >> > >> The service itself is basically a REST service that maintains schemas. > >>Each > >> schema has a "source" that it is associated with (the table or messaging > >> topic or whatever) and a unique id. Schemas can be fetched by id or you > >>can > >> get the latest schema for a given source. Having the notion of sources > >> allows us to do two things: (1) enforce a compatibility modal on schema > >> changes (no backwards incompatible changes for various definitions of > >> backwards compatibility), and (2) allow our hadoop etl to project all > >> messages forward to the latest schema (since AvroFile requires a single > >> schema not a per-row schema). > >> > >> If the Avro project is interested in adopting an official repository > >>that > >> would be really nice. It is frankly a pretty trivial piece of code, but > >> standardization would allow interoperability between things. I would be > >> willing to either open source our repository implementation or do a > >> from-scratch one if we come up with more requirements. > >> > >> -Jay > > > --14dae93411cd75481104c4835382--