couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r1171149 - in /couchdb/trunk: ./ etc/couchdb/ share/www/script/test/ src/ src/couchdb/ test/etap/
Date Thu, 15 Sep 2011 15:44:38 GMT
Author: davisp
Date: Thu Sep 15 15:44:37 2011
New Revision: 1171149

URL: http://svn.apache.org/viewvc?rev=1171149&view=rev
Log:
Create the couch_mrview application.

The couch_mrview application is the implementation of the current
couchdb map/reduce views. This implementation is 100% compatible with
trunk and serves as a reference implementation for other indexers.


Modified:
    couchdb/trunk/.gitignore
    couchdb/trunk/configure.ac
    couchdb/trunk/etc/couchdb/default.ini.tpl.in
    couchdb/trunk/license.skip
    couchdb/trunk/share/www/script/test/view_compaction.js
    couchdb/trunk/src/Makefile.am
    couchdb/trunk/src/couchdb/couch_compaction_daemon.erl
    couchdb/trunk/test/etap/072-cleanup.t
    couchdb/trunk/test/etap/080-config-get-set.t
    couchdb/trunk/test/etap/200-view-group-no-db-leaks.t

Modified: couchdb/trunk/.gitignore
URL: http://svn.apache.org/viewvc/couchdb/trunk/.gitignore?rev=1171149&r1=1171148&r2=1171149&view=diff
==============================================================================
--- couchdb/trunk/.gitignore (original)
+++ couchdb/trunk/.gitignore Thu Sep 15 15:44:37 2011
@@ -52,6 +52,7 @@ bin/couch-config_dev
 etc/couchdb/default.ini
 etc/launchd/org.apache.couchdb.plist
 etc/logrotate.d/couchdb
+src/couch_mrview/ebin/
 src/couchdb/.libs/*
 src/couchdb/couch.app
 src/couchdb/couchjs

Modified: couchdb/trunk/configure.ac
URL: http://svn.apache.org/viewvc/couchdb/trunk/configure.ac?rev=1171149&r1=1171148&r2=1171149&view=diff
==============================================================================
--- couchdb/trunk/configure.ac (original)
+++ couchdb/trunk/configure.ac Thu Sep 15 15:44:37 2011
@@ -504,6 +504,7 @@ AC_CONFIG_FILES([etc/Makefile])
 AC_CONFIG_FILES([share/Makefile])
 AC_CONFIG_FILES([src/Makefile])
 AC_CONFIG_FILES([src/couch_index/Makefile])
+AC_CONFIG_FILES([src/couch_mrview/Makefile])
 AC_CONFIG_FILES([src/couchdb/couch.app.tpl])
 AC_CONFIG_FILES([src/couchdb/Makefile])
 AC_CONFIG_FILES([src/couchdb/priv/Makefile])

Modified: couchdb/trunk/etc/couchdb/default.ini.tpl.in
URL: http://svn.apache.org/viewvc/couchdb/trunk/etc/couchdb/default.ini.tpl.in?rev=1171149&r1=1171148&r2=1171149&view=diff
==============================================================================
--- couchdb/trunk/etc/couchdb/default.ini.tpl.in (original)
+++ couchdb/trunk/etc/couchdb/default.ini.tpl.in Thu Sep 15 15:44:37 2011
@@ -4,7 +4,6 @@
 
 [couchdb]
 database_dir = %localstatelibdir%
-view_index_dir = %localstatelibdir%
 index_dir = %localstatelibdir%
 util_driver_dir = %couchprivlibdir%
 max_document_size = 4294967296 ; 4 GB
@@ -72,7 +71,6 @@ reduce_limit = true
 os_process_limit = 25
 
 [daemons]
-view_manager={couch_view, start_link, []}
 index_server={couch_index_server, start_link, []}
 external_manager={couch_external_manager, start_link, []}
 query_servers={couch_query_servers, start_link, []}
@@ -103,11 +101,12 @@ _session = {couch_httpd_auth, handle_ses
 _oauth = {couch_httpd_oauth, handle_oauth_req}
 
 [httpd_db_handlers]
-_view_cleanup = {couch_httpd_db, handle_view_cleanup_req}
+_all_docs = {couch_mrview_http, handle_all_docs_req}
+_changes = {couch_httpd_db, handle_changes_req}
 _compact = {couch_httpd_db, handle_compact_req}
 _design = {couch_httpd_db, handle_design_req}
-_temp_view = {couch_httpd_view, handle_temp_view_req}
-_changes = {couch_httpd_db, handle_changes_req}
+_temp_view = {couch_mrview_http, handle_temp_view_req}
+_view_cleanup = {couch_mrview_http, handle_cleanup_req}
 
 ; The external module takes an optional argument allowing you to narrow it to a
 ; single script. Otherwise the script name is inferred from the first path section
@@ -116,12 +115,13 @@ _changes = {couch_httpd_db, handle_chang
 ; _external = {couch_httpd_external, handle_external_req}
 
 [httpd_design_handlers]
-_view = {couch_httpd_view, handle_view_req}
-_show = {couch_httpd_show, handle_doc_show_req}
-_list = {couch_httpd_show, handle_view_list_req}
-_info = {couch_httpd_db,   handle_design_info_req}
+_compact = {couch_mrview_http, handle_compact_req}
+_info = {couch_mrview_http, handle_info_req}
+_list = {couch_mrview_show, handle_view_list_req}
 _rewrite = {couch_httpd_rewrite, handle_rewrite_req}
-_update = {couch_httpd_show, handle_doc_update_req}
+_show = {couch_mrview_show, handle_doc_show_req}
+_update = {couch_mrview_show, handle_doc_update_req}
+_view = {couch_mrview_http, handle_view_req}
 
 ; enable external as an httpd handler, then link it with commands here.
 ; note, this api is still under consideration.

Modified: couchdb/trunk/license.skip
URL: http://svn.apache.org/viewvc/couchdb/trunk/license.skip?rev=1171149&r1=1171148&r2=1171149&view=diff
==============================================================================
--- couchdb/trunk/license.skip (original)
+++ couchdb/trunk/license.skip Thu Sep 15 15:44:37 2011
@@ -73,6 +73,9 @@
 ^src/couch_index/Makefile
 ^src/couch_index/Makefile.in
 ^src/couch_index/ebin/.*beam
+^src/couch_mrview/Makefile
+^src/couch_mrview/Makefile.in
+^src/couch_mrview/ebin/.*beam
 ^src/couchdb/.*beam
 ^src/couchdb/.deps/*
 ^src/couchdb/Makefile

Modified: couchdb/trunk/share/www/script/test/view_compaction.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/view_compaction.js?rev=1171149&r1=1171148&r2=1171149&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/view_compaction.js (original)
+++ couchdb/trunk/share/www/script/test/view_compaction.js Thu Sep 15 15:44:37 2011
@@ -87,7 +87,7 @@ couchTests.view_compaction = function(de
   T(data_size_before_compact < disk_size_before_compact, "data size < file size");
 
   // compact view group
-  var xhr = CouchDB.request("POST", "/" + db.name + "/_compact" + "/foo");
+  var xhr = CouchDB.request("POST", "/" + db.name + "/_design/foo/_compact");
   T(JSON.parse(xhr.responseText).ok === true);
 
   resp = db.designInfo("_design/foo");

Modified: couchdb/trunk/src/Makefile.am
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/Makefile.am?rev=1171149&r1=1171148&r2=1171149&view=diff
==============================================================================
--- couchdb/trunk/src/Makefile.am (original)
+++ couchdb/trunk/src/Makefile.am Thu Sep 15 15:44:37 2011
@@ -12,6 +12,7 @@
 
 SUBDIRS = \
     couch_index \
+    couch_mrview \
     couchdb \
     ejson \
     erlang-oauth \

Modified: couchdb/trunk/src/couchdb/couch_compaction_daemon.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_compaction_daemon.erl?rev=1171149&r1=1171148&r2=1171149&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_compaction_daemon.erl (original)
+++ couchdb/trunk/src/couchdb/couch_compaction_daemon.erl Thu Sep 15 15:44:37 2011
@@ -228,13 +228,13 @@ maybe_compact_view(DbName, GroupId, Conf
     {ok, GroupInfo} ->
         case can_view_compact(Config, DbName, GroupId, GroupInfo) of
         true ->
-            {ok, CompactPid} = couch_view_compactor:start_compact(DbName, GroupId),
+            ok = couch_mrview:compact(DbName, DDocId),
+            {ok, MonRef} = couch_mrview:monitor_compaction(DbName, DDocId),
             TimeLeft = compact_time_left(Config),
-            MonRef = erlang:monitor(process, CompactPid),
             receive
-            {'DOWN', MonRef, process, CompactPid, normal} ->
+            {'DOWN', MonRef, process, _, normal} ->
                 ok;
-            {'DOWN', MonRef, process, CompactPid, Reason} ->
+            {'DOWN', MonRef, process, _, Reason} ->
                 ?LOG_ERROR("Compaction daemon - an error ocurred while compacting"
                     " the view group `~s` from database `~s`: ~p",
                     [GroupId, DbName, Reason]),
@@ -244,7 +244,7 @@ maybe_compact_view(DbName, GroupId, Conf
                     "view group `~s` of the database `~s` because it's exceeding"
                     " the allowed period.", [GroupId, DbName]),
                 erlang:demonitor(MonRef, [flush]),
-                ok = couch_view_compactor:cancel_compact(DbName, GroupId),
+                ok = couch_mrview:cancel_compaction(DbName, DDocId),
                 timeout
             end;
         false ->
@@ -329,7 +329,7 @@ can_view_compact(Config, DbName, GroupId
             false ->
                 false;
             true ->
-                Free = free_space(couch_config:get("couchdb", "view_index_dir")),
+                Free = free_space(couch_index_util:root_dir()),
                 case Free >= SpaceRequired of
                 true ->
                     true;

Modified: couchdb/trunk/test/etap/072-cleanup.t
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/072-cleanup.t?rev=1171149&r1=1171148&r2=1171149&view=diff
==============================================================================
--- couchdb/trunk/test/etap/072-cleanup.t (original)
+++ couchdb/trunk/test/etap/072-cleanup.t Thu Sep 15 15:44:37 2011
@@ -125,6 +125,6 @@ view_cleanup() ->
 
 count_index_files() ->
     % call server to fetch the index files
-    RootDir = couch_config:get("couchdb", "view_index_dir"),
+    RootDir = couch_config:get("couchdb", "index_dir"),
     length(filelib:wildcard(RootDir ++ "/." ++
-        binary_to_list(?TEST_DB) ++ "_design"++"/*")).
+        binary_to_list(?TEST_DB) ++ "_design"++"/mrview/*")).

Modified: couchdb/trunk/test/etap/080-config-get-set.t
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/080-config-get-set.t?rev=1171149&r1=1171148&r2=1171149&view=diff
==============================================================================
--- couchdb/trunk/test/etap/080-config-get-set.t (original)
+++ couchdb/trunk/test/etap/080-config-get-set.t Thu Sep 15 15:44:37 2011
@@ -50,7 +50,7 @@ test() ->
 
     etap:is(
         couch_config:get("httpd_design_handlers", "_view"),
-        "{couch_httpd_view, handle_view_req}",
+        "{couch_mrview_http, handle_view_req}",
         "The {httpd_design_handlers, view} is the expected default."
     ),
 

Modified: couchdb/trunk/test/etap/200-view-group-no-db-leaks.t
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/200-view-group-no-db-leaks.t?rev=1171149&r1=1171148&r2=1171149&view=diff
==============================================================================
--- couchdb/trunk/test/etap/200-view-group-no-db-leaks.t (original)
+++ couchdb/trunk/test/etap/200-view-group-no-db-leaks.t Thu Sep 15 15:44:37 2011
@@ -90,10 +90,11 @@ test() ->
     create_docs(),
     create_design_doc(),
 
-    ViewGroup = couch_view:get_group_server(
-        test_db_name(), <<"_design/", (ddoc_name())/binary>>),
-    etap:is(is_pid(ViewGroup), true, "got view group pid"),
-    etap:is(is_process_alive(ViewGroup), true, "view group pid is alive"),
+    {ok, IndexerPid} = couch_index_server:get_index(
+        couch_mrview_index, test_db_name(), <<"_design/", (ddoc_name())/binary>>
+    ),
+    etap:is(is_pid(IndexerPid), true, "got view group pid"),
+    etap:is(is_process_alive(IndexerPid), true, "view group pid is alive"),
 
     query_view(),
     check_db_ref_count(),
@@ -169,7 +170,8 @@ wait_db_compact_done(N) ->
     end.
 
 compact_view_group() ->
-    {ok, _} = couch_view_compactor:start_compact(test_db_name(), ddoc_name()),
+    DDoc = list_to_binary("_design/" ++ binary_to_list(ddoc_name())),
+    ok = couch_mrview:compact(test_db_name(), DDoc),
     wait_view_compact_done(10).
 
 wait_view_compact_done(0) ->



Mime
View raw message