Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2024-09-07 00:12:40 +00:00
parent 52982854c8
commit 7f2db6120d
6 changed files with 32 additions and 65 deletions

View File

@ -32,7 +32,7 @@
.note-textarea {
display: block;
padding: 10px 16px;
color: $gl-text-color;
@apply gl-text-primary;
font-family: $regular-font;
border: 0;
@ -49,10 +49,9 @@
.common-note-form {
.md-area {
border: 1px solid $gray-400;
border-radius: $border-radius-large;
@apply gl-bg-default gl-rounded-lg;
transition: border-color ease-in-out 0.15s,
box-shadow ease-in-out 0.15s;
background-color: $white;
&.is-dropzone-hover {
border-color: $green-500;
@ -93,8 +92,7 @@
// cf. https://gitlab.com/gitlab-org/gitlab/-/merge_requests/147476
&.note-textarea-rounded-bottom {
margin-bottom: 3px;
border-bottom-left-radius: $gl-border-radius-base;
border-bottom-right-radius: $gl-border-radius-base;
@apply gl-rounded-b-base;
}
}
@ -140,7 +138,8 @@
.issuable-note-warning {
color: $orange-600;
background-color: $orange-50;
border-radius: $gl-border-radius-base $gl-border-radius-base 0 0;
@apply gl-rounded-t-base gl-rounded-b-none;
padding: 3px 12px;
margin: auto;
align-items: center;
@ -157,8 +156,7 @@
}
+ .md-area {
border-top-left-radius: 0;
border-top-right-radius: 0;
@apply gl-border-t-0;
}
.disabled-comment {
@ -170,7 +168,7 @@
}
.sidebar-item-icon {
border-radius: $gl-border-radius-base;
@apply gl-rounded-base;
margin: 0 5px 0 0;
vertical-align: text-bottom;
@ -192,7 +190,7 @@
padding: 16px;
.text {
color: $text-color;
@apply gl-text-primary;
}
.sidebar-item-warning-message-actions {
@ -205,7 +203,7 @@
}
.discussion-form {
background-color: $white;
@apply gl-bg-default;
@include media-breakpoint-down(xs) {
.user-avatar-link {
@ -253,8 +251,7 @@ table {
font-size: 14px;
.md-area {
background-color: $white;
border-radius: $gl-border-radius-base;
@apply gl-bg-default gl-rounded-base;
}
}
@ -287,13 +284,11 @@ table {
.diff-file,
.commit-diff {
.discussion-reply-holder {
border-radius: 0 0 $gl-border-radius-base $gl-border-radius-base;
padding: 0 $gl-padding $gl-padding-12 $gl-padding;
@apply gl-rounded-t-none gl-rounded-b-base;
+ .new-note {
@apply gl-border-t-1;
@apply gl-border-solid;
@apply gl-border-subtle;
@apply gl-border-t gl-border-t-subtle;
}
&.internal-note,
@ -310,14 +305,11 @@ table {
}
.code-commit .discussion-notes .notes .note-comment:first-child {
@apply gl-bg-default;
@apply gl-border-b;
@apply gl-border-b-subtle;
@apply gl-bg-default gl-border-b gl-border-b-subtle;
// stylelint-disable-next-line gitlab/no-gl-class
.gl-dark & {
@apply gl-bg-strong;
border-bottom-color: var(--gl-background-color-default);
@apply gl-bg-strong gl-border-b-default;
}
}
@ -361,13 +353,12 @@ table {
.discussion-reply-holder {
.reply-placeholder-text-field {
border-radius: $gl-border-radius-base;
@apply gl-bg-default gl-rounded-base;
width: 100%;
resize: none;
padding: $gl-padding-8 $gl-padding-12;
line-height: 1;
border: 1px solid $gray-200;
background-color: $white;
overflow: hidden;
transition: border-color ease-in-out 0.15s,
box-shadow ease-in-out 0.15s;
@ -389,7 +380,7 @@ table {
}
.comment-toolbar {
color: $gl-text-color-secondary;
@apply gl-text-subtle;
}
.toolbar-button {
@ -401,7 +392,7 @@ table {
&:hover,
&:focus {
color: $blue-600;
@apply gl-text-link;
outline: 0;
}
@ -422,7 +413,7 @@ table {
}
.note-form-actions {
color: $gl-text-color;
@apply gl-text-primary;
@include media-breakpoint-down(xs) {
.btn {
@ -493,7 +484,7 @@ table {
}
.markdown-selector {
color: $blue-600;
@apply gl-text-link;
}
.comment-warning-wrapper {

View File

@ -141,19 +141,20 @@ module CounterAttribute
end
end
def update_counters(increments)
self.class.update_counters(id, increments)
end
def update_counters_with_lease(increments)
detect_race_on_record(log_fields: { caller: __method__, attributes: increments.keys }) do
self.class.update_counters(id, increments)
update_counters(increments)
end
end
def initiate_refresh!(attribute)
raise ArgumentError, %(attribute "#{attribute}" cannot be refreshed) unless counter_attribute_enabled?(attribute)
detect_race_on_record(log_fields: { caller: __method__, attributes: attribute }) do
counter(attribute).initiate_refresh!
end
counter(attribute).initiate_refresh!
log_clear_counter(attribute)
end
@ -191,10 +192,9 @@ module CounterAttribute
"project:{#{project_id}}:#{self.class}:#{id}"
end
# detect_race_on_record uses a lease to monitor access
# to the project statistics row. This is needed to detect
# concurrent attempts to increment columns, which could result in a
# race condition.
# This method uses a lease to monitor access to the model row.
# This is needed to detect concurrent attempts to increment columns,
# which could result in a race condition.
#
# As the purpose is to detect and warn concurrent attempts,
# it falls back to direct update on the row if it fails to obtain the lease.

View File

@ -56,9 +56,7 @@ class ProjectStatistics < ApplicationRecord
schedule_namespace_aggregation_worker
end
detect_race_on_record(log_fields: { caller: __method__, attributes: columns_to_update }) do
save!
end
save!
end
def update_commit_count
@ -107,9 +105,7 @@ class ProjectStatistics < ApplicationRecord
# Since this incremental update method does not update the storage_size directly,
# we have to update the storage_size separately in an after_commit action.
def refresh_storage_size!
detect_race_on_record(log_fields: { caller: __method__, attributes: :storage_size }) do
self.class.where(id: id).update_all("storage_size = #{storage_size_sum}")
end
self.class.where(id: id).update_all("storage_size = #{storage_size_sum}")
end
# For counter attributes, storage_size will be refreshed after the counter is flushed,

View File

@ -106,11 +106,7 @@ module Projects
end
def reset_project_statistics!
# This method is called in the `before_transition` block which is in a transaction.
# See issue: https://gitlab.com/gitlab-org/gitlab/-/issues/441524
Gitlab::ExclusiveLease.skipping_transaction_check do
project.statistics.initiate_refresh!(COUNTER_ATTRIBUTE_NAME)
end
project.statistics.initiate_refresh!(COUNTER_ATTRIBUTE_NAME)
end
def next_batch(limit:)

View File

@ -147,17 +147,9 @@ module Gitlab
flush_amount = amount_to_be_flushed
next if flush_amount == 0
# `update_counters_with_lease` internally uses `detect_race_on_record`
# to track potential race conditions when concurrently updating a counter.
# We need the transaction so we can rollback the counter update if `remove_flushed_key` fails.
counter_record.transaction do
# Exclusive lease is obtained within `counter_record.transaction` which could lead to idle transactions
# if exclusive lease Redis I/O is slow. We skip the transaction check for now.
# See issue: https://gitlab.com/gitlab-org/gitlab/-/issues/441530
Gitlab::ExclusiveLease.skipping_transaction_check do
counter_record.update_counters_with_lease({ attribute => flush_amount })
end
counter_record.update_counters({ attribute => flush_amount })
remove_flushed_key
end

View File

@ -290,10 +290,6 @@ RSpec.describe ProjectStatistics do
refresh_statistics
end
end
it_behaves_like 'obtaining lease to update database' do
let(:model) { statistics }
end
end
describe '#update_commit_count' do
@ -441,10 +437,6 @@ RSpec.describe ProjectStatistics do
expect { refresh_storage_size }.to change { statistics.reload.storage_size }.from(0).to(2)
end
end
it_behaves_like 'obtaining lease to update database' do
let(:model) { statistics }
end
end
describe '.increment_statistic' do