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

parser: cleanup parser/scanner error. #145

Merged
merged 2 commits into from
Sep 15, 2015

Conversation

qiuyesuifeng
Copy link
Member

No description provided.

err := errors.New(fmt.Sprintf("line %d column %d near \"%s\"", ln, c, l.val) + argStr)
l.errs = append(l.errs, err)
}

func (l *lexer) err(s string, args ...interface{}) {
l.err0(l.line, l.col, args...)
func (l *lexer) err(arg interface{}) {
Copy link
Member

Choose a reason for hiding this comment

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

we can support errf(format string, args ...string).

btw, I think err(args ...interface{}) may be the correct format, you can see

https://golang.org/pkg/fmt/#Sprint

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually I prefer err(string), but i found that many places use l.err(err), so i update function to err(interface{}) for less modifications.
i don't choose err(args ...interface{}) is that using string or error as input is enough now, and also if err(arg1, arg2), seems have to add some separators for better print.

@qiuyesuifeng
Copy link
Member Author

@zimulala PTAL

@shenli
Copy link
Member

shenli commented Sep 15, 2015

LGTM

1 similar comment
@zimulala
Copy link
Contributor

LGTM

zimulala added a commit that referenced this pull request Sep 15, 2015
@zimulala zimulala merged commit f651e32 into master Sep 15, 2015
@zimulala zimulala deleted the qiuyesuifeng/cleanup-parse-error branch September 15, 2015 02:59
YuJuncen pushed a commit to YuJuncen/tidb that referenced this pull request Apr 23, 2021
…ingcap#145)

* *: parse the data source directly into data and skip the KV encoder

This skips the more complex pingcap/parser, and speeds up parsing speed
by 50%.

We have also refactored the KV delivery mechanism to use channels
directly, and revamped metrics:

- Make the metrics about engines into its own `engines` counter. The
  `tables` counter is exclusively about tables now.
- Removed `block_read_seconds`, `block_read_bytes`, `block_encode_seconds`
  since the concept of "block" no longer applies. Replaced by the
  equivalents named `row_***`.
- Removed `chunk_parser_read_row_seconds` for being overlapping with
  `row_read_seconds`.
- Changed `block_deliver_bytes` into a histogram vec, with kind=index
  or kind=data. Introduced `block_deliver_kv_pairs`.

* tests,restore: prevent spurious error in checkpoint_chunks test

Only kill Lightning if the whole chunk is imported exactly. The chunk
checkpoint may be recorded before a chunk is fully written, and this will
hit the failpoint more than 5 times.

* kv: use composed interface to simplify some types

* kv: properly handle the SQL mode

* common: disable IsContextCanceledError() when log level = debug

This helps debugging some mysterious cancellation where the log is
inhibited.

Added IsReallyContextCanceledError() for code logic affected by error
type.

* restore: made some log more detailed

* restore: made the SlowDownImport failpoint apply to index engines too

* restore: do not open a write stream when there are no KV pairs to send

* tests: ensure we drop the checkpoints DB before re-run

* mydump: fixed various off-by-one errors in the CSV parser

* *: rename `!IsContextCanceledError` to `ShouldLogError`

* *: addressed comments

* restore: zero the checksums and column permutations on initialization

* *: addressed comments

* tests: add back a missing license header

* tests: improve a comment.
YuJuncen pushed a commit to YuJuncen/tidb that referenced this pull request Apr 23, 2021
…gcap#158 (pingcap#159)

* tests: fix a test failure due to conflict between pingcap#145 and pingcap#158

* restore: apply the row count limit to failpoint KillIfImportedChunk too
nolouch pushed a commit to tidblabs/tidb that referenced this pull request Jan 6, 2023
…ase 6.4` rate limit (pingcap#155)

* merge pr#130,pingcap#133 into 6.4

Signed-off-by: zeminzhou <zhouzemin@pingcap.com>

* fix start limit rate

Signed-off-by: zeminzhou <zhouzemin@pingcap.com>

* default config

Signed-off-by: zeminzhou <zhouzemin@pingcap.com>

* keyspace: use `user_storage_size` instead of `storage_size` for ratelimit (pingcap#145)

* use user_storage_size instead of storage_size for ratelimit

Signed-off-by: zeminzhou <zhouzemin@pingcap.com>

* update golang.org/x/text to 0.3.8

Signed-off-by: zeminzhou <zhouzemin@pingcap.com>

* Fix error handle when loadKeyspace failed at startup (pingcap#143)

Signed-off-by: yongman <yming0221@gmail.com>

Signed-off-by: yongman <yming0221@gmail.com>

* add keyspace-activate mode (pingcap#142)

* fix loadkeyspace nil (pingcap#144)

* fix loadkeyspace nil

Signed-off-by: ystaticy <y_static_y@sina.com>

* retry load keyspace

Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>

* address comments

Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>

Signed-off-by: ystaticy <y_static_y@sina.com>
Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>
Co-authored-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>

* Compatible with old pd

Signed-off-by: zeminzhou <zhouzemin@pingcap.com>

Signed-off-by: zeminzhou <zhouzemin@pingcap.com>
Signed-off-by: yongman <yming0221@gmail.com>
Signed-off-by: ystaticy <y_static_y@sina.com>
Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>
Co-authored-by: yongman <yming0221@gmail.com>
Co-authored-by: better0332 <better0332@163.com>
Co-authored-by: ystaticy <y_static_y@sina.com>
Co-authored-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>

* make check

Signed-off-by: zeminzhou <zhouzemin@pingcap.com>

* fix confict

Signed-off-by: zeminzhou <zhouzemin@pingcap.com>

* make check

Signed-off-by: zeminzhou <zhouzemin@pingcap.com>

Signed-off-by: zeminzhou <zhouzemin@pingcap.com>
Signed-off-by: yongman <yming0221@gmail.com>
Signed-off-by: ystaticy <y_static_y@sina.com>
Signed-off-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>
Co-authored-by: yongman <yming0221@gmail.com>
Co-authored-by: better0332 <better0332@163.com>
Co-authored-by: ystaticy <y_static_y@sina.com>
Co-authored-by: David <8039876+AmoebaProtozoa@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants