From d273de483f98364c4e4cf608edab3fe422c3a233 Mon Sep 17 00:00:00 2001 From: Pere Diaz Bou Date: Mon, 28 Jul 2025 10:50:50 +0200 Subject: [PATCH] comment clone for schema --- core/schema.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/schema.rs b/core/schema.rs index bc20cc90b..6144424c4 100644 --- a/core/schema.rs +++ b/core/schema.rs @@ -313,6 +313,10 @@ impl Schema { } impl Clone for Schema { + /// Cloning a `Schema` requires deep cloning of all internal tables and indexes, even though they are wrapped in `Arc`. + /// Simply copying the `Arc` pointers would result in multiple `Schema` instances sharing the same underlying tables and indexes, + /// which could lead to panics or data races if any instance attempts to modify them. + /// To ensure each `Schema` is independent and safe to modify, we clone the underlying data for all tables and indexes. fn clone(&self) -> Self { let tables = self .tables