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

Chetan Mehrotra edited comment on OAK-6080 at 5/9/17 6:46 AM:
--------------------------------------------------------------

Attached is an [initial implementation|^OAK-6080-v1.patch] for this. Key points

The patch introduces a {{IndexInfoService}} which provide access to 
{{IndexInfo}} instance for all indexes present in the setup. In turn it makes 
use of {{IndexInfoProvider}} to get index specific details for different types 
of indexes. For now the info captured is like

{code}
public interface IndexInfo {
    /**
     * Returns paths of index definition in the repository
     */
    String getIndexPath();

    /**
     * Returns type of index definition like 'property' or 'lucene'
     */
    String getType();

    /**
     * Returns name of the async index lane to which this index is bound to
     * or null if its not an async index
     */
    @CheckForNull
    String getAsyncName();

    /**
     * Time in millis at which index was last updated
     *
     * @return time in millis or -1 if unknown
     */
    long getLastUpdatedTime();

    /**
     * Returns time in millis of the repository state upto which index is upto
     * date. This may or may not be same as {@code #getLastUpdatedTime}. For 
e.g.
     * consider an index at /oak:index/fooIndex bound to async lane "async".
     * The index might have got updated 2 cycle ago when async indexer 
traversed content
     * node which were indexed by this index and it was not updated in last 
index cycle.
     * Then {@code indexedUptoTime} would be the time of last complete cycle 
while
     * {@code lastUpdatedTime} would the time of 2nd last cycle
     *
     * @return time in millis or -1 if unknown
     */
    long getIndexedUptoTime();

    /**
     * An estimate of entry count in the index
     */
    long getEstimatedEntryCount();

    /**
     * Index data storage size

     * @return storage size or -1 if unknown
     */
    long getSizeInBytes();

    /**
     * Determines if index definition has changed but no reindexing
     * was done for that change.
     */
    boolean hasIndexDefinitionChangedWithoutReindexing();
}
{code}

In addition an {{IndexPrinter}} is implemented (see OAK-6179) which uses this 
service to render [this output|^status-oak-indexes.txt]. Going forward we can 
add following possible enhancements

# Perform index integrity check
# -Dump index definitions as json- Done with v2. With a separate printer is 
provided which also dump the index definitions as json
# Support for property index
# Support for Solr index

*Update-2* - Updated [patch|^OAK-6080-v2.patch]

[~tmueller] [~catholicon] [~teofili] [~dhasler] Please review and provide 
feedback


was (Author: chetanm):
Attached is an [initial implementation|^OAK-6080-v1.patch] for this. Key points

The patch introduces a {{IndexInfoService}} which provide access to 
{{IndexInfo}} instance for all indexes present in the setup. In turn it makes 
use of {{IndexInfoProvider}} to get index specific details for different types 
of indexes. For now the info captured is like

{code}
public interface IndexInfo {
    /**
     * Returns paths of index definition in the repository
     */
    String getIndexPath();

    /**
     * Returns type of index definition like 'property' or 'lucene'
     */
    String getType();

    /**
     * Returns name of the async index lane to which this index is bound to
     * or null if its not an async index
     */
    @CheckForNull
    String getAsyncName();

    /**
     * Time in millis at which index was last updated
     *
     * @return time in millis or -1 if unknown
     */
    long getLastUpdatedTime();

    /**
     * Returns time in millis of the repository state upto which index is upto
     * date. This may or may not be same as {@code #getLastUpdatedTime}. For 
e.g.
     * consider an index at /oak:index/fooIndex bound to async lane "async".
     * The index might have got updated 2 cycle ago when async indexer 
traversed content
     * node which were indexed by this index and it was not updated in last 
index cycle.
     * Then {@code indexedUptoTime} would be the time of last complete cycle 
while
     * {@code lastUpdatedTime} would the time of 2nd last cycle
     *
     * @return time in millis or -1 if unknown
     */
    long getIndexedUptoTime();

    /**
     * An estimate of entry count in the index
     */
    long getEstimatedEntryCount();

    /**
     * Index data storage size

     * @return storage size or -1 if unknown
     */
    long getSizeInBytes();

    /**
     * Determines if index definition has changed but no reindexing
     * was done for that change.
     */
    boolean hasIndexDefinitionChangedWithoutReindexing();
}
{code}

In addition an {{IndexPrinter}} is implemented (see OAK-6179) which uses this 
service to render [this output|^status-oak-indexes.txt]. Going forward we can 
add following possible enhancements

# Perform index integrity check
# Dump index definitions as json 

[~tmueller] [~catholicon] [~teofili] [~dhasler] Please review and provide 
feedback

> Index report service
> --------------------
>
>                 Key: OAK-6080
>                 URL: https://issues.apache.org/jira/browse/OAK-6080
>             Project: Jackrabbit Oak
>          Issue Type: New Feature
>          Components: indexing
>            Reporter: Chetan Mehrotra
>             Fix For: 1.8
>
>         Attachments: OAK-6080-v1.patch, OAK-6080-v2.patch, 
> status-oak-indexes.txt
>
>
> Currently we have various MBeans which provide insight into current indexing 
> state and index size etc. For enabling better understanding of index state on 
> a setup we should provide an explicit IndexReportService which provide 
> details about
> # Set of index present in setup and for each index
> ## Entry Count
> ## Size
> ## Health status
> ## Last indexing time
> # Current indexing status
> ## Current progress
> ## Health of indexing



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to