-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
server: schema info api of http status server #5256
Conversation
server/region_handler.go
Outdated
// table schema of a specified table name | ||
cTableName := model.NewCIStr(tableName) | ||
if data, err := schema.TableByName(cDBName, cTableName); err != nil { | ||
rh.writeError(w, err) |
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.
Could we return
after writeXXX
, since we do not care about this logic anymore?
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.
Done!
/run-all-tests |
server/region_handler.go
Outdated
} | ||
rh.writeError(w, infoschema.ErrDatabaseNotExists.GenByArgs(dbName)) | ||
return | ||
} else if tableID := req.FormValue(pTableID); len(tableID) > 0 { |
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.
WIth the return in line 266, we do not need the else. So as line 280.
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.
Done.
server/region_handler_test.go
Outdated
err = decoder.Decode(&t) | ||
c.Assert(err, IsNil) | ||
|
||
resp, err = http.Get(fmt.Sprintf("http://127.0.0.1:10090/schema?table_id=a")) |
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.
If we don't check resp
, using _
is better.
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.
done
server/region_handler.go
Outdated
pRegionID = "regionID" | ||
pRecordID = "recordID" | ||
pStartTS = "startTS" | ||
pHexKey = "hexKey" | ||
pTableID = "table_id" |
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.
Should we need to use the unified format? tableID
or region_id
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.
It's based on @AndreMouche 's document. I'll check it out.
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.
Has moved it to a standalone part.
decoder := json.NewDecoder(resp.Body) | ||
var dbs []*model.DBInfo | ||
err = decoder.Decode(&dbs) | ||
c.Assert(err, IsNil) |
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.
check dbs value?
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.
done
server/region_handler_test.go
Outdated
var t *tables.MemoryTable | ||
decoder = json.NewDecoder(resp.Body) | ||
err = decoder.Decode(&t) | ||
c.Assert(err, IsNil) |
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.
ditto
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.
done
/run-all-tests |
LGTM |
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.
LGTM
PTAL @AndreMouche