Skip to content
This repository was archived by the owner on Oct 18, 2023. It is now read-only.

Commit ef55476

Browse files
authored
fix proxy bug (#659)
1 parent 944a6db commit ef55476

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

sqld/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,8 @@ async fn start_primary(
520520
config.disable_namespaces,
521521
);
522522

523-
let proxy_service = ProxyService::new(namespaces.clone(), Some(auth));
523+
let proxy_service =
524+
ProxyService::new(namespaces.clone(), Some(auth), config.disable_namespaces);
524525

525526
run_service(
526527
namespaces.clone(),

sqld/src/rpc/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub async fn run_rpc_server(
3434
namespaces: Arc<NamespaceStore<PrimaryNamespaceMaker>>,
3535
disable_namespaces: bool,
3636
) -> anyhow::Result<()> {
37-
let proxy_service = ProxyService::new(namespaces.clone(), None);
37+
let proxy_service = ProxyService::new(namespaces.clone(), None, disable_namespaces);
3838
let logger_service = ReplicationLogService::new(
3939
namespaces.clone(),
4040
idle_shutdown_layer.clone(),

sqld/src/rpc/proxy.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,17 +264,20 @@ pub struct ProxyService {
264264
clients: RwLock<HashMap<Uuid, Arc<TrackedConnection<LibSqlConnection>>>>,
265265
namespaces: Arc<NamespaceStore<PrimaryNamespaceMaker>>,
266266
auth: Option<Arc<Auth>>,
267+
disable_namespaces: bool,
267268
}
268269

269270
impl ProxyService {
270271
pub fn new(
271272
namespaces: Arc<NamespaceStore<PrimaryNamespaceMaker>>,
272273
auth: Option<Arc<Auth>>,
274+
disable_namespaces: bool,
273275
) -> Self {
274276
Self {
275277
clients: Default::default(),
276278
namespaces,
277279
auth,
280+
disable_namespaces,
278281
}
279282
}
280283
}
@@ -445,9 +448,7 @@ impl Proxy for ProxyService {
445448
} else {
446449
Authenticated::from_proxy_grpc_request(&req)?
447450
};
448-
449-
let namespace = super::extract_namespace(true, &req)?;
450-
451+
let namespace = super::extract_namespace(self.disable_namespaces, &req)?;
451452
let req = req.into_inner();
452453
let pgm = crate::connection::program::Program::try_from(req.pgm.unwrap())
453454
.map_err(|e| tonic::Status::new(tonic::Code::InvalidArgument, e.to_string()))?;

0 commit comments

Comments
 (0)