yahoNanJing commented on a change in pull request #1913:
URL: https://github.com/apache/arrow-datafusion/pull/1913#discussion_r820328987



##########
File path: ballista/rust/scheduler/src/state/persistent_state.rs
##########
@@ -0,0 +1,312 @@
+// 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.
+
+use log::debug;
+use parking_lot::RwLock;
+use prost::Message;
+use std::any::type_name;
+use std::collections::HashMap;
+use std::sync::Arc;
+
+use ballista_core::error::{BallistaError, Result};
+
+use ballista_core::serde::protobuf::JobStatus;
+
+use crate::state::backend::StateBackendClient;
+use ballista_core::serde::scheduler::ExecutorMetadata;
+use ballista_core::serde::{protobuf, AsExecutionPlan, AsLogicalPlan, 
BallistaCodec};
+use datafusion::physical_plan::ExecutionPlan;
+use datafusion::prelude::ExecutionContext;
+
+type StageKey = (String, u32);
+
+#[derive(Clone)]
+pub(crate) struct PersistentSchedulerState<
+    T: 'static + AsLogicalPlan,
+    U: 'static + AsExecutionPlan,
+> {
+    // for db
+    config_client: Arc<dyn StateBackendClient>,
+    namespace: String,
+    pub(crate) codec: BallistaCodec<T, U>,
+
+    // for in-memory cache
+    executors_metadata: Arc<RwLock<HashMap<String, ExecutorMetadata>>>,

Review comment:
       Suppose there's a cluster deployed on k8s in a standalone mode and we 
want to redeploy the scheduler. It would be better for the scheduler to reload 
the topology info from persistent storage. Whether the executor metadata be 
overdue or not, it should be managed by the executor heartbeat.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to