Skip to content
Merged
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: 2 additions & 2 deletions server/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -829,9 +829,9 @@ func (a *Account) addStreamWithAssignment(config *StreamConfig, fsConfig *FileSt

// Add created timestamp used for the store, must match that of the stream assignment if it exists.
if sa != nil {
js.mu.RLock()
// The following assignment does not require mutex
// protection: sa.Created is immutable.
mset.created = sa.Created
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I assume this is safe because sa.Created is a special-case field whose value never changes, if so it might be worth adding a comment to that effect.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, the field appears to be immutable.
Running BenchmarkJetStreamCreate under -race shows no problems.
(BenchmakrJetStreamCreate would reliably fall into the deadlock execution)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added a comment in the code to clarify that.

js.mu.RUnlock()
}

// Start our signaling routine to process consumers.
Expand Down