Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 47928 invoked from network); 8 Nov 2009 04:12:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Nov 2009 04:12:38 -0000 Received: (qmail 75914 invoked by uid 500); 8 Nov 2009 04:12:37 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 75777 invoked by uid 500); 8 Nov 2009 04:12:36 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 75767 invoked by uid 99); 8 Nov 2009 04:12:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Nov 2009 04:12:36 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [63.249.119.34] (HELO server.rogerbinns.com) (63.249.119.34) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Nov 2009 04:12:26 +0000 Received: from [192.168.1.53] (unknown [192.168.1.53]) by server.rogerbinns.com (Postfix) with ESMTPSA id 1656C21146B for ; Sat, 7 Nov 2009 20:12:05 -0800 (PST) Message-ID: <4AF64514.8090401@rogerbinns.com> Date: Sat, 07 Nov 2009 20:12:04 -0800 From: Roger Binns User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: user@couchdb.apache.org Subject: Re: Silent corruption of large numbers References: <4AF5FB9E.70300@rogerbinns.com> <4AF622D5.9070708@rogerbinns.com> In-Reply-To: X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Paul Davis wrote: > RFC 4627 does mention this issue in passing in section 4 by saying "An > implementation may set limits on the range of numbers." Generally I > take this to mean that you're gonna have weird implementation > dependent behavior when dealing with the limits of common number > representations. If there are limits then I'd expect them to be enforced in some way, typically some sort of exception. The last thing I would expect is for the numbers to be silently corrupted. If strings over 1,024 bytes were randomly mutated would that be acceptable? > As such, relying on the view engine to error out In this case the limit is in the Javascript view engine. The CouchDB server doesn't have a problem. If the view engine is Python then it won't have the problem either. > While not > the best answer the only thing I can suggest would be to do as Adam > says and store large values as strings and use a Bignum library in the > places you need to manipulate such values. In this case it is just my test suite that trips over the problem and my language (Python) does bignums by default. I'm not too bothered that there is a failure but rather by the manner of the failure - silent mutation. > Even if we told the view server to error on such values, what would > that error look like? Would everyone be unable to pass a doc with a > big num through the view server (depending on language)? Things get > messy quick. I'm old school. I don't think this kind of mutation is acceptable. A user is sitting behind layers of user interface, CouchDB libraries, JSON libraries, HTTP libraries and several other bits of glue. Silently doing this is bad - one day a user will end up with data corruption with serious repercussions. Using a string analogy what should a view server do if a string is passed in that is larger than it wants to handle? Is silent mutation or corruption ok? Roger -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkr2RRIACgkQmOOfHg372QQjZACfdbGUvlT+t+ZzBQR9JKyAs4eD th0AoNAJk/XAQi2qSpA9QkBrHWnU4NFH =wHXn -----END PGP SIGNATURE-----