Skip to content

fix(server): load .env before embedded-storage worker detectio#920

Merged
Teingi merged 9 commits into
oceanbase:mainfrom
Teingi:dev_0507
May 12, 2026
Merged

fix(server): load .env before embedded-storage worker detectio#920
Teingi merged 9 commits into
oceanbase:mainfrom
Teingi:dev_0507

Conversation

@Teingi
Copy link
Copy Markdown
Member

@Teingi Teingi commented May 7, 2026

image

用 .env 把向量库配成 OceanBase。OceanBaseConfig 配置了 env_file=None,不会去读 .env,只靠 os.environ。结果就是启动时出现:Embedded storage detected … Forcing workers=1,把本应可用的多 worker 强行改成 1。

@Teingi
Copy link
Copy Markdown
Member Author

Teingi commented May 7, 2026

修复方案

  • 在 _is_embedded_storage() 里,先调用 _load_dotenv_if_available(),把项目 .env(或 POWERMEM_ENV_FILE 指向的文件)加载进 os.environ。
  • 再构造 DatabaseSettings() 和 OceanBaseConfig(),用真实的 provider 和 是否有远程 host 来判断是否为嵌入式,从而 只在真的是 SQLite / 本地 SeekDB(host 为空)时才强制 workers=1。

Fix

  • In _is_embedded_storage(), first call _load_dotenv_if_available() to load the project .env (or the file pointed to by POWERMEM_ENV_FILE) into os.environ.
  • Reconstruct DatabaseSettings() and OceanBaseConfig(), use the real provider and whether there is a remote host to determine whether it is embedded, so that workers=1 is only forced when it is really SQLite/local SeekDB (host is empty).

@Ripcord55
Copy link
Copy Markdown
Contributor

Ripcord55 commented May 12, 2026

Verified
image
image
image
Before the repair, due to a mistaken identification of oceanbase as an embedded database, the Server forced the use of "POWERMEM_SERVER_WORKERS=1" It starts in this mode, but in fact, oceanbase supports multiple workers
After the repair, when oceanbase is used as the storage database, the Server can be started normally in multi-worker mode
Simultaneously verify: pyseekdb and sqlite are normally started in the mode of "POWERMEM_SERVER_WORKERS=1"

Copy link
Copy Markdown
Member

@Evenss Evenss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Teingi Teingi merged commit cf1300e into oceanbase:main May 12, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants