summaryrefslogtreecommitdiff
path: root/internal/server/handlers/mapcommand.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-07-04 08:55:10 +0300
committerPaul Buetow <paul@buetow.org>2025-07-04 08:55:10 +0300
commit73b885b7b1e74de010fd8aafc0b89dc60b7ac870 (patch)
tree6330c1a2084aa6ea98192ebaa130911bed0cf90b /internal/server/handlers/mapcommand.go
parent859be4593e4f7ef37ff2c91dc90f42e6930a3996 (diff)
fix: resolve MapReduce turbo mode issues and serverless processing
- 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>
Diffstat (limited to 'internal/server/handlers/mapcommand.go')
-rw-r--r--internal/server/handlers/mapcommand.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/server/handlers/mapcommand.go b/internal/server/handlers/mapcommand.go
index 5dc7b8f..c804189 100644
--- a/internal/server/handlers/mapcommand.go
+++ b/internal/server/handlers/mapcommand.go
@@ -23,8 +23,10 @@ func newMapCommand(serverHandler *ServerHandler, argc int,
m := mapCommand{server: serverHandler}
queryStr := strings.Join(args[1:], " ")
- // If turbo mode is enabled, create a TurboAggregate
- if config.Server.TurboModeEnable {
+ // If turbo mode is enabled AND we're in server mode (not serverless), create a TurboAggregate
+ // Turbo mode is a server-side optimization and should not be used in serverless mode
+ dlog.Server.Debug("MapReduce mode check", "turboModeEnable", config.Server.TurboModeEnable, "serverless", serverHandler.serverless)
+ if config.Server.TurboModeEnable && !serverHandler.serverless {
dlog.Server.Info("Creating turbo aggregate for MapReduce", "query", queryStr)
turboAggregate, err := server.NewTurboAggregate(queryStr)
if err != nil {