@@ -24,7 +24,6 @@ import (
24
24
"github.com/cockroachdb/cockroach/pkg/util/log/eventpb"
25
25
"github.com/cockroachdb/cockroach/pkg/util/log/logconfig"
26
26
"github.com/cockroachdb/cockroach/pkg/util/log/logpb"
27
- "github.com/cockroachdb/cockroach/pkg/util/log/logtestutils"
28
27
"github.com/cockroachdb/cockroach/pkg/util/timeutil"
29
28
"github.com/cockroachdb/errors"
30
29
"github.com/cockroachdb/redact"
@@ -116,46 +115,6 @@ func TestStructuredEventLogging(t *testing.T) {
116
115
}
117
116
}
118
117
119
- func TestStructuredEventLogging_txnTimestamp (t * testing.T ) {
120
- defer leaktest .AfterTest (t )()
121
- defer log .Scope (t ).Close (t )
122
-
123
- ctx := context .Background ()
124
- appLogsSpy := logtestutils .NewStructuredLogSpy (
125
- t ,
126
- []logpb.Channel {logpb .Channel_SQL_SCHEMA },
127
- []string {"create_table" },
128
- func (entry logpb.Entry ) (eventpb.CreateTable , error ) {
129
- var cte eventpb.CreateTable
130
- if err := json .Unmarshal ([]byte (entry .Message [entry .StructuredStart :entry .StructuredEnd ]), & cte ); err != nil {
131
- return cte , err
132
- }
133
- return cte , nil
134
- },
135
- )
136
-
137
- cleanup := log .InterceptWith (ctx , appLogsSpy )
138
- defer cleanup ()
139
-
140
- s , conn , _ := serverutils .StartServer (t , base.TestServerArgs {})
141
- defer s .Stopper ().Stop (ctx )
142
-
143
- runner := sqlutils .MakeSQLRunner (conn )
144
- runner .Exec (t , "CREATE TABLE test (id INT PRIMARY KEY)" )
145
- runner .Exec (t , "BEGIN" )
146
- runner .Exec (t , "SET autocommit_before_ddl = false" )
147
- runner .Exec (t , "CREATE TABLE test1 (id INT PRIMARY KEY)" )
148
- runner .Exec (t , "CREATE TABLE test2 (id INT PRIMARY KEY)" )
149
- runner .Exec (t , "COMMIT" )
150
-
151
- createTables := appLogsSpy .GetLogs (logpb .Channel_SQL_SCHEMA )
152
- require .Len (t , createTables , 3 )
153
- // Not created in the same transaction, so transaction timestamps are different
154
- require .NotEqual (t , createTables [0 ].TxnTimestamp , createTables [1 ].TxnTimestamp )
155
- // Created in the same transaction, so transaction timestamps are the same
156
- require .Equal (t , createTables [1 ].TxnTimestamp , createTables [2 ].TxnTimestamp )
157
- }
158
-
159
118
var execLogRe = regexp .MustCompile (`event_log.go` )
160
119
161
120
// Test the SQL_PERF and SQL_INTERNAL_PERF logging channels.
@@ -181,7 +140,7 @@ func TestPerfLogging(t *testing.T) {
181
140
{
182
141
query : `SELECT pg_sleep(0.256)` ,
183
142
errRe : `` ,
184
- logRe : `"EventType":"slow_query","Statement":"SELECT pg_sleep\(‹0.256›\)","Tag":"SELECT","User":"root","TxnTimestamp":.*," ExecMode":"exec","NumRows":1` ,
143
+ logRe : `"EventType":"slow_query","Statement":"SELECT pg_sleep\(‹0.256›\)","Tag":"SELECT","User":"root","ExecMode":"exec","NumRows":1` ,
185
144
logExpected : true ,
186
145
channel : channel .SQL_PERF ,
187
146
},
@@ -202,7 +161,7 @@ func TestPerfLogging(t *testing.T) {
202
161
{
203
162
query : `INSERT INTO t VALUES (2, pg_sleep(0.256), 'x')` ,
204
163
errRe : `` ,
205
- logRe : `"EventType":"slow_query","Statement":"INSERT INTO .*\.t VALUES \(‹2›, pg_sleep\(‹0.256›\), ‹'x'›\)","Tag":"INSERT","User":"root","TxnTimestamp":.*," ExecMode":"exec","NumRows":1` ,
164
+ logRe : `"EventType":"slow_query","Statement":"INSERT INTO .*\.t VALUES \(‹2›, pg_sleep\(‹0.256›\), ‹'x'›\)","Tag":"INSERT","User":"root","ExecMode":"exec","NumRows":1` ,
206
165
logExpected : true ,
207
166
channel : channel .SQL_PERF ,
208
167
},
@@ -216,7 +175,7 @@ func TestPerfLogging(t *testing.T) {
216
175
{
217
176
query : `INSERT INTO t VALUES (4, pg_sleep(0.256), repeat('x', 1024))` ,
218
177
errRe : `` ,
219
- logRe : `"EventType":"slow_query","Statement":"INSERT INTO .*\.t VALUES \(‹4›, pg_sleep\(‹0.256›\), repeat\(‹'x'›, ‹1024›\)\)","Tag":"INSERT","User":"root","TxnTimestamp":.*," ExecMode":"exec","NumRows":1` ,
178
+ logRe : `"EventType":"slow_query","Statement":"INSERT INTO .*\.t VALUES \(‹4›, pg_sleep\(‹0.256›\), repeat\(‹'x'›, ‹1024›\)\)","Tag":"INSERT","User":"root","ExecMode":"exec","NumRows":1` ,
220
179
logExpected : true ,
221
180
channel : channel .SQL_PERF ,
222
181
},
@@ -230,7 +189,7 @@ func TestPerfLogging(t *testing.T) {
230
189
{
231
190
query : `SELECT *, pg_sleep(0.064) FROM t` ,
232
191
errRe : `` ,
233
- logRe : `"EventType":"slow_query","Statement":"SELECT \*, pg_sleep\(‹0.064›\) FROM .*\.t","Tag":"SELECT","User":"root","TxnTimestamp":.*," ExecMode":"exec","NumRows":4` ,
192
+ logRe : `"EventType":"slow_query","Statement":"SELECT \*, pg_sleep\(‹0.064›\) FROM .*\.t","Tag":"SELECT","User":"root","ExecMode":"exec","NumRows":4` ,
234
193
logExpected : true ,
235
194
channel : channel .SQL_PERF ,
236
195
},
0 commit comments