summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_view_group.erl
AgeCommit message (Collapse)Author
2011-06-23Merged revision 1138796 from trunkFilipe David Borba Manana
Simpler and safer db open/closing in view group servers This makes the opening and closing of databases in the view group server to be more friendly with the db reference counting system, avoiding more potential db file leaking after compaction, as we currently open a database in one process and use it on another process (view compactor, view updater). This significantly reduces the chances of failure when compacting very large views as discussed in COUCHDB-994. This relates to COUCHDB-926 and COUCHDB-994. git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1138798 13f79535-47bb-0310-9956-ffa450edef68
2011-05-13Merged revision 1102137 from trunkFilipe David Borba Manana
Make sure view group shutdowns when database is deleted or dies Added more assertions to test 200-view-group-no-db-leaks.t to ensure this doesn't happen anymore. git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1102678 13f79535-47bb-0310-9956-ffa450edef68
2011-04-23Merged revision 1096252 from trunkFilipe David Borba Manana
View groups: only open the databases when needed View groups keep the databases open all the time. This is a problem once the server reaches max_dbs_open open databases, as it prevents the server from closing inactive databases via the LRU system. Closes COUCHDB-1138. git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1096253 13f79535-47bb-0310-9956-ffa450edef68
2010-11-18Make sure that after a database compaction the old database reference ↵Filipe David Borba Manana
counters don't get unreleased forever. Closes COUCHDB-926. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1036294 13f79535-47bb-0310-9956-ffa450edef68
2010-11-08shut down couch_view_group cleanly if no_db_fileAdam Kocoloski
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1032764 13f79535-47bb-0310-9956-ffa450edef68
2010-10-25GET /db/_design/doc/_info should not trigger an update.Filipe David Borba Manana
Closes COUCHDB-858. Patch by Klaus Trainer. Thanks Klaus. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1027215 13f79535-47bb-0310-9956-ffa450edef68
2010-10-10Avoid view regeneration for new ETags support.Paul Joseph Davis
This reverts the group signature calculation to use a tuple that would've been generated before changing the view record definition. New ETag's will automatically be supported when people run their next index update. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1006345 13f79535-47bb-0310-9956-ffa450edef68
2010-10-10Fixes COUCHDB-799 - More granular ETags for views.Paul Joseph Davis
ETags for views now only change when their underlying view index changes due to indexing or purges. ETags are also specific to each view. Thanks to Klaus Trainer for the patch. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1006339 13f79535-47bb-0310-9956-ffa450edef68
2010-10-09Bug fix: when receiving the compact_done message, make sure the gen_server ↵Filipe David Borba Manana
unlinks itself from the compactor process and purges the compactor's exit message from its mailbox. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1006181 13f79535-47bb-0310-9956-ffa450edef68
2010-10-01remove vestigal db handle that will just be replaced by couch_view_updater ↵John Christopher Anderson
anyway git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1003706 13f79535-47bb-0310-9956-ffa450edef68
2010-10-01close db handles after using them to get view groupsJohn Christopher Anderson
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1003701 13f79535-47bb-0310-9956-ffa450edef68
2010-09-30Removing ?getv macros.Filipe David Borba Manana
With OTP releases up to R13B03 it's not possible to define a 2 macro functions with the same name and different arities. (Only allowed in R13B04 and R14). git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1003025 13f79535-47bb-0310-9956-ffa450edef68
2010-09-27CommonJS support in map functionsJohn Christopher Anderson
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1001895 13f79535-47bb-0310-9956-ffa450edef68
2010-09-27Replacing calls to couch_util:get_value with ?getvFilipe David Borba Manana
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1001879 13f79535-47bb-0310-9956-ffa450edef68
2010-07-08Fix deletion of view files after compaction.Filipe David Borba Manana
Also added test for view compaction. Thanks Adam for reporting the issue. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@961893 13f79535-47bb-0310-9956-ffa450edef68
2010-06-23Make file deletions async to avoid pauses during compaction and db deletion. ↵Damien F. Katz
Fixes COUCHDB-780. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@957303 13f79535-47bb-0310-9956-ffa450edef68
2010-06-02trailing whitespace pedantryJan Lehnardt
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@950545 13f79535-47bb-0310-9956-ffa450edef68
2010-05-04use crypto:md5 when available. thx fdmanana. Closes COUCHDB-757Adam Kocoloski
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@941033 13f79535-47bb-0310-9956-ffa450edef68
2010-05-04use keysearch BIF to search ejson props. Closes COUCHDB-747Adam Kocoloski
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@940708 13f79535-47bb-0310-9956-ffa450edef68
2010-04-02Deterministic/synchronous shutdown code.Damien F. Katz
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@930363 13f79535-47bb-0310-9956-ffa450edef68
2010-03-04reverting damien's latest commit until we can figure out why it's causing ↵John Christopher Anderson
failures git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@918834 13f79535-47bb-0310-9956-ffa450edef68
2010-03-04Changed process tree shutdown to be synchronous, to eliminate spurious test ↵Damien F. Katz
failures caused by processes not shutdown fast enough or at the wrong time. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@918805 13f79535-47bb-0310-9956-ffa450edef68
2010-02-24replicator and view generator can skip check_is_reader when opening database ↵John Christopher Anderson
files git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@915827 13f79535-47bb-0310-9956-ffa450edef68
2010-02-18Fixes COUCHDB-640 - Reset views with invalid update seqs.Paul Joseph Davis
If a database is restored to a previous version, and the view files are not updated appropriately they will contain data from the database after the reverted-to-update_seq. This patch checks that the update sequence recorded in a view is less than or equal to the update sequence of the database. Patch is by Filipe Manana. Execellent work once again. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@911544 13f79535-47bb-0310-9956-ffa450edef68
2009-10-13Add more information to the view info objects.Paul Joseph Davis
View info is available at the URL: http://127.0.0.1:5984/db_name/_design/ddocid/_info New fields include: updater_running [true|false] : Whether the view is being built waiting_commit [true|false] : Whether this view is a head of db commits waiting_clients [integer] : How many clients are waiting on this view update_seq [integer] : The update sequence that has been indexed purge_seq [integer] : The purge sequence that has been processed Other fields for reference: signature [string] : The md5 signature of the design document's functions language [string] : The language of the design document disk_size [integer] : Number of bytes the view file occupies on disk compact_running [boolean] : Whether the view is currently being compacted git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@824970 13f79535-47bb-0310-9956-ffa450edef68
2009-09-14View refactoring and addition of raw collationoption. Significant ↵Damien F. Katz
performance improvements in view indexer. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@814893 13f79535-47bb-0310-9956-ffa450edef68
2009-08-10fix speling, thanks JasonJan Lehnardt
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@802680 13f79535-47bb-0310-9956-ffa450edef68
2009-07-22various bugfixes and improvements for view compactionAdam Kocoloski
View compaction was broken after the switch to signature-based index files, but we don't have tests for it yet so we didn't notice. I also committed a few changes that should make compaction faster and more robust: * commit the header immediately after compaction finishes. We used to wait 1 seconds, but if the server restarted in that second the index would be reset. * unlink from old index file at the end. Prevents process crashes that could couch_view (and with the delayed commit would sometimes cause index resets). * don't wait for running view updates to finish before replacing old view index file. If an update is running, restart it and point it to the new view group. This alleviates the situation where the view compaction goes into a busy wait, printing "still behind main file" 1000s of times to the log, and generally makes compaction finish more quickly. * better logging git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@796805 13f79535-47bb-0310-9956-ffa450edef68
2009-07-17Deterministic revids, MD5 checking of documents, added tracking of rev when ↵Damien F. Katz
an attachment is edited to allow attachment level replication. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@795232 13f79535-47bb-0310-9956-ffa450edef68
2009-07-16checkpoint long-running view updatesAdam Kocoloski
Improves stale=ok view queries, which will now see gradually updating indexes. Also reduces the consequences of an updater crash because we can restart from the latest checkpoint. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@794843 13f79535-47bb-0310-9956-ffa450edef68
2009-07-14wheeeeeeeeNoah Slater
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@794057 13f79535-47bb-0310-9956-ffa450edef68
2009-07-06trimmed trailing whitespaceNoah Slater
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@791350 13f79535-47bb-0310-9956-ffa450edef68
2009-07-04Name view index files by their function hashes for no downtime deploys. ↵John Christopher Anderson
Closes COUCHDB-218 Adds ability to switch view indexes on the fly by building the index from a "staging" design doc, and then COPYing the staging doc to the production doc's id. Since indexes are referenced by view definition, the new version of the production design doc will point immediately to the index files already built in staging. Please use and give feedback. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@791140 13f79535-47bb-0310-9956-ffa450edef68
2009-05-30Test and fix for infinite loops in view_servers, fix for crashed OS ↵Damien F. Katz
processes causing leaked erlang processes and fix for view server crashing when view group process terminates. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@780165 13f79535-47bb-0310-9956-ffa450edef68
2009-05-25Merging new tail append storage into trunk. Upgrades are automatic, once ↵Damien F. Katz
opened by this version old versions of CouchDB will not be able to open the files. As a precaution, you should back-up your production databases before upgrading. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@778485 13f79535-47bb-0310-9956-ffa450edef68
2009-05-04reduce_limit error is thrown when the reduce function output is not small ↵John Christopher Anderson
enough compared to the input. Errors can be switched off using the config API. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@771466 13f79535-47bb-0310-9956-ffa450edef68
2009-04-10Fixes for leaked file handles, with test.Damien F. Katz
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@763858 13f79535-47bb-0310-9956-ffa450edef68
2009-04-05added compaction for view indexes. See COUCHDB-92Adam Kocoloski
No tests or Futon interface for this feature yet. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@762153 13f79535-47bb-0310-9956-ffa450edef68
2009-02-01Added options member to design docs. Currently the only option is ↵John Christopher Anderson
include_designs (views can now run over design docs as well if they need to), the default is false, which is the current behavior. Thanks davisp for the original patch. Closes COUCHDB-156 git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@739866 13f79535-47bb-0310-9956-ffa450edef68
2009-01-23Added task status checking, to help debug the progress of long running ↵Damien F. Katz
tasks, like view indexing and compaction. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@736906 13f79535-47bb-0310-9956-ffa450edef68
2009-01-09Added support so clients can detect if a server has potentially lost commits ↵Damien F. Katz
after multiple updates, like during bulk imports and so the replicator can detect lost commits on remote replications. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@733174 13f79535-47bb-0310-9956-ffa450edef68
2009-01-05Fixed views to not commit index headers if they are ahead of what has been ↵Damien F. Katz
fully committed to the database. Also, the index headers are now committed async, improving response times updating views. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@731618 13f79535-47bb-0310-9956-ffa450edef68
2009-01-04Rename _temp_views to _slow_views. Any clients who were using temp views are ↵John Christopher Anderson
encouraged not to use slow views, and instead transition to design documents (or running the views on the client). git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@731144 13f79535-47bb-0310-9956-ffa450edef68
2008-12-18fix for crash of couch_server when database non-existantDamien F. Katz
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@727832 13f79535-47bb-0310-9956-ffa450edef68
2008-12-12modifications to view server to keep the file descriptor open for the life ↵Damien F. Katz
of the view group. git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@725909 13f79535-47bb-0310-9956-ffa450edef68
2008-12-10view group state gen_server. thanks damien and davisp.John Christopher Anderson
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@724946 13f79535-47bb-0310-9956-ffa450edef68