Skip to content
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
8 changes: 6 additions & 2 deletions common/primitives/uuid.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"encoding/hex"

guuid "github.com/google/uuid"
"github.com/pborman/uuid"
)

// UUID represents a 16-byte universally unique identifier
Expand Down Expand Up @@ -93,7 +92,12 @@ func ValidateUUID(s string) (string, error) {

// NewUUID generates a new random UUID
func NewUUID() UUID {
return UUID(uuid.NewRandom())
u, err := guuid.NewV7()
if err != nil {
// Should never happen, but this matches the behavior of pborman/uuid.NewRandom
return nil
}
return u[:]
}

// Downcast returns the UUID as a byte slice. This is necessary when passing to type sensitive interfaces such as cql.
Expand Down
6 changes: 3 additions & 3 deletions service/history/api/startworkflow/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"errors"
"time"

"github.com/google/uuid"
commonpb "go.temporal.io/api/common/v1"
enumspb "go.temporal.io/api/enums/v1"
historypb "go.temporal.io/api/history/v1"
Expand All @@ -44,6 +43,7 @@ import (
"go.temporal.io/server/common/namespace"
"go.temporal.io/server/common/persistence"
"go.temporal.io/server/common/persistence/visibility/manager"
"go.temporal.io/server/common/primitives"
"go.temporal.io/server/common/tasktoken"
"go.temporal.io/server/service/history/api"
"go.temporal.io/server/service/history/consts"
Expand Down Expand Up @@ -249,7 +249,7 @@ func (s *Starter) lockCurrentWorkflowExecution(
// prepareNewWorkflow creates a new workflow context, and closes its mutable state transaction as snapshot.
// It returns the creationContext which can later be used to insert into the executions table.
func (s *Starter) prepareNewWorkflow(workflowID string) (*creationParams, error) {
runID := uuid.NewString()
runID := primitives.NewUUID().String()
mutableState, err := api.NewWorkflowWithSignal(
s.shardContext,
s.namespace,
Expand Down Expand Up @@ -403,7 +403,7 @@ func (s *Starter) resolveDuplicateWorkflowID(
// Using a new RunID here to simplify locking: MultiOperation, that re-uses the Starter, is creating
// a locked workflow context for each new workflow. Using a fresh RunID prevents a deadlock with the
// previously created workflow context.
newRunID := uuid.NewString()
newRunID := primitives.NewUUID().String()

currentExecutionUpdateAction, err := api.ResolveDuplicateWorkflowID(
s.shardContext,
Expand Down
Loading