diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-09-20 20:36:36 -0700 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-09-20 21:51:08 -0700 |
commit | 7ffcf90bb9b7214e30b82a0e8e371207409052eb (patch) | |
tree | ee10ed693cc34fc6df64809e65d0471057b13555 /source4/dsdb/repl/drepl_extended.c | |
parent | 6f47a24bc55be0ea907594a748774675a105b5e3 (diff) | |
download | samba-7ffcf90bb9b7214e30b82a0e8e371207409052eb.tar.gz |
s4-drepl: use the partition UDV and hwm for extended getncchanges ops
we find the NC root then load the uptodateness vector and highwater
mark, if available, from there
Diffstat (limited to 'source4/dsdb/repl/drepl_extended.c')
-rw-r--r-- | source4/dsdb/repl/drepl_extended.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/source4/dsdb/repl/drepl_extended.c b/source4/dsdb/repl/drepl_extended.c index de56cb5ac5a..2c9d1f04e66 100644 --- a/source4/dsdb/repl/drepl_extended.c +++ b/source4/dsdb/repl/drepl_extended.c @@ -48,6 +48,8 @@ static WERROR drepl_create_extended_source_dsa(struct dreplsrv_service *service, struct ldb_context *ldb = service->samdb; int ret; WERROR werr; + struct ldb_dn *nc_root; + struct dreplsrv_partition *p; sdsa = talloc_zero(service, struct dreplsrv_partition_source_dsa); W_ERROR_HAVE_NO_MEMORY(sdsa); @@ -100,7 +102,9 @@ static WERROR drepl_create_extended_source_dsa(struct dreplsrv_service *service, return WERR_NOMEM; } - sdsa->repsFrom1->highwatermark.highest_usn = min_usn; + if (!service->am_rodc) { + sdsa->repsFrom1->replica_flags = DRSUAPI_DRS_WRIT_REP; + } werr = dreplsrv_out_connection_attach(service, sdsa->repsFrom1, &sdsa->conn); if (!W_ERROR_IS_OK(werr)) { @@ -110,6 +114,39 @@ static WERROR drepl_create_extended_source_dsa(struct dreplsrv_service *service, return werr; } + ret = dsdb_find_nc_root(service->samdb, sdsa, nc_dn, &nc_root); + if (ret != LDB_SUCCESS) { + DEBUG(0,(__location__ ": Failed to find nc_root for %s\n", + ldb_dn_get_linearized(nc_dn))); + talloc_free(sdsa); + return WERR_DS_DRA_INTERNAL_ERROR; + } + + /* use the partition uptodateness vector */ + ret = dsdb_load_udv_v2(service->samdb, nc_root, sdsa->partition, + &sdsa->partition->uptodatevector.cursors, + &sdsa->partition->uptodatevector.count); + if (ret != LDB_SUCCESS) { + DEBUG(0,(__location__ ": Failed to load UDV for %s\n", + ldb_dn_get_linearized(nc_root))); + talloc_free(sdsa); + return WERR_DS_DRA_INTERNAL_ERROR; + } + + /* find the highwatermark from the partitions list */ + for (p=service->partitions; p; p=p->next) { + if (ldb_dn_compare(p->dn, nc_root) == 0) { + struct dreplsrv_partition_source_dsa *s; + for (s=p->sources; s; s=s->next) { + if (GUID_equal(&s->repsFrom1->source_dsa_obj_guid, + &sdsa->repsFrom1->source_dsa_obj_guid)) { + sdsa->repsFrom1->highwatermark = s->repsFrom1->highwatermark; + } + } + } + } + + *_sdsa = sdsa; return WERR_OK; } |