This is an automated email from the ASF dual-hosted git repository.
irakov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new b48c508 IGNITE-10376 Fail to update metadata during invocation on
cache - Fixes #5520.
b48c508 is described below
commit b48c5087085868b1b0432c1bc7fccd5bf9b93152
Author: Ivan Fedotov <[email protected]>
AuthorDate: Wed Jan 16 16:11:33 2019 +0300
IGNITE-10376 Fail to update metadata during invocation on cache - Fixes
#5520.
Signed-off-by: Ivan Rakov <[email protected]>
---
.../ignite/internal/binary/BinaryMetadataHandler.java | 10 ++++++----
.../processors/cache/binary/BinaryMetadataKey.java | 2 +-
.../cache/binary/CacheObjectBinaryProcessorImpl.java | 16 ++++++++++++----
.../cache/binary/MetadataUpdateProposedMessage.java | 12 ++++++------
.../cacheobject/IgniteCacheObjectProcessor.java | 10 +++++-----
5 files changed, 30 insertions(+), 20 deletions(-)
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMetadataHandler.java
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMetadataHandler.java
index 85ab137..3652d98 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMetadataHandler.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryMetadataHandler.java
@@ -20,13 +20,15 @@ package org.apache.ignite.internal.binary;
import java.util.Collection;
import org.apache.ignite.binary.BinaryObjectException;
import org.apache.ignite.binary.BinaryType;
+import
org.apache.ignite.internal.processors.cache.binary.MetadataUpdateProposedMessage;
/**
- * Binary meta data handler.
+ * Binary metadata handler.
*/
public interface BinaryMetadataHandler {
/**
- * Adds meta data.
+ * Adds a new or updates an existing metadata to the latest version.
+ * See {@link MetadataUpdateProposedMessage} javadoc for detailed protocol
description.
*
* @param typeId Type ID.
* @param meta Metadata.
@@ -36,7 +38,7 @@ public interface BinaryMetadataHandler {
public void addMeta(int typeId, BinaryType meta, boolean
failIfUnregistered) throws BinaryObjectException;
/**
- * Gets meta data for provided type ID.
+ * Gets metadata for provided type ID.
*
* @param typeId Type ID.
* @return Metadata.
@@ -45,7 +47,7 @@ public interface BinaryMetadataHandler {
public BinaryType metadata(int typeId) throws BinaryObjectException;
/**
- * Gets unwrapped meta data for provided type ID.
+ * Gets unwrapped metadata for provided type ID.
*
* @param typeId Type ID.
* @return Metadata.
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataKey.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataKey.java
index 32ab2a0..3527540 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataKey.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataKey.java
@@ -25,7 +25,7 @@ import
org.apache.ignite.internal.processors.cache.GridCacheUtilityKey;
import org.apache.ignite.internal.util.typedef.internal.S;
/**
- * Key for binary meta data.
+ * Key for binary metadata.
*/
public class BinaryMetadataKey extends GridCacheUtilityKey<BinaryMetadataKey>
implements Externalizable {
/** */
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
index 7b6b4ab..4045766 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
@@ -535,8 +535,16 @@ public class CacheObjectBinaryProcessorImpl extends
GridProcessorAdapter impleme
BinaryMetadata mergedMeta = BinaryUtils.mergeMetadata(oldMeta,
newMeta0, changedSchemas);
- if (oldMeta != null && mergedMeta == oldMeta &&
metaHolder.pendingVersion() == metaHolder.acceptedVersion())
- return; // Safe to use existing schemas.
+ if (mergedMeta == oldMeta) {
+ // Metadata locally is up-to-date. Waiting for updating
metadata in an entire cluster, if necessary.
+ if (metaHolder.pendingVersion() !=
metaHolder.acceptedVersion()) {
+ GridFutureAdapter<MetadataUpdateResult> fut =
+ transport.awaitMetadataUpdate(typeId,
metaHolder.pendingVersion());
+
+ fut.get();
+ }
+ return;
+ }
if (failIfUnregistered)
throw new UnregisteredBinaryTypeException(
@@ -571,7 +579,7 @@ public class CacheObjectBinaryProcessorImpl extends
GridProcessorAdapter impleme
throw res.error();
}
catch (IgniteCheckedException e) {
- throw new BinaryObjectException("Failed to update meta data for
type: " + newMeta.typeName(), e);
+ throw new BinaryObjectException("Failed to update metadata for
type: " + newMeta.typeName(), e);
}
}
@@ -610,7 +618,7 @@ public class CacheObjectBinaryProcessorImpl extends
GridProcessorAdapter impleme
/**
* @param typeId Type ID.
- * @return Meta data.
+ * @return Metadata.
* @throws IgniteException In case of error.
*/
@Nullable public BinaryMetadata metadata0(final int typeId) {
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/MetadataUpdateProposedMessage.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/MetadataUpdateProposedMessage.java
index 84e32e1..c465314 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/MetadataUpdateProposedMessage.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/MetadataUpdateProposedMessage.java
@@ -77,22 +77,22 @@ public final class MetadataUpdateProposedMessage implements
DiscoveryCustomMessa
/** */
private final IgniteUuid id = IgniteUuid.randomUuid();
- /** */
+ /** Node UUID which initiated metadata update. */
private final UUID origNodeId;
/** */
private BinaryMetadata metadata;
- /** */
+ /** Metadata type id. */
private final int typeId;
- /** */
+ /** Metadata version which is pending for update. */
private int pendingVer;
- /** */
+ /** Metadata version which is already accepted by entire cluster. */
private int acceptedVer;
- /** */
+ /** Message acceptance status. */
private ProposalStatus status = ProposalStatus.SUCCESSFUL;
/** */
@@ -222,7 +222,7 @@ public final class MetadataUpdateProposedMessage implements
DiscoveryCustomMessa
return typeId;
}
- /** */
+ /** Message acceptance status. */
private enum ProposalStatus {
/** */
SUCCESSFUL,
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java
index f59a99e..c029705 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessor.java
@@ -240,7 +240,7 @@ public interface IgniteCacheObjectProcessor extends
GridProcessor {
/**
* @param typeId Type ID.
- * @param newMeta New meta data.
+ * @param newMeta New metadata.
* @param failIfUnregistered Fail if unregistered.
* @throws IgniteException In case of error.
*/
@@ -253,7 +253,7 @@ public interface IgniteCacheObjectProcessor extends
GridProcessor {
* of BinaryType.
*
* @param typeId Type ID.
- * @param newMeta New meta data.
+ * @param newMeta New metadata.
* @throws IgniteException In case of error.
*/
public void addMetaLocally(int typeId, final BinaryType newMeta) throws
IgniteException;
@@ -273,7 +273,7 @@ public interface IgniteCacheObjectProcessor extends
GridProcessor {
/**
* @param typeId Type ID.
- * @return Meta data.
+ * @return Metadata.
* @throws IgniteException In case of error.
*/
@Nullable public BinaryType metadata(int typeId) throws IgniteException;
@@ -282,14 +282,14 @@ public interface IgniteCacheObjectProcessor extends
GridProcessor {
/**
* @param typeId Type ID.
* @param schemaId Schema ID.
- * @return Meta data.
+ * @return Metadata.
* @throws IgniteException In case of error.
*/
@Nullable public BinaryType metadata(int typeId, int schemaId) throws
IgniteException;
/**
* @param typeIds Type ID.
- * @return Meta data.
+ * @return Metadata.
* @throws IgniteException In case of error.
*/
public Map<Integer, BinaryType> metadata(Collection<Integer> typeIds)
throws IgniteException;