waitStarRocksReady blocks until at least one StarRocks backend is registered and alive, which is required before tablet-allocating DDL (CREATE TABLE) succeeds. The check is read-only on purpose: issuing DDL during allin1's first-boot disrupts backend registration, so poll SHOW BACKENDS rather than p
(ctx context.Context, db *sql.DB)
| 345 | // read-only on purpose: issuing DDL during allin1's first-boot disrupts backend |
| 346 | // registration, so poll SHOW BACKENDS rather than probing with CREATE TABLE. |
| 347 | func waitStarRocksReady(ctx context.Context, db *sql.DB) error { |
| 348 | ticker := time.NewTicker(3 * time.Second) |
| 349 | defer ticker.Stop() |
| 350 | timeout := time.After(10 * time.Minute) |
| 351 | for { |
| 352 | select { |
| 353 | case <-ticker.C: |
| 354 | if starRocksBackendAlive(ctx, db) { |
| 355 | return nil |
| 356 | } |
| 357 | case <-timeout: |
| 358 | return errors.Errorf("StarRocks backend did not become ready") |
| 359 | } |
| 360 | } |
| 361 | } |
| 362 | |
| 363 | // starRocksBackendAlive reports whether SHOW BACKENDS lists a backend with Alive=true. |
| 364 | func starRocksBackendAlive(ctx context.Context, db *sql.DB) bool { |
no test coverage detected