INNER CODE UNIT · Go

DirectReadSegment

rwynn/gtm · gtm.go:1081

func DirectReadSegment(ctx *OpCtx, client *mongo.Client, ns string, o *Options, seg *CollectionSegment, stats *CollectionStats) (err error) {
	defer ctx.allWg.Done()
	defer ctx.DirectReadWg.Done()
	defer ctx.directReadConcWg.Done()
	task := newTask(ctx.stopC)
	defer task.Done()
	n := &N{}
	if err = n.parse(ns); err != nil {
		ctx.ErrC <- errors.Wrap(err, "Error starting direct reads. Invalid namespace")
		return
	}
	var batch int32 = 0
	if stats.AvgObjectSize > 0 {
		batch = (2 * 1024 * 1024) / stats.AvgObjectSize // 2MB divided by avg doc size
	}
	c := client.Database(n.database).Collection(n.collection)
	if o.DirectReadBounded {
		if seg.min == nil {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…