unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] lib: Fix endless upgrade problem
@ 2014-09-01 22:49 Austin Clements
  2014-09-02  4:38 ` Tomi Ollila
  2014-09-02  6:15 ` David Bremner
  0 siblings, 2 replies; 4+ messages in thread
From: Austin Clements @ 2014-09-01 22:49 UTC (permalink / raw)
  To: notmuch

48db8c8 introduced a disagreement between when
notmuch_database_needs_upgrade returned TRUE and when
notmuch_database_upgrade actually performed an upgrade.  As a result,
if a database had a version less than 3, but no new features were
required, notmuch new would call notmuch_database_upgrade to perform
an upgrade, but notmuch_database_upgrade would return immediately
without updating the database version.  Hence, the next notmuch new
would do the same, and so on.

Fix this by ensuring that the upgrade-required logic is identical
between the two.
---
 lib/database.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/database.cc b/lib/database.cc
index 5116188..a3a7cd3 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -1222,7 +1222,7 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,
     target_features = notmuch->features | NOTMUCH_FEATURES_CURRENT;
     new_features = NOTMUCH_FEATURES_CURRENT & ~notmuch->features;
 
-    if (! new_features)
+    if (! notmuch_database_needs_upgrade (notmuch))
 	return NOTMUCH_STATUS_SUCCESS;
 
     if (progress_notify) {
-- 
2.0.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] lib: Fix endless upgrade problem
  2014-09-01 22:49 [PATCH] lib: Fix endless upgrade problem Austin Clements
@ 2014-09-02  4:38 ` Tomi Ollila
  2014-09-02  6:11   ` Mark Walters
  2014-09-02  6:15 ` David Bremner
  1 sibling, 1 reply; 4+ messages in thread
From: Tomi Ollila @ 2014-09-02  4:38 UTC (permalink / raw)
  To: Austin Clements, notmuch

On Tue, Sep 02 2014, Austin Clements <amdragon@mit.edu> wrote:

> 48db8c8 introduced a disagreement between when
> notmuch_database_needs_upgrade returned TRUE and when
> notmuch_database_upgrade actually performed an upgrade.  As a result,
> if a database had a version less than 3, but no new features were
> required, notmuch new would call notmuch_database_upgrade to perform
> an upgrade, but notmuch_database_upgrade would return immediately
> without updating the database version.  Hence, the next notmuch new
> would do the same, and so on.
>
> Fix this by ensuring that the upgrade-required logic is identical
> between the two.

LGTM

Tomi

> ---
>  lib/database.cc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/database.cc b/lib/database.cc
> index 5116188..a3a7cd3 100644
> --- a/lib/database.cc
> +++ b/lib/database.cc
> @@ -1222,7 +1222,7 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,
>      target_features = notmuch->features | NOTMUCH_FEATURES_CURRENT;
>      new_features = NOTMUCH_FEATURES_CURRENT & ~notmuch->features;
>  
> -    if (! new_features)
> +    if (! notmuch_database_needs_upgrade (notmuch))
>  	return NOTMUCH_STATUS_SUCCESS;
>  
>      if (progress_notify) {
> -- 
> 2.0.0
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] lib: Fix endless upgrade problem
  2014-09-02  4:38 ` Tomi Ollila
@ 2014-09-02  6:11   ` Mark Walters
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Walters @ 2014-09-02  6:11 UTC (permalink / raw)
  To: Tomi Ollila, Austin Clements, notmuch


On Tue, 02 Sep 2014, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> On Tue, Sep 02 2014, Austin Clements <amdragon@mit.edu> wrote:
>
>> 48db8c8 introduced a disagreement between when
>> notmuch_database_needs_upgrade returned TRUE and when
>> notmuch_database_upgrade actually performed an upgrade.  As a result,
>> if a database had a version less than 3, but no new features were
>> required, notmuch new would call notmuch_database_upgrade to perform
>> an upgrade, but notmuch_database_upgrade would return immediately
>> without updating the database version.  Hence, the next notmuch new
>> would do the same, and so on.
>>
>> Fix this by ensuring that the upgrade-required logic is identical
>> between the two.
>
> LGTM

and me +1

Mark


>
> Tomi
>
>> ---
>>  lib/database.cc | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/database.cc b/lib/database.cc
>> index 5116188..a3a7cd3 100644
>> --- a/lib/database.cc
>> +++ b/lib/database.cc
>> @@ -1222,7 +1222,7 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,
>>      target_features = notmuch->features | NOTMUCH_FEATURES_CURRENT;
>>      new_features = NOTMUCH_FEATURES_CURRENT & ~notmuch->features;
>>  
>> -    if (! new_features)
>> +    if (! notmuch_database_needs_upgrade (notmuch))
>>  	return NOTMUCH_STATUS_SUCCESS;
>>  
>>      if (progress_notify) {
>> -- 
>> 2.0.0
>>
>> _______________________________________________
>> notmuch mailing list
>> notmuch@notmuchmail.org
>> http://notmuchmail.org/mailman/listinfo/notmuch
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] lib: Fix endless upgrade problem
  2014-09-01 22:49 [PATCH] lib: Fix endless upgrade problem Austin Clements
  2014-09-02  4:38 ` Tomi Ollila
@ 2014-09-02  6:15 ` David Bremner
  1 sibling, 0 replies; 4+ messages in thread
From: David Bremner @ 2014-09-02  6:15 UTC (permalink / raw)
  To: Austin Clements, notmuch

Austin Clements <amdragon@mit.edu> writes:

> 48db8c8 introduced a disagreement between when
> notmuch_database_needs_upgrade returned TRUE and when
> notmuch_database_upgrade actually performed an upgrade.  As a result,
> if a database had a version less than 3, but no new features were
> required, notmuch new would call notmuch_database_upgrade to perform
> an upgrade, but notmuch_database_upgrade would return immediately
> without updating the database version.  Hence, the next notmuch new
> would do the same, and so on.
>

Thanks for the quick fix.

pushed,

d

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-02  6:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-01 22:49 [PATCH] lib: Fix endless upgrade problem Austin Clements
2014-09-02  4:38 ` Tomi Ollila
2014-09-02  6:11   ` Mark Walters
2014-09-02  6:15 ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).