Skip to content

change gen uuid method to v7 - #13857

Merged
mergify[bot] merged 16 commits into
matrixorigin:mainfrom
YANGGMM:fix-13576-3
Jan 8, 2024
Merged

mergify[bot] merged 16 commits into
matrixorigin:mainfrom
YANGGMM:fix-13576-3

Conversation

@YANGGMM

@YANGGMM YANGGMM commented Dec 27, 2023

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #13576

What this PR does / why we need it:

change gen uuid method to v7
now just change for somekey methods not include the test file

@matrix-meow

This comment was marked as off-topic.

@YANGGMM
YANGGMM requested a review from fengttt December 27, 2023 07:02
sukki37
sukki37 previously approved these changes Dec 27, 2023

@sukki37 sukki37 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you please provide some additional test data

@YANGGMM

YANGGMM commented Dec 28, 2023

Copy link
Copy Markdown
Contributor Author

Could you please provide some additional test data

ok

@YANGGMM

YANGGMM commented Dec 28, 2023 •

Copy link
Copy Markdown
Contributor Author
 uuidv7 format
/*
		 0                   1                   2                   3
		 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
		+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
		|                           unix_ts_ms                          |
		+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
		|          unix_ts_ms           |  ver  |       rand_a          |
		+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
		|var|                        rand_b                             |
		+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
		|                            rand_b                             |
		+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
	*/

测试代码
每一ms生成一个uuid,然后测试这些uuid是否有序

func Test_UUIDWhetherInOrder(t *testing.T) {
	uuidStrs := make([]string, 0, 10000)
	uuidStrComps := make([]string, 0, 10000)
	for i := 0; i < 10000; i++ {
		uid, err := uuid.NewV7()
		assert.NoError(t, err)
		uuidStrs = append(uuidStrs, uid.String())
		uuidStrComps = append(uuidStrComps, uid.String())
		time.Sleep(time.Millisecond)
	}
	sort.Strings(uuidStrComps)
	assert.Equal(t, uuidStrComps, uuidStrs)
}

测试结果
image

测试数据增加到2w条
image

@sukki37
sukki37 dismissed their stale review December 31, 2023 02:28

pls fix ci issues first

@YANGGMM YANGGMM closed this Jan 1, 2024
@YANGGMM YANGGMM reopened this Jan 1, 2024
@matrix-meow matrix-meow added size/M Denotes a PR that changes [100,499] lines and removed size/S Denotes a PR that changes [10,99] lines labels Jan 4, 2024
@matrix-meow matrix-meow added size/S Denotes a PR that changes [10,99] lines and removed size/M Denotes a PR that changes [100,499] lines labels Jan 8, 2024
@mergify
mergify Bot merged commit 7a08b4e into matrixorigin:main Jan 8, 2024
YANGGMM added a commit to YANGGMM/matrixone that referenced this pull request Jan 22, 2024
change gen uuid method to v7
now just change for somekey methods not include the test file

Approved by: @reusee, @aunjgr, @sukki37, @nnsgmsone, @LeftHandCold, @XuPeng-SH, @zhangxu19830126, @m-schen, @daviszhen, @qingxinhome, @ouyuanning, @gavinyue
@YANGGMM
YANGGMM deleted the fix-13576-3 branch January 22, 2024 12:03
fengttt pushed a commit to fengttt/matrixone that referenced this pull request May 7, 2026
change gen uuid method to v7
now just change for somekey methods not include the test file

Approved by: @reusee, @aunjgr, @sukki37, @nnsgmsone, @LeftHandCold, @XuPeng-SH, @zhangxu19830126, @m-schen, @daviszhen, @qingxinhome, @ouyuanning, @gavinyue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement size/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.