fabriziofortino commented on a change in pull request #340:
URL: https://github.com/apache/jackrabbit-oak/pull/340#discussion_r691954951



##########
File path: 
oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/async/AsyncIndexerBase.java
##########
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.index.async;
+
+import com.google.common.io.Closer;
+import org.apache.jackrabbit.oak.index.IndexHelper;
+import org.apache.jackrabbit.oak.plugins.index.AsyncIndexUpdate;
+import org.apache.jackrabbit.oak.plugins.index.IndexEditorProvider;
+import org.apache.jackrabbit.oak.stats.StatisticsProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+public abstract class AsyncIndexerBase implements Closeable {
+
+    private static final Logger log = 
LoggerFactory.getLogger(AsyncIndexerBase.class);
+    private final IndexHelper indexHelper;
+    protected final Closer closer;
+    private final List<String> names;
+    private final long INIT_DELAY = 0;
+    private final long delay;
+    private ScheduledExecutorService pool;
+    private CountDownLatch latch;

Review comment:
       ```suggestion
       private final ScheduledExecutorService pool;
       private final CountDownLatch latch;
   ```

##########
File path: 
oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/IndexOptions.java
##########
@@ -88,12 +93,21 @@ public IndexOptions(OptionParser parser){
                 "only Lucene indexes are supported. Possible values 1 - Basic 
check, 2 - Full check (slower)")
                 .withOptionalArg().ofType(Integer.class).defaultsTo(1);
 
+        asyncDelay = parser.accepts("async-delay", "Delay (in seconds) betwen 
the execution of async cycles for a given lane")

Review comment:
       typo
   ```suggestion
           asyncDelay = parser.accepts("async-delay", "Delay (in seconds) 
between the execution of async cycles for a given lane")
   ```

##########
File path: 
oak-run/src/main/java/org/apache/jackrabbit/oak/index/ExtendedIndexHelper.java
##########
@@ -35,11 +35,10 @@
 import java.util.List;

Review comment:
       remove `Closer` and `Closeable` imports

##########
File path: 
oak-run/src/main/java/org/apache/jackrabbit/oak/index/IndexCommand.java
##########
@@ -39,8 +39,11 @@
 import org.apache.commons.io.FileUtils;
 import org.apache.felix.inventory.Format;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.index.async.AsyncIndexerLucene;
 import org.apache.jackrabbit.oak.index.indexer.document.DocumentStoreIndexer;
+import org.apache.jackrabbit.oak.plugins.index.AsyncIndexerService;
 import org.apache.jackrabbit.oak.plugins.index.importer.IndexDefinitionUpdater;
+import 
org.apache.jackrabbit.oak.plugins.index.lucene.property.PropertyIndexCleaner;

Review comment:
       ```suggestion
   ```

##########
File path: 
oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/async/AsyncIndexerBase.java
##########
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.index.async;
+
+import com.google.common.io.Closer;
+import org.apache.jackrabbit.oak.index.IndexHelper;
+import org.apache.jackrabbit.oak.plugins.index.AsyncIndexUpdate;
+import org.apache.jackrabbit.oak.plugins.index.IndexEditorProvider;
+import org.apache.jackrabbit.oak.stats.StatisticsProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+public abstract class AsyncIndexerBase implements Closeable {
+
+    private static final Logger log = 
LoggerFactory.getLogger(AsyncIndexerBase.class);
+    private final IndexHelper indexHelper;
+    protected final Closer closer;
+    private final List<String> names;
+    private final long INIT_DELAY = 0;

Review comment:
       static?

##########
File path: 
oak-run-elastic/src/main/java/org/apache/jackrabbit/oak/index/async/AsyncIndexerElastic.java
##########
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.index.async;
+
+import com.google.common.io.Closer;
+import org.apache.commons.io.FileUtils;
+import org.apache.jackrabbit.oak.index.ElasticIndexOptions;
+import org.apache.jackrabbit.oak.index.IndexHelper;
+import org.apache.jackrabbit.oak.plugins.index.CompositeIndexEditorProvider;

Review comment:
       ```suggestion
   ```

##########
File path: 
oak-run-elastic/src/main/java/org/apache/jackrabbit/oak/index/async/AsyncIndexerElastic.java
##########
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.index.async;
+
+import com.google.common.io.Closer;
+import org.apache.commons.io.FileUtils;
+import org.apache.jackrabbit.oak.index.ElasticIndexOptions;
+import org.apache.jackrabbit.oak.index.IndexHelper;
+import org.apache.jackrabbit.oak.plugins.index.CompositeIndexEditorProvider;
+import org.apache.jackrabbit.oak.plugins.index.IndexEditorProvider;
+import 
org.apache.jackrabbit.oak.plugins.index.counter.NodeCounterEditorProvider;
+import org.apache.jackrabbit.oak.plugins.index.elastic.ElasticConnection;
+import 
org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticIndexEditorProvider;
+import org.apache.jackrabbit.oak.plugins.index.search.ExtractedTextCache;
+import org.apache.jackrabbit.oak.run.cli.NodeStoreFixture;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class AsyncIndexerElastic extends AsyncIndexerBase {
+
+    private final ElasticIndexOptions indexOpts;
+    public AsyncIndexerElastic(IndexHelper indexHelper, Closer closer, 
List<String> names,
+                               long delay, ElasticIndexOptions indexOpts) {
+        super(indexHelper, closer, names, delay);
+        this.indexOpts = indexOpts;
+    }
+
+    @Override
+    public IndexEditorProvider getIndexEditorProvider() {
+        final ElasticConnection.Builder.BuildStep buildStep = 
ElasticConnection.newBuilder()
+                .withIndexPrefix(indexOpts.getIndexPrefix())
+                .withConnectionParameters(
+                        indexOpts.getElasticScheme(),
+                        indexOpts.getElasticHost(),
+                        indexOpts.getElasticPort()
+                );
+        final ElasticConnection coordinate;
+        if (indexOpts.getApiKeyId() != null && indexOpts.getApiKeySecret() != 
null) {
+            coordinate = buildStep.withApiKeys(indexOpts.getApiKeyId(), 
indexOpts.getApiKeySecret()).build();
+        } else {
+            coordinate = buildStep.build();
+        }
+        closer.register(coordinate);
+        ElasticIndexEditorProvider editorProvider = new 
ElasticIndexEditorProvider(coordinate,
+                new ExtractedTextCache(10 * FileUtils.ONE_MB, 100));
+        return editorProvider;

Review comment:
       redundant local variable
   ```suggestion
           return new ElasticIndexEditorProvider(coordinate,
                   new ExtractedTextCache(10 * FileUtils.ONE_MB, 100));
   ```

##########
File path: 
oak-run-elastic/src/main/java/org/apache/jackrabbit/oak/index/async/AsyncIndexerElastic.java
##########
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.index.async;
+
+import com.google.common.io.Closer;
+import org.apache.commons.io.FileUtils;
+import org.apache.jackrabbit.oak.index.ElasticIndexOptions;
+import org.apache.jackrabbit.oak.index.IndexHelper;
+import org.apache.jackrabbit.oak.plugins.index.CompositeIndexEditorProvider;
+import org.apache.jackrabbit.oak.plugins.index.IndexEditorProvider;
+import 
org.apache.jackrabbit.oak.plugins.index.counter.NodeCounterEditorProvider;

Review comment:
       ```suggestion
   ```

##########
File path: 
oak-run-elastic/src/main/java/org/apache/jackrabbit/oak/index/async/AsyncIndexerElastic.java
##########
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.index.async;
+
+import com.google.common.io.Closer;
+import org.apache.commons.io.FileUtils;
+import org.apache.jackrabbit.oak.index.ElasticIndexOptions;
+import org.apache.jackrabbit.oak.index.IndexHelper;
+import org.apache.jackrabbit.oak.plugins.index.CompositeIndexEditorProvider;
+import org.apache.jackrabbit.oak.plugins.index.IndexEditorProvider;
+import 
org.apache.jackrabbit.oak.plugins.index.counter.NodeCounterEditorProvider;
+import org.apache.jackrabbit.oak.plugins.index.elastic.ElasticConnection;
+import 
org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticIndexEditorProvider;
+import org.apache.jackrabbit.oak.plugins.index.search.ExtractedTextCache;
+import org.apache.jackrabbit.oak.run.cli.NodeStoreFixture;
+
+import java.util.Arrays;

Review comment:
       ```suggestion
   ```

##########
File path: 
oak-run/src/main/java/org/apache/jackrabbit/oak/index/IndexCommand.java
##########
@@ -39,8 +39,11 @@
 import org.apache.commons.io.FileUtils;
 import org.apache.felix.inventory.Format;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.index.async.AsyncIndexerLucene;
 import org.apache.jackrabbit.oak.index.indexer.document.DocumentStoreIndexer;
+import org.apache.jackrabbit.oak.plugins.index.AsyncIndexerService;

Review comment:
       ```suggestion
   ```

##########
File path: 
oak-run-elastic/src/main/java/org/apache/jackrabbit/oak/index/async/AsyncIndexerElastic.java
##########
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.index.async;
+
+import com.google.common.io.Closer;
+import org.apache.commons.io.FileUtils;
+import org.apache.jackrabbit.oak.index.ElasticIndexOptions;
+import org.apache.jackrabbit.oak.index.IndexHelper;
+import org.apache.jackrabbit.oak.plugins.index.CompositeIndexEditorProvider;
+import org.apache.jackrabbit.oak.plugins.index.IndexEditorProvider;
+import 
org.apache.jackrabbit.oak.plugins.index.counter.NodeCounterEditorProvider;
+import org.apache.jackrabbit.oak.plugins.index.elastic.ElasticConnection;
+import 
org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticIndexEditorProvider;
+import org.apache.jackrabbit.oak.plugins.index.search.ExtractedTextCache;
+import org.apache.jackrabbit.oak.run.cli.NodeStoreFixture;

Review comment:
       ```suggestion
   ```

##########
File path: 
oak-run/src/main/java/org/apache/jackrabbit/oak/index/async/AsyncIndexerLucene.java
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.index.async;
+
+import com.google.common.io.Closer;
+import org.apache.jackrabbit.oak.index.ExtendedIndexHelper;
+import org.apache.jackrabbit.oak.index.LuceneIndexHelper;
+import org.apache.jackrabbit.oak.plugins.index.CompositeIndexEditorProvider;
+import org.apache.jackrabbit.oak.plugins.index.IndexEditorProvider;
+import 
org.apache.jackrabbit.oak.plugins.index.counter.NodeCounterEditorProvider;
+import 
org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+
+public class AsyncIndexerLucene extends AsyncIndexerBase {
+
+    private static final Logger log = 
LoggerFactory.getLogger(AsyncIndexerLucene.class);
+    private ExtendedIndexHelper extendedIndexHelper;
+    private boolean enableCowCor;

Review comment:
       ```suggestion
       private final ExtendedIndexHelper extendedIndexHelper;
       private final boolean enableCowCor;
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to