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

server: schema info api of http status server #5256

Merged
merged 9 commits into from
Nov 30, 2017

Conversation

jackysp
Copy link
Member

@jackysp jackysp commented Nov 29, 2017

// table schema of a specified table name
cTableName := model.NewCIStr(tableName)
if data, err := schema.TableByName(cDBName, cTableName); err != nil {
rh.writeError(w, err)
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

@jackysp
Copy link
Member Author

jackysp commented Nov 29, 2017

/run-all-tests

}
rh.writeError(w, infoschema.ErrDatabaseNotExists.GenByArgs(dbName))
return
} else if tableID := req.FormValue(pTableID); len(tableID) > 0 {
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

err = decoder.Decode(&t)
c.Assert(err, IsNil)

resp, err = http.Get(fmt.Sprintf("http://127.0.0.1:10090/schema?table_id=a"))
Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

pRegionID = "regionID"
pRecordID = "recordID"
pStartTS = "startTS"
pHexKey = "hexKey"
pTableID = "table_id"
Copy link
Contributor

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

Copy link
Member Author

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.

Copy link
Member Author

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)
Copy link
Contributor

Choose a reason for hiding this comment

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

check dbs value?

Copy link
Member Author

Choose a reason for hiding this comment

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

done

var t *tables.MemoryTable
decoder = json.NewDecoder(resp.Body)
err = decoder.Decode(&t)
c.Assert(err, IsNil)
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@jackysp
Copy link
Member Author

jackysp commented Nov 30, 2017

/run-all-tests

@tiancaiamao
Copy link
Contributor

LGTM

@tiancaiamao tiancaiamao added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 30, 2017
Copy link
Contributor

@AndreMouche AndreMouche left a comment

Choose a reason for hiding this comment

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

LGTM

@jackysp jackysp merged commit 8a5b8d5 into pingcap:master Nov 30, 2017
@jackysp jackysp deleted the index_mvcc branch November 30, 2017 11:23
jackysp added a commit to jackysp/tidb that referenced this pull request Jan 12, 2018
ngaut pushed a commit that referenced this pull request Jan 14, 2018
#5629)

* server: schema info api of http status server (#5256)

* server: support http index mvcc interface (#5304)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants