From e3f665e48607ea92f34d26f1ee916b329ee57d8a Mon Sep 17 00:00:00 2001
From: Georgy Moshkin <gmoshkin@picodata.io>
Date: Thu, 18 May 2023 11:13:10 +0300
Subject: [PATCH] fix: globally distributed spaces are local

---
 src/schema.rs        | 7 ++++++-
 test/int/test_ddl.py | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/schema.rs b/src/schema.rs
index 88998daebe..4d4dbe5b36 100644
--- a/src/schema.rs
+++ b/src/schema.rs
@@ -59,6 +59,11 @@ impl SpaceDef {
             })
             .collect();
 
+        let mut flags = BTreeMap::new();
+        if matches!(self.distribution, Distribution::Global) {
+            flags.insert("group_id".into(), 1.into());
+        }
+
         let space_def = SpaceMetadata {
             id: self.id,
             // Do we want to be more explicit about user_id?
@@ -66,7 +71,7 @@ impl SpaceDef {
             name: self.name.as_str().into(),
             engine: SpaceEngineType::Memtx,
             field_count: 0,
-            flags: Default::default(),
+            flags,
             format,
         };
 
diff --git a/test/int/test_ddl.py b/test/int/test_ddl.py
index 412b7ea7d7..2c60202653 100644
--- a/test/int/test_ddl.py
+++ b/test/int/test_ddl.py
@@ -142,7 +142,7 @@ def test_ddl_create_space_bulky(cluster: Cluster):
         "stuff",
         "memtx",
         0,
-        dict(),
+        dict(group_id=1),
         [dict(name="id", type="unsigned", is_nullable=False)],
     ]
     assert i1.call("box.space._space:get", space_id) == tt_space_def
-- 
GitLab