tkalkirill commented on code in PR #3917:
URL: https://github.com/apache/ignite-3/pull/3917#discussion_r1639347324
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/index/IndexMetaStorage.java:
##########
@@ -378,13 +405,49 @@ private static IndexMeta setNewStatus(IndexMeta
indexMeta, MetaIndexStatus newSt
return indexMeta.status(newStatus, catalog.version(), catalog.time());
}
- private static ByteArray indexMetaVaultKey(IndexMeta indexMeta) {
- return ByteArray.fromString(INDEX_META_KEY_PREFIX +
indexMeta.indexId());
- }
-
private static boolean shouldBeRemoved(IndexMeta indexMeta, int
lwmCatalogVersion) {
MetaIndexStatus status = indexMeta.status();
return (status == READ_ONLY || status == REMOVED) &&
indexMeta.statusChanges().get(status).catalogVersion() <= lwmCatalogVersion;
}
+
+ private static ByteArray indexMetaVersionKey(IndexMeta indexMeta) {
+ return ByteArray.fromString(INDEX_META_VERSION_KEY_PREFIX +
indexMeta.indexId());
+ }
+
+ private static ByteArray indexMetaValueKey(IndexMeta indexMeta) {
+ return ByteArray.fromString(INDEX_META_VALUE_KEY_PREFIX +
indexMeta.indexId());
+ }
+
+ private CompletableFuture<?> saveToMetastore(IndexMeta newMeta) {
+ ByteArray versionKey = indexMetaVersionKey(newMeta);
+
+ return metaStorageManager.invoke(
+ value(versionKey).lt(intToBytes(newMeta.catalogVersion())),
+ List.of(
+ put(versionKey, intToBytes(newMeta.catalogVersion())),
+ put(indexMetaValueKey(newMeta), toBytes(newMeta))
+ ),
+ List.of(noop())
+ );
+ }
+
+ private CompletableFuture<?> removeFromMetastore(IndexMeta indexMeta) {
+ ByteArray versionKey = indexMetaVersionKey(indexMeta);
+
+ return metaStorageManager.invoke(
+ exists(versionKey),
+ List.of(remove(versionKey),
remove(indexMetaValueKey(indexMeta))),
+ List.of(noop())
+ );
+ }
+
+ private CompletableFuture<?> updateAndSaveIndexMetaToMetastore(
Review Comment:
Because at the moment I don’t care what the future returns, I will ignore
this value; if in the future someone needs the result, he can easily change it.
--
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]