couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Smith (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COUCHDB-1670) Replicator crashes if numbers in checkpoint docs are expressed in scientific notation
Date Thu, 07 Feb 2013 04:09:12 GMT

    [ https://issues.apache.org/jira/browse/COUCHDB-1670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13573163#comment-13573163
] 

Jason Smith commented on COUCHDB-1670:
--------------------------------------

Other issues have brought up the meaning of "numbers" in JSON. (For example, the spec just
says that numbers are a series of numerals, implying arbitrary precision, not IEEE 754.)

I agree with Jens. In the important sense, he **is** returning the same opaque value to CouchDB.
He encoded it differently, but IMO those differences are more like insignificant white space
in the JSON.

(CouchDB does not follow this principle perfectly. IIRC, if you place "insignificant" whitespace
in your `_view?key=xxx` query then you will not get a result.)

If the Go library does that, this is a good opportunity for CouchDB to become more "liberal
in what it accepts."
                
> 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

Mime
View raw message