Merge branch 'master' into count-global

This commit is contained in:
Nia 2021-01-29 10:57:46 -05:00 committed by GitHub
commit 13db91379f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 3 deletions

View file

@ -143,7 +143,6 @@ func (e *executor) Close() error {
// Execute executes a PQL query.
func (e *executor) Execute(ctx context.Context, index string, q *pql.Query, shards []uint64, opt *execOptions) (QueryResponse, error) {
span, ctx := tracing.StartSpanFromContext(ctx, "Executor.Execute")
span.LogKV("pql", q.String())
defer span.Finish()
@ -1516,7 +1515,18 @@ func executeDistinctShardSet(ctx context.Context, qcx *Qcx, idx *Index, fieldNam
fragData, _, err := tx.ContainerIterator(index, fieldName, "standard", shard, 0)
switch errors.Cause(err) {
case ViewNotFound, FragmentNotFound:
return nil, nil
// It may seem reasonable to return `nil` here in the case where the
// fragment for this shard does not exist. The problem with doing that
// is that if this operation is being performed on a remote node, then
// this result is going to get serialized as a QueryResponse and sent
// back to the original, non-remote node. When this happens, the
// encodeRow/decodeRow logic replaces `nil` with an empty Row. An empty
// Row will cause problems during the union step of the reduce phase if
// it is the "left" side of the union, because then the resulting Row
// after the union will have blank Index and Field values. Here, we
// ensure that we send a non-nil Row with valid Index and Field values
// so that the union step doesn't cause problems.
return &Row{Index: index, Field: fieldName}, nil
case nil:
default:
return nil, errors.Wrap(err, "getting fragment data")

@ -1 +1 @@
Subproject commit 36f453c1ea3bf86c546a8ad4a88f2a926724d683
Subproject commit 28c2313ecfcd7e083d42d4e409483e968b4c421b

View file

@ -24,6 +24,7 @@ import (
"context"
"crypto/tls"
"io"
"io/ioutil"
"log"
"math/rand"
"net"
@ -31,6 +32,7 @@ import (
"os/signal"
"runtime"
"strconv"
"strings"
"sync"
"syscall"
"time"
@ -152,6 +154,20 @@ func (m *Command) Start() (err error) {
return errors.Wrap(err, "setting up server")
}
if runtime.GOOS == "linux" {
result, err := ioutil.ReadFile("/proc/sys/vm/max_map_count")
if err != nil {
m.logger.Printf("Tried unsuccessfully to check system mmap limit: %v", err)
} else {
sysMmapLimit, err := strconv.ParseUint(strings.TrimSuffix(string(result), "\n"), 10, 64)
if err != nil {
m.logger.Printf("Tried unsuccessfully to check system mmap limit: %v", err)
} else if m.Config.MaxMapCount > sysMmapLimit {
m.logger.Printf("WARNING: Config max map limit (%v) is greater than current system limits (%v)", m.Config.MaxMapCount, sysMmapLimit)
}
}
}
// Set up networking (i.e. gossip)
err = m.setupNetworking()
if err != nil {