From: Rich Lane <rlane@club.cc.cmu.edu>
To: sup-devel@rubyforge.org
Subject: [sup-devel] [PATCH 4/4] trivial index format upgrade
Date: Sat, 16 Jan 2010 12:03:07 -0800 [thread overview]
Message-ID: <1263672187-5174-4-git-send-email-rlane@club.cc.cmu.edu> (raw)
In-Reply-To: <1263672187-5174-3-git-send-email-rlane@club.cc.cmu.edu>
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
next prev parent reply other threads:[~2010-01-16 20:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-16 20:03 [sup-devel] [PATCH 1/4] dont index redundant data Rich Lane
2010-01-16 20:03 ` [sup-devel] [PATCH 2/4] index email addresses as text Rich Lane
2010-01-16 20:03 ` [sup-devel] [PATCH 3/4] id query prefix synonym for msgid Rich Lane
2010-01-16 20:03 ` Rich Lane [this message]
2010-01-23 12:49 ` [sup-devel] [PATCH 1/4] dont index redundant data William Morgan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1263672187-5174-4-git-send-email-rlane@club.cc.cmu.edu \
--to=rlane@club.cc.cmu.edu \
--cc=sup-devel@rubyforge.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox