From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.213.7.146 with SMTP id d18cs291398ebd; Sat, 16 Jan 2010 12:05:56 -0800 (PST) Received: by 10.224.113.19 with SMTP id y19mr3199438qap.323.1263672355685; Sat, 16 Jan 2010 12:05:55 -0800 (PST) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id 2si1102964qwi.57.2010.01.16.12.05.54; Sat, 16 Jan 2010 12:05:54 -0800 (PST) Received-SPF: pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) client-ip=205.234.109.19; Authentication-Results: mx.google.com; spf=pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) smtp.mail=sup-devel-bounces@rubyforge.org Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id EA7EF15B8028; Sat, 16 Jan 2010 15:05:53 -0500 (EST) Received: from magnesium.club.cc.cmu.edu (MAGNESIUM.CLUB.CC.cmu.edu [128.237.157.15]) by rubyforge.org (Postfix) with ESMTP id 52D6318582D8 for ; Sat, 16 Jan 2010 15:03:52 -0500 (EST) Received: (qmail 27829 invoked from network); 16 Jan 2010 20:03:51 -0000 Received: from pion.club.cc.cmu.edu (HELO localhost.localdomain) (128.237.157.88) by magnesium.club.cc.cmu.edu with SMTP; 16 Jan 2010 20:03:51 -0000 From: Rich Lane To: sup-devel@rubyforge.org Date: Sat, 16 Jan 2010 12:03:07 -0800 Message-Id: <1263672187-5174-4-git-send-email-rlane@club.cc.cmu.edu> X-Mailer: git-send-email 1.6.5.2 In-Reply-To: <1263672187-5174-3-git-send-email-rlane@club.cc.cmu.edu> References: <1263672187-5174-1-git-send-email-rlane@club.cc.cmu.edu> <1263672187-5174-2-git-send-email-rlane@club.cc.cmu.edu> <1263672187-5174-3-git-send-email-rlane@club.cc.cmu.edu> Subject: [sup-devel] [PATCH 4/4] trivial index format upgrade X-BeenThere: sup-devel@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: Sup developer discussion List-Id: Sup developer discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: sup-devel-bounces@rubyforge.org Errors-To: sup-devel-bounces@rubyforge.org A v2 client can read a v1 index, but a v1 client cannot read a v2 index. Once the v2 client modifies the index the v1 client will be unable to read it. So, make the version check match that. --- lib/sup/xapian_index.rb | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/sup/xapian_index.rb b/lib/sup/xapian_index.rb index eefd492..464cee1 100644 --- a/lib/sup/xapian_index.rb +++ b/lib/sup/xapian_index.rb @@ -8,7 +8,7 @@ module Redwood # for searching due to precomputing thread membership. class XapianIndex < BaseIndex STEM_LANGUAGE = "english" - INDEX_VERSION = '1' + INDEX_VERSION = '2' ## dates are converted to integers for xapian, and are used for document ids, ## so we must ensure they're reasonably valid. this typically only affect @@ -35,7 +35,10 @@ EOS @xapian = Xapian::WritableDatabase.new(path, Xapian::DB_OPEN) db_version = @xapian.get_metadata 'version' db_version = '0' if db_version.empty? - if db_version != INDEX_VERSION + if db_version == '1' + info "Upgrading index format 1 to 2" + @xapian.set_metadata 'version', INDEX_VERSION + elsif db_version != INDEX_VERSION fail "This Sup version expects a v#{INDEX_VERSION} index, but you have an existing v#{db_version} index. Please downgrade to your previous version and dump your labels before upgrading to this version (then run sup-sync --restore)." end else -- 1.6.5.2 _______________________________________________ Sup-devel mailing list Sup-devel@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-devel