You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sa...@apache.org on 2022/06/07 11:46:18 UTC
[ignite-3] branch main updated: IGNITE-17115 Use of IGNITE_GET_METADATA_LOCALLY_ONLY from within SchemaManager added (#860)
This is an automated email from the ASF dual-hosted git repository.
sanpwc pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new aefc9a6b4 IGNITE-17115 Use of IGNITE_GET_METADATA_LOCALLY_ONLY from within SchemaManager added (#860)
aefc9a6b4 is described below
commit aefc9a6b4eb18ee8e518ddbf55f032ba6f55a273
Author: Alexander Lapin <la...@gmail.com>
AuthorDate: Tue Jun 7 14:46:13 2022 +0300
IGNITE-17115 Use of IGNITE_GET_METADATA_LOCALLY_ONLY from within SchemaManager added (#860)
---
.../ignite/internal/schema/SchemaManager.java | 25 +++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/modules/schema/src/main/java/org/apache/ignite/internal/schema/SchemaManager.java b/modules/schema/src/main/java/org/apache/ignite/internal/schema/SchemaManager.java
index de2ccfa96..c4e7dd04a 100644
--- a/modules/schema/src/main/java/org/apache/ignite/internal/schema/SchemaManager.java
+++ b/modules/schema/src/main/java/org/apache/ignite/internal/schema/SchemaManager.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.schema;
import static java.util.concurrent.CompletableFuture.completedFuture;
import static java.util.concurrent.CompletableFuture.failedFuture;
-import static org.apache.ignite.internal.configuration.util.ConfigurationUtil.directProxy;
import static org.apache.ignite.internal.configuration.util.ConfigurationUtil.getByInternalId;
import java.util.HashMap;
@@ -30,6 +29,7 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
import java.util.function.Function;
+import org.apache.ignite.configuration.ConfigurationProperty;
import org.apache.ignite.configuration.NamedListView;
import org.apache.ignite.configuration.notifications.ConfigurationNamedListListener;
import org.apache.ignite.configuration.notifications.ConfigurationNotificationEvent;
@@ -38,6 +38,7 @@ import org.apache.ignite.internal.causality.VersionedValue;
import org.apache.ignite.internal.configuration.schema.ExtendedTableConfiguration;
import org.apache.ignite.internal.configuration.schema.SchemaConfiguration;
import org.apache.ignite.internal.configuration.schema.SchemaView;
+import org.apache.ignite.internal.configuration.util.ConfigurationUtil;
import org.apache.ignite.internal.manager.EventListener;
import org.apache.ignite.internal.manager.IgniteComponent;
import org.apache.ignite.internal.manager.Producer;
@@ -49,6 +50,7 @@ import org.apache.ignite.internal.util.IgniteSpinBusyLock;
import org.apache.ignite.lang.IgniteException;
import org.apache.ignite.lang.IgniteInternalException;
import org.apache.ignite.lang.IgniteStringFormatter;
+import org.apache.ignite.lang.IgniteSystemProperties;
import org.apache.ignite.lang.NodeStoppingException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -60,6 +62,14 @@ public class SchemaManager extends Producer<SchemaEvent, SchemaEventParameters>
/** Initial version for schemas. */
public static final int INITIAL_SCHEMA_VERSION = 1;
+ /**
+ * If this property is set to {@code true} then an attempt to get the configuration property directly from the meta storage will be
+ * skipped, and the local property will be returned.
+ * TODO: IGNITE-16774 This property and overall approach, access configuration directly through the Metostorage,
+ * TODO: will be removed after fix of the issue.
+ */
+ private final boolean getMetadataLocallyOnly = IgniteSystemProperties.getBoolean("IGNITE_GET_METADATA_LOCALLY_ONLY");
+
/** Busy lock to stop synchronously. */
private final IgniteSpinBusyLock busyLock = new IgniteSpinBusyLock();
@@ -368,4 +378,17 @@ public class SchemaManager extends Producer<SchemaEvent, SchemaEventParameters>
busyLock.block();
}
+
+ /**
+ * Gets a direct accessor for the configuration distributed property.
+ * If the metadata access only locally configured the method will return local property accessor.
+ *
+ * @param property Distributed configuration property to receive direct access.
+ * @param <T> Type of the property accessor.
+ * @return An accessor for distributive property.
+ * @see #getMetadataLocallyOnly
+ */
+ private <T extends ConfigurationProperty<?>> T directProxy(T property) {
+ return getMetadataLocallyOnly ? property : ConfigurationUtil.directProxy(property);
+ }
}