Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
108838: Create chinese.stop r=rickystewart,Xiang-Gu a=zhenruyan

add tsearch chinese stopwords

I'm considering using cockroachdb for Chinese searches, so I hope I can contribute something.

Release note: None
Epic: None


109264: pkg/util/log: change default httpSink timeout to 2s r=dhartunian a=abarganier

Previously, the default timeout for the httpSink was
for there to be no timeout at all.

This means that the first call to `output()` on where
the http target was unavailable would hang forever.
This would deadlock the calling goroutine, whether
that's the bufferedSink flush goroutine, or (even worse)
a server goroutine in the event that the httpSink is not
buffered.

Our default timeout should not deadlock in the worst case
scenario. Admittedly, `2s` would also cause a noticeable
performance degradation in the event that the httpSink was
unbuffered, but it would at least be able to emit logs
indicating the timeout as the cause. Availability would also
be maintained to some degree. Previously, the deadlocks
due to no timeout being set by default meant that no
indication was ever given that the httpSink was unable
to reach the http target.

Release note (ops change): The default value of `timeout`
for `http-servers` logging sinks has been changed from
"no timeout" to `2s`. This will be reflected in the
`http-defaults` section of the log configuration. Users
still maintain the ability to override the timeout, or
disable it by explicitly setting it to `0` (e.g. `timeout: 0`).

Fixes: #109263

109454: concurrency: s/queuedWriters/queuedLockingRequests/g r=nvanbenschoten a=arulajmani

See individual commits for details.

Co-authored-by: 真如赝 <baiyangwangzhan@hotmail.com>
Co-authored-by: Alex Barganier <abarganier@cockroachlabs.com>
Co-authored-by: Arul Ajmani <arulajmani@gmail.com>
  • Loading branch information
4 people committed Aug 25, 2023
4 parents 155dc00 + 04ae35f + 91dcefd + 3c6df30 commit 87fc44f
Show file tree
Hide file tree
Showing 48 changed files with 1,651 additions and 846 deletions.
2 changes: 1 addition & 1 deletion pkg/cli/log_flags_test.go
Expand Up @@ -51,7 +51,7 @@ func TestSetupLogging(t *testing.T) {
const defaultHTTPConfig = `http-defaults: {` +
`method: POST, ` +
`unsafe-tls: false, ` +
`timeout: 0s, ` +
`timeout: 2s, ` +
`disable-keep-alives: false, ` +
`compression: gzip, ` +
`filter: INFO, ` +
Expand Down
531 changes: 269 additions & 262 deletions pkg/kv/kvserver/concurrency/lock_table.go

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions pkg/kv/kvserver/concurrency/lock_table_test.go
Expand Up @@ -1941,13 +1941,13 @@ func TestCanElideWaitingStateUpdateConsidersAllFields(t *testing.T) {
doNotIncludeWhenDeciding inclusionStatus = false
)
fieldMap := map[string]inclusionStatus{
"kind": includeWhenDeciding,
"txn": includeWhenDeciding,
"key": includeWhenDeciding,
"held": includeWhenDeciding,
"queuedWriters": doNotIncludeWhenDeciding,
"queuedReaders": doNotIncludeWhenDeciding,
"guardStrength": doNotIncludeWhenDeciding,
"kind": includeWhenDeciding,
"txn": includeWhenDeciding,
"key": includeWhenDeciding,
"held": includeWhenDeciding,
"queuedLockingRequests": doNotIncludeWhenDeciding,
"queuedReaders": doNotIncludeWhenDeciding,
"guardStrength": doNotIncludeWhenDeciding,
}
ws := waitingState{}
typ := reflect.ValueOf(ws).Type()
Expand Down
Expand Up @@ -113,7 +113,7 @@ sequence req=req3
[2] sequence req3: acquiring latches
[2] sequence req3: scanning lock table for conflicting locks
[2] sequence req3: waiting in lock wait-queues
[2] sequence req3: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"k"› (queuedWriters: 0, queuedReaders: 1)
[2] sequence req3: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"k"› (queuedLockingRequests: 0, queuedReaders: 1)
[2] sequence req3: pushing after 0s for: liveness detection = true, deadlock detection = true, timeout enforcement = false, priority enforcement = false
[2] sequence req3: pushing timestamp of txn 00000002 above 14.000000000,1
[2] sequence req3: blocked on select in concurrency_test.(*cluster).PushTransaction
Expand Down Expand Up @@ -200,7 +200,7 @@ sequence req=req5
[2] sequence req5: acquiring latches
[2] sequence req5: scanning lock table for conflicting locks
[2] sequence req5: waiting in lock wait-queues
[2] sequence req5: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"k"› (queuedWriters: 0, queuedReaders: 1)
[2] sequence req5: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"k"› (queuedLockingRequests: 0, queuedReaders: 1)
[2] sequence req5: pushing after 0s for: liveness detection = true, deadlock detection = false, timeout enforcement = false, priority enforcement = false
[2] sequence req5: pushing timestamp of txn 00000002 above 14.000000000,1
[2] sequence req5: blocked on select in concurrency_test.(*cluster).PushTransaction
Expand All @@ -215,7 +215,7 @@ sequence req=req6
[3] sequence req6: acquiring latches
[3] sequence req6: scanning lock table for conflicting locks
[3] sequence req6: waiting in lock wait-queues
[3] sequence req6: lock wait-queue event: wait for txn 00000002 holding lock @ key ‹"k"› (queuedWriters: 0, queuedReaders: 2)
[3] sequence req6: lock wait-queue event: wait for txn 00000002 holding lock @ key ‹"k"› (queuedLockingRequests: 0, queuedReaders: 2)
[3] sequence req6: not pushing
[3] sequence req6: blocked on select in concurrency.(*lockTableWaiterImpl).WaitOn

Expand Down Expand Up @@ -259,7 +259,7 @@ finish req=req6
[-] finish req6: finishing request
[4] sequence req7: scanning lock table for conflicting locks
[4] sequence req7: waiting in lock wait-queues
[4] sequence req7: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"k"› (queuedWriters: 1, queuedReaders: 0)
[4] sequence req7: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"k"› (queuedLockingRequests: 1, queuedReaders: 0)
[4] sequence req7: pushing after 0s for: liveness detection = true, deadlock detection = false, timeout enforcement = false, priority enforcement = false
[4] sequence req7: pushing txn 00000002 to abort
[4] sequence req7: blocked on select in concurrency_test.(*cluster).PushTransaction
Expand Down
Expand Up @@ -63,7 +63,7 @@ sequence req=req1
[3] sequence req1: acquiring latches
[3] sequence req1: scanning lock table for conflicting locks
[3] sequence req1: waiting in lock wait-queues
[3] sequence req1: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"a"› (queuedWriters: 0, queuedReaders: 1)
[3] sequence req1: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"a"› (queuedLockingRequests: 0, queuedReaders: 1)
[3] sequence req1: pushing after 0s for: liveness detection = true, deadlock detection = true, timeout enforcement = false, priority enforcement = false
[3] sequence req1: pushing timestamp of txn 00000002 above 10.000000000,1
[3] sequence req1: blocked on select in concurrency_test.(*cluster).PushTransaction
Expand Down Expand Up @@ -165,7 +165,7 @@ debug-lock-table
num=1
lock: "a"
holder: txn: 00000002-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: false req: 2, strength: Intent, txn: 00000001-0000-0000-0000-000000000000

sequence req=req1
Expand All @@ -174,7 +174,7 @@ sequence req=req1
[3] sequence req1: acquiring latches
[3] sequence req1: scanning lock table for conflicting locks
[3] sequence req1: waiting in lock wait-queues
[3] sequence req1: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"a"› (queuedWriters: 1, queuedReaders: 0)
[3] sequence req1: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"a"› (queuedLockingRequests: 1, queuedReaders: 0)
[3] sequence req1: pushing after 0s for: liveness detection = true, deadlock detection = true, timeout enforcement = false, priority enforcement = false
[3] sequence req1: pushing txn 00000002 to abort
[3] sequence req1: blocked on select in concurrency_test.(*cluster).PushTransaction
Expand All @@ -201,11 +201,11 @@ debug-lock-table
----
num=2
lock: "a"
queued writers:
queued locking requests:
active: false req: 2, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "b"
holder: txn: 00000002-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl [holder finalized: committed]
queued writers:
queued locking requests:
active: false req: 2, strength: Intent, txn: 00000001-0000-0000-0000-000000000000

sequence req=req1
Expand All @@ -230,14 +230,14 @@ debug-lock-table
----
num=3
lock: "a"
queued writers:
queued locking requests:
active: false req: 2, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "b"
queued writers:
queued locking requests:
active: false req: 2, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "c"
holder: txn: 00000002-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl [holder finalized: committed]
queued writers:
queued locking requests:
active: false req: 2, strength: Intent, txn: 00000001-0000-0000-0000-000000000000

sequence req=req1
Expand All @@ -257,13 +257,13 @@ debug-lock-table
----
num=3
lock: "a"
queued writers:
queued locking requests:
active: false req: 2, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "b"
queued writers:
queued locking requests:
active: false req: 2, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "c"
queued writers:
queued locking requests:
active: false req: 2, strength: Intent, txn: 00000001-0000-0000-0000-000000000000

finish req=req1
Expand Down Expand Up @@ -352,7 +352,7 @@ sequence req=req1
[4] sequence req1: acquiring latches
[4] sequence req1: scanning lock table for conflicting locks
[4] sequence req1: waiting in lock wait-queues
[4] sequence req1: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"a"› (queuedWriters: 0, queuedReaders: 1)
[4] sequence req1: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"a"› (queuedLockingRequests: 0, queuedReaders: 1)
[4] sequence req1: pushing after 0s for: liveness detection = true, deadlock detection = true, timeout enforcement = false, priority enforcement = false
[4] sequence req1: pushing timestamp of txn 00000002 above 10.000000000,1
[4] sequence req1: blocked on select in concurrency_test.(*cluster).PushTransaction
Expand Down Expand Up @@ -450,15 +450,15 @@ debug-lock-table
num=3
lock: "c"
holder: txn: 00000003-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "d"
holder: txn: 00000003-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "e"
holder: txn: 00000005-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000

sequence req=req1
Expand All @@ -467,7 +467,7 @@ sequence req=req1
[3] sequence req1: acquiring latches
[3] sequence req1: scanning lock table for conflicting locks
[3] sequence req1: waiting in lock wait-queues
[3] sequence req1: lock wait-queue event: wait for (distinguished) txn 00000003 holding lock @ key ‹"c"› (queuedWriters: 1, queuedReaders: 0)
[3] sequence req1: lock wait-queue event: wait for (distinguished) txn 00000003 holding lock @ key ‹"c"› (queuedLockingRequests: 1, queuedReaders: 0)
[3] sequence req1: pushing after 0s for: liveness detection = true, deadlock detection = true, timeout enforcement = false, priority enforcement = false
[3] sequence req1: pushing txn 00000003 to abort
[3] sequence req1: blocked on select in concurrency_test.(*cluster).PushTransaction
Expand All @@ -477,16 +477,16 @@ debug-lock-table
num=3
lock: "c"
holder: txn: 00000003-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: true req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
distinguished req: 5
lock: "d"
holder: txn: 00000003-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "e"
holder: txn: 00000005-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000

new-request name=req3 txn=txn3 ts=10,1
Expand Down Expand Up @@ -536,16 +536,16 @@ num=5
holder: txn: 00000004-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: unrepl [(str: Exclusive seq: 0)]
lock: "c"
holder: txn: 00000003-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: true req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
distinguished req: 5
lock: "d"
holder: txn: 00000003-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "e"
holder: txn: 00000005-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000

new-request name=req2 txn=txn2 ts=11,1
Expand All @@ -559,7 +559,7 @@ sequence req=req2
[6] sequence req2: acquiring latches
[6] sequence req2: scanning lock table for conflicting locks
[6] sequence req2: waiting in lock wait-queues
[6] sequence req2: lock wait-queue event: wait for (distinguished) txn 00000003 holding lock @ key ‹"a"› (queuedWriters: 0, queuedReaders: 1)
[6] sequence req2: lock wait-queue event: wait for (distinguished) txn 00000003 holding lock @ key ‹"a"› (queuedLockingRequests: 0, queuedReaders: 1)
[6] sequence req2: pushing after 0s for: liveness detection = true, deadlock detection = true, timeout enforcement = false, priority enforcement = false
[6] sequence req2: pushing timestamp of txn 00000003 above 11.000000000,1
[6] sequence req2: blocked on select in concurrency_test.(*cluster).PushTransaction
Expand All @@ -576,16 +576,16 @@ num=5
holder: txn: 00000004-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: unrepl [(str: Exclusive seq: 0)]
lock: "c"
holder: txn: 00000003-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: true req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
distinguished req: 5
lock: "d"
holder: txn: 00000003-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "e"
holder: txn: 00000005-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000

debug-advance-clock ts=123
Expand All @@ -597,13 +597,13 @@ on-txn-updated txn=txn3 status=aborted
----
[-] update txn: aborting txn3
[3] sequence req1: resolving intent ‹"c"› for txn 00000003 with ABORTED status
[3] sequence req1: lock wait-queue event: wait for (distinguished) txn 00000005 holding lock @ key ‹"e"› (queuedWriters: 1, queuedReaders: 0)
[3] sequence req1: lock wait-queue event: wait for (distinguished) txn 00000005 holding lock @ key ‹"e"› (queuedLockingRequests: 1, queuedReaders: 0)
[3] sequence req1: conflicted with ‹00000003-0000-0000-0000-000000000000› on ‹"c"› for 123.000s
[3] sequence req1: pushing after 0s for: liveness detection = true, deadlock detection = true, timeout enforcement = false, priority enforcement = false
[3] sequence req1: pushing txn 00000005 to abort
[3] sequence req1: blocked on select in concurrency_test.(*cluster).PushTransaction
[6] sequence req2: resolving intent ‹"a"› for txn 00000003 with ABORTED status
[6] sequence req2: lock wait-queue event: wait for (distinguished) txn 00000004 holding lock @ key ‹"b"› (queuedWriters: 0, queuedReaders: 1)
[6] sequence req2: lock wait-queue event: wait for (distinguished) txn 00000004 holding lock @ key ‹"b"› (queuedLockingRequests: 0, queuedReaders: 1)
[6] sequence req2: conflicted with ‹00000003-0000-0000-0000-000000000000› on ‹"a"› for 123.000s
[6] sequence req2: pushing after 0s for: liveness detection = true, deadlock detection = true, timeout enforcement = false, priority enforcement = false
[6] sequence req2: pushing timestamp of txn 00000004 above 11.000000000,1
Expand All @@ -618,15 +618,15 @@ num=4
req: 8, txn: 00000002-0000-0000-0000-000000000000
distinguished req: 8
lock: "c"
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "d"
holder: txn: 00000003-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl [holder finalized: aborted]
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "e"
holder: txn: 00000005-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: true req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
distinguished req: 5

Expand All @@ -651,14 +651,14 @@ debug-lock-table
----
num=3
lock: "c"
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "d"
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "e"
holder: txn: 00000005-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: true req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
distinguished req: 5

Expand Down
Expand Up @@ -42,7 +42,7 @@ sequence req=req1
[3] sequence req1: acquiring latches
[3] sequence req1: scanning lock table for conflicting locks
[3] sequence req1: waiting in lock wait-queues
[3] sequence req1: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"a"› (queuedWriters: 0, queuedReaders: 1)
[3] sequence req1: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"a"› (queuedLockingRequests: 0, queuedReaders: 1)
[3] sequence req1: pushing after 0s for: liveness detection = true, deadlock detection = true, timeout enforcement = false, priority enforcement = false
[3] sequence req1: pushing timestamp of txn 00000002 above 10.000000000,1
[3] sequence req1: blocked on select in concurrency_test.(*cluster).PushTransaction
Expand Down

0 comments on commit 87fc44f

Please sign in to comment.