gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r5333 - in GNUnet: . src/applications/datastore src/applica


From: gnunet
Subject: [GNUnet-SVN] r5333 - in GNUnet: . src/applications/datastore src/applications/fs/ecrs src/applications/fs/lib src/applications/fs/module src/applications/sqstore_mysql src/include
Date: Sat, 21 Jul 2007 23:55:11 -0600 (MDT)

Author: grothoff
Date: 2007-07-21 23:55:11 -0600 (Sat, 21 Jul 2007)
New Revision: 5333

Modified:
   GNUnet/ChangeLog
   GNUnet/UPDATING
   GNUnet/src/applications/datastore/datastore.c
   GNUnet/src/applications/datastore/prefetch.c
   GNUnet/src/applications/fs/ecrs/download.c
   GNUnet/src/applications/fs/lib/fslib.c
   GNUnet/src/applications/fs/module/dht_push.c
   GNUnet/src/applications/fs/module/fs.c
   GNUnet/src/applications/fs/module/ondemand.c
   GNUnet/src/applications/sqstore_mysql/mysql.c
   GNUnet/src/include/gnunet_datastore_service.h
Log:
stuff

Modified: GNUnet/ChangeLog
===================================================================
--- GNUnet/ChangeLog    2007-07-22 05:38:55 UTC (rev 5332)
+++ GNUnet/ChangeLog    2007-07-22 05:55:11 UTC (rev 5333)
@@ -1,3 +1,7 @@
+Sat Jul 21 23:42:11 MDT 2007
+       Radical changes to MySQL implementation (trying to
+       address certain scalability issues).
+
 Sat Jul  7 00:22:47 MDT 2007
        Releasing GNUnet 0.7.2a.
 

Modified: GNUnet/UPDATING
===================================================================
--- GNUnet/UPDATING     2007-07-22 05:38:55 UTC (rev 5332)
+++ GNUnet/UPDATING     2007-07-22 05:55:11 UTC (rev 5333)
@@ -8,6 +8,13 @@
 data-preserving migration may not be possible.  For SVN versions,
 you're on your own.
 
+0.7.2a to HEAD
+==============
+
+WARNING: Migration of the content in your databases is not yet supported.
+(all of your existing content will be "lost" (for now)).
+
+
 0.7.2 to 0.7.2a
 ===============
 

Modified: GNUnet/src/applications/datastore/datastore.c
===================================================================
--- GNUnet/src/applications/datastore/datastore.c       2007-07-22 05:38:55 UTC 
(rev 5332)
+++ GNUnet/src/applications/datastore/datastore.c       2007-07-22 05:55:11 UTC 
(rev 5333)
@@ -111,6 +111,23 @@
   return ret;
 }
 
+
+static int
+deleteCB (const HashCode512 * key,
+         const Datastore_Value * value, void *closure,
+         unsigned long long uid)
+{
+  const Datastore_Value * have = closure;
+  if (have == NULL)
+    return NO;
+  if  ( (value->size == have->size) &&
+       (0 == memcmp(&have[1],
+                    &value[1],
+                    ntohl(value->size) - sizeof(Datastore_Value))))
+    return NO;
+  return OK;
+}
+
 /**
  * Explicitly remove some content from the database.
  */
@@ -130,27 +147,12 @@
               &enc, __FILE__, __LINE__);
       return 0;
     }
-  ok = sq->del (query, value);
-  if (ok >= 0)
+  ok = sq->get (query, ntohl(value->type), &deleteCB, (void*) value);
+  while (ok-- > 0)
     {
       makeUnavailable (query);  /* update filter! */
       available += ntohl (value->size);
-#if DEBUG_DATASTORE
-      IF_GELOG (coreAPI->ectx,
-                GE_DEBUG | GE_REQUEST | GE_USER, hash2enc (query, &enc));
-      GE_LOG (coreAPI->ectx,
-              GE_DEBUG | GE_REQUEST | GE_USER,
-              "Deleted `%s' from database.\n", &enc);
-#endif
     }
-  else
-    {
-      IF_GELOG (coreAPI->ectx,
-                GE_WARNING | GE_BULK | GE_USER, hash2enc (query, &enc));
-      GE_LOG (coreAPI->ectx,
-              GE_WARNING | GE_BULK | GE_USER,
-              _("Database failed to delete `%s'.\n"), &enc);
-    }
   return ok;
 }
 
@@ -243,7 +245,6 @@
 
   /* check if it already exists... */
   cls.exists = NO;
-  cls.existing = NULL;
   cls.value = value;
   sq->get (key, ntohl (value->type), &checkExists, &cls);
   if (ntohl (value->type) == D_BLOCK)
@@ -253,7 +254,7 @@
     {
       if ((ntohl (value->prio) == 0) &&
           (ntohll (value->expirationTime) <=
-           cls.expiration)))
+           cls.expiration))
         {
           return OK;
         }
@@ -293,34 +294,27 @@
  */
 static int
 freeSpaceExpired (const HashCode512 * key,
-                  const Datastore_Value * value, void *closure)
+                  const Datastore_Value * value, void *closure,
+                 unsigned long long uid)
 {
-  int *icls = closure;
-  int ret;
-
+  if ((available > 0) && (available >= MIN_FREE))
+    return SYSERR;
   if (get_time () < ntohll (value->expirationTime))
     return SYSERR;              /* not expired */
-  ret = sq->del (key, value);
-  if (ret != SYSERR)
-    available += ntohl (value->size);
-  if ((available > 0) && (available >= MIN_FREE))
-    return *icls;
-  return OK;
+  available += ntohl (value->size);
+  return NO;
 }
 
 static int
 freeSpaceLow (const HashCode512 * key,
-              const Datastore_Value * value, void *closure)
+              const Datastore_Value * value, void *closure,
+             unsigned long long uid)
 {
-  int ret;
-
-  minPriority = ntohl (value->prio);
-  ret = sq->del (key, value);
-  if (ret != SYSERR)
-    available += ntohl (value->size);
   if ((available > 0) && (available >= MIN_FREE))
     return SYSERR;
-  return OK;
+  minPriority = ntohl (value->prio);
+  available += ntohl (value->size);
+  return NO;
 }
 
 /**
@@ -332,12 +326,10 @@
 static void
 cronMaintenance (void *unused)
 {
-  int syserr = SYSERR;
-
   available = quota - sq->getSize ();
   if ((available < 0) || (available < MIN_FREE))
     {
-      sq->iterateExpirationTime (ANY_BLOCK, &freeSpaceExpired, &syserr);
+      sq->iterateExpirationTime (ANY_BLOCK, &freeSpaceExpired, NULL);
       if ((available < 0) || (available < MIN_FREE))
         {
           sq->iterateLowPriority (ANY_BLOCK, &freeSpaceLow, NULL);
@@ -466,7 +458,8 @@
  */
 static int
 filterAddAll (const HashCode512 * key,
-              const Datastore_Value * value, void *closure)
+              const Datastore_Value * value, void *closure,
+             unsigned long long uid)
 {
   makeAvailable (key);
   return OK;

Modified: GNUnet/src/applications/datastore/prefetch.c
===================================================================
--- GNUnet/src/applications/datastore/prefetch.c        2007-07-22 05:38:55 UTC 
(rev 5332)
+++ GNUnet/src/applications/datastore/prefetch.c        2007-07-22 05:55:11 UTC 
(rev 5333)
@@ -65,7 +65,8 @@
 
 static int
 acquire (const HashCode512 * key,
-         const Datastore_Value * value, void *closure)
+         const Datastore_Value * value, void *closure,
+        unsigned long long uid)
 {
   if (doneSignal)
     return SYSERR;

Modified: GNUnet/src/applications/fs/ecrs/download.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/download.c  2007-07-22 05:38:55 UTC (rev 
5332)
+++ GNUnet/src/applications/fs/ecrs/download.c  2007-07-22 05:55:11 UTC (rev 
5333)
@@ -962,7 +962,8 @@
  */
 static int
 nodeReceive (const HashCode512 * query,
-             const Datastore_Value * reply, void *cls)
+             const Datastore_Value * reply, void *cls,
+            unsigned long long uid)
 {
   NodeClosure *node = cls;
   struct GE_Context *ectx = node->ctx->rm->ectx;

Modified: GNUnet/src/applications/fs/lib/fslib.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslib.c      2007-07-22 05:38:55 UTC (rev 
5332)
+++ GNUnet/src/applications/fs/lib/fslib.c      2007-07-22 05:55:11 UTC (rev 
5333)
@@ -129,7 +129,8 @@
                                                                value,
                                                                ctx->
                                                                handles[i]->
-                                                               closure))
+                                                               closure,
+                                                              0))
                         {
                           ctx->handles[i]->callback = NULL;
                         }

Modified: GNUnet/src/applications/fs/module/dht_push.c
===================================================================
--- GNUnet/src/applications/fs/module/dht_push.c        2007-07-22 05:38:55 UTC 
(rev 5332)
+++ GNUnet/src/applications/fs/module/dht_push.c        2007-07-22 05:55:11 UTC 
(rev 5333)
@@ -75,7 +75,8 @@
 
 static int
 push_callback (const HashCode512 * key,
-               const Datastore_Value * value, void *closure)
+               const Datastore_Value * value, void *closure,
+              unsigned long long uid)
 {
   cron_t delay;
 

Modified: GNUnet/src/applications/fs/module/fs.c
===================================================================
--- GNUnet/src/applications/fs/module/fs.c      2007-07-22 05:38:55 UTC (rev 
5332)
+++ GNUnet/src/applications/fs/module/fs.c      2007-07-22 05:55:11 UTC (rev 
5333)
@@ -512,7 +512,8 @@
  */
 static int
 completeValue (const HashCode512 * key,
-               const Datastore_Value * value, void *closure)
+               const Datastore_Value * value, void *closure,
+              unsigned long long uid)
 {
   Datastore_Value *comp = closure;
 
@@ -707,7 +708,8 @@
  */
 static int
 gapGetConverter (const HashCode512 * key,
-                 const Datastore_Value * invalue, void *cls)
+                 const Datastore_Value * invalue, void *cls,
+                unsigned long long uid)
 {
   GGC *ggc = (GGC *) cls;
   GapWrapper *gw;

Modified: GNUnet/src/applications/fs/module/ondemand.c
===================================================================
--- GNUnet/src/applications/fs/module/ondemand.c        2007-07-22 05:38:55 UTC 
(rev 5332)
+++ GNUnet/src/applications/fs/module/ondemand.c        2007-07-22 05:55:11 UTC 
(rev 5333)
@@ -97,7 +97,8 @@
  */
 static int
 checkPresent (const HashCode512 * key,
-              const Datastore_Value * value, void *closure)
+              const Datastore_Value * value, void *closure,
+             unsigned long long uid)
 {
   Datastore_Value *comp = closure;
 
@@ -532,7 +533,8 @@
  */
 static int
 completeValue (const HashCode512 * key,
-               const Datastore_Value * value, void *closure)
+               const Datastore_Value * value, void *closure,
+              unsigned long long uid)
 {
   Datastore_Value *comp = closure;
 

Modified: GNUnet/src/applications/sqstore_mysql/mysql.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysql.c       2007-07-22 05:38:55 UTC 
(rev 5332)
+++ GNUnet/src/applications/sqstore_mysql/mysql.c       2007-07-22 05:55:11 UTC 
(rev 5333)
@@ -25,7 +25,13 @@
  * Database: MySQL
  *
  * NOTE: This db module does NOT work with mysql prior to 4.1 since
- * it uses prepared statements.
+ * it uses prepared statements.  MySQL 5.0.46 promises to fix a bug
+ * in MyISAM that is causing us grief.  At the time of this writing,
+ * that version is yet to be released.  In anticipation, the code
+ * will use MyISAM with 5.0.46 (and higher).  If you run such a
+ * version, please run "make check" to verify that the MySQL bug
+ * was actually fixed in your version (and if not, change the
+ * code below to use MyISAM for gn071).
  *
  * HIGHLIGHTS
  *
@@ -106,7 +112,7 @@
  *   1) by running mysqlcheck -A, or
  *   2) by executing (inside of mysql using the GNUnet database):
  *   mysql> REPAIR TABLE gn071;
- *   mysql> REPAIR TABLE gn071;
+ *   mysql> REPAIR TABLE gn072;
  *
  * PROBLEMS?
  *

Modified: GNUnet/src/include/gnunet_datastore_service.h
===================================================================
--- GNUnet/src/include/gnunet_datastore_service.h       2007-07-22 05:38:55 UTC 
(rev 5332)
+++ GNUnet/src/include/gnunet_datastore_service.h       2007-07-22 05:55:11 UTC 
(rev 5333)
@@ -88,7 +88,8 @@
  *
  * @param datum called with the next item
  * @param closure user-defined extra argument
- * @param uid unique identifier for the datum
+ * @param uid unique identifier for the datum;
+ *        maybe 0 if no unique identifier is available
  *
  * @return SYSERR to abort the iteration, OK to continue,
  *         NO to delete the item and continue (if supported)
@@ -185,6 +186,12 @@
                     HashCode512 * key,
                     Datastore_Value ** value, unsigned int type);
 
+  /**
+   * Explicitly remove some content from the database.
+   */
+  int
+  (*del)(const HashCode512 * query, const Datastore_Value * value);
+
 } Datastore_ServiceAPI;
 
 #if 0                           /* keep Emacsens' auto-indent happy */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]