Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

bugfix:fix debug mod and homedir config in yaml #990

Merged
merged 1 commit into from
Oct 22, 2019

Conversation

yunfeiyanggzq
Copy link
Member

@yunfeiyanggzq yunfeiyanggzq commented Oct 10, 2019

Signed-off-by: yunfeiyangbuaa [email protected]

Ⅰ. Describe what this PR did

we can't config debug mod and homedir in yaml file because init config after init log and use option to config the log instead of cfg

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)

Ⅳ. Describe how to verify it

the yaml file is

base:
  listenPort: 9002
  downloadPort: 9001
  advertiseIP: 102.168.50.156
  failAccessInterval: 2m0s
  gcInitialDelay: 3s
  gcMetaInterval: 10m0s
  taskExpireTime: 2m0s
  peerGCDelay: 100m0s
  gcDiskInterval: 120s
  debug: true

the command is

sudo go run main.go --config /home/yunfeiyang/yml/supernode.yml --port 8090 --advertise-ip 127.0.0.2
the config result is

2019-10-10 15:35:44.417 DEBU sign:16151 : get supernode config: base:
  listenPort: 8090
  downloadPort: 9001
  homeDir: /home/admin/supernode
  schedulerCorePoolSize: 10
  downloadPath: /home/admin/supernode/repo/download
  peerUpLimit: 5
  peerDownLimit: 4
  eliminationLimit: 5
  failureCountLimit: 5
  linkLimit: 20480GB
  systemReservedBandwidth: 20480GB
  maxBandwidth: 204800GB
  enableProfiler: false
  debug: true
  advertiseIP: 127.0.0.2
  failAccessInterval: 2m0s
  gcInitialDelay: 3s
  gcMetaInterval: 10m0s
  taskExpireTime: 2m0s
  peerGCDelay: 1h40m0s
  gcDiskInterval: 2m0s
  youngGCThreshold: 100GB
  fullGCThreshold: 5GB
  IntervalThreshold: 2h0m0s
  cleanratio: 1
plugins: {}
storages: {}

Ⅴ. Special notes for reviews

@pouchrobot pouchrobot added kind/bug This is bug report for project size/S labels Oct 10, 2019
@codecov-io
Copy link

codecov-io commented Oct 10, 2019

Codecov Report

Merging #990 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #990   +/-   ##
=======================================
  Coverage   46.93%   46.93%           
=======================================
  Files         115      115           
  Lines        6954     6954           
=======================================
  Hits         3264     3264           
  Misses       3434     3434           
  Partials      256      256
Impacted Files Coverage Δ
cmd/supernode/app/root.go 68.85% <0%> (ø) ⬆️
...get/core/downloader/p2p_downloader/power_client.go 52.17% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f4870ac...fe078b1. Read the comment docs.

@yunfeiyanggzq yunfeiyanggzq changed the title bugfix:fix debug mod config [WIP]bugfix:fix debug mod config Oct 10, 2019
@yunfeiyanggzq
Copy link
Member Author

@starnop @lowzj emmmm,I find supernode init log before init config in previous code
I make init config before init log so we can set log mod in debug mod.
but, if init config goes wrong like ERRO[0000] failed to init properties: open /etc/dragonfly/supernode.yml: no such file or directory can't bean written to log and it will print in cli.do you have some good idea

@yeya24
Copy link
Collaborator

yeya24 commented Oct 10, 2019

Actually I don' t think it is a good idea to support debug in both config file and startup flags. For simplicity in one place is enough.

cmd/supernode/app/root.go Outdated Show resolved Hide resolved
cmd/supernode/app/root.go Outdated Show resolved Hide resolved
@starnop
Copy link
Contributor

starnop commented Oct 12, 2019

@starnop @lowzj emmmm,I find supernode init log before init config in previous code
I make init config before init log so we can set log mod in debug mod.
but, if init config goes wrong like ERRO[0000] failed to init properties: open /etc/dragonfly/supernode.yml: no such file or directory can't bean written to log and it will print in cli.do you have some good idea

Maybe you could make a reload.

@yunfeiyanggzq yunfeiyanggzq force-pushed the d branch 2 times, most recently from 45b7adc to be91582 Compare October 12, 2019 11:25
@yunfeiyanggzq yunfeiyanggzq changed the title [WIP]bugfix:fix debug mod config bugfix:fix debug mod config Oct 12, 2019
@yunfeiyanggzq
Copy link
Member Author

@starnop please review this pr again

@yunfeiyanggzq yunfeiyanggzq changed the title bugfix:fix debug mod config bugfix:fix debug mod and homedir config in yaml Oct 12, 2019
@starnop
Copy link
Contributor

starnop commented Oct 15, 2019

Could you please rebase the code? And please pay attention the comment here.

@yunfeiyanggzq
Copy link
Member Author

Done @starnop

@starnop
Copy link
Contributor

starnop commented Oct 22, 2019

LGTM>

@starnop starnop merged commit 0f78781 into dragonflyoss:master Oct 22, 2019
starnop added a commit to starnop/Dragonfly that referenced this pull request Nov 27, 2019
bugfix:fix debug mod and homedir config in yaml
inoc603 pushed a commit to inoc603/Dragonfly that referenced this pull request Dec 23, 2019
bugfix:fix debug mod and homedir config in yaml
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug This is bug report for project size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants