Skip to content
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

uniform lightning related errmessage text to lightning_error file. #5

Merged
merged 1 commit into from
May 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions ddl/lightning/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func InitGolbalLightningBackendEnv() (err error) {
GlobalLightningEnv.Status = cfg.Status.StatusPort
if err := GlobalLightningEnv.initSortPath(); err != nil {
GlobalLightningEnv.IsInited = false
log.L().Warn("Lightning init failed: ", zap.String("Os error", err.Error()))
log.L().Warn(LWAR_ENV_INIT_FAILD, zap.String("Os error", err.Error()))
return err
}
if GlobalLightningEnv.IsInited {
Expand All @@ -83,16 +83,15 @@ func InitGolbalLightningBackendEnv() (err error) {
// Todo need to set Memory limitation, temp set to 128 G
GlobalLightningEnv.LitMemRoot.init(maxMemLimation)
log.SetAppLogger(logutil.BgLogger())
log.L().Info("Lightning: Init global lightning backend environment finished.")
log.L().Info(LInfo_ENV_INIT_SUCC)
GlobalLightningEnv.IsInited = true
return nil
}

func (l *LightningEnv) parseDiskQuota() {
sz, err := lcom.GetStorageSize(l.SortPath)
if err != nil {
log.L().Warn("Lightning: GetStorageSize err:", zap.String("Os error:", err.Error()), zap.String("default size", "10G"))
l.diskQuota = 10 * _gb
log.L().Warn(LERR_GET_STORAGE_QUOTA, zap.String("Os error:", err.Error()), zap.String("default size", "10G"))
return
}
l.diskQuota = int64(sz.Available)
Expand Down
20 changes: 20 additions & 0 deletions ddl/lightning/lightning_error.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package lightning


const (
// Error message
LERR_ALLOC_MEM_FAILED string = "Lightning: Alloc memory failed."
LERR_OUT_OF_MAX_MEM string = "Lightning: Memory is used up for Lightning add index."
LERR_NO_MEM_TYPE string = "Lightning: Unking structure for Lightning add index."
LERR_CREATE_BACKEND_FAILED string = "Lightning: Build lightning backend failed, will use kernel index reorg method to backfill the index."
LERR_CREATE_ENGINE_FAILED string = "Lightning: Build lightning engine failed, will use kernel index reorg method to backfill the index."
LERR_CREATE_CONTEX_FAILED string = "Lightning: Build lightning worker context failed, will use kernel index reorg method to backfill the index."
LERR_GET_ENGINE_FAILED string = "Lightning: Use key get engininfo failed."
LERR_GET_STORAGE_QUOTA string = "Lightning: Get storage quota err:"

// Warning message
LWAR_ENV_INIT_FAILD string = "Lightning: initialize environment failed"

// Info message
LInfo_ENV_INIT_SUCC string = "Lightning: Init global lightning backend environment finished."
)
9 changes: 0 additions & 9 deletions ddl/lightning/mem_mgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,6 @@ const (
BUILD_BACKEND_CONTEXT BuildType = 1
BUILD_ENGINE_INFO BuildType = 2
BUILD_WORKER_CONTEXT BuildType = 3

// Error msg
LERR_ALLOC_MEM_FAILED string = "Lightning: Alloc memory failed."
LERR_OUT_OF_MAX_MEM string = "Lightning: Memory is used up for Lightning add index."
LERR_NO_MEM_TYPE string = "Lightning: Unking structure for Lightning add index."
LERR_CREATE_BACKEND_FAILED string = "Lightning: Build lightning backend failed, will use kernel index reorg method to backfill the index."
LERR_CREATE_ENGINE_FAILED string = "Lightning: Build lightning engine failed, will use kernel index reorg method to backfill the index."
LERR_CREATE_CONTEX_FAILED string = "Lightning: Build lightning worker context failed, will use kernel index reorg method to backfill the index."
LERR_GET_ENGINE_FAILED string = "Lightning: Use key get engininfo failed."
)

// MemoryRoot is used to trace the memory usage of all light DDL environment.
Expand Down