Skip to content

Fix error 4320 (MINVALUE must be less than MAXVALUE) when ALTER SEQUENCE RESTART START WITH after nextval #459

@chyujing

Description

@chyujing

Environment

  • Version: 5.7.25 OceanBase seekdb (r) (Built 1-1d32563d30803aee72e7ce1f61b690dddf6e66d5 Apr 3 2026)
  • Is this an RD-provided temporary version?: No
  • Reproducibility: Always reproducible (必现)

Description

When running the sequence.restart_mysql mysqltest, an error occurs after executing NEXTVAL on a sequence followed by an ALTER SEQUENCE ... RESTART START WITH command. The operation fails with error code 4320 and the message "MINVALUE must be less than MAXVALUE". The expected behavior is for the test case to pass, matching the result of the sequence.restart_mysql test.

Steps to Reproduce

  1. Connect using: mysql -uroot -h -P 2881
  2. Execute the following SQL statements:
CREATE TABLE t1 (c1 INT);
INSERT INTO t1 VALUES (1);
CREATE SEQUENCE seq1;
SELECT seq1.nextval FROM t1;
ALTER SEQUENCE seq1 RESTART START WITH 10;

Actual Result: Error 4320.
Expected Result: The operation should succeed, consistent with the sequence.restart_mysql test result.

Additional Context

  • Machine/Path: /obdata/data/AndroidTest/ob_opensource_test/tools/deploy
  • Steps to run the mysqltest:
export OCEANBASE_HOME=/obdata/data/AndroidTest/ob_opensource_test/
cd ${OCEANBASE_HOME}/tools/deploy
source activate_obd.sh
export OBD_SEEKDB_STATUS_FALLBACK_TCP=1

obd test mysqltest test_env --mysqltest-bin=${OCEANBASE_HOME}/deps/3rd/u01/obclient/bin/mysqltest --obclient-bin=${OCEANBASE_HOME}/deps/3rd/u01/obclient/bin/obclient --init-only --init-sql-dir=${OCEANBASE_HOME}/tools/deploy --init-sql-files='init.sql,init_user.sql|root@sys|test'
obd test mysqltest test_env --mysqltest-bin=${OCEANBASE_HOME}/deps/3rd/u01/obclient/bin/mysqltest --obclient-bin=${OCEANBASE_HOME}/deps/3rd/u01/obclient/bin/obclient --disable-reboot --test-set=sequence.restart_mysql

Notes

  • The issue was reported from an external business context. Please refer to internal guidelines for classifying the work item type (客服反馈, 线上问题, 线上故障) based on its impact stage (pre-release, post-release, production incident).
  • Screenshots were provided in the original report but are not included here as they contain internal URLs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions