Thread View: news.software.nntp
4 messages
4 total messages
Started by D. Stussy
Wed, 19 Nov 2008 08:21
Documentation: actsync program.
Author: D. Stussy
Date: Wed, 19 Nov 2008 08:21
Date: Wed, 19 Nov 2008 08:21
8 lines
1668 bytes
1668 bytes
I had to look at the source code to figure out why the "-T" option wasn't working. It works by looking at the top directories in "patharticle" - i.e. the top of the spool for the TRADSPOOL storage type. As I use CNFS, I don't have any such directories - and I guess the tool hasn't been updated to account for the existence of other storage types (whereby it should scan the active file from "host1" for any other group of the same top level hierarchy; possibly building a list as the "host1" active file is read). It would have been nice if the manual page indicated that this currently works only with tradspool-stored hierarchies. Argh!
Re: Documentation: actsync program.
Author: Julien ÉLIE
Date: Wed, 19 Nov 2008 09:40
Date: Wed, 19 Nov 2008 09:40
181 lines
6736 bytes
6736 bytes
Hi D. Stussy,
The problem you are reporting was fixed by Jeff in INN 2.5.
I hope we will /soon/ manage to release INN 2.5 -- another reason to!
> I had to look at the source code to figure out why the "-T" option wasn't working.
> It works by looking at the top directories in "patharticle" - i.e. the top of
> the spool for the TRADSPOOL storage type. As I use CNFS, I don't have any such
> directories - and I guess the tool hasn't been updated to account for the existence
> of other storage types (whereby it should scan the active file from "host1" for
> any other group of the same top level hierarchy; possibly building a list
> as the "host1" active file is read).
I tried to see where the problem was but as I did not find it, I searched in
the history of actsync and saw that Jeffrey already fixed that bug:
Revision 7579 (October, 17th 2006):
Fix bug in which -T flag could not work with the storage API. Reported
by Mike Brudenell.
The previous implementation required the on-disk representation of the
spool to check for the existence of a top-level hierarchy; this was
fundamentally insufficient at best, and broke completely with the
storage API.
The new implementation uses a hash table to keep track of which
top-level hierarchies exist in the host1 active file, and thus can
detect new hierarchy creation (when -T is used).
Here is the patch (which may not work on INN 2.4):
http://inn.eyrie.org/viewcvs/trunk/backends/actsync.c?r1=6755&r2=7579&view=patch
--- trunk/backends/actsync.c 2004/05/17 03:01:26 6755
+++ trunk/backends/actsync.c 2006/10/17 00:50:43 7579
@@ -70,6 +70,7 @@
#include "inn/innconf.h"
#include "inn/messages.h"
+#include "inn/hashtab.h"
#include "inn/qio.h"
#include "libinn.h"
#include "paths.h"
@@ -322,7 +323,9 @@
char *host2);
static int exec_cmd(int mode, const char *cmd, char *grp, char *type,
const char *who);
-static int new_top_hier(char *name);
+static int new_top_hier(char *name, struct hash *existing_hier);
+static const void *string_key(const void *entry);
+static bool string_equal(const void *key, const void *entry);
int
main(int argc, char *argv[])
@@ -1803,6 +1806,8 @@
int top_ignore; /* number of groups ignored because of no top level */
int restore; /* host1 groups restored due to -o a1 */
double host1_same; /* % of host1 that is the same */
+ struct hash *existing_hier; /* hash of existing hierarchies for -T */
+ char *p, *q;
int i;
/* firewall */
@@ -1838,12 +1843,24 @@
* If -T, ignore new top level groups from host2
*/
if (no_new_hier) {
+ existing_hier = hash_create(32, hash_string, string_key,
+ string_equal, free);
+ for (i=0; i < grplen; ++i) {
+ if (grp[i].hostid == HOSTID2)
+ continue;
+ p = xstrdup(grp[i].name);
+ q = strchr(p, '.');
+ if (q != NULL)
+ *q = '\0';
+ if (!hash_insert(existing_hier, p, p))
+ free(p);
+ }
top_ignore = 0;
for (i=0; i < grplen; ++i) {
/* look at new newsgroups */
if (grp[i].hostid == HOSTID2 &&
grp[i].output != 0 &&
- new_top_hier(grp[i].name)) {
+ new_top_hier(grp[i].name, existing_hier)) {
/* no top level ignore this new group */
grp[i].ignore |= CHECK_HIER;
grp[i].output = 0;
@@ -1853,6 +1870,7 @@
++top_ignore;
}
}
+ hash_free(existing_hier);
if (D_SUMMARY)
warn("STATUS: ignored %d new newsgroups due to new hierarchy",
top_ignore);
@@ -2688,17 +2706,15 @@
*
* given:
* name name of newsgroup to check
+ * existing_hier hash table of existing hierarchies
*
* returns:
* false hierarchy already exists
* true hierarchy does not exist, name represents a new hierarchy
- *
- * NOTE: This function assumes that we are at the top of the news spool.
*/
static int
-new_top_hier(char *name)
+new_top_hier(char *name, struct hash *existing_hier)
{
- struct stat statbuf; /* stat of the hierarchy */
int result; /* return result */
char *dot;
@@ -2713,7 +2729,8 @@
/*
* determine if we can find this top level hierarchy directory
*/
- result = !(stat(name, &statbuf) >= 0 && S_ISDIR(statbuf.st_mode));
+ result = (hash_lookup(existing_hier, name) == NULL);
+
/* restore name */
if (dot != NULL) {
*dot = '.';
@@ -2724,3 +2741,43 @@
*/
return result;
}
+
+/*
+ * string_key - identity function, for use with hashtab library
+ *
+ * Returns its only argument.
+ *
+ * given:
+ * entry void* pointer representing a string
+ *
+ * returns:
+ * the same void* pointer
+ */
+static const void *
+string_key(const void *entry)
+{
+ return entry;
+}
+
+/*
+ * string_equal - string comparison function, for use with hashtab library
+ *
+ * Compares two strings.
+ *
+ * given:
+ * key void* pointer representing a hash table key
+ * entry void* pointer representing a hash table entry
+ *
+ * returns:
+ * 0 arguments are not equal
+ * 1 arguments are equal
+ */
+static bool
+string_equal(const void *key, const void *entry)
+{
+ const char *p, *q;
+
+ p = key;
+ q = entry;
+ return !strcmp(p, q);
+}
--
Julien ÉLIE
« Le sel de l'existence est essentiellement dans le poivre qu'on y met. »
Re: Documentation: actsync program.
Author: D. Stussy
Date: Thu, 20 Nov 2008 00:06
Date: Thu, 20 Nov 2008 00:06
10 lines
1495 bytes
1495 bytes
"Julien ÉLIE" <iulius@nom-de-mon-site.com.invalid> wrote in message news:gg0mv6$9th$1@news.trigofacile.com... > The problem you are reporting was fixed by Jeff in INN 2.5. > I hope we will /soon/ manage to release INN 2.5 -- another reason to! > ... > Revision 7579 (October, 17th 2006): Fixed 2 years ago but not back-ported! Ack!
Re: Documentation: actsync program.
Author: Jeffrey M. Vinocur
Date: Fri, 21 Nov 2008 02:11
Date: Fri, 21 Nov 2008 02:11
18 lines
1442 bytes
1442 bytes
In article <gg0mv6$9th$1@news.trigofacile.com>, Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> wrote: > >I tried to see where the problem was but as I did not find it, I searched in >the history of actsync and saw that Jeffrey already fixed that bug: Gosh, I did? I have no recollection of that at all! I don't even recall knowing how to use the hash table library. Crazy. -- Jeffrey M. Vinocur jeff@litech.org
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads