Repository: hashgraph/hedera-services
Issue: MixedOps-Restart-Performance-10k-31m  20N_20C test failure

**Summary of the defect**
`MixedOps-Restart-Performance-10k-31m ` starts successfully, but fails as the schedules to be created already exist and receives a wrong actual status. Need to modify the client to continue the test irrespective of received status.

**How to reproduce (if possible)**
Slack Summary link : https://hedera-hashgraph.slack.com/archives/C018Y4E6ADT/p1617764642017000
Slack link : https://hedera-hashgraph.slack.com/archives/CKWHL8R9A/p1617764591218400


Changed files:
test-clients/src/main/java/com/hedera/services/bdd/spec/queries/schedule/HapiGetScheduleInfo.java
test-clients/src/main/java/com/hedera/services/bdd/suites/perf/MixedOpsLoadTest.java
test-clients/src/main/java/com/hedera/services/bdd/spec/infrastructure/OpProvider.java
test-clients/src/main/java/com/hedera/services/bdd/spec/infrastructure/HapiSpecRegistry.java
test-clients/src/main/java/com/hedera/services/bdd/spec/transactions/schedule/HapiScheduleSign.java

diff --git a/test-clients/src/main/java/com/hedera/services/bdd/spec/infrastructure/HapiSpecRegistry.java b/test-clients/src/main/java/com/hedera/services/bdd/spec/infrastructure/HapiSpecRegistry.java
index 2103fb04fa..18e5933f26 100644
--- a/test-clients/src/main/java/com/hedera/services/bdd/spec/infrastructure/HapiSpecRegistry.java
+++ b/test-clients/src/main/java/com/hedera/services/bdd/spec/infrastructure/HapiSpecRegistry.java
@@ -31,6 +31,8 @@ import com.hedera.services.bdd.spec.infrastructure.meta.SupportedContract;
 import com.hedera.services.bdd.spec.stats.OpObs;
 import com.hedera.services.bdd.spec.stats.ThroughputObs;
 import com.hedera.services.bdd.suites.HapiApiSuite;
+import com.hedera.services.legacy.core.HexUtils;
+import com.hedera.services.legacy.core.KeyPairObj;
 import com.hederahashgraph.api.proto.java.AccountID;
 import com.hederahashgraph.api.proto.java.ConsensusCreateTopicTransactionBody;
 import com.hederahashgraph.api.proto.java.ConsensusUpdateTopicTransactionBody;
@@ -47,13 +49,17 @@ import com.hederahashgraph.api.proto.java.Timestamp;
 import com.hederahashgraph.api.proto.java.TokenID;
 import com.hederahashgraph.api.proto.java.TopicID;
 import com.hederahashgraph.api.proto.java.TransactionID;
-import com.hedera.services.legacy.core.HexUtils;
-import com.hedera.services.legacy.core.KeyPairObj;
 import com.hederahashgraph.api.proto.java.TransactionRecord;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
-import java.io.*;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.NotSerializableException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.time.Instant;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -66,7 +72,9 @@ import static com.hedera.services.bdd.spec.HapiPropertySource.asAccountString;
 import static com.hedera.services.bdd.spec.HapiPropertySource.asScheduleString;
 import static com.hedera.services.bdd.spec.HapiPropertySource.asTokenString;
 import static com.hedera.services.bdd.spec.keys.KeyFactory.firstStartupKp;
-import static java.util.stream.Collectors.*;
+import static java.util.stream.Collectors.counting;
+import static java.util.stream.Collectors.groupingBy;
+import static java.util.stream.Collectors.toList;
 
 public class HapiSpecRegistry {
 	static final Logger log = LogManager.getLogger(HapiSpecRegistry.class);
diff --git a/test-clients/src/main/java/com/hedera/services/bdd/spec/infrastructure/OpProvider.java b/test-clients/src/main/java/com/hedera/services/bdd/spec/infrastructure/OpProvider.java
index f5e67f5110..353d778886 100644
--- a/test-clients/src/main/java/com/hedera/services/bdd/spec/infrastructure/OpProvider.java
+++ b/test-clients/src/main/java/com/hedera/services/bdd/spec/infrastructure/OpProvider.java
@@ -36,7 +36,7 @@ public interface OpProvider {
 			OK,
 			BUSY,
 			INSUFFICIENT_TX_FEE,
-			PLATFORM_TRANSACTION_NOT_CREATED,
+			PLATFORM_TRANSACTION_NOT_CREATED
 	};
 
 	ResponseCodeEnum[] STANDARD_PERMISSIBLE_PRECHECKS = {
@@ -46,7 +46,7 @@ public interface OpProvider {
 			DUPLICATE_TRANSACTION,
 			INVALID_PAYER_SIGNATURE,
 			INSUFFICIENT_PAYER_BALANCE,
-			PLATFORM_TRANSACTION_NOT_CREATED,
+			PLATFORM_TRANSACTION_NOT_CREATED
 	};
 
 	ResponseCodeEnum[] STANDARD_PERMISSIBLE_OUTCOMES = {
@@ -54,7 +54,7 @@ public interface OpProvider {
 			LIVE_HASH_NOT_FOUND,
 			INVALID_SIGNATURE,
 			INSUFFICIENT_PAYER_BALANCE,
-			UNKNOWN,
+			UNKNOWN
 	};
 
 	default List<HapiSpecOperation> suggestedInitializers() {
diff --git a/test-clients/src/main/java/com/hedera/services/bdd/spec/queries/schedule/HapiGetScheduleInfo.java b/test-clients/src/main/java/com/hedera/services/bdd/spec/queries/schedule/HapiGetScheduleInfo.java
index cee78eddb8..1edae28c76 100644
--- a/test-clients/src/main/java/com/hedera/services/bdd/spec/queries/schedule/HapiGetScheduleInfo.java
+++ b/test-clients/src/main/java/com/hedera/services/bdd/spec/queries/schedule/HapiGetScheduleInfo.java
@@ -23,9 +23,7 @@ package com.hedera.services.bdd.spec.queries.schedule;
 import com.hedera.services.bdd.spec.HapiApiSpec;
 import com.hedera.services.bdd.spec.infrastructure.HapiSpecRegistry;
 import com.hedera.services.bdd.spec.queries.HapiQueryOp;
-import com.hedera.services.bdd.spec.queries.QueryVerbs;
 import com.hedera.services.bdd.spec.transactions.TxnUtils;
-import com.hedera.services.bdd.spec.utilops.CustomSpecAssert;
 import com.hederahashgraph.api.proto.java.HederaFunctionality;
 import com.hederahashgraph.api.proto.java.KeyList;
 import com.hederahashgraph.api.proto.java.Query;
diff --git a/test-clients/src/main/java/com/hedera/services/bdd/spec/transactions/schedule/HapiScheduleSign.java b/test-clients/src/main/java/com/hedera/services/bdd/spec/transactions/schedule/HapiScheduleSign.java
index 5ab531178e..e8263c95bf 100644
--- a/test-clients/src/main/java/com/hedera/services/bdd/spec/transactions/schedule/HapiScheduleSign.java
+++ b/test-clients/src/main/java/com/hedera/services/bdd/spec/transactions/schedule/HapiScheduleSign.java
@@ -22,13 +22,13 @@ package com.hedera.services.bdd.spec.transactions.schedule;
 
 import com.google.common.base.MoreObjects;
 import com.hedera.services.bdd.spec.HapiApiSpec;
-import com.hedera.services.bdd.spec.HapiPropertySource;
 import com.hedera.services.bdd.spec.fees.FeeCalculator;
-import com.hedera.services.bdd.spec.queries.schedule.HapiGetScheduleInfo;
+import com.hedera.services.bdd.spec.infrastructure.RegistryNotFound;
 import com.hedera.services.bdd.spec.transactions.HapiTxnOp;
 import com.hedera.services.bdd.suites.HapiApiSuite;
 import com.hederahashgraph.api.proto.java.HederaFunctionality;
 import com.hederahashgraph.api.proto.java.Key;
+import com.hederahashgraph.api.proto.java.ScheduleID;
 import com.hederahashgraph.api.proto.java.ScheduleInfo;
 import com.hederahashgraph.api.proto.java.ScheduleSignTransactionBody;
 import com.hederahashgraph.api.proto.java.Transaction;
@@ -40,11 +40,9 @@ import org.apache.logging.log4j.Logger;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import java.util.Optional;
 import java.util.function.Consumer;
 import java.util.function.Function;
 
-import static com.hedera.services.bdd.spec.queries.QueryVerbs.getScheduleInfo;
 import static com.hedera.services.bdd.spec.transactions.TxnUtils.asScheduleId;
 import static com.hedera.services.bdd.spec.transactions.TxnUtils.suFrom;
 import static com.hederahashgraph.api.proto.java.HederaFunctionality.ScheduleSign;
@@ -54,16 +52,22 @@ public class HapiScheduleSign extends HapiTxnOp<HapiScheduleSign> {
 
 	private final String schedule;
 	private List<String> signatories = Collections.emptyList();
+	private boolean ignoreMissing = false;
 
 	public HapiScheduleSign(String schedule) {
 		this.schedule = schedule;
 	}
 
-	public HapiScheduleSign alsoSigningWith(String... keys)	 {
+	public HapiScheduleSign alsoSigningWith(String... keys) {
 		signatories = List.of(keys);
 		return this;
 	}
 
+	public HapiScheduleSign ignoreIfMissing() {
+		ignoreMissing = true;
+		return this;
+	}
+
 	@Override
 	protected HapiScheduleSign self() {
 		return this;
@@ -80,7 +84,15 @@ public class HapiScheduleSign extends HapiTxnOp<HapiScheduleSign> {
 				.txns()
 				.<ScheduleSignTransactionBody, ScheduleSignTransactionBody.Builder>body(
 						ScheduleSignTransactionBody.class, b -> {
-							b.setScheduleID(asScheduleId(schedule, spec));
+							ScheduleID id;
+							try {
+								id = asScheduleId(schedule, spec);
+								b.setScheduleID(id);
+							} catch (RegistryNotFound e) {
+								if (!ignoreMissing) {
+									throw e;
+								}
+							}
 						}
 				);
 		return b -> b.setScheduleSign(opBody);
diff --git a/test-clients/src/main/java/com/hedera/services/bdd/suites/perf/MixedOpsLoadTest.java b/test-clients/src/main/java/com/hedera/services/bdd/suites/perf/MixedOpsLoadTest.java
index d35ae2a779..fec0fc5f46 100644
--- a/test-clients/src/main/java/com/hedera/services/bdd/suites/perf/MixedOpsLoadTest.java
+++ b/test-clients/src/main/java/com/hedera/services/bdd/suites/perf/MixedOpsLoadTest.java
@@ -28,6 +28,7 @@ import org.apache.commons.lang3.ArrayUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
+import java.net.InetAddress;
 import java.nio.ByteBuffer;
 import java.time.Instant;
 import java.util.List;
@@ -69,6 +70,7 @@ import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_TOPIC_
 import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.OK;
 import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.PAYER_ACCOUNT_NOT_FOUND;
 import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.PLATFORM_TRANSACTION_NOT_CREATED;
+import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.SCHEDULE_ALREADY_EXECUTED;
 import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.SUCCESS;
 import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.TOKENS_PER_ACCOUNT_LIMIT_EXCEEDED;
 import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.TOKEN_ALREADY_ASSOCIATED_TO_ACCOUNT;
@@ -178,7 +180,8 @@ public class MixedOpsLoadTest extends LoadTest {
 								INVALID_TOKEN_ID,
 								UNKNOWN, TOKEN_NOT_ASSOCIATED_TO_ACCOUNT)
 						.deferStatusResolution() :
-						scheduleSign(schedule + r.nextInt(NUM_SUBMISSIONS))
+						scheduleSign(schedule + "-" + getHostName() + "-" + r.nextInt(NUM_SUBMISSIONS))
+								.ignoreIfMissing()
 								.noLogging()
 								.alsoSigningWith(receiver)
 								.hasPrecheckFrom(OK, INVALID_SCHEDULE_ID)
@@ -186,7 +189,8 @@ public class MixedOpsLoadTest extends LoadTest {
 										OK,
 										TRANSACTION_EXPIRED,
 										INVALID_SCHEDULE_ID,
-										UNKNOWN)
+										UNKNOWN,
+										SCHEDULE_ALREADY_EXECUTED)
 								.fee(ONE_HBAR)
 								.deferStatusResolution()
 		};
@@ -236,13 +240,15 @@ public class MixedOpsLoadTest extends LoadTest {
 						sleepFor(10000),
 						inParallel(IntStream.range(0, NUM_SUBMISSIONS)
 								.mapToObj(ignore ->
-										scheduleCreate("schedule" + scheduleId.getAndIncrement(),
+										scheduleCreate("schedule-" + getHostName() + "-" +
+														scheduleId.getAndIncrement(),
 												cryptoTransfer(tinyBarsFromTo(sender, receiver, 1))
 										)
 												.signedBy(DEFAULT_PAYER)
 												.fee(ONE_HUNDRED_HBARS)
 												.alsoSigningWith(sender)
 												.hasPrecheckFrom(STANDARD_PERMISSIBLE_PRECHECKS)
+												.hasAnyKnownStatus()
 												.deferStatusResolution()
 												.adminKey(DEFAULT_PAYER)
 												.noLogging())
@@ -275,4 +281,13 @@ public class MixedOpsLoadTest extends LoadTest {
 	protected Logger getResultsLogger() {
 		return log;
 	}
+
+	private String getHostName() {
+		try {
+			return InetAddress.getLocalHost().getHostName();
+		} catch (Exception e) {
+			log.info("Error getting host name");
+			return "Hostname-Not-Available";
+		}
+	}
 }