CURRENT branch

Julien ÉLIE julien at trigofacile.com
Mon May 11 18:30:53 UTC 2009


Hi,

> Maybe a boolean in the group_data structure to say whether the file should
> be remapped?  (The boolean would be set during tdx_data_add().)

I believe the following patch fixes the issue.
At least, the test suite works and I do not see anything suspect
in a few overview requests.

I am going to commit it.  Feel free to complain in case you notice
something wrong with it.


Index: tdx-private.h
===================================================================
--- tdx-private.h       (révision 8451)
+++ tdx-private.h       (copie de travail)
@@ -29,6 +29,7 @@
 struct group_data {
     char *path;
     bool writable;
+    bool remapoutoforder;
     ARTNUM high;
     ARTNUM base;
     int indexfd;
Index: tdx-group.c
===================================================================
--- tdx-group.c (révision 8451)
+++ tdx-group.c (copie de travail)
@@ -838,6 +838,11 @@
         entry->low = article->number;
     if (entry->high < article->number)
         entry->high = article->number;
+    /* Used to know that we have to remap the data file owing to
+     * our OVSTATICSEARCH (an article whose number is lower than
+     * the highest has been added at the end of the file). */
+    if (data->high > article->number)
+        data->remapoutoforder = true;
     entry->count++;
     inn_msync_page(entry, sizeof(*entry), MS_ASYNC);
     index_lock_group(index->fd, offset, INN_LOCK_UNLOCK);
Index: tdx-data.c
===================================================================
--- tdx-data.c  (révision 8451)
+++ tdx-data.c  (copie de travail)
@@ -215,6 +215,7 @@
     data = xmalloc(sizeof(struct group_data));
     data->path = group_path(group);
     data->writable = writable;
+    data->remapoutoforder = false;
     data->high = 0;
     data->base = 0;
     data->indexfd = -1;
@@ -420,10 +421,12 @@
     struct index_entry *entry;
     ARTNUM offset;

-    if (article > data->high && high > data->high) {
+    if ((article > data->high && high > data->high)
+        || data->remapoutoforder){
         unmap_index(data);
         map_index(data);
         data->high = high;
+        data->remapoutoforder = false;
     } else if (innconf->nfsreader && stale_index(data))
         unmap_index(data);
     if (data->index == NULL)
@@ -458,12 +461,15 @@
     if (end < start)
         return NULL;

-    if (end > data->high && high > data->high) {
+    if ((end > data->high && high > data->high)
+        || data->remapoutoforder) {
         unmap_index(data);
         map_index(data);
+        unmap_data(data);
         data->high = high;
-       unmap_data(data);
+        data->remapoutoforder = false;
     }
+
     if (start > data->high)
         return NULL;

@@ -519,9 +525,9 @@
        be an issue in limited testing, although write caching that leads to
        on-disk IDX and DAT being out of sync could trigger a problem here. */
     if (entry->offset + entry->length > search->data->datalen) {
-        warn("Invalid or inaccessible entry for article %lu in %s.IDX: offset %lu length %lu",
+        warn("Invalid or inaccessible entry for article %lu in %s.IDX: offset %lu length %lu datalength %lu",
              search->current + search->data->base, search->data->path,
-             (unsigned long) entry->offset, (unsigned long) entry->length);
+             (unsigned long) entry->offset, (unsigned long) entry->length, (unsigned long) search->data->datalen);
         return false;
     }



-- 
Julien ÉLIE

« Utiliser vi n'est pas un péché, c'est une punition. Car souvenez-vous
  que vi-vi-vi est l'éditeur de la Bête. » (Stallman, Church of Emacs) 




More information about the inn-workers mailing list