[ 
https://issues.apache.org/jira/browse/OAK-2887?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vikas Saurabh updated OAK-2887:
-------------------------------
    Comment: was deleted

(was: [~chetanm] Oops!. Ok, attached another 
[patch|^ExportDetailedDoc-take2.patch] to print {{mongoexport}} command that 
would extract the documents.

BTW, the printed mongoexport didn't work out as is on my windows cmd. It worked 
fine on cygwin though. I think we'd need to document that somewhere (unless 
there's a way to fix it -- which I didn't actually find)

Ignore the following section - I had missed using '^' in regex expression (have 
updated the patch). Probably the query then took a bit longer to run and I 
_think_ mongo killed it (although, I thought that shouldn't be the case).
----
The output from {{mongoexport}}, although, isn't quite working right for me. 
Here's a command line I used to generate mongoexport command:
{noformat}
> oak.printMongoExportCommand("/etc", {db: "aem-author"})}
{noformat}
The execution of mongoexport looked like:
{noformat}
mongoexport --host 127.0.0.1 --port 27017 --db aem-author --collection nodes 
--out all-required-nodes.json --query 
'{"$or":[{"_id":{"$regex":"2:p\\/"}},{"_id":{"$regex":"3:p\\/etc\\/"}},{"_id":{"$in":["0:/","1:/etc"]}}]}'
connected to: 127.0.0.1:27017
exported 8 records
{noformat}
where all the (snipped) results were:
{noformat}
{ "_id" : "2:p/r14d6b944992-0-1/0",...}
{ "_id" : "2:p/r14d6b96491f-0-1/0",...}
{ "_id" : "2:p/r14d6b97d85d-0-1/0",...}
{ "_id" : "2:p/r14d6b98b821-0-1/0",...}
{ "_id" : "2:p/r14d6b9951ef-0-1/0",...}
{ "_id" : "2:p/r14d6b9ad5bc-0-1/0",...}
{ "_id" : "2:p/r14d6b9ce045-0-1/0",...}
{ "_id" : "2:p/r14d6b9ebc74-0-1/0",...}
{noformat}
Notice, only split docs are showing up. I, then tried modifying mongoexport 
command to not account for split docs (removed the regex ones from {{or}} list) 
and it included {{0:/}} and {{1:/etc}} correctly:
{noformat}
mongoexport --host 127.0.0.1 --port 27017 --db aem-author --collection nodes 
--out all-required-nodes.json --query 
'{"$or":[{"_id":{"$in":["0:/","1:/etc"]}}]}'                   connected to: 
127.0.0.1:27017
exported 2 records
{noformat}
I'm unable to figure out what am I missing :/. I tried {{--limit 0}} as well 
but that didn't work too.
----)

> Add support for generating mongo export command to oak-mongo
> ------------------------------------------------------------
>
>                 Key: OAK-2887
>                 URL: https://issues.apache.org/jira/browse/OAK-2887
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: run
>            Reporter: Chetan Mehrotra
>            Priority: Minor
>             Fix For: 1.3.0
>
>         Attachments: ExportDetailedDoc-take2.patch, ExportDetailedDoc.patch, 
> createExportCommand.groovy
>
>
> At time to analyse a issue with {{DocumentNodeStore}} running on Mongo we 
> need a dump of various documents so as to recreate the scenario locally. In 
> most case if issue is being observed for a specific path like /a/b then its 
> sufficient to get Mongo documents for /, /a, /a/b and all the split documents 
> for those paths.
> It would be useful to have a function in oak-mongo which generates the 
> required export command. For e.g. for path like /a/b following export command 
> would dump all required info
> {noformat}
> mongoexport -h <mongo server> --port 27017 --db <db name> --collection nodes 
> --out all-required-nodes.json --query '{$or:[{_id : /^4:p\/a\/b\//},{_id : 
> /^3:p\/a\//},{_id : /^2:p\//},{_id:{$in:["2:/a/b","1:/a","0:/"]}}]}'
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to