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

sql: pre-split hash sharded indexes ranges before DELETE_AND_WRITE_ONLY #74923

Merged

Conversation

chengxiong-ruan
Copy link
Contributor

Fixes #74558

Pre-split ranges on shard boundaries before SchemaChanger move
new hash sharded indexes from DELETE_ONLY to DELETE_AND_WRITE_ONLY
state.

Release note (bug fix): None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@chengxiong-ruan chengxiong-ruan force-pushed the pre-split-hash-index-ranges branch 3 times, most recently from 417a790 to 5c8055c Compare January 18, 2022 15:55
@chengxiong-ruan
Copy link
Contributor Author

need to rebase after pr #74835 is merged

Fixes cockroachdb#74558

Pre-split ranges on shard boundaries before SchemaChanger move
new hash sharded indexes from DELETE_ONLY to DELETE_AND_WRITE_ONLY
state.

Release note (bug fix): When creating hash sharded index to an existing
table, traffic could hit hard on the single range of the index before
it is split into more ranges for shards as range size grows. This change
make schema changer able to presplit ranges on shard boundaries before
the index becomes writable. `sql.hash_sharded_range_pre_split.max` is
the cluster setting added so that users can set the upbound of the
amount of ranges to have. If the bucket count of the defined index is
less than the cluster setting, the bucket count will be the amount of
pre-split ranges.
@chengxiong-ruan
Copy link
Contributor Author


pkg/sql/logictest/testdata/logic_test/hash_sharded_index, line 910 at r1 (raw file):

);

skipif config 3node-tenant

querying crdb_internal.ranges is not supported in multi-tenant mode

@chengxiong-ruan chengxiong-ruan marked this pull request as ready for review January 20, 2022 14:33
@chengxiong-ruan chengxiong-ruan requested review from a team and ajwerner January 20, 2022 14:33
Copy link
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 5 of 6 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @ajwerner)


pkg/sql/schema_changer_test.go, line 7591 at r1 (raw file):

	tdb.Exec(t, `
SET experimental_enable_hash_sharded_indexes = on;

this reminds me, we should create an issue to track deprecating this session variable and removing the gates.

Copy link
Contributor Author

@chengxiong-ruan chengxiong-ruan left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @ajwerner)


pkg/sql/schema_changer_test.go, line 7591 at r1 (raw file):

Previously, ajwerner wrote…

this reminds me, we should create an issue to track deprecating this session variable and removing the gates.

ha, that is true. created #75442

@chengxiong-ruan
Copy link
Contributor Author

thanks for the review and adding backporting label :)
bors r+

@craig
Copy link
Contributor

craig bot commented Jan 24, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Jan 24, 2022

Build succeeded:

@craig craig bot merged commit 72c5471 into cockroachdb:master Jan 24, 2022
@blathers-crl
Copy link

blathers-crl bot commented Jan 24, 2022

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from 1723f7a to blathers/backport-release-21.2-74923: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 21.2.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

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.

sql: pre-split hash sharded indexes on shard boundaries before DELETE_AND_WRITE_ONLY
3 participants