You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by am...@apache.org on 2024/06/18 15:37:46 UTC
(ignite-3) 01/02: Introduce CatalogMarshallerException for catalog serialization issues.
This is an automated email from the ASF dual-hosted git repository.
amashenkov pushed a commit to branch ignite-22270
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
commit 3d50ac046c3c6aa7c511f9bda81b97fbe569b37d
Author: amashenkov <an...@gmail.com>
AuthorDate: Tue Jun 18 18:21:16 2024 +0300
Introduce CatalogMarshallerException for catalog serialization issues.
---
.../internal/catalog/storage/UpdateLogImpl.java | 8 ++---
.../serialization/CatalogMarshallerException.java | 34 ++++++++++++++++++++++
.../serialization/UpdateLogMarshallerImpl.java | 5 ++--
3 files changed, 40 insertions(+), 7 deletions(-)
diff --git a/modules/catalog/src/main/java/org/apache/ignite/internal/catalog/storage/UpdateLogImpl.java b/modules/catalog/src/main/java/org/apache/ignite/internal/catalog/storage/UpdateLogImpl.java
index cf80b4549c..e14460781b 100644
--- a/modules/catalog/src/main/java/org/apache/ignite/internal/catalog/storage/UpdateLogImpl.java
+++ b/modules/catalog/src/main/java/org/apache/ignite/internal/catalog/storage/UpdateLogImpl.java
@@ -37,6 +37,7 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.IntStream;
import java.util.stream.Stream;
+import org.apache.ignite.internal.catalog.storage.serialization.CatalogMarshallerException;
import org.apache.ignite.internal.catalog.storage.serialization.UpdateLogMarshaller;
import org.apache.ignite.internal.catalog.storage.serialization.UpdateLogMarshallerImpl;
import org.apache.ignite.internal.lang.ByteArray;
@@ -59,7 +60,6 @@ import org.apache.ignite.internal.metastorage.dsl.Update;
import org.apache.ignite.internal.util.IgniteSpinBusyLock;
import org.apache.ignite.lang.ErrorGroups.Common;
import org.apache.ignite.lang.IgniteException;
-import org.apache.ignite.lang.MarshallerException;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
@@ -175,7 +175,7 @@ public class UpdateLogImpl implements UpdateLog {
Iif iif = iif(versionAsExpected, appendUpdateEntryAndBumpVersion, ops().yield(false));
return metastore.invoke(iif).thenApply(StatementResult::getAsBoolean);
- } catch (MarshallerException ex) {
+ } catch (CatalogMarshallerException ex) {
LOG.warn("Failed to append update log.", ex);
// TODO: IGNITE-14611 Pass exception to an error handler because catalog got into inconsistent state.
@@ -221,7 +221,7 @@ public class UpdateLogImpl implements UpdateLog {
Iif iif = iif(versionIsRecent, saveSnapshotAndDropOutdatedUpdates, ops().yield(false));
return metastore.invoke(iif).thenApply(StatementResult::getAsBoolean);
- } catch (MarshallerException ex) {
+ } catch (CatalogMarshallerException ex) {
LOG.warn("Failed to append update log.", ex);
// TODO: IGNITE-14611 Pass exception to an error handler because catalog got into inconsistent state.
@@ -313,7 +313,7 @@ public class UpdateLogImpl implements UpdateLog {
UpdateLogEvent update = marshaller.unmarshall(payload);
handleFutures.add(onUpdateHandler.handle(update, event.timestamp(), event.revision()));
- } catch (MarshallerException ex) {
+ } catch (CatalogMarshallerException ex) {
LOG.warn("Failed to deserialize update.", ex);
// TODO: IGNITE-14611 Pass exception to an error handler because catalog got into inconsistent state.
diff --git a/modules/catalog/src/main/java/org/apache/ignite/internal/catalog/storage/serialization/CatalogMarshallerException.java b/modules/catalog/src/main/java/org/apache/ignite/internal/catalog/storage/serialization/CatalogMarshallerException.java
new file mode 100644
index 0000000000..37e73431a6
--- /dev/null
+++ b/modules/catalog/src/main/java/org/apache/ignite/internal/catalog/storage/serialization/CatalogMarshallerException.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.catalog.storage.serialization;
+
+import org.apache.ignite.internal.lang.IgniteInternalException;
+import org.apache.ignite.lang.ErrorGroups.Common;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * This exception is caused by a failure to marshall or unmarshall catalog event.
+ * The failure can be due to compatibility reason or any other unrecoverable error.
+ */
+public class CatalogMarshallerException extends IgniteInternalException {
+ private static final long serialVersionUID = 3401185592041257347L;
+
+ CatalogMarshallerException(@Nullable Throwable cause) {
+ super(Common.INTERNAL_ERR, cause);
+ }
+}
diff --git a/modules/catalog/src/main/java/org/apache/ignite/internal/catalog/storage/serialization/UpdateLogMarshallerImpl.java b/modules/catalog/src/main/java/org/apache/ignite/internal/catalog/storage/serialization/UpdateLogMarshallerImpl.java
index 47f4b5f49f..0666423c7d 100644
--- a/modules/catalog/src/main/java/org/apache/ignite/internal/catalog/storage/serialization/UpdateLogMarshallerImpl.java
+++ b/modules/catalog/src/main/java/org/apache/ignite/internal/catalog/storage/serialization/UpdateLogMarshallerImpl.java
@@ -24,7 +24,6 @@ import org.apache.ignite.internal.catalog.storage.UpdateLogEvent;
import org.apache.ignite.internal.catalog.storage.VersionedUpdate;
import org.apache.ignite.internal.util.io.IgniteUnsafeDataInput;
import org.apache.ignite.internal.util.io.IgniteUnsafeDataOutput;
-import org.apache.ignite.lang.MarshallerException;
import org.jetbrains.annotations.TestOnly;
/**
@@ -95,7 +94,7 @@ public class UpdateLogMarshallerImpl implements UpdateLogMarshaller {
return output.array();
} catch (Throwable t) {
- throw new MarshallerException(t);
+ throw new CatalogMarshallerException(t);
}
}
@@ -113,7 +112,7 @@ public class UpdateLogMarshallerImpl implements UpdateLogMarshaller {
return (UpdateLogEvent) serializers.get(typeId).readFrom(input);
} catch (Throwable t) {
- throw new MarshallerException(t);
+ throw new CatalogMarshallerException(t);
}
}
}