#include "dbwrap/dbwrap_rbt.h"
#include "lib/param/param.h"
-#ifdef CLUSTER_SUPPORT
-
/*
* It is not possible to include ctdb.h and tdb_compat.h (included via
* some other include above) without warnings. This fixes those
-#ifdef HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL
static NTSTATUS db_ctdb_send_schedule_for_deletion(struct db_record *rec)
{
NTSTATUS status;
return status;
}
-#endif
static NTSTATUS db_ctdb_delete(struct db_record *rec)
{
return status;
}
-#ifdef HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL
status = db_ctdb_send_schedule_for_deletion(rec);
-#endif
-
return status;
}
static bool db_ctdb_can_use_local_hdr(const struct ctdb_ltdb_header *hdr,
bool read_only)
{
-#ifdef HAVE_CTDB_WANT_READONLY_DECL
if (hdr->dmaster != get_my_vnn()) {
/* If we're not dmaster, it must be r/o copy. */
return read_only && (hdr->flags & CTDB_REC_RO_HAVE_READONLY);
* If we want write access, no one may have r/o copies.
*/
return read_only || !(hdr->flags & CTDB_REC_RO_HAVE_DELEGATIONS);
-#else
- return (hdr->dmaster == get_my_vnn());
-#endif
}
static bool db_ctdb_can_use_local_copy(TDB_DATA ctdb_data, bool read_only)
DEBUG(0, ("db_ctdb_fetch_locked for %s key %s, chain %d "
"needed %d attempts, %d milliseconds, "
- "chainlock: %d ms, CTDB %d ms\n",
+ "chainlock: %f ms, CTDB %f ms\n",
tdb_name(ctx->wtdb->tdb),
hex_encode_talloc(talloc_tos(),
(unsigned char *)key.dptr,
key.dsize),
chain,
migrate_attempts, duration_msecs,
- (int) chainlock_time * 1000,
- (int) ctdb_time * 1000));
+ chainlock_time * 1000.0,
+ ctdb_time * 1000.0));
}
GetTimeOfDay(&crec->lock_time);
result->lock_order = lock_order;
/* only pass through specific flags */
- tdb_flags &= TDB_SEQNUM;
+ tdb_flags &= TDB_SEQNUM|TDB_VOLATILE|
+ TDB_MUTEX_LOCKING|TDB_CLEAR_IF_FIRST;
/* honor permissions if user has specified O_CREAT */
if (open_flags & O_CREAT) {
return NULL;
}
-#ifdef HAVE_CTDB_WANT_READONLY_DECL
if (!result->persistent &&
(dbwrap_flags & DBWRAP_FLAG_OPTIMIZE_READONLY_ACCESS))
{
return NULL;
}
}
-#endif
lp_ctx = loadparm_init_s3(db_path, loadparm_s3_helpers());
- db_ctdb->wtdb = tdb_wrap_open(db_ctdb, db_path, hash_size, tdb_flags,
- O_RDWR, 0, lp_ctx);
+ if (hash_size == 0) {
+ hash_size = lpcfg_tdb_hash_size(lp_ctx, db_path);
+ }
+
+ db_ctdb->wtdb = tdb_wrap_open(db_ctdb, db_path, hash_size,
+ lpcfg_tdb_flags(lp_ctx, tdb_flags),
+ O_RDWR, 0);
talloc_unlink(db_path, lp_ctx);
if (db_ctdb->wtdb == NULL) {
DEBUG(0, ("Could not open tdb %s: %s\n", db_path, strerror(errno)));
return result;
}
-
-#else /* CLUSTER_SUPPORT */
-
-struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
- const char *name,
- int hash_size, int tdb_flags,
- int open_flags, mode_t mode,
- enum dbwrap_lock_order lock_order,
- uint64_t dbwrap_flags)
-{
- DEBUG(3, ("db_open_ctdb: no cluster support!\n"));
- errno = ENOSYS;
- return NULL;
-}
-
-#endif