From: Kuukka-Härmä R. <Rii...@fi...> - 2021-02-16 10:34:17
|
Hello, Any ideas that what could be gone wrong are welcomed. We have an issue in eXist 4.7.1 db-installation . Backup is failing for some files, and after investigating, we found that there is Document ID that is pointing two different files in separate collections. Failed to access document data Document ID: 11240 Investigating which file this is with query: xquery version "3.1"; declare function local:find($path, $document-id as xs:integer) as xs:string* { local:find-in-collection($path, (), $document-id) }; declare function local:resource ($collection as xs:string, $resource as xs:string, $document-id as xs:integer) as xs:string? { let $path := $collection || '/' || $resource let $id := util:document-id($path) return if ($id eq $document-id) then ($path) else () }; declare function local:find-in-collection ($collection as xs:string, $sub-collection as xs:string?, $document-id as xs:integer) as xs:string* { let $path := string-join(($collection, $sub-collection), '/') return if (xmldb:collection-available($path)) then ( for-each( xmldb:get-child-collections($path), local:find-in-collection($path, ?, $document-id) ), for-each( xmldb:get-child-resources($path), local:resource($path, ?, $document-id) ) ) else ($path || " not found or insufficient permissions to read") }; let $id := '11240' return local:find('/db/APP', $id) This returns two files: "/db/APP/ORGANIZATION.A/CODE/INTERNAL/PUBLISHED/1603458557855/TOSELEMENTS/customFields.xml" "/db/APP/ORGANIZATION.B/CODE/INTERNAL/PUBLISHED/1611822097512/TOSELEMENTS/strongEsignatureText.xml" Howcome there can be returned two files with same id? How this can be fixed, is there any options than reinstall the database and return the content from backup? Should that fix the fileId:s eventually? What I know, for some problematic files there is used eXist dashboard copy/paste functionality - but not all copy pasted files are having this issue. Best Regards, Riina Kuukka-Härmä |