jackrabbit-oak-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amit Jain (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (OAK-6586) [oak-run] Add option to datastorecheck command to report misconfigured external binary references
Date Fri, 01 Dec 2017 08:38:00 GMT

    [ https://issues.apache.org/jira/browse/OAK-6586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16274071#comment-16274071
] 

Amit Jain edited comment on OAK-6586 at 12/1/17 8:37 AM:
---------------------------------------------------------

Done with http://svn.apache.org/viewvc?rev=1816800&view=rev, http://svn.apache.org/viewvc?rev=1816808&view=rev,
http://svn.apache.org/viewvc?rev=1816810&view=rev


was (Author: amitjain):
Done with http://svn.apache.org/viewvc?rev=1816800&view=rev

> [oak-run] Add option to datastorecheck command to report misconfigured external binary
references
> -------------------------------------------------------------------------------------------------
>
>                 Key: OAK-6586
>                 URL: https://issues.apache.org/jira/browse/OAK-6586
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: run
>            Reporter: Arek Kita
>            Assignee: Amit Jain
>             Fix For: 1.8, 1.7.13
>
>
> It would be good if we could create OOTB check in oak-run that could scan Oak repositories
looking for any binaries that might be missing mostly due to 2 reasons:
> * binaries that are not inlined _when_ BlobStore/DataStore is not defined (the assumption
is we have *+only+* inlined binaries and we would like to verify such hypothesis, external
reference exists but shouldn't and no DS is known, i.e. a result of misconfiguration)
> * missing binaries in defined BlobStore/DataStore (external references exist but no binary
is present at DataStore)
> _This might also be also very helpful debugging repository in the future with CompositeBlobStore
layouts._
> I see that this is is often the case and it causes problems during migration (upgrades,
sidegrades) of stores. The knowledge which JCR paths are affected would be a great help for
Oak users.
> The following groovy script does this but I thought about something built-in.
> {code}
> // usage:
> // java -jar oak-run-1.4.6.jar console --fds-path crx-quickstart/repository/datastore
crx-quickstart/repository/segmentstore ":load find-missing-blobs.groovy"
> import org.apache.jackrabbit.oak.api.PropertyState
> import org.apache.jackrabbit.oak.api.Type
> import org.apache.jackrabbit.oak.commons.PathUtils
> import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry
> import org.apache.jackrabbit.oak.spi.state.NodeState
> org.slf4j.LoggerFactory.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME).setLevel(ch.qos.logback.classic.Level.OFF)
> class MissingBlobFinder {
>     static checkProperties(state, String path) {
>         for (PropertyState p : state.properties) {
>             try {
>                 if (p.type == Type.BINARY) {
>                     InputStream is = p.getValue(Type.BINARY).newStream
>                     is.read()
>                     is.close()
>                 } else if (p.type == Type.BINARIES && p.count() > 0) {
>                     InputStream is = p.getValue(Type.BINARIES).iterator().next().newStream
>                     is.read()
>                     is.close()
>                 }
>             } catch (Exception e) {
>                 System.out.println(PathUtils.concat(path, p.name))
>             }
>         }
>     }
>     static traverse(NodeState state, String path) {
>         checkProperties(state, path)
>         for (ChildNodeEntry c : state.childNodeEntries) {
>             traverse(c.nodeState, PathUtils.concat(path, c.name))
>         }
>     }
>     static runFixer(session) {
>         System.out.println("---")
>         System.out.println("List of missing blobs:")
>         System.out.println()
>         traverse(session.store.root, "/")
>         System.out.println("---")
>         null
>     }
> }
> MissingBlobFinder.runFixer(session)
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message