summaryrefslogtreecommitdiff
path: root/internal/server/handlers
AgeCommit message (Collapse)Author
2026-04-10task 80: fix protocol compatibility parsingPaul Buetow
2026-03-20Optimize mapr parsing and stabilize aggregate shutdownPaul Buetow
2026-03-19task 261: harden server reads with OpenRootPaul Buetow
2026-03-13Fix mapreduce integration drain racePaul Buetow
2026-03-13Fix serverless output draining regressionsPaul Buetow
2026-03-13Stop stale query work promptly on generation cancelPaul Buetow
2026-03-13task 682e6ae9: filter stale generation outputPaul Buetow
2026-03-13task 58076a44: enable query session workloadsPaul Buetow
2026-03-13task 398: implement session preemptionPaul Buetow
2026-03-13task 400: add server session command scaffoldingPaul Buetow
2026-03-10Refactor server-side config singleton readsPaul Buetow
2026-03-08task: propagate dropped processing and flush errors (task 379)Paul Buetow
2026-03-08task: scope auth key dependencies to server instances (task 375)Paul Buetow
2026-03-05more on thisPaul Buetow
2026-03-05Improve lint/vet reliability and refactor client runtime/bootstrapPaul Buetow
2026-03-03Stabilize integration-mode auth tests and concurrent dcat readsPaul Buetow
2026-03-03Add dtailhealth no-auth-key flag and adjust turbo EOF handlingPaul Buetow
2026-03-03Add auth-key fast reconnect integration coveragePaul Buetow
2026-03-03feat(server): add AUTHKEY command handlingPaul Buetow
2026-03-02server: use auth strategy registry and stabilize turbo EOF syncPaul Buetow
2026-03-02handlers: use turbo EOF acknowledgement instead of sleep heuristicPaul Buetow
2026-03-02config: make server timing and buffer knobs configurablePaul Buetow
2026-03-02refactor: add readcommand facade for server dependenciesPaul Buetow
2026-03-02refactor: split turbo read processor construction in readcommandPaul Buetow
2026-03-02refactor(handlers): use command registry in server handlerPaul Buetow
2026-03-02refactor(handlers): decouple turbo network writer from base handlerPaul Buetow
2026-03-02refactor(handlers): centralize protocol line/message formattingPaul Buetow
Task: 026363ea-d985-49a1-801e-bfbbe25bb6b8
2026-03-02refactor(handlers): extract shutdown coordination from read commandPaul Buetow
Task: 45cfde84-3b56-4821-bc84-b8e9a90d2ca4
2026-03-02Consolidate read command paths via strategy loop (task 333)Paul Buetow
2026-03-02Extract protocol and turbo responsibilities from baseHandler (task 327)Paul Buetow
2026-03-02Refactor server path to use injected runtime config (task 329)Paul Buetow
2026-01-29refactor: improve Go best practices compliancePaul Buetow
- Add explicit interface satisfaction checks (var _ Interface = (*Type)(nil)) for compile-time verification: - TurboWriter implementations (DirectTurboWriter, TurboChannelWriter) - Processor implementations (GrepLineProcessor, ChannellessLineProcessor) - Parser implementations (genericParser, csvParser, genericKVParser, custom parsers, mimecastParser) - Logger implementations (file, stdout) - Handler implementations (ServerHandler, ClientHandler) - Connector implementations (Serverless, ServerConnection) - SSH callback implementations (KnownHostsCallback) - Improve error handling with context wrapping (%w): - SSH operations: GeneratePrivateRSAKey, Agent - Query parsing: Query.parse - SSH client connections: dial, session, handle methods - Fix receiver consistency: - Convert Query.String() from value to pointer receiver - Convert Outfile.String() from value to pointer receiver - Convert all KnownHostsCallback methods to pointer receivers - Convert mapCommand.Start() to pointer receiver - Reorganize file structure for better clarity: - internal/io/dlog/dlog.go: Move type definition before public functions - internal/mapr/token.go: Reorganize helper functions after public ones - Add documentation comments: - Query.String() method - Outfile.String() method - Regex.String() method - Improve config variable documentation All unit tests and integration tests pass. Amp-Thread-ID: https://ampcode.com/threads/T-019c0b08-0eeb-705d-a1f7-31bb764b659a Co-authored-by: Amp <amp@ampcode.com>
2026-01-24test: add unit tests for turbo writer typesPaul Buetow
Add comprehensive unit tests for DirectTurboWriter and TurboChannelWriter: - DirectTurboWriter: serverless plain mode, network modes, server messages - TurboChannelWriter: line data, channel full handling, server messages - Stats tracking verification Note: Some tests skipped due to global config/dlog dependencies: - Colored mode tests (require color config) - DirectLineProcessor tests (require dlog initialization) These are covered by integration tests. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24refactor: split large functions for maintainabilityPaul Buetow
Split functions exceeding 50 lines into smaller, focused helpers: - DirectTurboWriter.WriteLineData (~97 lines) split into: - WriteLineData (dispatcher, 9 lines) - writeServerlessLine (serverless mode, 48 lines) - writeNetworkLine (network mode, 40 lines) - TurboNetworkWriter.WriteLineData (~60 lines) split into: - WriteLineData (builds protocol line, 33 lines) - sendToTurboChannel (channel send with retry, 28 lines) - Server.handleRequests (~67 lines) split into: - handleRequests (request loop, 23 lines) - handleShellRequest (shell session setup, 57 lines) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-07-04fix: remove unnecessary delays in turbo mode for serverless operationPaul Buetow
In serverless mode (when dcat runs locally), data is written directly to stdout and doesn't need network transmission delays. This fix eliminates the 500ms+ exit delay by skipping unnecessary sleep calls when running in serverless mode. Changes: - Skip 500ms wait in readFiles() when serverless - Skip 50ms wait in readWithTurboProcessor() when serverless - Skip aggregate serialization waits when serverless - Fix turbo benchmark test compilation errors 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-04refactor: change turbo boost to be enabled by defaultPaul Buetow
- Changed environment variable from DTAIL_TURBOBOOST_ENABLE to DTAIL_TURBOBOOST_DISABLE - Changed config field from TurboModeEnable to TurboBoostDisable - Turbo boost is now enabled by default and must be explicitly disabled - Updated all code references, documentation, and examples - No change in functionality, only inverted the boolean logic This makes turbo boost opt-out rather than opt-in, providing better default performance for large files while allowing users to disable it for scenarios where it adds overhead. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-04fix: resolve MapReduce turbo mode issues and serverless processingPaul Buetow
- Fix serverless MapReduce to pass options with map command for proper mode detection - Prevent raw lines from being sent to client during MapReduce operations - Only use turbo mode for cat/grep/tail when no aggregate is present - Fix race conditions in TurboAggregate with proper synchronization - Add SafeAggregateSet wrapper for thread-safe operations - Fix parser selection to use correct parser names - Add comprehensive unit tests for turbo aggregate functionality This ensures MapReduce operations in both turbo and non-turbo modes produce identical results and fixes serverless mode processing. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-03fix: improve turbo mode MapReduce batch processing and shutdown sequencePaul Buetow
- Fixed batch processor to use synchronous processing during shutdown - Added processBatchAndWait method for guaranteed batch completion - Fixed Flush() to ensure all data is processed before file completion - Improved parser selection logic for table-based queries - Added extensive debug logging for troubleshooting - Increased wait times for serialization during shutdown These changes address data loss issues when processing multiple files concurrently in turbo mode. The batch processor now properly flushes all remaining data when files complete and during shutdown. Note: Integration tests still failing due to SSH authentication issues in test environment, but core turbo mode logic has been fixed. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-03fix: implement thread-safe turbo mode for MapReduce operationsPaul Buetow
- Add SafeAggregateSet wrapper with mutex protection for concurrent access - Implement TurboAggregate for direct line processing without channels - Fix race conditions in turbo mode MapReduce aggregation - Add proper synchronization for batch processing completion - Update shutdown sequence to ensure all data is serialized - Add integration test configuration for high-concurrency scenarios The turbo mode now correctly handles MapReduce queries with significant performance improvements while maintaining data integrity and preventing race conditions during concurrent aggregation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-02feat: make turbo mode configurable via config filePaul Buetow
Add TurboModeEnable setting to server configuration with environment variable override. The DTAIL_TURBOBOOST_ENABLE environment variable takes precedence over config file setting. Turbo mode is automatically disabled for MapReduce operations to prevent data accuracy issues. - Add TurboModeEnable boolean to ServerConfig struct - Update config initializer to check environment variable for backward compatibility - Replace direct env var checks with config.Server.TurboModeEnable throughout codebase - Enable turbo mode in example config file (dtail.json.example) - Add property to JSON schema with descriptive documentation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-02feat: add server info message for literal grep modePaul Buetow
- Add IsLiteral() and Pattern() methods to regex.Regex struct - Log info message when grep uses optimized literal string matching - Fix bug where grep commands were processed as cat commands - Add comprehensive integration tests to verify literal mode messages This gives users visibility when the performance-optimized literal string matching is being used instead of regex matching. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-01perf: optimize turbo mode for 2.87x faster serverless performancePaul Buetow
Major performance improvements in turbo mode: - Fixed trace logging overhead by adding early level checks before expensive runtime.Caller() operations - Improved buffering strategy by removing forced immediate flush in serverless mode - Turbo mode now 2.87x faster (was 3-5x slower before optimization) Changes: - internal/io/dlog/dlog.go: Added early return in Trace() and Devel() when logging disabled - internal/server/handlers/turbo_writer.go: Removed serverless immediate flush condition Performance results: - Before: Turbo mode was 3-5x slower than non-turbo mode - After: Turbo mode is 2.87x faster (65% improvement) - All integration tests pass Added comprehensive benchmarking tools in benchmarks/ directory 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-01fix: resolve turbo mode race condition and improve TestDCat2Paul Buetow
- Fixed race condition in periodicTruncateCheck by using context cancellation - Added turbo mode support to TestDCat2 server configuration - Removed problematic wait for pending files in readCommand.Start - Fixed potential panic when truncate channel is closed while goroutine is running The test now properly enables turbo mode on both client and server, preventing the timeout issues that occurred when only the client had turbo mode enabled. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-01feat: ensure command doesn't complete until all pending files are processedPaul Buetow
In turbo mode, prevent Start() from returning until all pending files have been fully processed, not just queued. This prevents commandFinished() from being called prematurely which could trigger shutdown while files are still being processed due to concurrency limits. This partially addresses the issue with TestDCat2 failing when MaxConcurrentCats=2, though further investigation is needed for complete resolution. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-30feat: track pending files to prevent premature server shutdownPaul Buetow
- Add pendingFiles counter to ServerHandler to track files waiting for limiter slots - Only shutdown when both activeCommands and pendingFiles are zero - Increment pendingFiles when starting to process a batch of files - Decrement as each file completes processing - Add comprehensive logging for debugging shutdown issues - Flush turbo data before signaling EOF to ensure all data is transmitted This fixes the issue where the server would shutdown while files were still queued in the catLimiter, causing incomplete processing when MaxConcurrentCats is lower than the number of files being processed. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-30fix: resolve channel close panic and improve turbo mode synchronizationPaul Buetow
- Remove problematic close(turboEOF) call from TurboNetworkWriter.Flush() that was causing "close of closed channel" panic when processing multiple files - Add proper EOF signaling in readFiles() after all files are processed - Always create new turboEOF channel for each batch to ensure clean state - Increase flush timeout iterations for turbo mode to handle large file batches - Add wait time after EOF signal to ensure data transmission completes This fixes the panic that occurred in TestDCat2 when processing the same file multiple times, where the TurboNetworkWriter instance was reused and attempted to close the same channel multiple times. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-30fix: ensure complete data transmission in turbo mode for dtail operationsPaul Buetow
This commit fixes integration test failures in turbo mode where data was not being fully transmitted before the connection closed. The main issue was that readWithTurboProcessor was returning too quickly without ensuring all data had been written to the network stream. Key changes: - Add comprehensive trace logging to track data flow in turbo mode - Fix turbo channel draining mechanism in baseHandler.Read() to wait for all data - Add proper flushing in TurboNetworkWriter with channel drain synchronization - Increase flush timeout from 10 to 100 iterations for turbo mode data volumes - Fix color formatting in serverless mode by processing lines individually - Add synchronization delays to ensure data transmission completes The fixes ensure that all data is properly transmitted before connection closure, resolving TestDcat integration test failures when DTAIL_TURBOBOOST_ENABLE is set. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-30fix: disable turbo boost for MapReduce operations in server modePaul Buetow
The turbo boost optimization introduced in commit 6afc304 causes a panic when processing MapReduce operations in server mode. The optimized reader's periodicTruncateCheck function attempts to send on a closed channel, resulting in incomplete MapReduce results. This fix disables turbo boost specifically for MapReduce (aggregate) operations while keeping it enabled for regular cat/grep/tail operations. The traditional channel-based approach is required for MapReduce to function correctly. Fixes TestDMap3 integration test failures when DTAIL_TURBOBOOST_ENABLE=yes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-29fix: improve aggregate channel switching for MapReduce operationsPaul Buetow
- Add mutex protection to prevent race conditions in nextLine() - Implement synchronous channel put-back in turbo mode when possible - Add timeout mechanism to prevent goroutine leaks - Increase NextLinesCh buffer size to 1000 for better concurrency handling - Document known limitation with turbo mode and high-concurrency MapReduce These changes ensure TestDMap3 passes consistently without turbo mode. With turbo mode, extreme concurrency (100+ files) may still have issues due to the fundamental mismatch between turbo mode's speed and the aggregate's channel rotation design. Workarounds are documented. Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-29feat: enable turbo boost mode for tail (dtail) operationsPaul Buetow
Enable the DTAIL_TURBOBOOST_ENABLE optimization for dtail commands. The infrastructure was already fully implemented with specialized tailWithProcessorOptimized() for continuous streaming, but the mode check was preventing it from being used. This completes turbo boost support for all dtail commands (dcat, dgrep, dmap, dtail), providing up to 62% performance improvement for high-volume log streaming scenarios. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>