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 27342182E2 for ; Mon, 1 Feb 2016 20:31:45 +0000 (UTC) Received: (qmail 34598 invoked by uid 500); 1 Feb 2016 20:31:45 -0000 Delivered-To: apmail-avro-dev-archive@avro.apache.org Received: (qmail 34539 invoked by uid 500); 1 Feb 2016 20:31:44 -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 34527 invoked by uid 99); 1 Feb 2016 20:31:44 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Feb 2016 20:31:44 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id BF0CEC13F2 for ; Mon, 1 Feb 2016 20:31:43 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.9 X-Spam-Level: ** X-Spam-Status: No, score=2.9 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=appdynamics.com Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id HGRcKl7DC0dF for ; Mon, 1 Feb 2016 20:31:33 +0000 (UTC) Received: from mail-lf0-f50.google.com (mail-lf0-f50.google.com [209.85.215.50]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id C0D0A42B96 for ; Mon, 1 Feb 2016 20:31:32 +0000 (UTC) Received: by mail-lf0-f50.google.com with SMTP id l143so37591629lfe.2 for ; Mon, 01 Feb 2016 12:31:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=appdynamics.com; s=google; h=mime-version:date:message-id:subject:from:to:content-type; bh=K3jUxOu0GdhbOKGHDmar3YylY/FlNjRS5ZmdOsoJwxs=; b=JZO8qDYpn7TLxOT1ZfTAGEm/1RUQyu4ZWt+IHZXaLRMUzoMmBGM5etyft854aIMNDp jzloLpXWHnFFV2dDZ0YrQpxxHhcg33k7uoHFULoCZV0ajgo08H7DGDWW5qgVYSEzcMWq 0LdMKR8sLu3jbiKpaNyl4D4Uaf7PQndC8dCTQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=K3jUxOu0GdhbOKGHDmar3YylY/FlNjRS5ZmdOsoJwxs=; b=Wj6EMZyimy+eqPBEz/azsF9KF0+465ZPU6KpeguxDtHyoc4nrpkdbaO5jX024ELGGI lqjgBq+/lCXdZu4U2yCeCgG5ebDQebe6wRb/PsE8n7BO2RNIXsNFGNFpOGbVjsE/7VpH a/xYFYt0CrTsJHmnhoqRWN2fsuuBcuIxnld1u91fsKPliPjdBt8bFN3Bd0qM1XkCBVSL HOhB/N81zvu+Cvtq1d62LBbF+lAh9lk/9Qyo8K0iV3xPX6OcmD/kd9CG2d6SGpPl/RA8 5wGbXYt0QOV+Vb5KOuqUCNfbxl9qN+JluRGVy/JkACtIJ2N9wXjIef7LPe12XK9gFq66 F5fQ== X-Gm-Message-State: AG10YORqZ7JlD4rV79VQ7aclAH47L6gd1CAs7YXUWDK5YbDqKNRGxqEwwR/ThhESKiIXBcyH0C/nZM69T7RCUrjP MIME-Version: 1.0 X-Received: by 10.25.85.136 with SMTP id j130mr9431143lfb.9.1454358685986; Mon, 01 Feb 2016 12:31:25 -0800 (PST) Received: by 10.25.35.150 with HTTP; Mon, 1 Feb 2016 12:31:25 -0800 (PST) Date: Mon, 1 Feb 2016 12:31:25 -0800 Message-ID: Subject: Avro schema doesn't honor backward compatibilty From: Raghvendra Singh To: dev@avro.apache.org, user@avro.apache.org Content-Type: multipart/alternative; boundary=001a11412f5cdad708052abb44ae --001a11412f5cdad708052abb44ae Content-Type: text/plain; charset=UTF-8 down votefavorite I have this avro schema { "namespace": "xx.xxxx.xxxxx.xxxxx", "type": "record", "name": "MyPayLoad", "fields": [ {"name": "filed1", "type": "string"}, {"name": "filed2", "type": "long"}, {"name": "filed3", "type": "boolean"}, { "name" : "metrics", "type": { "type" : "array", "items": { "name": "MyRecord", "type": "record", "fields" : [ {"name": "min", "type": "long"}, {"name": "max", "type": "long"}, {"name": "sum", "type": "long"}, {"name": "count", "type": "long"} ] } } } ]} Here is the code which we use to parse the data public static final MyPayLoad parseBinaryPayload(byte[] payload) { DatumReader payloadReader = new SpecificDatumReader<>(MyPayLoad.class); Decoder decoder = DecoderFactory.get().binaryDecoder(payload, null); MyPayLoad myPayLoad = null; try { myPayLoad = payloadReader.read(null, decoder); } catch (IOException e) { logger.log(Level.SEVERE, e.getMessage(), e); } return myPayLoad; } Now i want to add one more field int the schema so the schema looks like below { "namespace": "xx.xxxx.xxxxx.xxxxx", "type": "record", "name": "MyPayLoad", "fields": [ {"name": "filed1", "type": "string"}, {"name": "filed2", "type": "long"}, {"name": "filed3", "type": "boolean"}, { "name" : "metrics", "type": { "type" : "array", "items": { "name": "MyRecord", "type": "record", "fields" : [ {"name": "min", "type": "long"}, {"name": "max", "type": "long"}, {"name": "sum", "type": "long"}, {"name": "count", "type": "long"} ] } } } {"name": "agentType", "type": ["null", "string"], "default": "APP_AGENT"} ]} Note the filed added and also the default is defined. The problem is that if we receive the data which was written using the older schema i get this error java.io.EOFException: null at org.apache.avro.io.BinaryDecoder.ensureBounds(BinaryDecoder.java:473) ~[avro-1.7.4.jar:1.7.4] at org.apache.avro.io.BinaryDecoder.readInt(BinaryDecoder.java:128) ~[avro-1.7.4.jar:1.7.4] at org.apache.avro.io.BinaryDecoder.readIndex(BinaryDecoder.java:423) ~[avro-1.7.4.jar:1.7.4] at org.apache.avro.io.ResolvingDecoder.doAction(ResolvingDecoder.java:229) ~[avro-1.7.4.jar:1.7.4] at org.apache.avro.io.parsing.Parser.advance(Parser.java:88) ~[avro-1.7.4.jar:1.7.4] at org.apache.avro.io.ResolvingDecoder.readIndex(ResolvingDecoder.java:206) ~[avro-1.7.4.jar:1.7.4] at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:152) ~[avro-1.7.4.jar:1.7.4] at org.apache.avro.generic.GenericDatumReader.readRecord(GenericDatumReader.java:177) ~[avro-1.7.4.jar:1.7.4] at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:148) ~[avro-1.7.4.jar:1.7.4] at org.apache.avro.generic.GenericDatumReader.read(GenericDatumReader.java:139) ~[avro-1.7.4.jar:1.7.4] at com.appdynamics.blitz.shared.util.XXXXXXXXXXXXX.parseBinaryPayload(BlitzAvroSharedUtil.java:38) ~[blitz-shared.jar:na] What i understood from this document that this should have been backward compatible but somehow that doesn't seem to be the case. Any idea what i am doing wrong? --001a11412f5cdad708052abb44ae--