Uploaded image for project: 'CouchDB'
  1. CouchDB
  2. COUCHDB-1670

Replicator crashes if numbers in checkpoint docs are expressed in scientific notation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • Replication
    • None

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            snej Jens Alfke
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: