Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/18388#discussion_r124716883
--- Diff:
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/protocol/OpenBlocksFailed.java
---
@@ -0,0 +1,84 @@
+/*
+ * 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.spark.network.shuffle.protocol;
+
+import com.google.common.base.Objects;
+import io.netty.buffer.ByteBuf;
+
+// Needed by ScalaDoc. See SPARK-7726
+import static
org.apache.spark.network.shuffle.protocol.BlockTransferMessage.Type;
+
+/**
+ * This message is responded from shuffle service when client failed to
"open blocks" due to
+ * some reason(e.g. the shuffle service is suffering from high memory
cost).
+ */
+public class OpenBlocksFailed extends BlockTransferMessage {
+
+ public final int reason;
+
+ public OpenBlocksFailed(int reason) {
+ this.reason = reason;
+ }
+
+ @Override
+ protected Type type() { return Type.OPEN_BLOCKS_FAILED; }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(reason);
+ }
+
+ public String toString() {
+ String reasonStr = null;
+ switch (reason) {
+ case 1:
+ reasonStr = "shuffle service is suffering high memory cost";
+ break;
+ default:
+ reasonStr = "unknown";
+ break;
+ }
+ return Objects.toStringHelper(this)
+ .add("reason", reasonStr)
+ .toString();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other != null && other instanceof OpenBlocksFailed) {
+ OpenBlocksFailed o = (OpenBlocksFailed) other;
+ return Objects.equal(reason, o.reason);
--- End diff --
nit: `this.reason == o.reason`?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]