-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix(multi-tenancy): Format namespace to human readable form #7552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -592,15 +592,16 @@ func (r *rebuilder) Run(ctx context.Context) error { | |
|
||
glog.V(1).Infof( | ||
"Rebuilding index for predicate %s: Starting process. StartTs=%d. Prefix=\n%s\n", | ||
r.attr, r.startTs, hex.Dump(r.prefix)) | ||
x.FormatNsAttr(r.attr), r.startTs, hex.Dump(r.prefix)) | ||
|
||
// Counter is used here to ensure that all keys are committed at different timestamp. | ||
// We set it to 1 in case there are no keys found and NewStreamAt is called with ts=0. | ||
var counter uint64 = 1 | ||
|
||
tmpWriter := tmpDB.NewManagedWriteBatch() | ||
stream := pstore.NewStreamAt(r.startTs) | ||
stream.LogPrefix = fmt.Sprintf("Rebuilding index for predicate %s (1/2):", r.attr) | ||
stream.LogPrefix = fmt.Sprintf("Rebuilding index for predicate %s (1/2):", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Print namespace and attr |
||
x.FormatNsAttr(r.attr)) | ||
stream.Prefix = r.prefix | ||
stream.KeyToList = func(key []byte, itr *badger.Iterator) (*bpb.KVList, error) { | ||
// We should return quickly if the context is no longer valid. | ||
|
@@ -662,19 +663,21 @@ func (r *rebuilder) Run(ctx context.Context) error { | |
return err | ||
} | ||
glog.V(1).Infof("Rebuilding index for predicate %s: building temp index took: %v\n", | ||
r.attr, time.Since(start)) | ||
x.FormatNsAttr(r.attr), time.Since(start)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here as well. Print namespace everywhere. Without the namespace, we wouldn't know which namespace is doing this operation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is already printing namespace information. predicate There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My bad. I didn't realize the formatNSAttr was adding the namespace as well. |
||
|
||
// Now we write all the created posting lists to disk. | ||
glog.V(1).Infof("Rebuilding index for predicate %s: writing index to badger", r.attr) | ||
glog.V(1).Infof("Rebuilding index for predicate %s: writing index to badger", | ||
x.FormatNsAttr(r.attr)) | ||
start = time.Now() | ||
defer func() { | ||
glog.V(1).Infof("Rebuilding index for predicate %s: writing index took: %v\n", | ||
r.attr, time.Since(start)) | ||
x.FormatNsAttr(r.attr), time.Since(start)) | ||
}() | ||
|
||
writer := pstore.NewManagedWriteBatch() | ||
tmpStream := tmpDB.NewStreamAt(counter) | ||
tmpStream.LogPrefix = fmt.Sprintf("Rebuilding index for predicate %s (2/2):", r.attr) | ||
tmpStream.LogPrefix = fmt.Sprintf("Rebuilding index for predicate %s (2/2):", | ||
x.FormatNsAttr(r.attr)) | ||
tmpStream.KeyToList = func(key []byte, itr *badger.Iterator) (*bpb.KVList, error) { | ||
l, err := ReadPostingList(key, itr) | ||
if err != nil { | ||
|
@@ -717,7 +720,8 @@ func (r *rebuilder) Run(ctx context.Context) error { | |
if err := tmpStream.Orchestrate(ctx); err != nil { | ||
return err | ||
} | ||
glog.V(1).Infof("Rebuilding index for predicate %s: Flushing all writes.\n", r.attr) | ||
glog.V(1).Infof("Rebuilding index for predicate %s: Flushing all writes.\n", | ||
x.FormatNsAttr(r.attr)) | ||
return writer.Flush() | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Print namespace as well.