parseK8sMemory parses a Kubernetes memory string (e.g., "360Gi", "8Gi", "512Mi", "4GB") into bytes. Supports both IEC (Ki/Mi/Gi/Ti) and SI (KB/MB/GB/TB) units.
(s string)
| 1454 | msg = fmt.Sprintf("database %q does not exist", requestedCatalog) |
| 1455 | } |
| 1456 | sessionStart.Finish("error", observe.SessionStartReasonMetadataStore) |
| 1457 | _ = server.WriteErrorResponse(writer, "FATAL", "3D000", msg) |
| 1458 | _ = writer.Flush() |
| 1459 | return |
| 1460 | } |
| 1461 | duckLakeAttached = true |
| 1462 | database = visibleCatalogName(logicalCatalog, effectiveCatalog) |
| 1463 | defer destroySessionOnExit() |
| 1464 | // No slow pre-ready acquisition to watch: ReadyForQuery follows the |
| 1465 | // initial parameters immediately, so the disconnect watcher would only |
| 1466 | // contend with a client that pipelines its first query. |
| 1467 | } else { |
| 1468 | var admissionCtx context.Context |
| 1469 | admissionCtx, disconnectWatcher = startPreReadyDisconnectWatcher(preReadyCtx, tlsConn, reader) |
| 1470 | defer disconnectWatcher.Stop() |
| 1471 | createdPID, exec, err := createSessionWithRegisteredCancel( |
| 1472 | admissionCtx, |
| 1473 | cp.srv, |
| 1474 | cp.cfg.WorkerQueueTimeout, |
| 1475 | server.BackendKey{Pid: pid, SecretKey: secretKey}, |
| 1476 | func(ctx context.Context) (int32, *flightclient.FlightExecutor, error) { |
| 1477 | return sessions.CreateSession(ctx, username, pid, memLimit, threads, initialProfile) |
| 1478 | }, |
| 1479 | ) |
| 1480 | executor = exec |
| 1481 | if cp.isDraining() { |
| 1482 | err = ErrSessionManagerDraining |
| 1483 | } |
| 1484 | if err != nil { |
| 1485 | // Session creation may have committed at the same instant a CancelRequest, |
| 1486 | // client FIN/RST, or drain canceled its context. Never retain that raced |
| 1487 | // session without a live client to own it. |
no outgoing calls