Skip to content

Commit 2d9b553

Browse files
authored
Show warning message about lakectl local performance (#10374)
1 parent 07be229 commit 2d9b553

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

cmd/lakectl/cmd/common_helpers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const (
3434
LakectlInteractive = "LAKECTL_INTERACTIVE"
3535
DeathMessage = "{{.Error|red}}\nError executing command.\n"
3636
DeathMessageWithFields = "{{.Message|red}}\n{{.Status}}\n"
37-
WarnMessage = "{{.Warning|yellow}}\n\n"
37+
WarnMessage = "{{.Prefix|yellow}} {{.Message}}\n\n"
3838
)
3939

4040
const (
@@ -234,7 +234,7 @@ func WriteIfVerbose(tpl string, data any) {
234234
}
235235

236236
func Warning(message string) {
237-
WriteTo(WarnMessage, struct{ Warning string }{Warning: "Warning: " + message}, os.Stderr)
237+
WriteTo(WarnMessage, struct{ Prefix, Message string }{Prefix: "Warning:", Message: message}, os.Stderr)
238238
}
239239

240240
func Die(errMsg string, code int) {

cmd/lakectl/cmd/local.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ const (
3232
cloneOperation LocalOperation = "clone"
3333

3434
CaseInsensitiveWarningMessageFormat = `Directory '%s' is case-insensitive, versioning tools such as lakectl local and git will work incorrectly.`
35+
36+
localScalabilityWarning = `Using "lakectl local" requires a full local copy of cloned data. For a more scalable solution, please refer to: https://docs.lakefs.io/reference/mount.html`
3537
)
3638

3739
const localSummaryTemplate = `
@@ -157,6 +159,7 @@ var localCmd = &cobra.Command{
157159
Short: "Sync local directories with lakeFS paths",
158160
PersistentPreRun: func(cmd *cobra.Command, args []string) {
159161
preRunCmd(cmd)
162+
Warning(localScalabilityWarning)
160163

161164
_, localPath := getSyncArgs(args, false, false)
162165
cmdSuffix := ""

esti/lakectl_util.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ var (
3939
rePreSignURL = regexp.MustCompile(`https?://\S+\?\S+`)
4040
reSecretAccessKey = regexp.MustCompile(`secret_access_key: \S{16,128}`)
4141
reAccessKeyID = regexp.MustCompile(`access_key_id: AKIA\S{12,124}`)
42+
reLocalWarning = regexp.MustCompile(`(?m)^Warning: Using "lakectl local" requires .*\n\n?`)
4243
)
4344

4445
func lakeBinaryLocation(name string) string {
@@ -149,6 +150,7 @@ func sanitize(output string, vars map[string]string) string {
149150
// The order of execution below is important as certain expression can contain others
150151
// and so, should be handled first
151152
s := strings.ReplaceAll(output, "\r\n", "\n")
153+
s = reLocalWarning.ReplaceAllString(s, "")
152154
if _, ok := vars["DATE"]; !ok {
153155
s = normalizeProgramTimestamp(s)
154156
}

0 commit comments

Comments
 (0)