Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-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 93174E4E3 for ; Wed, 6 Feb 2013 18:39:14 +0000 (UTC) Received: (qmail 20287 invoked by uid 500); 6 Feb 2013 18:39:14 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 20236 invoked by uid 500); 6 Feb 2013 18:39:14 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 20186 invoked by uid 99); 6 Feb 2013 18:39:14 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Feb 2013 18:39:14 +0000 Date: Wed, 6 Feb 2013 18:39:14 +0000 (UTC) From: "Jens Alfke (JIRA)" To: dev@couchdb.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (COUCHDB-1670) Replicator crashes if numbers in checkpoint docs are expressed in scientific notation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/COUCHDB-1670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13572655#comment-13572655 ] Jens Alfke commented on COUCHDB-1670: ------------------------------------- > since is opaque. You have to pass back exactly what you got from couchdb. I don't think that's a reasonable expectation. The JSON is going to be transformed anyway (to insert the _rev), so at some point it's going to be translated into an internal format and then regenerated. The output has to be an equivalent JSON document, but that doesn't mean byte-for-byte equivalence. For instance, object keys could be in a different order, Unicode escapes could be turned into literals or vice versa, and numbers might be represented differently, like changing to/from scientific notation or suppressing trailing zeros after the decimal point. > Replicator crashes if numbers in checkpoint docs are expressed in scientific notation > ------------------------------------------------------------------------------------- > > Key: COUCHDB-1670 > URL: https://issues.apache.org/jira/browse/COUCHDB-1670 > Project: CouchDB > Issue Type: Bug > Components: Replication > Reporter: Jens Alfke > > The CouchDB 1.2 replicator process crashes with an Erlang exception when parsing a checkpoint document read back from a remote database, if numbers in the document were JSON-encoded in scientific notation instead of as integers. This includes the properties source_last_seq, end_last_seq, start_last_seq. > That is, the following encoding works fine: > ..., "source_last_seq": 1234567, ... > whereas this completely-equivalent encoding causes an exception: > ..., "source_last_seq": 1.234567e+06, ... > This issue raised its head as a result of a CouchDB-compatible engine I'm writing (the Couchbase Sync Gateway) which can serve as a passive replication endpoint. It's implemented in Go, and the Go JSON package has the side effect of (a) parsing all JSON numbers into type 'double', and (b) encoding all doubles into JSON using scientific notation if they're more than six digits long. The net effect is that when CouchDB stores a checkpoint into the Sync Adapter's database and then later reads it back, it barfs due to the scientific notation. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira