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

Error occurred when read table stats for table, The error message is [types:1690]constant -9223372036854775808 overflows int #7868

Closed
darren opened this issue Oct 11, 2018 · 9 comments
Assignees
Labels
component/statistics type/bug The issue is confirmed as a bug.

Comments

@darren
Copy link
Contributor

darren commented Oct 11, 2018

Bug Report

  1. What did you do?
    update tidb cluster from 2.0.6 to 2.1.rc3

  2. What did you expect to see?
    query should be very fast.

  3. What did you see instead?

    query on some table is very slow, the error message is

2018/10/11 09:33:54.919 handle.go:152: [debug] Error occurred when read table stats for table t1_domain_cl. The error message is [types:1690]constant -9223372036854775808 overflows int
github.com/pingcap/tidb/vendor/github.com/pkg/errors.AddStack
	/go/src/github.com/pingcap/tidb/vendor/github.com/pkg/errors/errors.go:173
github.com/pingcap/tidb/terror.(*Error).GenWithStack
	/go/src/github.com/pingcap/tidb/terror/terror.go:224
github.com/pingcap/tidb/types.overflow
	/go/src/github.com/pingcap/tidb/types/etc.go:213
github.com/pingcap/tidb/types.ConvertIntToInt
	/go/src/github.com/pingcap/tidb/types/convert.go:89
github.com/pingcap/tidb/types.(*Datum).toSignedInteger
	/go/src/github.com/pingcap/tidb/types/datum.go:1403
github.com/pingcap/tidb/types.(*Datum).convertToInt
	/go/src/github.com/pingcap/tidb/types/datum.go:845
github.com/pingcap/tidb/types.(*Datum).ConvertTo
	/go/src/github.com/pingcap/tidb/types/datum.go:672
github.com/pingcap/tidb/statistics.(*Handle).histogramFromStorage
	/go/src/github.com/pingcap/tidb/statistics/histogram.go:309
github.com/pingcap/tidb/statistics.(*Handle).columnStatsFromStorage
	/go/src/github.com/pingcap/tidb/statistics/table.go:195
github.com/pingcap/tidb/statistics.(*Handle).tableStatsFromStorage
	/go/src/github.com/pingcap/tidb/statistics/table.go:265
github.com/pingcap/tidb/statistics.(*Handle).Update
	/go/src/github.com/pingcap/tidb/statistics/handle.go:149
github.com/pingcap/tidb/domain.(*Domain).updateStatsWorker
	/go/src/github.com/pingcap/tidb/domain/domain.go:738
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:2361.

I have tried analyze table t1_domain_cl manually, it takes 2 hours to finish. but the error persists.

stats data in stats_buckets

TiDB-Server [mysql]> select * from stats_buckets where table_id = 511 limit 10;
+----------+----------+---------+-----------+-------+---------+-------------+----------------------+
| table_id | is_index | hist_id | bucket_id | count | repeats | upper_bound | lower_bound          |
+----------+----------+---------+-----------+-------+---------+-------------+----------------------+
|      511 |        0 |       1 |         0 |    32 |       0 | 13976888    | -9223372036854775808 |
|      511 |        0 |       1 |         1 |    33 |       0 | 22171982    | 13976889             |
|      511 |        0 |       1 |         2 |    35 |       0 | 31427171    | 22171983             |
|      511 |        0 |       1 |         3 |    34 |       0 | 42153316    | 31427172             |
|      511 |        0 |       1 |         4 |    34 |       0 | 53819134    | 42153317             |
|      511 |        0 |       1 |         5 |    33 |       0 | 62127734    | 53819135             |
|      511 |        0 |       1 |         6 |    34 |       0 | 71515151    | 62127735             |
|      511 |        0 |       1 |         7 |    33 |       0 | 81125612    | 71515152             |
|      511 |        0 |       1 |         8 |    32 |       0 | 96038585    | 81125613             |
|      511 |        0 |       1 |         9 |    35 |       0 | 107480738   | 96038586             |
+----------+----------+---------+-----------+-------+---------+-------------+----------------------+
10 rows in set (0.01 sec)
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
Release Version: v2.1.0-rc.3-1-g8823f12
Git Commit Hash: 8823f12d324b0d5cc4b0750df5482d0eba521d2e
Git Branch: release-2.1
UTC Build Time: 2018-10-09 07:19:27
GoVersion: go version go1.10.4 linux/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false
@eurekaka eurekaka added type/bug The issue is confirmed as a bug. component/statistics labels Oct 11, 2018
@eurekaka
Copy link
Contributor

@darren thanks for reporting!

@lamxTyler PTAL.

@darren
Copy link
Contributor Author

darren commented Oct 11, 2018

A second run of analyze table t1_domain_cl manually seems fixed the stats info, and no errors reported any more.

@alivxxx
Copy link
Contributor

alivxxx commented Oct 11, 2018

@darren Thanks for your feedback. We will fix it soon.

@darren
Copy link
Contributor Author

darren commented Oct 16, 2018

manually analyze table on some of tables in our cluster show this error while save stats to storage

2018/10/16 09:08:02.677 session.go:737: [warning] con:0 schema_ver:4966 session error:
[types:1406]Data too long for column 'upper_bound' at row 1
github.com/pingcap/tidb/vendor/github.com/pkg/errors.AddStack
        /go/src/github.com/pingcap/tidb/vendor/github.com/pkg/errors/errors.go:173
github.com/pingcap/tidb/terror.(*Error).GenWithStack
        /go/src/github.com/pingcap/tidb/terror/terror.go:224
github.com/pingcap/tidb/executor.resetErrDataTooLong
        /go/src/github.com/pingcap/tidb/executor/write.go:186
github.com/pingcap/tidb/executor.(*InsertValues).handleErr
        /go/src/github.com/pingcap/tidb/executor/insert_common.go:175
github.com/pingcap/tidb/executor.(*InsertValues).getRow
        /go/src/github.com/pingcap/tidb/executor/insert_common.go:210
github.com/pingcap/tidb/executor.(*InsertValues).insertRows
        /go/src/github.com/pingcap/tidb/executor/insert_common.go:161
github.com/pingcap/tidb/executor.(*InsertExec).Next
        /go/src/github.com/pingcap/tidb/executor/insert.go:145
github.com/pingcap/tidb/executor.(*ExecStmt).handleNoDelayExecutor
        /go/src/github.com/pingcap/tidb/executor/adapter.go:273
github.com/pingcap/tidb/executor.(*ExecStmt).Exec
        /go/src/github.com/pingcap/tidb/executor/adapter.go:233
github.com/pingcap/tidb/session.runStmt
        /go/src/github.com/pingcap/tidb/session/tidb.go:148
github.com/pingcap/tidb/session.(*session).executeStatement
        /go/src/github.com/pingcap/tidb/session/session.go:734
github.com/pingcap/tidb/session.(*session).execute
        /go/src/github.com/pingcap/tidb/session/session.go:805
github.com/pingcap/tidb/session.(*session).Execute
        /go/src/github.com/pingcap/tidb/session/session.go:755
github.com/pingcap/tidb/statistics.(*Handle).SaveStatsToStorage
        /go/src/github.com/pingcap/tidb/statistics/histogram.go:262
github.com/pingcap/tidb/executor.(*AnalyzeExec).Next
        /go/src/github.com/pingcap/tidb/executor/analyze.go:80

@alivxxx
Copy link
Contributor

alivxxx commented Oct 16, 2018

@darren Could you provide the table schema?

@darren
Copy link
Contributor Author

darren commented Oct 16, 2018

@lamxTyler

CREATE TABLE `z_article` (
  `contentId` int(10) UNSIGNED NOT NULL,
  `userId` varchar(255) NOT NULL,
  `content` json NOT NULL,
  `updateTime` bigint(20) NOT NULL,
  PRIMARY KEY (`contentId`),
  KEY `userId` (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin 
> select max(contentID), max(userId) from z_article;
+----------------+-----------------------------------------+
| max(contentID) | max(userId)                             |
+----------------+-----------------------------------------+
|       38133640 | shen-me-zhi-de-mai-qi-che-xiao-xiao-zhi |
+----------------+-----------------------------------------+
1 row in set (0.03 sec)

@alivxxx
Copy link
Contributor

alivxxx commented Oct 16, 2018

@darren Do you have some very long json content?

@darren
Copy link
Contributor Author

darren commented Oct 16, 2018

@lamxTyler

Yes, we do! we have to save big json objects:

> select max(length(content)) from z_article;
+----------------------+
| max(length(content)) |
+----------------------+
|               162214 |
+----------------------+
1 row in set (0.29 sec)

@alivxxx
Copy link
Contributor

alivxxx commented Oct 16, 2018

@darren Thanks for your feedback. We will fix it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/statistics type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

3 participants