]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
add more elaborate test to fetch1 test
authorRonnie sahlberg <ronniesahlberg@gmail.com>
Thu, 12 Apr 2007 23:44:56 +0000 (09:44 +1000)
committerRonnie sahlberg <ronniesahlberg@gmail.com>
Thu, 12 Apr 2007 23:44:56 +0000 (09:44 +1000)
for now:
fetch a record
store a known entry for this record
fetch the record again  (and later verify we got the same record)
store it back again

this will not work right now since we dont yet store the record inside the daemon

(This used to be ctdb commit f502094499a3c25ab58aa3d192588b5e6dd2b8e4)

ctdb/tests/ctdb_fetch1.c

index 29a4fc9a62bcbbc314c85c2b6db2b58f8fe4f9dd..4e5bf63b6050047982298263af18b480aa61674f 100644 (file)
@@ -42,7 +42,7 @@ int main(int argc, const char *argv[])
        const char *myaddress = NULL;
        int self_connect=0;
        int daemon_mode=0;
-       TDB_DATA key, *data, store_data;
+       TDB_DATA key, *data, *data2, store_data;
        struct ctdb_record_handle *rh;
 
        struct poptOption popt_options[] = {
@@ -146,6 +146,14 @@ int main(int argc, const char *argv[])
        ret = ctdb_store_unlock(rh, store_data);
        printf("ctdb_store_unlock ret:%d\n",ret);
 
+       data2     = NULL;
+       rh = ctdb_fetch_lock(ctdb_db, ctdb_db, key, data2);
+/* hopefully   data2 will now contain the record written above */
+
+       /* just write it back to unlock it */
+       ret = ctdb_store_unlock(rh, data2);
+       printf("ctdb_store_unlock ret:%d\n",ret);
+
        while (1) {
                event_loop_once(ev);
        }