couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Couchdb Wiki] Update of "BreakingChangesUpdateTrunkTo0Dot9" by JanLehnardt
Date Sun, 15 Mar 2009 17:59:37 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The following page has been changed by JanLehnardt:
http://wiki.apache.org/couchdb/BreakingChangesUpdateTrunkTo0Dot9

The comment on the change is:
add script

------------------------------------------------------------------------------
  sudo gem install couchrest-*.gem
  }}}
  
- Now that you have the latest CouchRest, you can download the script, modify it to run in
your environment, and start it up. It does give some output every 100 docs, so you won't be
totally at a loss to what's happening.
+ Now that you have the latest CouchRest, you can download the script (see the bottom of this
page), modify it to run in your environment, and start it up. It does give some output every
100 docs, so you won't be totally at a loss to what's happening.
  
- It assumes that none of the databases on your `old_couch` exist on your `new_couch`. If
they do exist it will skip them.
+ It assumes that none of the databases on your `OLD_HOST` exist on your `NEW_HOST`. If they
do exist it will skip them.
  
  It also assumes that none of your individual attachments are larger than the memory you
can dedicate to the Ruby runtime. Coding a streaming attachment solution would be a fair amount
more work. If you need it patches are welcome but I think you might be better off with a different
approach. My script batches updates into blocks of 100 docs.
  
@@ -41, +41 @@

  
  Now, edit the trunk CouchDB's configuration so that it runs on port 5985 instead of 5984.
This you can do by changing the `etc/couchdb/local_dev.ini` file that was created by `make
dev`. Once that's done you can launch trunk CouchDB with `utils/run`
  
+ == The Script ==
+ {{{
+ require 'rubygems'
+ require 'couchrest'
+  
+ # this is the CouchDB where all the old databases are
+ OLD_HOST = "http://127.0.0.1:5984"
+  
+ # this is the CouchDB we want to copy to
+ NEW_HOST = "http://127.0.0.1:5985"
+  
+ old_couch = CouchRest.new(OLD_HOST)
+ new_couch = CouchRest.new(NEW_HOST)
+  
+ databases = old_couch.databases
+  
+ databases.each do |dbname|
+   if new_couch.databases.include?(dbname)
+     puts "the database '#{dbname}' already exists on the target"
+     puts "patches welcome for picking this process up in the middle"
+     puts "for now if it fails in the middle you could just comment out these lines"
+     puts "but you'll do double work and end up with spurious conflicts"
+     puts
+     puts
+   else
+     upgrader = CouchRest::Upgrade.new(dbname, old_couch, new_couch)
+     upgrader.clone!  
+   end
+ end
+ }}}
+ 

Mime
View raw message