INN commit: trunk/storage/tradindexed (3 files)

INN Commit Russ_Allbery at isc.org
Tue May 12 06:12:42 UTC 2009


    Date: Monday, May 11, 2009 @ 23:12:42
  Author: iulius
Revision: 8458

Add a proper remap of overview data files when new articles
are appended out-of-order to these files.  Static searches
otherwise would fail.

See also commit 8451.

Modified:
  trunk/storage/tradindexed/tdx-data.c
  trunk/storage/tradindexed/tdx-group.c
  trunk/storage/tradindexed/tdx-private.h

---------------+
 tdx-data.c    |   17 ++++++++++++-----
 tdx-group.c   |    5 +++++
 tdx-private.h |    1 +
 3 files changed, 18 insertions(+), 5 deletions(-)

Modified: tdx-data.c
===================================================================
--- tdx-data.c	2009-05-09 17:57:19 UTC (rev 8457)
+++ tdx-data.c	2009-05-12 06:12:42 UTC (rev 8458)
@@ -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,10 @@
        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;
     }
 

Modified: tdx-group.c
===================================================================
--- tdx-group.c	2009-05-09 17:57:19 UTC (rev 8457)
+++ tdx-group.c	2009-05-12 06:12:42 UTC (rev 8458)
@@ -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);

Modified: tdx-private.h
===================================================================
--- tdx-private.h	2009-05-09 17:57:19 UTC (rev 8457)
+++ tdx-private.h	2009-05-12 06:12:42 UTC (rev 8458)
@@ -29,6 +29,7 @@
 struct group_data {
     char *path;
     bool writable;
+    bool remapoutoforder;
     ARTNUM high;
     ARTNUM base;
     int indexfd;




More information about the inn-committers mailing list