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

ASF GitHub Bot commented on RYA-266:
------------------------------------

Github user meiercaleb commented on a diff in the pull request:

    https://github.com/apache/incubator-rya/pull/149#discussion_r136104402
  
    --- Diff: 
extras/indexing/src/main/java/org/apache/rya/indexing/accumulo/temporal/AccumuloTemporalIndexer.java
 ---
    @@ -102,42 +103,50 @@
         private boolean isInit = false;
     
     
    +    /**
    +     * intilize the temporal index.
    +     * This is dependent on a few set method calls before init:
    +     * >  Connector = ConfigUtils.getConnector(conf);
    +     * >  MultiTableBatchWriter mtbw = 
connector.createMultiTableBatchWriter(new BatchWriterConfig());
    +     * >  // optional: temporal.setConnector(connector);
    +     * >  temporal.setMultiTableBatchWriter(mtbw);
    +     * >  temporal.init();
    +     */
    +    @Override
    +    public void init() {
    +        if (!isInit) {
    +            try {
    +                initInternal();
    +                isInit = true;
    +            } catch (final AccumuloException | AccumuloSecurityException | 
TableNotFoundException | TableExistsException | RyaClientException e) {
    +                logger.warn("Unable to initialize index.  Throwing Runtime 
Exception. ", e);
    +                throw new RuntimeException(e);
    +            }
    +        }
    +    }
     
         private void initInternal() throws AccumuloException, 
AccumuloSecurityException, TableNotFoundException,
    -            TableExistsException {
    +                    TableExistsException, RyaClientException {
    +        if (mtbw == null)
    +            throw new RyaClientException("Failed to initialize temporal 
index, setMultiTableBatchWriter() was not set.");
    +        if (conf == null)
    +            throw new RyaClientException("Failed to initialize temporal 
index, setConf() was not set.");
    +
             temporalIndexTableName = getTableName();
             // Create one index table on first run.
    -        ConfigUtils.createTableIfNotExists(conf, temporalIndexTableName);
    -
    -        mtbw = ConfigUtils.createMultitableBatchWriter(conf);
    -
    +        Boolean isCreated = ConfigUtils.createTableIfNotExists(conf, 
temporalIndexTableName);
    +        if (isCreated) {
    +            logger.info("First run, created temporal index table: " + 
temporalIndexTableName);
    +        }
             temporalIndexBatchWriter = 
mtbw.getBatchWriter(temporalIndexTableName);
    -
             validPredicates = ConfigUtils.getTemporalPredicates(conf);
         }
     
         //initialization occurs in setConf because index is created using 
reflection
         @Override
         public void setConf(final Configuration conf) {
             this.conf = conf;
    -        if (!isInit) {
    --- End diff --
    
    After looking at this a bit more, you are right.  I think this is the way 
to go.  I was confusing how we construct our Indexes with how we construct our 
optimizers.  I think this is fine.


> Temporal index fails to write when using non-mock accumulo
> ----------------------------------------------------------
>
>                 Key: RYA-266
>                 URL: https://issues.apache.org/jira/browse/RYA-266
>             Project: Rya
>          Issue Type: Sub-task
>          Components: dao, sail
>         Environment: indexing
>            Reporter: David W. Lotts
>            Assignee: David W. Lotts
>            Priority: Blocker
>              Labels: flush, index, temporal
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Temporal indexing writes nothing to it's table name: [prefix]temporal.
> It does seem to work for a mock instance.  It might also work for a large 
> ingest since it would force a flush.
> See the parent RYA-72 for an explanation.



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

Reply via email to