summaryrefslogtreecommitdiff
path: root/internal/server/handlers/mapcommand.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/server/handlers/mapcommand.go')
-rw-r--r--internal/server/handlers/mapcommand.go19
1 files changed, 16 insertions, 3 deletions
diff --git a/internal/server/handlers/mapcommand.go b/internal/server/handlers/mapcommand.go
index 65e0ed8..bd83b46 100644
--- a/internal/server/handlers/mapcommand.go
+++ b/internal/server/handlers/mapcommand.go
@@ -4,6 +4,7 @@ import (
"context"
"strings"
+ "github.com/mimecast/dtail/internal/io/dlog"
"github.com/mimecast/dtail/internal/mapr/server"
)
@@ -13,13 +14,25 @@ type mapCommand struct {
server *ServerHandler
}
-// NewMapCommand returns a new server side mapreduce command.
+// newMapCommand returns a new server side mapreduce command.
+//
+// The Aggregate is the one and only aggregate path for BOTH server mode and
+// serverless: an Aggregate is always built, and the read commands feed it
+// directly via AggregateProcessor (no aggregate line-channel). The former
+// regular server.Aggregate has been deleted (task hv0), so there is no
+// fallback branch.
func newMapCommand(serverHandler *ServerHandler, argc int,
args []string) (mapCommand, *server.Aggregate, error) {
m := mapCommand{server: serverHandler}
queryStr := strings.Join(args[1:], " ")
- aggregate, err := server.NewAggregate(queryStr)
+ defaultLogFormat := ""
+ if serverHandler.serverCfg != nil {
+ defaultLogFormat = serverHandler.serverCfg.MapreduceLogFormat
+ }
+
+ dlog.Server.Info("Creating turbo aggregate for MapReduce", "query", queryStr)
+ aggregate, err := server.NewAggregate(queryStr, defaultLogFormat)
if err != nil {
return m, nil, err
}
@@ -27,6 +40,6 @@ func newMapCommand(serverHandler *ServerHandler, argc int,
return m, aggregate, nil
}
-func (m mapCommand) Start(ctx context.Context, aggregatedMessages chan<- string) {
+func (m *mapCommand) Start(ctx context.Context, aggregatedMessages chan<- string) {
m.aggregate.Start(ctx, aggregatedMessages)
}