DEBUG(0,(__location__ ": Failed to find attribute in schema for attrid %u mentioned in replPropertyMetaData of %s\n",
(unsigned int)md.ctr.ctr1.array[i].attid,
ldb_dn_get_linearized(msg->dn)));
- return WERR_DS_DRA_INTERNAL_ERROR;
+ return WERR_DS_DRA_SCHEMA_MISMATCH;
}
if (sa->linkID) {
req10->uptodateness_vector,
req10->extended_op,
max_wait_reached);
+
+ /* Retry if the schema changed under our feet */
+ if (W_ERROR_EQUAL(werr, WERR_DS_DRA_SCHEMA_MISMATCH)) {
+ /* Force a reload */
+ schema->last_refresh = 0;
+ schema->metadata_usn = 0;
+ talloc_unlink(mem_ctx, schema);
+
+ schema = dsdb_get_schema(sam_ctx, mem_ctx);
+ if (!schema) {
+ DEBUG(0,("No schema in sam_ctx\n"));
+ return WERR_DS_DRA_INTERNAL_ERROR;
+ }
+ werr = get_nc_changes_build_object(obj, msg,
+ sam_ctx, getnc_state->ncRoot_dn,
+ getnc_state->is_schema_nc,
+ schema, &session_key, getnc_state->min_usn,
+ req10->replica_flags,
+ req10->partial_attribute_set,
+ req10->uptodateness_vector,
+ req10->extended_op,
+ max_wait_reached);
+ }
if (!W_ERROR_IS_OK(werr)) {
return werr;
}