summaryrefslogtreecommitdiff
path: root/internal/server/handlers/basehandler.go
AgeCommit message (Collapse)Author
2026-03-13Fix serverless output draining regressionsPaul Buetow
2026-03-13task 682e6ae9: filter stale generation outputPaul Buetow
2026-03-13task 400: add server session command scaffoldingPaul Buetow
2026-03-05more on thisPaul Buetow
2026-03-05Improve lint/vet reliability and refactor client runtime/bootstrapPaul Buetow
2026-03-02handlers: use turbo EOF acknowledgement instead of sleep heuristicPaul Buetow
2026-03-02refactor(handlers): centralize protocol line/message formattingPaul Buetow
Task: 026363ea-d985-49a1-801e-bfbbe25bb6b8
2026-03-02Extract protocol and turbo responsibilities from baseHandler (task 327)Paul Buetow
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-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-28feat: implement channel-less grep for 62% performance improvementPaul Buetow
- Add LineProcessor interface for direct line processing without channels - Implement channel-less file reading in readfile_processor.go - Add optimized reader with 256KB buffering for efficient I/O - Create GrepLineProcessor for direct writing without intermediate channels - Fix serverless mode hanging due to stdin pipe detection - Fix base64 decoding bug (was counting characters instead of arguments) - Fix message output formatting by adding proper newline handling Performance improvements: - Channel-based: 9.00s → Channel-less: 3.42s (62% faster on 100MB files) - Removed channel synchronization overhead and context switching - Reduced memory allocations with buffer pooling Environment variables: - DTAIL_CHANNELLESS_GREP=yes - Enable channel-less implementation - DTAIL_OPTIMIZED_READER=yes - Use optimized buffered reader Known limitation: Inverted grep with context (--invert with --before/--after) not fully implemented in channel-less mode. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-24Fix dcat tests for server mode and --plain flag handlingPaul Buetow
- Update dcat tests to use comma-separated file lists in server mode - Fix basehandler.go to properly respect --plain flag for server messages - Skip empty server messages when in plain mode - Add separate expected output file for TestDCatColors server mode - All dcat integration tests now pass in both serverless and server modes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2024-03-29lint warningsPaul Buetow
2022-02-15minor fix, add missing newlines to server messagesPaul Buetow
2021-12-05buffer line.Line for performancePaul Buetow
2021-11-02Bugfix: Dealing correctly with files without newline characters, also add ↵Paul Buetow
more tests
2021-10-31rename spartan mode to plain modePaul Buetow
2021-10-24Fix deadlock around aggregating data + server max concurrent file read limiterPaul Buetow
2021-10-15refactorPaul Buetow
2021-10-14add dgrep context integration testsPaul Buetow
2021-10-14Merging grep context from masterPaul Buetow
2021-10-13add another dcat integration test - catting 100 files at oncePaul Buetow
2021-10-10add another dmap test - reading 100 source files at oncePaul Buetow
fix a data race when reading multiple files on one server from the same session at once
2021-10-10vetting and linting and some code restylingPaul Buetow
2021-10-09refactorPaul Buetow
2021-10-06enable faster shutdown - useful for dgrep/dmap and dcat commandsPaul Buetow
2021-10-05more on thisPaul Buetow
2021-10-05more on thisPaul Buetow