Ignore:
Timestamp:
Nov 29, 2012, 1:59:04 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.9

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/source3/lib/dbwrap_ctdb.c

    r745 r751  
    2323#include "lib/util/tdb_wrap.h"
    2424#include "util_tdb.h"
     25
    2526#ifdef CLUSTER_SUPPORT
    2627#include "ctdb.h"
     
    12471248}
    12481249
     1250/* wrapper to use traverse_persistent_callback with dbwrap */
     1251static int traverse_persistent_callback_dbwrap(struct db_record *rec, void* data)
     1252{
     1253        return traverse_persistent_callback(NULL, rec->key, rec->value, data);
     1254}
     1255
     1256
    12491257static int db_ctdb_traverse(struct db_context *db,
    12501258                            int (*fn)(struct db_record *rec,
     
    12611269
    12621270        if (db->persistent) {
     1271                struct tdb_context *ltdb = ctx->wtdb->tdb;
     1272                int ret;
     1273
    12631274                /* for persistent databases we don't need to do a ctdb traverse,
    12641275                   we can do a faster local traverse */
    1265                 return tdb_traverse(ctx->wtdb->tdb, traverse_persistent_callback, &state);
     1276                ret = tdb_traverse(ltdb, traverse_persistent_callback, &state);
     1277                if (ret < 0) {
     1278                        return ret;
     1279                }
     1280                if (ctx->transaction && ctx->transaction->m_write) {
     1281                        /*
     1282                         * we now have to handle keys not yet
     1283                         * present at transaction start
     1284                         */
     1285                        struct db_context *newkeys = db_open_rbt(talloc_tos());
     1286                        struct ctdb_marshall_buffer *mbuf = ctx->transaction->m_write;
     1287                        struct ctdb_rec_data *rec=NULL;
     1288                        NTSTATUS status;
     1289                        int i;
     1290                        int count = 0;
     1291
     1292                        if (newkeys == NULL) {
     1293                                return -1;
     1294                        }
     1295
     1296                        for (i=0; i<mbuf->count; i++) {
     1297                                TDB_DATA key;
     1298                                rec =db_ctdb_marshall_loop_next(mbuf, rec,
     1299                                                                NULL, NULL,
     1300                                                                &key, NULL);
     1301                                SMB_ASSERT(rec != NULL);
     1302
     1303                                if (!tdb_exists(ltdb, key)) {
     1304                                        dbwrap_store(newkeys, key, tdb_null, 0);
     1305                                }
     1306                        }
     1307                        status = dbwrap_traverse(newkeys,
     1308                                                 traverse_persistent_callback_dbwrap,
     1309                                                 &state,
     1310                                                 &count);
     1311                        talloc_free(newkeys);
     1312                        if (!NT_STATUS_IS_OK(status)) {
     1313                                return -1;
     1314                        }
     1315                        ret += count;
     1316                }
     1317                return ret;
    12661318        }
    12671319
Note: See TracChangeset for help on using the changeset viewer.