-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extract metadata log operations from FlintClient into FlintMetadataLogService #379
Extract metadata log operations from FlintClient into FlintMetadataLogService #379
Conversation
Signed-off-by: Sean Kao <seankao@amazon.com>
Signed-off-by: Sean Kao <seankao@amazon.com>
Signed-off-by: Sean Kao <seankao@amazon.com>
Signed-off-by: Sean Kao <seankao@amazon.com>
FlintClientBuilder uses reflection to instantiate FlintMetadataLogService, which cannot be checked at compile time. Signed-off-by: Sean Kao <seankao@amazon.com>
Signed-off-by: Sean Kao <seankao@amazon.com>
Signed-off-by: Sean Kao <seankao@amazon.com>
Signed-off-by: Sean Kao <seankao@amazon.com>
af23a72
to
4d8cba9
Compare
Signed-off-by: Sean Kao <seankao@amazon.com>
* Start a new optimistic transaction. | ||
* | ||
* @param indexName index name | ||
* @param forceInit forceInit create empty metadata log if not exist. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forceInit
sounds more like it tries to init even metadata already exist. initIfNotExist
or initWhenNeeded
should be better naming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to use initIfNotExist
for getMetadataLog. Keeping it as forceInit
for startTransaction, as the semantics I think is to force init the transaction, instead of init the metadata log
...core/src/main/scala/org/opensearch/flint/core/storage/FlintOpenSearchMetadataLogService.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Sean Kao <seankao@amazon.com>
Signed-off-by: Sean Kao <seankao@amazon.com>
Signed-off-by: Sean Kao <seankao@amazon.com>
|
||
public FlintOpenSearchClient(FlintOptions options) { | ||
public FlintOpenSearchClient(FlintOptions options, FlintMetadataLogService metadataLogService) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should better naming FlintOpenSearchClient, the reasons it FlintOpenSearchClient depend FlintMedataLogService, not OpenSearch. Or in the other way,
- Remove FlintMedataLogService operation from FlintOpenSearchClient
- Modify FlintOpenSearchClient caller to call FlintMedataLogService
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for above comment.
Also, what is the value add of FlintOpenSearchClient if we are passing down everything to FlintMetadataLogService?
Can we replace FlintOpenSearchClient with FlintMetadataLogService where ever we make operations on FlintMetadataLog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For startTransaction
I agree that we can make the callers use FlintMetadataLogService instead. However, FlintOpenSearchClient getIndexMetadata
still needs FlintMetadataLogService to getMetadataLog
.
Will try to move it away from getIndexMetadata and instead use it in its caller (FlintSpark describeIndex)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously we only initialize request index when starting transaction in createIndex
. Now current change is to init whenever new API getIndexMetadataLog
called? Not sure the impact and if benefit on code structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now current change is to init whenever new API getIndexMetadataLog called?
Sure... init is indeed not required. Changed so that the FlintMetadataLogService
public interface for getIndexMetadataLog
cannot init request index. It gets metadata log if available.
Now the initIfNotExist
is only used as private method for FlintOpenSearchMetadataLogService
as part of startTransaction
with forceInit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed FlintMetadataLogService
operation from FlintOpenSearchClient
flint-core/src/main/scala/org/opensearch/flint/core/metadata/log/FlintMetadataLogService.java
Outdated
Show resolved
Hide resolved
Any plan to move FlintClient / FlintMetadataLogService to commons module? |
Signed-off-by: Sean Kao <seankao@amazon.com>
Signed-off-by: Sean Kao <seankao@amazon.com>
will do in separate PR |
Signed-off-by: Sean Kao <seankao@amazon.com>
d81a35d
to
79c7937
Compare
Signed-off-by: Sean Kao <seankao@amazon.com>
Signed-off-by: Sean Kao <seankao@amazon.com>
79c7937
to
9664595
Compare
Signed-off-by: Sean Kao <seankao@amazon.com>
9502ad6
to
346e344
Compare
Signed-off-by: Sean Kao <seankao@amazon.com>
val latest = flintMetadataLogService | ||
.getIndexMetadataLog(indexName) | ||
.flatMap(_.getLatest) | ||
if (latest.isPresent) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may be not relelated to this PR, why latest metadatalog is requried? seems it could be optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was introduced as part of show flint index
statement, to get index state. And indeed it is optional. The log entry is added to the FlintMetadata if available
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes!
…gService (opensearch-project#379) * metadata log service interface Signed-off-by: Sean Kao <seankao@amazon.com> * flint opensearch metadata log service impl Signed-off-by: Sean Kao <seankao@amazon.com> * reflection for metadata log service instantiate Signed-off-by: Sean Kao <seankao@amazon.com> * add comments Signed-off-by: Sean Kao <seankao@amazon.com> * undo using client builder in tests FlintClientBuilder uses reflection to instantiate FlintMetadataLogService, which cannot be checked at compile time. Signed-off-by: Sean Kao <seankao@amazon.com> * use metadata log service in transaction IT suites Signed-off-by: Sean Kao <seankao@amazon.com> * metadata log test suite Signed-off-by: Sean Kao <seankao@amazon.com> * flint client builder test Signed-off-by: Sean Kao <seankao@amazon.com> * scalafmtAll Signed-off-by: Sean Kao <seankao@amazon.com> * undo reflection Signed-off-by: Sean Kao <seankao@amazon.com> * rename descriptive symbols Signed-off-by: Sean Kao <seankao@amazon.com> * descriptive parameter name and update comment Signed-off-by: Sean Kao <seankao@amazon.com> * remove init from getMetadataLog interface Signed-off-by: Sean Kao <seankao@amazon.com> * remove startTransaction from FlintClient Signed-off-by: Sean Kao <seankao@amazon.com> * rm flint os client dep on metadata log service Signed-off-by: Sean Kao <seankao@amazon.com> * rename function and remove unused flint client Signed-off-by: Sean Kao <seankao@amazon.com> * remove test case for init in getMetadataLog Signed-off-by: Sean Kao <seankao@amazon.com> * abstract recordHeartbeat method Signed-off-by: Sean Kao <seankao@amazon.com> * consistent var naming for metadataLogIndexName Signed-off-by: Sean Kao <seankao@amazon.com> --------- Signed-off-by: Sean Kao <seankao@amazon.com>
Description
FlintClient
intoFlintMetadataLogService
.Add flint options for custom class path and instantiatere-evaluate in another PRFlintMetadataLogService
through reflection.FlintClient.getIndexMetadata
no longer attaches metadata log entry, as it has no access toFlintMetadataLogService
. This is moved toFlintSpark.describeIndex
.FlintMetadataLogITSuite
Issues Resolved
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.