Skip to content

Commit

Permalink
Rename methods
Browse files Browse the repository at this point in the history
  • Loading branch information
naveen246 committed Dec 30, 2024
1 parent 1c40f21 commit 3bf1604
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
12 changes: 5 additions & 7 deletions slatedb/compactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ func spawnAndRunCompactorOrchestrator(
tableStore *store.TableStore,
opts DBOptions,
) (*CompactorOrchestrator, error) {

orchestrator, err := newCompactorOrchestrator(opts, manifestStore, tableStore)
if err != nil {
return nil, err
Expand Down Expand Up @@ -158,8 +157,7 @@ func (o *CompactorOrchestrator) spawnLoop(opts DBOptions) {
assert.True(err == nil, "Failed to load manifest")
case <-o.compactorMsgCh:
// we receive Shutdown msg on compactorMsgCh. Stop the executor.
// Don't return and let the loop continue until `orchestrator.processCompactionResult`
// has no more compaction results to process
// Don't return and let the loop continue until there are no more compaction results to process
o.executor.stop()
ticker.Stop()
default:
Expand Down Expand Up @@ -257,7 +255,7 @@ func (o *CompactorOrchestrator) startCompaction(compaction Compaction) {
}

func (o *CompactorOrchestrator) processCompactionResult(log *slog.Logger) bool {
result, resultPresent := o.executor.compactionResult()
result, resultPresent := o.executor.nextCompactionResult()
if resultPresent {
if result.Error != nil {
log.Error("Error executing compaction", "error", result.Error)
Expand Down Expand Up @@ -348,7 +346,7 @@ func newCompactorExecutor(
}
}

func (e *CompactionExecutor) compactionResult() (CompactionResult, bool) {
func (e *CompactionExecutor) nextCompactionResult() (CompactionResult, bool) {
select {
case result := <-e.resultCh:
return result, true
Expand Down Expand Up @@ -479,10 +477,10 @@ func (e *CompactionExecutor) startCompaction(compaction CompactionJob) {

func (e *CompactionExecutor) stop() {
e.stopped.Store(true)
e.waitForTasksCompletion()
e.waitForTasksToComplete()
}

func (e *CompactionExecutor) waitForTasksCompletion() {
func (e *CompactionExecutor) waitForTasksToComplete() {
e.tasksWG.Wait()
}

Expand Down
4 changes: 2 additions & 2 deletions slatedb/compactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ func TestShouldWriteManifestSafely(t *testing.T) {

err = orchestrator.submitCompaction(newCompaction(l0IDsToCompact, 0))
assert.NoError(t, err)
orchestrator.executor.waitForTasksCompletion()
msg, ok := orchestrator.executor.compactionResult()
orchestrator.executor.waitForTasksToComplete()
msg, ok := orchestrator.executor.nextCompactionResult()
assert.True(t, ok)
assert.NotNil(t, msg.SortedRun)
sr := msg.SortedRun
Expand Down

0 comments on commit 3bf1604

Please sign in to comment.