summaryrefslogtreecommitdiff
path: root/share/www
diff options
context:
space:
mode:
authorAdam Kocoloski <kocolosk@apache.org>2009-09-09 16:53:49 +0000
committerAdam Kocoloski <kocolosk@apache.org>2009-09-09 16:53:49 +0000
commit9b78e1555d73c888fedaa0b9d256abaeaadbe41a (patch)
tree921f620daaeb7116e5511db830e5ecb6d0498f98 /share/www
parent85d1cbfc79eb0a04ec7f16624d6290920b4355ac (diff)
choice of uuid algos for better insert perf. Closes COUCHDB-465. Thanks rnewson, bitdiddle
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@813051 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www')
-rw-r--r--share/www/script/test/uuids.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/share/www/script/test/uuids.js b/share/www/script/test/uuids.js
index 3b7533be..50621678 100644
--- a/share/www/script/test/uuids.js
+++ b/share/www/script/test/uuids.js
@@ -59,4 +59,45 @@ couchTests.uuids = function(debug) {
// ensure we return a 405 on POST
xhr = CouchDB.request("POST", "/_uuids?count=1000");
T(xhr.status == 405);
+
+ // Test sequential uuids
+ var seq_testfun = function() {
+ xhr = CouchDB.request("GET", "/_uuids?count=1000");
+ T(xhr.status == 200);
+ result = JSON.parse(xhr.responseText);
+ for(var i = 1; i < result.uuids.length; i++) {
+ T(result.uuids[i].length == 32);
+ T(result.uuids[i-1] < result.uuids[i], "Sequential uuids are ordered.");
+ }
+ };
+
+ run_on_modified_server([{
+ "section": "uuids",
+ "key": "algorithm",
+ "value": "sequential",
+ }],
+ seq_testfun
+ );
+
+ // Test utc_random uuids
+ var utc_testfun = function() {
+ xhr = CouchDB.request("GET", "/_uuids?count=1000");
+ T(xhr.status == 200);
+ result = JSON.parse(xhr.responseText);
+ for(var i = 1; i < result.uuids.length; i++) {
+ T(result.uuids[i].length == 32);
+ var u1 = result.uuids[i-1].substr(0, 13);
+ var u2 = result.uuids[i].substr(0, 13);
+ T(u1 < u2, "UTC uuids are roughly ordered.");
+ }
+ };
+
+ run_on_modified_server([{
+ "section": "uuids",
+ "key": "algorithm",
+ "value": "utc_random"
+ }],
+ utc_testfun
+ );
+
};