From 4a1e0f2cbccd9d830331e72a0d0ef75889c470cb Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Wed, 10 Apr 2019 15:58:21 +0200 Subject: [PATCH] xmldb_get cache bug --- apps/backend/backend_commit.c | 8 +++++++- lib/src/clixon_datastore_read.c | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/backend/backend_commit.c b/apps/backend/backend_commit.c index 8602166c..22839104 100644 --- a/apps/backend/backend_commit.c +++ b/apps/backend/backend_commit.c @@ -353,6 +353,10 @@ from_validate_common(clicon_handle h, /* This is the state we are going to */ if (xmldb_get1(h, candidate, "/", &td->td_target, NULL) < 0) goto done; + + /* Clear flags xpath for get */ + xml_apply0(td->td_target, CX_ELMNT, (xml_applyfn_t*)xml_flag_reset, + (void*)(XML_FLAG_MARK|XML_FLAG_CHANGE)); /* Validate the target state. It is not completely clear this should be done * here. It is being made in generic_validate below. * But xml_diff requires some basic validation, at least check that yang-specs @@ -367,7 +371,9 @@ from_validate_common(clicon_handle h, * This is the state we are going from */ if (xmldb_get1(h, "running", "/", &td->td_src, NULL) < 0) goto done; - + /* Clear flags xpath for get */ + xml_apply0(td->td_src, CX_ELMNT, (xml_applyfn_t*)xml_flag_reset, + (void*)(XML_FLAG_MARK|XML_FLAG_CHANGE)); /* 3. Compute differences */ if (xml_diff(yspec, td->td_src, diff --git a/lib/src/clixon_datastore_read.c b/lib/src/clixon_datastore_read.c index afed91fe..80d3e3c6 100644 --- a/lib/src/clixon_datastore_read.c +++ b/lib/src/clixon_datastore_read.c @@ -708,9 +708,9 @@ xmldb_get(clicon_handle h, * @note if xvec is given, then purge tree, if not return whole tree. * @see xmldb_get This version uses direct cache access and needs to be * cleanued up after use - * @see xmldb_get1_clean Must call after use + * @see xmldb_get1_clear Must call after use * @note If !CLICON_XMLDB_CACHE you need to free xret after use - * This should probably replace xmldb_get completely + * @note If CLICON_XMLDB_CACHE mark|change flags set, need to clear after call */ int xmldb_get1(clicon_handle h,