From 6b86c11c9117dd5ded26cd4582f34281304eaa91 Mon Sep 17 00:00:00 2001 From: Sean Kao Date: Thu, 13 Jun 2024 10:11:17 -0700 Subject: [PATCH] descriptive parameter name and update comment Signed-off-by: Sean Kao --- .../main/scala/org/opensearch/flint/core/FlintClient.java | 4 ++-- .../flint/core/metadata/log/FlintMetadataLogService.java | 8 ++++---- .../flint/core/storage/FlintOpenSearchClient.java | 4 ++-- .../core/storage/FlintOpenSearchMetadataLogService.java | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/flint-core/src/main/scala/org/opensearch/flint/core/FlintClient.java b/flint-core/src/main/scala/org/opensearch/flint/core/FlintClient.java index ce4ecb6ed..5cfc5de26 100644 --- a/flint-core/src/main/scala/org/opensearch/flint/core/FlintClient.java +++ b/flint-core/src/main/scala/org/opensearch/flint/core/FlintClient.java @@ -31,10 +31,10 @@ public interface FlintClient { * Start a new optimistic transaction. * * @param indexName index name - * @param initIfNotExist initIfNotExist create empty translog if not exist. + * @param forceInit force init transaction and create empty translog if not exist * @return transaction handle */ - OptimisticTransaction startTransaction(String indexName, boolean initIfNotExist); + OptimisticTransaction startTransaction(String indexName, boolean forceInit); /** * Create a Flint index with the metadata given. diff --git a/flint-core/src/main/scala/org/opensearch/flint/core/metadata/log/FlintMetadataLogService.java b/flint-core/src/main/scala/org/opensearch/flint/core/metadata/log/FlintMetadataLogService.java index 658d741e7..836805b7a 100644 --- a/flint-core/src/main/scala/org/opensearch/flint/core/metadata/log/FlintMetadataLogService.java +++ b/flint-core/src/main/scala/org/opensearch/flint/core/metadata/log/FlintMetadataLogService.java @@ -17,10 +17,10 @@ public interface FlintMetadataLogService { * Start a new optimistic transaction. * * @param indexName index name - * @param initIfNotExist initIfNotExist create empty metadata log if not exist. + * @param forceInit force init transaction and create empty metadata log if not exist * @return transaction handle */ - OptimisticTransaction startTransaction(String indexName, boolean initIfNotExist); + OptimisticTransaction startTransaction(String indexName, boolean forceInit); /** * Start a new optimistic transaction. @@ -36,10 +36,10 @@ default OptimisticTransaction startTransaction(String indexName) { * Get metadata log for index. * * @param indexName index name - * @param forceInit forceInit create empty metadata log if not exist + * @param initIfNotExist create empty metadata log if not exist * @return optional metadata log */ - Optional> getIndexMetadataLog(String indexName, boolean forceInit); + Optional> getIndexMetadataLog(String indexName, boolean initIfNotExist); /** * Get metadata log for index. diff --git a/flint-core/src/main/scala/org/opensearch/flint/core/storage/FlintOpenSearchClient.java b/flint-core/src/main/scala/org/opensearch/flint/core/storage/FlintOpenSearchClient.java index 311e22731..a1e2ee515 100644 --- a/flint-core/src/main/scala/org/opensearch/flint/core/storage/FlintOpenSearchClient.java +++ b/flint-core/src/main/scala/org/opensearch/flint/core/storage/FlintOpenSearchClient.java @@ -80,8 +80,8 @@ public FlintOpenSearchClient(FlintOptions options) { } @Override - public OptimisticTransaction startTransaction(String indexName, boolean initIfNotExist) { - return metadataLogService.startTransaction(indexName, initIfNotExist); + public OptimisticTransaction startTransaction(String indexName, boolean forceInit) { + return metadataLogService.startTransaction(indexName, forceInit); } @Override diff --git a/flint-core/src/main/scala/org/opensearch/flint/core/storage/FlintOpenSearchMetadataLogService.java b/flint-core/src/main/scala/org/opensearch/flint/core/storage/FlintOpenSearchMetadataLogService.java index 925609e0c..12d12f345 100644 --- a/flint-core/src/main/scala/org/opensearch/flint/core/storage/FlintOpenSearchMetadataLogService.java +++ b/flint-core/src/main/scala/org/opensearch/flint/core/storage/FlintOpenSearchMetadataLogService.java @@ -51,13 +51,13 @@ public OptimisticTransaction startTransaction(String indexName, boolean f } @Override - public Optional> getIndexMetadataLog(String indexName, boolean forceInit) { + public Optional> getIndexMetadataLog(String indexName, boolean initIfNotExist) { LOG.info("Getting metadata log for index " + indexName + " and data source " + dataSourceName); try (IRestHighLevelClient client = createOpenSearchClient()) { if (client.doesIndexExist(new GetIndexRequest(metaLogIndexName), RequestOptions.DEFAULT)) { LOG.info("Found metadata log index " + metaLogIndexName); } else { - if (forceInit) { + if (initIfNotExist) { initIndexMetadataLog(); } else { String errorMsg = "Metadata log index not found " + metaLogIndexName;