Skip to content

Commit 1212d86

Browse files
authored
Merge pull request #304 from chdb-io/patchset-3.0.1-2
Patchset for 3.0.1
2 parents 687afa9 + 302ad9c commit 1212d86

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

chdb/session/state.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def __init__(self, path=None):
5151
)
5252
g_session.close()
5353
g_session_path = None
54-
if path is None:
54+
if path is None or ":memory:" in path:
5555
self._cleanup = True
5656
self._path = tempfile.mkdtemp()
5757
else:
@@ -89,13 +89,19 @@ def close(self):
8989
if self._conn is not None:
9090
self._conn.close()
9191
self._conn = None
92+
global g_session, g_session_path
93+
g_session = None
94+
g_session_path = None
9295

9396
def cleanup(self):
9497
try:
9598
if self._conn is not None:
9699
self._conn.close()
97100
self._conn = None
98101
shutil.rmtree(self._path)
102+
global g_session, g_session_path
103+
g_session = None
104+
g_session_path = None
99105
except: # noqa
100106
pass
101107

programs/local/LocalServer.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -785,17 +785,8 @@ void LocalServer::processConfig()
785785
/// Command-line parameters can override settings from the default profile.
786786
applyCmdSettings(global_context);
787787

788-
// global once flag
789788
/// We load temporary database first, because projections need it.
790-
static std::once_flag db_catalog_once;
791-
if (config().has("path"))
792-
{
793-
DatabaseCatalog::instance().initializeAndLoadTemporaryDatabase();
794-
}
795-
else
796-
{
797-
std::call_once(db_catalog_once, [&] { DatabaseCatalog::instance().initializeAndLoadTemporaryDatabase(); });
798-
}
789+
DatabaseCatalog::instance().initializeAndLoadTemporaryDatabase();
799790

800791
std::string default_database = server_settings.default_database;
801792
DatabaseCatalog::instance().attachDatabase(default_database, createClickHouseLocalDatabaseOverlay(default_database, global_context));

0 commit comments

Comments
 (0)