marklogic-contentpump icon indicating copy to clipboard operation
marklogic-contentpump copied to clipboard

"Is a directory" error

Open brunovianarezende opened this issue 7 years ago • 17 comments

I'm trying to use mlcp to export the contents from my database and I get lot of errors like:

18/05/03 16:54:13 ERROR contentpump.SingleDocumentWriter: Error saving: data://.../340c82e5-4848-76a1-0000-00001dcf41b5.json java.io.FileNotFoundException: /var/opt/MarkLogic/.../340c82e5-4848-76a1-0000-00001dcf41b5.json (Is a directory)

if I try to import the exported content, I'll see errors like

ERROR mapreduce.ContentWriter: XDMP-MUSTHAVEUPDATE: Document must have at least one update permission.

and if I inspect some of the exported files, I see that info from the exported objects is missing.

The command I use is:

mlcp.sh export -host localhost -port 8000 -username user -password password -output_file_path /var/opt/MarkLogic/out

does mlcp supports exporting complex objects? where the metadata, like collections, are saved?

brunovianarezende avatar May 03 '18 17:05 brunovianarezende

If you want mlcp to export the associated attributes of a document, you want to use "-output_type archive".

jxchen-us avatar May 03 '18 17:05 jxchen-us

ok. Let me try it and see if if works.

brunovianarezende avatar May 03 '18 17:05 brunovianarezende

Based on the conversation I'm going to close this. Feel free to reply if you have other questions.

mattsunsjf avatar May 03 '18 17:05 mattsunsjf

I tried and got no ERROR when exporting, but when I try to import, I get this:

18/05/03 17:34:25 ERROR contentpump.DatabaseContentWriter: Error setting document properties for data://.../c6a13df8-6f85-e06c-0000-5ae9faffcbb0.json: No namespace binding for prefix

and then the final stats are:

18/05/03 17:34:25 INFO contentpump.LocalJobRunner: INPUT_RECORDS: 12328 18/05/03 17:34:25 INFO contentpump.LocalJobRunner: OUTPUT_RECORDS: 12328 18/05/03 17:34:25 INFO contentpump.LocalJobRunner: OUTPUT_RECORDS_COMMITTED: 12328 18/05/03 17:34:25 INFO contentpump.LocalJobRunner: OUTPUT_RECORDS_FAILED: 11801 18/05/03 17:34:25 INFO contentpump.LocalJobRunner: Total execution time: 23 sec

The command I execute to import is:

mlcp.sh export -host localhost -port 8000 -username user -password password -output_file_path /var/opt/MarkLogic/path -output_type archive

and to import:

mlcp.sh import -host localhost -port 8000 -username user -password password -input_file_path /var/opt/MarkLogic/path/20180503172935+0000-000000-JSON.zip -input_file_type archive -input_compressed true

am I doing anything obviously wrong?

brunovianarezende avatar May 03 '18 17:05 brunovianarezende

In your import command, try to set your input_file_path to: /var/opt/MarkLogic/path/

jxchen-us avatar May 03 '18 17:05 jxchen-us

I get exactly the same errors and final stats.

brunovianarezende avatar May 03 '18 17:05 brunovianarezende

the only place in code where I found 'No namespace binding for prefix' string is at

https://github.com/marklogic/java-client-api/blob/7ea967dc9ec08171b802dd3f17087baad7112389/marklogic-client-api/src/main/java/com/marklogic/client/impl/DocumentMetadataPatchBuilderImpl.java#L1279

it should have a prefix in the error message, but I can't see any prefix in my errors.

brunovianarezende avatar May 03 '18 18:05 brunovianarezende

Do you need to import document properties? If not, set -copy_properties false

jxchen-us avatar May 03 '18 18:05 jxchen-us

if I don't import document properties, the errors are gone, indeed. But then, the app doesn't work as expected. It might be caused by the lack of properties or not, I'm not sure yet. Anyway, is there any bug related with properties importing?

brunovianarezende avatar May 03 '18 18:05 brunovianarezende

Which version of mlcp and which version of MarkLogic server are you using?

jxchen-us avatar May 03 '18 19:05 jxchen-us

Marklogic 9.0.4 mlcp 9.0.4

brunovianarezende avatar May 03 '18 19:05 brunovianarezende

this is an example of properties in a document that caused errors (slightly modified):

<prop:properties xmlns:prop="http://marklogic.com/xdmp/property">
  <schemaVersion xsi:type="xs:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">1.0</schemaVersion>
  <documentDeleted xsi:type="xs:boolean" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">false</documentDeleted>
  <tenantId xsi:type="xs:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">development-tenant</tenantId>
  <active xsi:type="xs:boolean" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">true</active>
  <className xsi:type="xs:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">com.the.Class</className>
  <documentVersion xsi:type="xs:unsignedInt" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">0</documentVersion>
</prop:properties>

I retrieved it by using xdmp:document-properties

brunovianarezende avatar May 03 '18 19:05 brunovianarezende

In your property, you missed namespace declaration for xs.

jxchen-us avatar May 03 '18 20:05 jxchen-us

ok. Thanks for pointing that. This XML was returned by a query done through query console. Is the name space of a property stored together with the property?

brunovianarezende avatar May 03 '18 20:05 brunovianarezende

I'll close the ticket because it seems this is not a bug in mlcp.

brunovianarezende avatar May 04 '18 11:05 brunovianarezende

a question: isn't xs namespace implicitly defined everywhere? or am I misunderstanding https://docs.marklogic.com/guide/xquery/namespaces#id_21104 ?

brunovianarezende avatar May 08 '18 18:05 brunovianarezende

isn't xs namespace implicitly defined everywhere?

Sort of. It’s pre-defined in XQuery. Where you’re running into the problem is in the XML parser, which exists at a lower level and doesn’t spin up a full XQuery environment. It seems to me to be a bug that our parser can’t parse something that our XQuery engine can build and our persistence APIs can store. I’m following up on that with Engineering. Unfortunately I don’t have an ETA right now, though.

jmakeig avatar May 10 '18 22:05 jmakeig