## 问题背景 在 app 启动后等待 20s 以上,再手动触发数据库连接时,遇到瞬时网络错误(如 `no route to host`)会立即失败,用户体感为“没有重试”。 相关讨论与上下文参考: - https://github.com/Syngnat/GoNavi/pull/294 ## 问题描述 此前重试保护逻辑主要以“应用启动窗口(20s)”为边界: - 启动窗口内:瞬时网络失败会自动重试 - 启动窗口外:即使是瞬时网络失败也不重试 这导致“用户首次手动连接发生在稳定期”时,行为与预期不一致。 ## 本地复现关键日志(节选) ```log 2026/03/27 15:21:04.792462 [INFO] 应用启动完成(首次连接保护窗口=20s,最多重试=4 次) 2026/03/27 15:22:29.196794 [INFO] 获取数据库连接:... 启动阶段=稳定期(age=1m24.405s) 2026/03/27 15:22:29.208920 [ERROR] 建立数据库连接失败:... connect: no route to host 2026/03/27 15:22:29.212453 [ERROR] DBGetDatabases 获取连接失败:... connect: no route to host 2026/03/27 16:07:45.463959 [INFO] 获取数据库连接:... 启动阶段=稳定期(age=21s) 2026/03/27 16:07:45.470744 [ERROR] 建立数据库连接失败:... connect: no route to host 2026/03/27 16:07:45.473604 [WARN] 检测到瞬时网络失败,准备重试连接:... 尝试=1/4 延迟=800ms 2026/03/27 16:07:46.277658 [INFO] 获取数据库连接:... 启动阶段=稳定期(age=21.814s) 2026/03/27 16:07:46.281761 [INFO] 创建数据库驱动实例:... 尝试=2/4 2026/03/27 16:07:46.284741 [ERROR] 建立数据库连接失败:... connect: no route to host 2026/03/27 16:20:59.298636 [INFO] 应用启动完成(首次连接保护窗口=20s,最多重试=4 次) 2026/03/27 16:23:26.180978 [INFO] 获取数据库连接:... 启动阶段=稳定期(age=2m26.883s) 2026/03/27 16:23:26.201478 [INFO] 数据库连接成功并写入缓存:... ``` ## 变更内容 - 调整连接重试判定逻辑: - 启动窗口内:保持原有重试预算(最多 4 次) - 启动窗口外:若为瞬时网络错误,补充一次保护重试(总计 2 次尝试) - 非瞬时错误(如认证失败)在稳定期不重试 - 日志文案泛化,避免“仅启动期”误导: - 数据库连接在重试后成功 - 检测到瞬时网络失败,准备重试连接 ## 测试与验证 ### 新增/更新单元测试覆盖以下场景: - 启动期瞬时错误重试并成功 - 稳定期瞬时错误重试一次并成功 - 稳定期瞬时错误持续失败时,仅重试一次后停止 - 稳定期非瞬时错误不重试 - 稳定期重试路径输出重试提示日志 - 启动期瞬时错误失败时使用完整重试预算 ### 本地执行: - go test ./internal/app -run StartupRetry -count=1 - go test ./internal/app -count=1 ### 影响范围 - 连接建立重试策略(internal/app/app.go) - 启动重试相关测试(internal/app/app_startup_connect_retry_test.go) ## 风险与回滚 - 风险:稳定期瞬时网络错误会增加一次重试等待(约 800ms) - 回滚:可回退本 PR 即恢复“仅启动窗口重试”的旧策略
GoNavi - A Modern Lightweight Database Client
Language: English | 简体中文
GoNavi is a modern, high-performance, cross-platform database client built with Wails (Go) and React. It delivers native-like responsiveness with low resource usage.
Compared with many Electron-based clients, GoNavi is typically smaller in binary size (around 10MB class), starts faster, and uses less memory.
Project Overview
GoNavi is designed for developers and DBAs who need a unified desktop experience across multiple databases.
- Native-performance architecture: Wails (Go + WebView) with lightweight runtime overhead.
- Large dataset usability: virtualized rendering and optimized DataGrid workflows for high-volume tables.
- Unified connectivity: URI build/parse, SSH tunnel, proxy support, and on-demand driver activation.
- Production-oriented workflow: SQL editor, object management, batch export/backup, sync tools, execution logs, and update checks.
Supported Data Sources
Built-in: available out of the box.
Optional driver agent: install/enable via Driver Manager first.
| Category | Data Source | Driver Mode | Typical Capabilities |
|---|---|---|---|
| Relational | MySQL | Built-in | Schema browsing, SQL query, data editing, export/backup |
| Relational | PostgreSQL | Built-in | Schema browsing, SQL query, data editing, object management |
| Relational | Oracle | Built-in | Query execution, object browsing, data editing |
| Cache | Redis | Built-in | Key browsing, command execution, encoding/view switch |
| Relational | MariaDB | Optional driver agent | Querying, object management, data editing |
| Relational | Doris | Optional driver agent | Querying, object browsing, SQL execution |
| Search | Sphinx | Optional driver agent | SphinxQL querying and object browsing |
| Relational | SQL Server | Optional driver agent | Schema browsing, SQL query, object management |
| File-based | SQLite | Optional driver agent | Local DB browsing, editing, export |
| File-based | DuckDB | Optional driver agent | Large-table query, pagination, file-DB workflow |
| Domestic DB | Dameng | Optional driver agent | Querying, object browsing, data editing |
| Domestic DB | Kingbase | Optional driver agent | Querying, object browsing, data editing |
| Domestic DB | HighGo | Optional driver agent | Querying, object browsing, data editing |
| Domestic DB | Vastbase | Optional driver agent | Querying, object browsing, data editing |
| Document | MongoDB | Optional driver agent | Document query, collection browsing, connection management |
| Time-series | TDengine | Optional driver agent | Time-series schema browsing and querying |
| Columnar Analytics | ClickHouse | Optional driver agent | Analytical query, object browsing, SQL execution |
| Extensibility | Custom Driver/DSN | Custom | Extend to more data sources via Driver + DSN |
📸 Screenshots
Key Features
Performance
- Smooth interaction under load: optimized table interaction (including column resize workflow on large datasets).
- Virtualized rendering: keeps large result sets responsive.
Data Management (DataGrid)
- In-place cell editing.
- Batch insert/update/delete with transaction-oriented submit/rollback.
- Large-field popup editor.
- Context actions (set NULL, copy/export, etc.).
- Smart read/write mode switching based on query context.
- Export formats: CSV, Excel (XLSX), JSON, Markdown.
SQL Editor
- Monaco Editor core.
- Context-aware completion for databases/tables/columns.
- Multi-tab query workflow.
Batch Export / Backup
- Database-level and table-level batch export/backup.
- Scope-aware operation flow to reduce mistakes.
Connectivity
- URI generation/parsing.
- SSH tunnel support.
- Proxy support.
- Config import/export (JSON).
- Optional driver management and activation.
Redis Tools
- Multi-view value rendering (auto/raw text/UTF-8/hex).
- Built-in command execution panel.
Observability and Update
- SQL execution logs with timing information.
- Startup/scheduled/manual update checks.
UI/UX
- Ant Design 5 based interface.
- Light/Dark themes.
- Flexible sidebar and layout behavior.
Tech Stack
- Backend: Go 1.24 + Wails v2
- Frontend: React 18 + TypeScript + Vite
- UI: Ant Design 5
- State Management: Zustand
- Editor: Monaco Editor
Installation and Run
Prerequisites
Development Mode
# Clone
git clone https://github.com/Syngnat/GoNavi.git
cd GoNavi
# Start development with hot reload
wails dev
Build
# Build for current platform
wails build
# Clean build (recommended before release)
wails build -clean
Artifacts are generated in build/bin.
Cross-Platform Release (GitHub Actions)
The repository includes a release workflow.
Push a v* tag to trigger automated build and release.
Release notes are generated automatically from merged pull requests and categorized by .github/release.yaml.
Target artifacts include:
- macOS (AMD64 / ARM64)
- Windows (AMD64)
- Linux (AMD64, WebKitGTK 4.0 and 4.1 variants)
Troubleshooting
macOS: "App is damaged and can’t be opened"
Without Apple notarization, Gatekeeper may block startup.
- Move
GoNavi.appto Applications. - Open Terminal.
- Run:
sudo xattr -rd com.apple.quarantine /Applications/GoNavi.app
Or right-click the app in Finder and choose Open with Control key flow.
Linux: missing libwebkit2gtk / libjavascriptcoregtk
GoNavi depends on WebKitGTK runtime libraries.
# Debian 13 / Ubuntu 24.04+
sudo apt-get update
sudo apt-get install -y libgtk-3-0 libwebkit2gtk-4.1-0 libjavascriptcoregtk-4.1-0
# Ubuntu 22.04 / Debian 12
sudo apt-get update
sudo apt-get install -y libgtk-3-0 libwebkit2gtk-4.0-37 libjavascriptcoregtk-4.0-18
If you use Linux artifacts with the -WebKit41 suffix, prefer Debian 13 / Ubuntu 24.04+.
Contributing
Issues and pull requests are welcome.
For the full workflow, branch model, and maintainer sync rules, see:
External contributors should open pull requests directly against main.
License
Licensed under Apache-2.0.