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

fix ui doesn't work when running backend without 'feature-version' option #1178

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

baurine
Copy link
Collaborator

@baurine baurine commented Feb 10, 2022

close #1177

Try to dismiss the FEATURE_VERSION conception, use PDVersion directly to reduce the understanding confusion.

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has not been approved.

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@baurine baurine marked this pull request as draft February 10, 2022 11:03
@baurine baurine marked this pull request as ready for review February 10, 2022 11:13

// The FeatureVersion value is "N/A" when running `make && bin/tidb-dashboard`
// The FeatureVersion value is "Unknown" when running `go run cmd/tidb-dashboard/main.go`
featureSupported :=
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's interesting, why do we have these two different values? Is it possible to be simply "", which is the well-known default value for a missing string?

Copy link
Collaborator Author

@baurine baurine Feb 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The config.FeatureVersion is assigned to version.PDVersion default.

func Default() *Config {
	return &Config{
		DataDir:            "/tmp/dashboard-data",
		TempDir:            "",
		PDEndPoint:         "http://127.0.0.1:2379",
		PublicPathPrefix:   defaultPublicPathPrefix,
		ClusterTLSConfig:   nil,
		TiDBTLSConfig:      nil,
		EnableTelemetry:    true,
		EnableExperimental: false,
		FeatureVersion:     version.PDVersion,
	}
}

and the version.PDVeresion default value is "Unknown".

// Version information. It will be overwritten by LDFLAGS.
var (
	InternalVersion = "Unknown"
	Standalone      = "Unknown" // Unknown, Yes or No
	PDVersion       = "Unknown"
	BuildTime       = "Unknown"
	BuildGitHash    = "Unknown"
)

Its value is overwritten to "N/A" by LDFLAGS when building in dev mode.

LDFLAGS += -X "$(DASHBOARD_PKG)/pkg/utils/version.PDVersion=N/A"

Let me try to assign FEATURE_VERSION to "" if PDVersion is "N/A" and "Unknown".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we unify the PDVersion and the FEATURE_VERSION? Maybe we can specify the pd version during development.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about not assigning version.PDVersion to Default()? Will it cause any problems?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about not assigning version.PDVersion to Default()? Will it cause any problems?

I think it should be the same effect. we eventually need to use the version.PDVersion, before or later.

@baurine baurine marked this pull request as draft February 11, 2022 08:34
@codecov-commenter
Copy link

codecov-commenter commented Feb 11, 2022

Codecov Report

Attention: Patch coverage is 50.00000% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 29.17%. Comparing base (330f96e) to head (948703b).
Report is 255 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1178      +/-   ##
==========================================
+ Coverage   29.13%   29.17%   +0.03%     
==========================================
  Files         286      286              
  Lines       16941    16933       -8     
  Branches      646      646              
==========================================
+ Hits         4936     4940       +4     
+ Misses      11774    11762      -12     
  Partials      231      231              
Flag Coverage Δ
be_integration_test_latest 9.31% <50.00%> (+0.02%) ⬆️
be_integration_test_v4.0.1 9.30% <50.00%> (+0.02%) ⬆️
be_unit_test 24.07% <0.00%> (ø)
e2e_test 63.49% <ø> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report in Codecov by Sentry.

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

Comment on lines +57 to +59
if _, err := semver.NewVersion(version.PDVersion); err != nil {
log.Fatal("Invalid sematic PD Version", zap.Error(err), zap.String("pd_version", version.PDVersion))
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the PDVersion when starting, expose the error as early as possible.

@baurine baurine marked this pull request as ready for review February 11, 2022 09:45
@ti-chi-bot
Copy link
Member

@baurine: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TiDB Dashboard cannot start with default cli args
5 participants