Skip to content

Commit

Permalink
storage,server: enable separated intents
Browse files Browse the repository at this point in the history
Separated intents are enabled by default, and the setting
is randomized on the testing path for testserver.go.

The intent resolution performance, which caused these
to be disabled, has been improved due to
cockroachdb#60622 and
cockroachdb#60698

TestLogic/aggregate is tweaked to reduce the number of
intents created, as explained in the TODO added where
the change was made.

Informs cockroachdb#41720

Release note (ops change): The default value of the
storage.transaction.separated_intents.enabled cluster
setting is changed to true.
  • Loading branch information
sumeerbhola committed Feb 18, 2021
1 parent 95c0fe5 commit 40b65ff
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
11 changes: 5 additions & 6 deletions pkg/server/testserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"context"
"encoding/base64"
"fmt"
"math/rand"
"net"
"net/http"
"net/http/cookiejar"
Expand Down Expand Up @@ -132,12 +133,10 @@ func makeTestConfigFromParams(params base.TestServerArgs) Config {
st := params.Settings
if params.Settings == nil {
st = cluster.MakeClusterSettings()
// TODO(sumeer): re-introduce this randomization.
// enabledSeparated := rand.Intn(2) == 0
// log.Infof(context.Background(),
// "test Config is randomly setting enabledSeparated: %t",
// enabledSeparated)
// storage.SeparatedIntentsEnabled.Override(&st.SV, enabledSeparated)
enabledSeparated := rand.Intn(2) == 0
log.Infof(context.Background(),
"test Config is randomly setting enabledSeparated: %t", enabledSeparated)
storage.SeparatedIntentsEnabled.Override(&st.SV, enabledSeparated)
}
st.ExternalIODir = params.ExternalIODir
cfg := makeTestConfig(st)
Expand Down
16 changes: 11 additions & 5 deletions pkg/sql/logictest/testdata/logic_test/aggregate
Original file line number Diff line number Diff line change
Expand Up @@ -892,32 +892,38 @@ CREATE TABLE mnop (
p BIGINT
)

# TODO(sumeer): increase this series back to 2e4 once we have more performance
# improvements to ranged intent resolution. This test is somewhat artificial
# in that it accumulates a large number of deletion markers for intents for
# each key, in the LSM memtable, without them being flushed to ssts. This
# slows down ranged intent resolution. With 1e4 keys, the txn tracks each
# intent individually, and intent resolution is fast.
statement ok
INSERT INTO mnop (m, n) SELECT i, (1e9 + i/2e4)::float FROM
generate_series(1, 2e4) AS i(i)
generate_series(1, 5e3) AS i(i)

statement ok
UPDATE mnop SET o = n::decimal, p = (n * 10)::bigint

query RRR
SELECT round(variance(n), 2), round(variance(n), 2), round(variance(p)) FROM mnop
----
0.08 0.08 8
0.01 0.01 1

query RRR
SELECT round(var_pop(n), 2), round(var_pop(n), 2), round(var_pop(p)) FROM mnop
----
0.08 0.08 8
0.01 0.01 1

query RRR
SELECT round(stddev_samp(n), 2), round(stddev(n), 2), round(stddev_samp(p)) FROM mnop
----
0.29 0.29 3
0.07 0.07 1

query RRR
SELECT round(stddev_pop(n), 2), round(stddev_pop(n), 2), round(stddev_pop(p)) FROM mnop
----
0.29 0.29 3
0.07 0.07 1

query RRR
SELECT avg(1::int)::float, avg(2::float)::float, avg(3::decimal)::float
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/intent_reader_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var SeparatedIntentsEnabled = settings.RegisterBoolSetting(
"storage.transaction.separated_intents.enabled",
"if enabled, intents will be written to a separate lock table, instead of being "+
"interleaved with MVCC values",
false,
true,
)

// This file defines wrappers for Reader and Writer, and functions to do the
Expand Down

0 comments on commit 40b65ff

Please sign in to comment.