couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r1079966 - /couchdb/trunk/src/couchdb/couch_db_updater.erl
Date Wed, 09 Mar 2011 20:01:09 GMT
Author: fdmanana
Date: Wed Mar  9 20:01:08 2011
New Revision: 1079966

URL: http://svn.apache.org/viewvc?rev=1079966&view=rev
Log:
Deal with unsupported database versions more gracefully

Instead of crashing with a function_clause error, allow the updater to throw
the error '{database_disk_version_error, "Incorrect disk header version"}'
when opening more recent, unsupported, database files.
This is part of COUCHDB-1081.


Modified:
    couchdb/trunk/src/couchdb/couch_db_updater.erl

Modified: couchdb/trunk/src/couchdb/couch_db_updater.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_db_updater.erl?rev=1079966&r1=1079965&r2=1079966&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_db_updater.erl (original)
+++ couchdb/trunk/src/couchdb/couch_db_updater.erl Wed Mar  9 20:01:08 2011
@@ -345,13 +345,13 @@ btree_by_seq_reduce(reduce, DocInfos) ->
 btree_by_seq_reduce(rereduce, Reds) ->
     lists:sum(Reds).
 
-simple_upgrade_record(Old, New) when tuple_size(Old) =:= tuple_size(New) ->
-    Old;
 simple_upgrade_record(Old, New) when tuple_size(Old) < tuple_size(New) ->
     OldSz = tuple_size(Old),
     NewValuesTail =
         lists:sublist(tuple_to_list(New), OldSz + 1, tuple_size(New) - OldSz),
-    list_to_tuple(tuple_to_list(Old) ++ NewValuesTail).
+    list_to_tuple(tuple_to_list(Old) ++ NewValuesTail);
+simple_upgrade_record(Old, _New) ->
+    Old.
 
 -define(OLD_DISK_VERSION_ERROR,
     "Database files from versions smaller than 0.10.0 are no longer supported").



Mime
View raw message