Skip to content

Commit

Permalink
fix table comments (pingcap#3184)
Browse files Browse the repository at this point in the history
  • Loading branch information
hongyuanw authored and ngaut committed Apr 29, 2017
1 parent 21c3274 commit 892e3a8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion table/tables/bounded_tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ import (
)

const (
// We want to ensure our initial record id greater than a threshold.
// initialRecordID means initial record id, and we want to ensure our initial record id greater than a threshold.
initialRecordID int64 = 123
// invalidRecordID means invalid record id.
// In our case, a valid record will always greater than 0, so we use a
// macro to mark an invalid one.
invalidRecordID int64 = 0
Expand Down
2 changes: 1 addition & 1 deletion table/tables/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (c *indexIter) Next() (val []types.Datum, h int64, err error) {
return
}

// kvIndex is the data structure for index data in the KV store.
// index is the data structure for index data in the KV store.
type index struct {
tblInfo *model.TableInfo
idxInfo *model.IndexInfo
Expand Down
12 changes: 6 additions & 6 deletions table/tables/tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func (t *Table) setOnUpdateData(ctx context.Context, touched map[int]bool, data
return nil
}

// Fill untouched columns with original values.
// composeNewData fills untouched columns with original values.
// TODO: consider col state
func (t *Table) composeNewData(touched map[int]bool, newData []types.Datum, oldData []types.Datum) {
for i, od := range oldData {
Expand Down Expand Up @@ -359,7 +359,7 @@ func (t *Table) AddRecord(ctx context.Context, r []types.Datum) (recordID int64,
return recordID, nil
}

// Generate index content string representation.
// genIndexKeyStr generates index content string representation.
func (t *Table) genIndexKeyStr(colVals []types.Datum) (string, error) {
// Pass pre-composed error to txn.
strVals := make([]string, 0, len(colVals))
Expand All @@ -377,7 +377,7 @@ func (t *Table) genIndexKeyStr(colVals []types.Datum) (string, error) {
return strings.Join(strVals, "-"), nil
}

// Add data into indices.
// addIndices adds data into indices.
func (t *Table) addIndices(ctx context.Context, recordID int64, r []types.Datum, bs *kv.BufferStore) (int64, error) {
txn := ctx.Txn()
// Clean up lazy check error environment
Expand Down Expand Up @@ -548,7 +548,7 @@ func (t *Table) removeRowData(ctx context.Context, h int64) error {
return nil
}

// removeRowAllIndex removes all the indices of a row.
// removeRowIndices removes all the indices of a row.
func (t *Table) removeRowIndices(ctx context.Context, h int64, rec []types.Datum) error {
for _, v := range t.indices {
vals, err := v.FetchValues(rec)
Expand All @@ -569,15 +569,15 @@ func (t *Table) removeRowIndices(ctx context.Context, h int64, rec []types.Datum
return nil
}

// RemoveRowIndex implements table.Table RemoveRowIndex interface.
// removeRowIndex implements table.Table RemoveRowIndex interface.
func (t *Table) removeRowIndex(rm kv.RetrieverMutator, h int64, vals []types.Datum, idx table.Index) error {
if err := idx.Delete(rm, vals, h); err != nil {
return errors.Trace(err)
}
return nil
}

// BuildIndexForRow implements table.Table BuildIndexForRow interface.
// buildIndexForRow implements table.Table BuildIndexForRow interface.
func (t *Table) buildIndexForRow(rm kv.RetrieverMutator, h int64, vals []types.Datum, idx table.Index) error {
if idx.Meta().State == model.StateDeleteOnly || idx.Meta().State == model.StateDeleteReorganization {
// If the index is in delete only or write reorganization state, we can not add index.
Expand Down

0 comments on commit 892e3a8

Please sign in to comment.