diff --git a/core/src/main/scala/org/apache/spark/deploy/rest/mesos/MesosRestServer.scala b/core/src/main/scala/org/apache/spark/deploy/rest/mesos/MesosRestServer.scala
index c0b93596508f1728abdcce882eb5c7f87722f5bf..87d0fa8b52fe160ca738ffd0020ae4db753cd1f1 100644
--- a/core/src/main/scala/org/apache/spark/deploy/rest/mesos/MesosRestServer.scala
+++ b/core/src/main/scala/org/apache/spark/deploy/rest/mesos/MesosRestServer.scala
@@ -99,7 +99,11 @@ private[mesos] class MesosSubmitRequestServlet(
     // cause spark-submit script to look for files in SPARK_HOME instead.
     // We only need the ability to specify where to find spark-submit script
     // which user can user spark.executor.home or spark.home configurations.
-    val environmentVariables = request.environmentVariables.filterKeys(!_.equals("SPARK_HOME"))
+    //
+    // Do not use `filterKeys` here to avoid SI-6654, which breaks ZK persistence
+    val environmentVariables = request.environmentVariables.filter { case (k, _) =>
+      k != "SPARK_HOME"
+    }
     val name = request.sparkProperties.get("spark.app.name").getOrElse(mainClass)
 
     // Construct driver description