You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ns...@apache.org on 2008/06/22 20:56:40 UTC
svn commit: r670397 - in /incubator/couchdb/branches/runtimeconfig:
etc/couchdb/default.ini.tpl.in share/www/script/couch_tests.js
src/couchdb/couch_server_sup.erl
Author: nslater
Date: Sun Jun 22 11:56:39 2008
New Revision: 670397
URL: http://svn.apache.org/viewvc?rev=670397&view=rev
Log:
reformatted startup message
Modified:
incubator/couchdb/branches/runtimeconfig/etc/couchdb/default.ini.tpl.in
incubator/couchdb/branches/runtimeconfig/share/www/script/couch_tests.js
incubator/couchdb/branches/runtimeconfig/src/couchdb/couch_server_sup.erl
Modified: incubator/couchdb/branches/runtimeconfig/etc/couchdb/default.ini.tpl.in
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/runtimeconfig/etc/couchdb/default.ini.tpl.in?rev=670397&r1=670396&r2=670397&view=diff
==============================================================================
--- incubator/couchdb/branches/runtimeconfig/etc/couchdb/default.ini.tpl.in (original)
+++ incubator/couchdb/branches/runtimeconfig/etc/couchdb/default.ini.tpl.in Sun Jun 22 11:56:39 2008
@@ -6,7 +6,6 @@
RootDirectory=%localstatelibdir%
UtilDriverDir=%couchprivlibdir%
MaximumDocumentSize=4294967296 ; 4 GB
-StartupMessage=Apache CouchDB is starting.
[HTTPd]
Port=5984
Modified: incubator/couchdb/branches/runtimeconfig/share/www/script/couch_tests.js
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/runtimeconfig/share/www/script/couch_tests.js?rev=670397&r1=670396&r2=670397&view=diff
==============================================================================
--- incubator/couchdb/branches/runtimeconfig/share/www/script/couch_tests.js [utf-8] (original)
+++ incubator/couchdb/branches/runtimeconfig/share/www/script/couch_tests.js [utf-8] Sun Jun 22 11:56:39 2008
@@ -294,12 +294,12 @@
result = db.query(map, reduce, {startkey: i, endkey: numDocs - i});
T(result.rows[0].value == summate(numDocs-i) - summate(i-1));
}
-
+
db.deleteDb();
db.createDb();
for(var i=1; i <= 5; i++) {
-
+
for(var j=0; j < 10; j++) {
// these docs are in the order of the keys collation, for clarity
var docs = [];
@@ -317,23 +317,23 @@
T(db.bulkSave(docs).ok);
T(db.info().doc_count == ((i - 1) * 10 * 11) + ((j + 1) * 11));
}
-
+
map = function (doc) {emit(doc.keys, 1)};
reduce = function (keys, values) { return sum(values); };
-
+
var results = db.query(map, reduce, {group:true});
-
+
//group by exact key match
T(equals(results.rows[0], {key:["a"],value:20*i}));
T(equals(results.rows[1], {key:["a","b"],value:20*i}));
T(equals(results.rows[2], {key:["a", "b", "c"],value:10*i}));
T(equals(results.rows[3], {key:["a", "b", "d"],value:10*i}));
-
+
//group by the first element in the key array
var results = db.query(map, reduce, {group_level:1});
T(equals(results.rows[0], {key:["a"],value:70*i}));
T(equals(results.rows[1], {key:["d"],value:40*i}));
-
+
//group by the first 2 elements in the key array
var results = db.query(map, reduce, {group_level:2});
T(equals(results.rows[0], {key:["a"],value:20*i}));
@@ -344,13 +344,13 @@
T(equals(results.rows[5], {key:["d","b"],value:10*i}));
T(equals(results.rows[6], {key:["d","c"],value:10*i}));
}
-
+
// now test out more complex reductions that need to use the combine option.
-
+
db.deleteDb();
db.createDb();
-
+
var map = function (doc) {emit(null, doc.val)};
var reduceCombine = function (keys, values, rereduce) {
// This computes the standard deviation of the mapped results
@@ -358,7 +358,7 @@
var count=0;
var total=0;
var sqrTotal=0;
-
+
if (!rereduce) {
// This is the reduce phase, we are reducing over emitted values from
// the map functions.
@@ -368,7 +368,7 @@
}
count = values.length;
}
- else {
+ else {
// This is the rereduce phase, we are re-reducing previosuly
// reduced values.
for(var i in values) {
@@ -377,16 +377,16 @@
sqrTotal = sqrTotal + (values[i].sqrTotal * values[i].sqrTotal);
}
}
-
+
var variance = (sqrTotal - ((total * total)/count)) / count;
stdDeviation = Math.sqrt(variance);
-
+
// the reduce result. It contains enough information to be rereduced
// with other reduce results.
return {"stdDeviation":stdDeviation,"count":count,
"total":total,"sqrTotal":sqrTotal};
};
-
+
// Save a bunch a docs.
for(var j=0; j < 10; j++) {
var docs = [];
@@ -402,13 +402,13 @@
docs.push({val:100});
T(db.bulkSave(docs).ok);
}
-
+
var results = db.query(map, reduceCombine);
-
+
var difference = results.rows[0].value.stdDeviation - 28.722813232690143;
// account for floating point rounding error
T(Math.abs(difference) < 0.0000000001);
-
+
},
multiple_rows: function(debug) {
@@ -583,7 +583,7 @@
if (debug) debugger;
var numDocs = 500;
-
+
function makebigstring(power) {
var str = "a";
while(power-- > 0) {
@@ -1150,33 +1150,35 @@
if(debug) debugger;
var xhr;
- xhr = CouchDB.request("GET", "/_config/CouchDB/ConsoleStartupMsg");
+ xhr = CouchDB.request("GET", "/_config/CouchDB/MaximumDocumentSize");
T(xhr.status == 200);
- T(JSON.parse(xhr.responseText).ok);
+ var res = JSON.parse(xhr.responseText);
+ T(res.ok);
+ var original_value = res.value
- xhr = CouchDB.request("POST", "/_config/CouchDB/ConsoleStartupMsg", {"body":"CouchDB is awesome."});
+ xhr = CouchDB.request("POST", "/_config/CouchDB/MaximumDocumentSize", {"body":"1024"});
T(xhr.status == 200);
var res = JSON.parse(xhr.responseText);
T(res.ok);
- T(res.value == "CouchDB is awesome.");
+ T(res.value == "1024");
- xhr = CouchDB.request("GET", "/_config/CouchDB/ConsoleStartupMsg");
+ xhr = CouchDB.request("GET", "/_config/MaximumDocumentSize");
T(xhr.status == 200);
var res = JSON.parse(xhr.responseText);
T(res.ok);
- T(res.value == "CouchDB is awesome.");
+ T(res.value == "1024");
- xhr = CouchDB.request("DELETE", "/_config/CouchDB/ConsoleStartupMsg");
+ xhr = CouchDB.request("DELETE", "/_config/CouchDB/MaximumDocumentSize");
T(xhr.status == 200);
var res = JSON.parse(xhr.responseText);
T(res.ok);
- T(res.old_value == "CouchDB is awesome.");
+ T(res.old_value == "1024");
- xhr = CouchDB.request("PUT", "/_config/CouchDB/ConsoleStartupMsg", {"body":"Apache CouchDB is starting."});
+ xhr = CouchDB.request("PUT", "/_config/CouchDB/MaximumDocumentSize", {"body": original_value});
T(xhr.status == 200);
var res = JSON.parse(xhr.responseText);
T(res.ok);
- T(res.value == "Apache CouchDB is starting.");
+ T(res.value == original_value);
}
};
@@ -1368,4 +1370,4 @@
do {
xhr = CouchDB.request("GET", "/");
} while(xhr.status != 200);
-}
\ No newline at end of file
+}
Modified: incubator/couchdb/branches/runtimeconfig/src/couchdb/couch_server_sup.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/runtimeconfig/src/couchdb/couch_server_sup.erl?rev=670397&r1=670396&r2=670397&view=diff
==============================================================================
--- incubator/couchdb/branches/runtimeconfig/src/couchdb/couch_server_sup.erl (original)
+++ incubator/couchdb/branches/runtimeconfig/src/couchdb/couch_server_sup.erl Sun Jun 22 11:56:39 2008
@@ -42,13 +42,10 @@
end,
% annoucne startup
- io:format("Apache CouchDB ~s (LogLevel=~s)~n", [
- couch_server:get_version(),
+ io:format("Apache CouchDB ~s (LogLevel=~s) is starting.~n", [
+ couch_server:get_version(),
couch_config:lookup({"Log", "Level"})
]),
-
- io:format("~s~n~n", [couch_config:lookup({"CouchDB", "StartupMessage"})]),
-
% read config and register for configuration changes
@@ -57,7 +54,7 @@
ConfigChangeCallbackFunction = fun() -> ?MODULE:stop() end,
UpdateNotificationProcesses = couch_config:lookup({"CouchDB", "UpdateNotificationProcesses"}, []),
FtSearchQueryServer = couch_config:lookup({"Search", "QueryServer"}, []),
-
+
couch_config:register(
{"CouchDB", "UpdateNotificationProcesses"}, ConfigChangeCallbackFunction),
couch_config:register(
@@ -136,7 +133,7 @@
case StartResult of
{ok,_} ->
% only output when startup was successful
- io:format("Apache CouchDB has started, time to relax. See http://~s:~s/_utils/index.html~n",
+ io:format("Apache CouchDB has started, see http://~s:~s/_utils/index.html~n",
[couch_config:lookup({"HTTPd", "BindAddress"}), couch_config:lookup({"HTTPd", "Port"})]);
_ ->
% Since we failed startup, unconditionally dump configuration data to console
@@ -151,4 +148,4 @@
couch_log:stop().
init(ChildProcesses) ->
- {ok, {{one_for_one, 10, 3600}, ChildProcesses}}.
\ No newline at end of file
+ {ok, {{one_for_one, 10, 3600}, ChildProcesses}}.