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

[ENH] Min compaction size #2346

Merged
merged 9 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion chromadb/proto/chroma_pb2_grpc.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion chromadb/proto/coordinator_pb2_grpc.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions chromadb/proto/logservice_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions chromadb/proto/logservice_pb2.pyi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion chromadb/proto/logservice_pb2_grpc.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/database/log/db/copyfrom.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/database/log/db/db.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions go/database/log/db/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions go/database/log/db/queries.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions go/database/log/queries/queries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ with summary as (
select r.collection_id, r.offset, r.timestamp, row_number() over(partition by r.collection_id order by r.offset) as rank
from record_log r, collection c
where r.collection_id = c.id
and (c.record_enumeration_offset_position - c.record_compaction_offset_position) >= sqlc.arg(min_compaction_size)
and r.offset > c.record_compaction_offset_position
)
select * from summary
Expand Down
7 changes: 4 additions & 3 deletions go/pkg/log/repository/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package repository
import (
"context"
"errors"
"time"

log "github.com/chroma-core/chroma/go/database/log/db"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgxpool"
"time"
)

type LogRepository struct {
Expand Down Expand Up @@ -76,8 +77,8 @@ func (r *LogRepository) PullRecords(ctx context.Context, collectionId string, of
return
}

func (r *LogRepository) GetAllCollectionInfoToCompact(ctx context.Context) (collectionToCompact []log.GetAllCollectionsToCompactRow, err error) {
collectionToCompact, err = r.queries.GetAllCollectionsToCompact(ctx)
func (r *LogRepository) GetAllCollectionInfoToCompact(ctx context.Context, minCompactionSize uint64) (collectionToCompact []log.GetAllCollectionsToCompactRow, err error) {
collectionToCompact, err = r.queries.GetAllCollectionsToCompact(ctx, int64(minCompactionSize))
HammadB marked this conversation as resolved.
Show resolved Hide resolved
if collectionToCompact == nil {
collectionToCompact = []log.GetAllCollectionsToCompactRow{}
}
Expand Down
Loading
Loading