Skip to content

Commit

Permalink
Apply interface changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sejongk committed Nov 25, 2023
1 parent 5c42e17 commit af4c73d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,4 @@ jobs:
run: sleep 30s

- name: Run the tests with shard tag
run: go test -tags shard -race -v ./...
run: go test -tags shard -race -v ./test/shard/...
9 changes: 7 additions & 2 deletions server/backend/database/memory/housekeeping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ func TestHousekeeping(t *testing.T) {

userInfo, err := memdb.CreateUserInfo(ctx, "test", "test")
assert.NoError(t, err)
project, err := memdb.CreateProjectInfo(ctx, database.DefaultProjectName, userInfo.ID, clientDeactivateThreshold)
project, err := memdb.CreateProjectInfo(
ctx,
database.DefaultProjectName,
userInfo.Username,
clientDeactivateThreshold,
)
assert.NoError(t, err)

yesterday := gotime.Now().Add(-24 * gotime.Hour)
Expand Down Expand Up @@ -123,7 +128,7 @@ func createDBandProjects(t *testing.T) (*memory.DB, []*database.ProjectInfo) {

projects := make([]*database.ProjectInfo, 0)
for i := 0; i < 10; i++ {
p, err := memdb.CreateProjectInfo(ctx, fmt.Sprintf("%d project", i), userInfo.ID, clientDeactivateThreshold)
p, err := memdb.CreateProjectInfo(ctx, fmt.Sprintf("%d project", i), userInfo.Username, clientDeactivateThreshold)
assert.NoError(t, err)

projects = append(projects, p)
Expand Down
15 changes: 8 additions & 7 deletions test/bench/push_pull_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
gotime "time"

"github.com/stretchr/testify/assert"

"github.com/yorkie-team/yorkie/api/converter"
"github.com/yorkie-team/yorkie/api/types"
"github.com/yorkie-team/yorkie/pkg/document"
Expand Down Expand Up @@ -89,7 +90,7 @@ func setUpClientsAndDocs(
assert.NoError(b, err)
docInfo, err := be.DB.FindDocInfoByKeyAndOwner(ctx, database.DefaultProjectID, clientInfo.ID, docKey, true)
assert.NoError(b, err)
assert.NoError(b, clientInfo.AttachDocument(docInfo.ID))
assert.NoError(b, clientInfo.AttachDocument(docInfo.Key, docInfo.ID))
assert.NoError(b, be.DB.UpdateClientInfoAfterPushPull(ctx, clientInfo, docInfo))

bytesID, _ := clientInfo.ID.Bytes()
Expand Down Expand Up @@ -136,7 +137,7 @@ func benchmarkPushChanges(
docKey := getDocKey(b, i)
clientInfos, docID, docs := setUpClientsAndDocs(ctx, 1, docKey, b, be)
pack := createChangePack(changeCnt, docs[0], b)
docInfo, err := documents.FindDocInfo(ctx, be, project, docID)
docInfo, err := documents.FindDocInfoByKeyAndID(ctx, be, docKey, docID)
assert.NoError(b, err)
b.StartTimer()

Expand All @@ -161,12 +162,12 @@ func benchmarkPullChanges(
pushPack := createChangePack(changeCnt, pusherDoc, b)
pullPack := createChangePack(0, pullerDoc, b)

docInfo, err := documents.FindDocInfo(ctx, be, project, docID)
docInfo, err := documents.FindDocInfoByKeyAndID(ctx, be, docKey, docID)
assert.NoError(b, err)
_, err = packs.PushPull(ctx, be, project, pusherClientInfo, docInfo, pushPack, types.SyncModePushPull)
assert.NoError(b, err)

docInfo, err = documents.FindDocInfo(ctx, be, project, docID)
docInfo, err = documents.FindDocInfoByKeyAndID(ctx, be, docKey, docID)
assert.NoError(b, err)
b.StartTimer()

Expand All @@ -192,7 +193,7 @@ func benchmarkPushSnapshots(
for j := 0; j < snapshotCnt; j++ {
b.StopTimer()
pushPack := createChangePack(changeCnt, docs[0], b)
docInfo, err := documents.FindDocInfo(ctx, be, project, docID)
docInfo, err := documents.FindDocInfoByKeyAndID(ctx, be, docKey, docID)
assert.NoError(b, err)
b.StartTimer()

Expand Down Expand Up @@ -226,12 +227,12 @@ func benchmarkPullSnapshot(
pushPack := createChangePack(changeCnt, pusherDoc, b)
pullPack := createChangePack(0, pullerDoc, b)

docInfo, err := documents.FindDocInfo(ctx, be, project, docID)
docInfo, err := documents.FindDocInfoByKeyAndID(ctx, be, docKey, docID)
assert.NoError(b, err)
_, err = packs.PushPull(ctx, be, project, pusherClientInfo, docInfo, pushPack, types.SyncModePushPull)
assert.NoError(b, err)

docInfo, err = documents.FindDocInfo(ctx, be, project, docID)
docInfo, err = documents.FindDocInfoByKeyAndID(ctx, be, docKey, docID)
assert.NoError(b, err)
b.StartTimer()

Expand Down
2 changes: 2 additions & 0 deletions test/integration/retention_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ func TestRetention(t *testing.T) {

changes, err := mongoCli.FindChangesBetweenServerSeqs(
ctx,
docInfo.Key,
docInfo.ID,
change.InitialServerSeq,
change.MaxServerSeq,
Expand Down Expand Up @@ -229,6 +230,7 @@ func TestRetention(t *testing.T) {

changes, err = mongoCli.FindChangesBetweenServerSeqs(
ctx,
docInfo.Key,
docInfo.ID,
change.InitialServerSeq,
change.MaxServerSeq,
Expand Down

1 comment on commit af4c73d

@github-actions
Copy link

Choose a reason for hiding this comment

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

Go Benchmark

Benchmark suite Current: af4c73d Previous: 3acd623 Ratio
BenchmarkDocument/constructor_test - ns/op 1345 ns/op 1356 ns/op 0.99
BenchmarkDocument/constructor_test - B/op 1208 B/op 1208 B/op 1
BenchmarkDocument/constructor_test - allocs/op 20 allocs/op 20 allocs/op 1
BenchmarkDocument/status_test - ns/op 767.9 ns/op 786.3 ns/op 0.98
BenchmarkDocument/status_test - B/op 1176 B/op 1176 B/op 1
BenchmarkDocument/status_test - allocs/op 18 allocs/op 18 allocs/op 1
BenchmarkDocument/equals_test - ns/op 7116 ns/op 7138 ns/op 1.00
BenchmarkDocument/equals_test - B/op 6913 B/op 6913 B/op 1
BenchmarkDocument/equals_test - allocs/op 120 allocs/op 120 allocs/op 1
BenchmarkDocument/nested_update_test - ns/op 16102 ns/op 16201 ns/op 0.99
BenchmarkDocument/nested_update_test - B/op 11963 B/op 11962 B/op 1.00
BenchmarkDocument/nested_update_test - allocs/op 254 allocs/op 254 allocs/op 1
BenchmarkDocument/delete_test - ns/op 23160 ns/op 22198 ns/op 1.04
BenchmarkDocument/delete_test - B/op 15187 B/op 15188 B/op 1.00
BenchmarkDocument/delete_test - allocs/op 333 allocs/op 333 allocs/op 1
BenchmarkDocument/object_test - ns/op 9573 ns/op 10199 ns/op 0.94
BenchmarkDocument/object_test - B/op 6721 B/op 6721 B/op 1
BenchmarkDocument/object_test - allocs/op 116 allocs/op 116 allocs/op 1
BenchmarkDocument/array_test - ns/op 28645 ns/op 29641 ns/op 0.97
BenchmarkDocument/array_test - B/op 11818 B/op 11819 B/op 1.00
BenchmarkDocument/array_test - allocs/op 270 allocs/op 270 allocs/op 1
BenchmarkDocument/text_test - ns/op 30575 ns/op 31320 ns/op 0.98
BenchmarkDocument/text_test - B/op 14795 B/op 14795 B/op 1
BenchmarkDocument/text_test - allocs/op 468 allocs/op 468 allocs/op 1
BenchmarkDocument/text_composition_test - ns/op 28549 ns/op 29237 ns/op 0.98
BenchmarkDocument/text_composition_test - B/op 18276 B/op 18278 B/op 1.00
BenchmarkDocument/text_composition_test - allocs/op 477 allocs/op 477 allocs/op 1
BenchmarkDocument/rich_text_test - ns/op 80709 ns/op 82849 ns/op 0.97
BenchmarkDocument/rich_text_test - B/op 38540 B/op 38540 B/op 1
BenchmarkDocument/rich_text_test - allocs/op 1147 allocs/op 1147 allocs/op 1
BenchmarkDocument/counter_test - ns/op 16577 ns/op 16861 ns/op 0.98
BenchmarkDocument/counter_test - B/op 10210 B/op 10210 B/op 1
BenchmarkDocument/counter_test - allocs/op 236 allocs/op 236 allocs/op 1
BenchmarkDocument/text_edit_gc_100 - ns/op 2887184 ns/op 2985130 ns/op 0.97
BenchmarkDocument/text_edit_gc_100 - B/op 1655356 B/op 1655239 B/op 1.00
BenchmarkDocument/text_edit_gc_100 - allocs/op 17093 allocs/op 17092 allocs/op 1.00
BenchmarkDocument/text_edit_gc_1000 - ns/op 229045754 ns/op 234174280 ns/op 0.98
BenchmarkDocument/text_edit_gc_1000 - B/op 144336366 B/op 144368132 B/op 1.00
BenchmarkDocument/text_edit_gc_1000 - allocs/op 200888 allocs/op 201011 allocs/op 1.00
BenchmarkDocument/text_split_gc_100 - ns/op 3353347 ns/op 3436736 ns/op 0.98
BenchmarkDocument/text_split_gc_100 - B/op 2313632 B/op 2313433 B/op 1.00
BenchmarkDocument/text_split_gc_100 - allocs/op 16195 allocs/op 16193 allocs/op 1.00
BenchmarkDocument/text_split_gc_1000 - ns/op 289418560 ns/op 292485836 ns/op 0.99
BenchmarkDocument/text_split_gc_1000 - B/op 228893380 B/op 228890592 B/op 1.00
BenchmarkDocument/text_split_gc_1000 - allocs/op 203945 allocs/op 203938 allocs/op 1.00
BenchmarkDocument/text_delete_all_10000 - ns/op 10436668 ns/op 11958204 ns/op 0.87
BenchmarkDocument/text_delete_all_10000 - B/op 5810636 B/op 5811760 B/op 1.00
BenchmarkDocument/text_delete_all_10000 - allocs/op 40675 allocs/op 40681 allocs/op 1.00
BenchmarkDocument/text_delete_all_100000 - ns/op 181028725 ns/op 192054829 ns/op 0.94
BenchmarkDocument/text_delete_all_100000 - B/op 81906384 B/op 81904042 B/op 1.00
BenchmarkDocument/text_delete_all_100000 - allocs/op 411654 allocs/op 411636 allocs/op 1.00
BenchmarkDocument/text_100 - ns/op 220607 ns/op 233920 ns/op 0.94
BenchmarkDocument/text_100 - B/op 118483 B/op 118483 B/op 1
BenchmarkDocument/text_100 - allocs/op 5080 allocs/op 5080 allocs/op 1
BenchmarkDocument/text_1000 - ns/op 2371112 ns/op 2472786 ns/op 0.96
BenchmarkDocument/text_1000 - B/op 1153068 B/op 1153071 B/op 1.00
BenchmarkDocument/text_1000 - allocs/op 50084 allocs/op 50084 allocs/op 1
BenchmarkDocument/array_1000 - ns/op 1174775 ns/op 1226516 ns/op 0.96
BenchmarkDocument/array_1000 - B/op 1091203 B/op 1091288 B/op 1.00
BenchmarkDocument/array_1000 - allocs/op 11825 allocs/op 11826 allocs/op 1.00
BenchmarkDocument/array_10000 - ns/op 12826133 ns/op 13448793 ns/op 0.95
BenchmarkDocument/array_10000 - B/op 9801738 B/op 9798818 B/op 1.00
BenchmarkDocument/array_10000 - allocs/op 120299 allocs/op 120286 allocs/op 1.00
BenchmarkDocument/array_gc_100 - ns/op 139252 ns/op 153630 ns/op 0.91
BenchmarkDocument/array_gc_100 - B/op 132491 B/op 132479 B/op 1.00
BenchmarkDocument/array_gc_100 - allocs/op 1248 allocs/op 1248 allocs/op 1
BenchmarkDocument/array_gc_1000 - ns/op 1343499 ns/op 1430382 ns/op 0.94
BenchmarkDocument/array_gc_1000 - B/op 1159019 B/op 1158905 B/op 1.00
BenchmarkDocument/array_gc_1000 - allocs/op 12865 allocs/op 12864 allocs/op 1.00
BenchmarkDocument/counter_1000 - ns/op 197695 ns/op 212571 ns/op 0.93
BenchmarkDocument/counter_1000 - B/op 192854 B/op 192851 B/op 1.00
BenchmarkDocument/counter_1000 - allocs/op 5765 allocs/op 5765 allocs/op 1
BenchmarkDocument/counter_10000 - ns/op 2168480 ns/op 2224184 ns/op 0.97
BenchmarkDocument/counter_10000 - B/op 2087767 B/op 2087765 B/op 1.00
BenchmarkDocument/counter_10000 - allocs/op 59772 allocs/op 59772 allocs/op 1
BenchmarkDocument/object_1000 - ns/op 1306306 ns/op 1424367 ns/op 0.92
BenchmarkDocument/object_1000 - B/op 1428094 B/op 1428068 B/op 1.00
BenchmarkDocument/object_1000 - allocs/op 9845 allocs/op 9845 allocs/op 1
BenchmarkDocument/object_10000 - ns/op 14252124 ns/op 14642658 ns/op 0.97
BenchmarkDocument/object_10000 - B/op 12168400 B/op 12167843 B/op 1.00
BenchmarkDocument/object_10000 - allocs/op 100564 allocs/op 100562 allocs/op 1.00
BenchmarkDocument/tree_100 - ns/op 682622 ns/op 744469 ns/op 0.92
BenchmarkDocument/tree_100 - B/op 442879 B/op 442890 B/op 1.00
BenchmarkDocument/tree_100 - allocs/op 4506 allocs/op 4506 allocs/op 1
BenchmarkDocument/tree_1000 - ns/op 46171861 ns/op 50380066 ns/op 0.92
BenchmarkDocument/tree_1000 - B/op 35222855 B/op 35222527 B/op 1.00
BenchmarkDocument/tree_1000 - allocs/op 44119 allocs/op 44118 allocs/op 1.00
BenchmarkDocument/tree_10000 - ns/op 6009030049 ns/op 6537517333 ns/op 0.92
BenchmarkDocument/tree_10000 - B/op 3439192128 B/op 3438881024 B/op 1.00
BenchmarkDocument/tree_10000 - allocs/op 440190 allocs/op 440197 allocs/op 1.00
BenchmarkDocument/tree_delete_all_1000 - ns/op 46168403 ns/op 50383873 ns/op 0.92
BenchmarkDocument/tree_delete_all_1000 - B/op 35687612 B/op 35686781 B/op 1.00
BenchmarkDocument/tree_delete_all_1000 - allocs/op 51747 allocs/op 51744 allocs/op 1.00
BenchmarkDocument/tree_edit_gc_100 - ns/op 2502758 ns/op 2640190 ns/op 0.95
BenchmarkDocument/tree_edit_gc_100 - B/op 2099462 B/op 2100192 B/op 1.00
BenchmarkDocument/tree_edit_gc_100 - allocs/op 11165 allocs/op 11165 allocs/op 1
BenchmarkDocument/tree_edit_gc_1000 - ns/op 183207642 ns/op 203482588 ns/op 0.90
BenchmarkDocument/tree_edit_gc_1000 - B/op 180290642 B/op 180290254 B/op 1.00
BenchmarkDocument/tree_edit_gc_1000 - allocs/op 113336 allocs/op 113352 allocs/op 1.00
BenchmarkDocument/tree_split_gc_100 - ns/op 1833681 ns/op 1956842 ns/op 0.94
BenchmarkDocument/tree_split_gc_100 - B/op 1363459 B/op 1363460 B/op 1.00
BenchmarkDocument/tree_split_gc_100 - allocs/op 8735 allocs/op 8735 allocs/op 1
BenchmarkDocument/tree_split_gc_1000 - ns/op 122943556 ns/op 135715287 ns/op 0.91
BenchmarkDocument/tree_split_gc_1000 - B/op 120283747 B/op 120284779 B/op 1.00
BenchmarkDocument/tree_split_gc_1000 - allocs/op 96185 allocs/op 96190 allocs/op 1.00
BenchmarkRPC/client_to_server - ns/op 358116613 ns/op 359703488 ns/op 1.00
BenchmarkRPC/client_to_server - B/op 12484170 B/op 12458544 B/op 1.00
BenchmarkRPC/client_to_server - allocs/op 177388 allocs/op 176321 allocs/op 1.01
BenchmarkRPC/client_to_client_via_server - ns/op 598149990 ns/op 603988013 ns/op 0.99
BenchmarkRPC/client_to_client_via_server - B/op 23209092 B/op 23259432 B/op 1.00
BenchmarkRPC/client_to_client_via_server - allocs/op 331782 allocs/op 331024 allocs/op 1.00
BenchmarkRPC/attach_large_document - ns/op 1224140290 ns/op 1381620656 ns/op 0.89
BenchmarkRPC/attach_large_document - B/op 1843802280 B/op 1820736296 B/op 1.01
BenchmarkRPC/attach_large_document - allocs/op 10470 allocs/op 10374 allocs/op 1.01
BenchmarkRPC/adminCli_to_server - ns/op 506111330 ns/op 506711988 ns/op 1.00
BenchmarkRPC/adminCli_to_server - B/op 20174160 B/op 20155856 B/op 1.00
BenchmarkRPC/adminCli_to_server - allocs/op 318230 allocs/op 317226 allocs/op 1.00
BenchmarkLocker - ns/op 67.18 ns/op 67.15 ns/op 1.00
BenchmarkLocker - B/op 16 B/op 16 B/op 1
BenchmarkLocker - allocs/op 1 allocs/op 1 allocs/op 1
BenchmarkLockerParallel - ns/op 38.17 ns/op 41.59 ns/op 0.92
BenchmarkLockerParallel - B/op 0 B/op 0 B/op NaN
BenchmarkLockerParallel - allocs/op 0 allocs/op 0 allocs/op NaN
BenchmarkLockerMoreKeys - ns/op 155.1 ns/op 160.5 ns/op 0.97
BenchmarkLockerMoreKeys - B/op 15 B/op 15 B/op 1
BenchmarkLockerMoreKeys - allocs/op 0 allocs/op 0 allocs/op NaN
BenchmarkChange/Push_10_Changes - ns/op 4107402 ns/op 4228009 ns/op 0.97
BenchmarkChange/Push_10_Changes - B/op 147819 B/op 147011 B/op 1.01
BenchmarkChange/Push_10_Changes - allocs/op 1305 allocs/op 1305 allocs/op 1
BenchmarkChange/Push_100_Changes - ns/op 15462528 ns/op 15569560 ns/op 0.99
BenchmarkChange/Push_100_Changes - B/op 712545 B/op 714288 B/op 1.00
BenchmarkChange/Push_100_Changes - allocs/op 6858 allocs/op 6857 allocs/op 1.00
BenchmarkChange/Push_1000_Changes - ns/op 121933440 ns/op 122971913 ns/op 0.99
BenchmarkChange/Push_1000_Changes - B/op 6056040 B/op 6319134 B/op 0.96
BenchmarkChange/Push_1000_Changes - allocs/op 64363 allocs/op 64364 allocs/op 1.00
BenchmarkChange/Pull_10_Changes - ns/op 3205106 ns/op 3266944 ns/op 0.98
BenchmarkChange/Pull_10_Changes - B/op 124725 B/op 123436 B/op 1.01
BenchmarkChange/Pull_10_Changes - allocs/op 1005 allocs/op 1006 allocs/op 1.00
BenchmarkChange/Pull_100_Changes - ns/op 5060118 ns/op 5267253 ns/op 0.96
BenchmarkChange/Pull_100_Changes - B/op 328481 B/op 325367 B/op 1.01
BenchmarkChange/Pull_100_Changes - allocs/op 3475 allocs/op 3475 allocs/op 1
BenchmarkChange/Pull_1000_Changes - ns/op 9690560 ns/op 10054426 ns/op 0.96
BenchmarkChange/Pull_1000_Changes - B/op 1641608 B/op 1636062 B/op 1.00
BenchmarkChange/Pull_1000_Changes - allocs/op 29846 allocs/op 29837 allocs/op 1.00
BenchmarkSnapshot/Push_3KB_snapshot - ns/op 19232598 ns/op 19612724 ns/op 0.98
BenchmarkSnapshot/Push_3KB_snapshot - B/op 950382 B/op 947220 B/op 1.00
BenchmarkSnapshot/Push_3KB_snapshot - allocs/op 6862 allocs/op 6862 allocs/op 1
BenchmarkSnapshot/Push_30KB_snapshot - ns/op 127159034 ns/op 128964020 ns/op 0.99
BenchmarkSnapshot/Push_30KB_snapshot - B/op 6300406 B/op 6446989 B/op 0.98
BenchmarkSnapshot/Push_30KB_snapshot - allocs/op 64170 allocs/op 64177 allocs/op 1.00
BenchmarkSnapshot/Pull_3KB_snapshot - ns/op 7647608 ns/op 7629068 ns/op 1.00
BenchmarkSnapshot/Pull_3KB_snapshot - B/op 1018466 B/op 1013744 B/op 1.00
BenchmarkSnapshot/Pull_3KB_snapshot - allocs/op 15498 allocs/op 15499 allocs/op 1.00
BenchmarkSnapshot/Pull_30KB_snapshot - ns/op 15714789 ns/op 16093336 ns/op 0.98
BenchmarkSnapshot/Pull_30KB_snapshot - B/op 7335059 B/op 7331584 B/op 1.00
BenchmarkSnapshot/Pull_30KB_snapshot - allocs/op 150112 allocs/op 150113 allocs/op 1.00
BenchmarkSync/memory_sync_10_test - ns/op 7020 ns/op 7126 ns/op 0.99
BenchmarkSync/memory_sync_10_test - B/op 1286 B/op 1286 B/op 1
BenchmarkSync/memory_sync_10_test - allocs/op 38 allocs/op 38 allocs/op 1
BenchmarkSync/memory_sync_100_test - ns/op 53543 ns/op 55219 ns/op 0.97
BenchmarkSync/memory_sync_100_test - B/op 8621 B/op 8990 B/op 0.96
BenchmarkSync/memory_sync_100_test - allocs/op 272 allocs/op 295 allocs/op 0.92
BenchmarkSync/memory_sync_1000_test - ns/op 592259 ns/op 440383 ns/op 1.34
BenchmarkSync/memory_sync_1000_test - B/op 74580 B/op 83572 B/op 0.89
BenchmarkSync/memory_sync_1000_test - allocs/op 2123 allocs/op 2682 allocs/op 0.79
BenchmarkSync/memory_sync_10000_test - ns/op 7424627 ns/op 4564967 ns/op 1.63
BenchmarkSync/memory_sync_10000_test - B/op 758653 B/op 818933 B/op 0.93
BenchmarkSync/memory_sync_10000_test - allocs/op 20511 allocs/op 24458 allocs/op 0.84
BenchmarkTextEditing - ns/op 19566280531 ns/op 19066495451 ns/op 1.03
BenchmarkTextEditing - B/op 9038002576 B/op 9038245440 B/op 1.00
BenchmarkTextEditing - allocs/op 19923532 allocs/op 19924611 allocs/op 1.00

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.