risingwave_frontend/handler/
recover.rs1use pgwire::pg_response::{PgResponse, StatementType};
16
17use super::RwPgResponse;
18use crate::error::{ErrorCode, Result};
19use crate::handler::HandlerArgs;
20use crate::session::SessionImpl;
21
22pub(super) async fn handle_recover(handler_args: HandlerArgs) -> Result<RwPgResponse> {
23 if !handler_args.session.is_super_user() {
25 return Err(ErrorCode::PermissionDenied(
26 "only superusers can trigger adhoc recovery".to_owned(),
27 )
28 .into());
29 }
30 do_recover(&handler_args.session).await?;
31 Ok(PgResponse::empty_result(StatementType::RECOVER))
32}
33
34pub(crate) async fn do_recover(session: &SessionImpl) -> Result<()> {
35 let client = session.env().meta_client();
36 client.recover().await?;
37 Ok(())
38}