@@ -1253,9 +1253,11 @@ static int wsrep_TOI_begin(THD *thd, char *db_, char *table_,
1253
1253
}
1254
1254
else if (key_arr.keys_len > 0 ) {
1255
1255
/* jump to error handler in mysql_execute_command() */
1256
- WSREP_WARN (" TO isolation failed for: %d, sql: %s. Check wsrep "
1256
+ WSREP_WARN (" TO isolation failed for: %d, schema: %s, sql: %s. Check wsrep "
1257
1257
" connection state and retry the query." ,
1258
- ret, (thd->query ()) ? thd->query () : " void" );
1258
+ ret,
1259
+ (thd->db ? thd->db : " (null)" ),
1260
+ (thd->query ()) ? thd->query () : " void" );
1259
1261
my_error (ER_LOCK_DEADLOCK, MYF (0 ), " WSREP replication failed. Check "
1260
1262
" your wsrep connection state and retry the query." );
1261
1263
wsrep_keys_free (&key_arr);
@@ -1288,8 +1290,10 @@ static void wsrep_TOI_end(THD *thd) {
1288
1290
WSREP_DEBUG (" TO END: %lld" , (long long )wsrep_thd_trx_seqno (thd));
1289
1291
}
1290
1292
else {
1291
- WSREP_WARN (" TO isolation end failed for: %d, sql: %s" ,
1292
- ret, (thd->query ()) ? thd->query () : " void" );
1293
+ WSREP_WARN (" TO isolation end failed for: %d, schema: %s, sql: %s" ,
1294
+ ret,
1295
+ (thd->db ? thd->db : " (null)" ),
1296
+ (thd->query ()) ? thd->query () : " void" );
1293
1297
}
1294
1298
}
1295
1299
@@ -1302,7 +1306,10 @@ static int wsrep_RSU_begin(THD *thd, char *db_, char *table_)
1302
1306
ret = wsrep->desync (wsrep);
1303
1307
if (ret != WSREP_OK)
1304
1308
{
1305
- WSREP_WARN (" RSU desync failed %d for %s" , ret, thd->query ());
1309
+ WSREP_WARN (" RSU desync failed %d for schema: %s, query: %s" ,
1310
+ ret,
1311
+ (thd->db ? thd->db : " (null)" ),
1312
+ thd->query ());
1306
1313
my_error (ER_LOCK_DEADLOCK, MYF (0 ));
1307
1314
return (ret);
1308
1315
}
@@ -1313,15 +1320,20 @@ static int wsrep_RSU_begin(THD *thd, char *db_, char *table_)
1313
1320
if (wsrep_wait_committing_connections_close (5000 ))
1314
1321
{
1315
1322
/* no can do, bail out from DDL */
1316
- WSREP_WARN (" RSU failed due to pending transactions, %s" , thd->query ());
1323
+ WSREP_WARN (" RSU failed due to pending transactions, schema: %s, query %s" ,
1324
+ (thd->db ? thd->db : " (null)" ),
1325
+ thd->query ());
1317
1326
mysql_mutex_lock (&LOCK_wsrep_replaying);
1318
1327
wsrep_replaying--;
1319
1328
mysql_mutex_unlock (&LOCK_wsrep_replaying);
1320
1329
1321
1330
ret = wsrep->resync (wsrep);
1322
1331
if (ret != WSREP_OK)
1323
1332
{
1324
- WSREP_WARN (" resync failed %d for %s" , ret, thd->query ());
1333
+ WSREP_WARN (" resync failed %d for schema: %s, query: %s" ,
1334
+ ret,
1335
+ (thd->db ? thd->db : " (null)" ),
1336
+ thd->query ());
1325
1337
}
1326
1338
my_error (ER_LOCK_DEADLOCK, MYF (0 ));
1327
1339
return (1 );
@@ -1330,7 +1342,9 @@ static int wsrep_RSU_begin(THD *thd, char *db_, char *table_)
1330
1342
wsrep_seqno_t seqno = wsrep->pause (wsrep);
1331
1343
if (seqno == WSREP_SEQNO_UNDEFINED)
1332
1344
{
1333
- WSREP_WARN (" pause failed %lld for %s" , (long long )seqno, thd->query ());
1345
+ WSREP_WARN (" pause failed %lld for schema: %s, query: %s" , (long long )seqno,
1346
+ (thd->db ? thd->db : " (null)" ),
1347
+ thd->query ());
1334
1348
return (1 );
1335
1349
}
1336
1350
WSREP_DEBUG (" paused at %lld" , (long long )seqno);
@@ -1352,12 +1366,16 @@ static void wsrep_RSU_end(THD *thd)
1352
1366
ret = wsrep->resume (wsrep);
1353
1367
if (ret != WSREP_OK)
1354
1368
{
1355
- WSREP_WARN (" resume failed %d for %s" , ret, thd->query ());
1369
+ WSREP_WARN (" resume failed %d for schema: %s, query: %s" , ret,
1370
+ (thd->db ? thd->db : " (null)" ),
1371
+ thd->query ());
1356
1372
}
1357
1373
ret = wsrep->resync (wsrep);
1358
1374
if (ret != WSREP_OK)
1359
1375
{
1360
- WSREP_WARN (" resync failed %d for %s" , ret, thd->query ());
1376
+ WSREP_WARN (" resync failed %d for schema: %s, query: %s" , ret,
1377
+ (thd->db ? thd->db : " (null)" ),
1378
+ thd->query ());
1361
1379
return ;
1362
1380
}
1363
1381
thd->variables .wsrep_on = 1 ;
@@ -1377,8 +1395,10 @@ int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_,
1377
1395
1378
1396
if (thd->wsrep_conflict_state == MUST_ABORT)
1379
1397
{
1380
- WSREP_INFO (" thread: %lu, %s has been aborted due to multi-master conflict" ,
1381
- thd->thread_id , thd->query ());
1398
+ WSREP_INFO (" thread: %lu, schema: %s, query: %s has been aborted due to multi-master conflict" ,
1399
+ thd->thread_id ,
1400
+ (thd->db ? thd->db : " (null)" ),
1401
+ thd->query ());
1382
1402
mysql_mutex_unlock (&thd->LOCK_wsrep_thd );
1383
1403
return WSREP_TRX_FAIL;
1384
1404
}
@@ -1456,12 +1476,12 @@ void wsrep_to_isolation_end(THD *thd)
1456
1476
}
1457
1477
}
1458
1478
1459
- #define WSREP_MDL_LOG (severity, msg, req, gra ) \
1479
+ #define WSREP_MDL_LOG (severity, msg, schema, schema_len, req, gra ) \
1460
1480
WSREP_##severity( \
1461
- " % s\n " \
1481
+ " schema: %.* s\n " \
1462
1482
" request: (%lu \t seqno %lld \t wsrep (%d, %d, %d) cmd %d %d \t %s)\n " \
1463
1483
" granted: (%lu \t seqno %lld \t wsrep (%d, %d, %d) cmd %d %d \t %s)" , \
1464
- msg, \
1484
+ msg, schema_len, schema, \
1465
1485
req->thread_id, (long long )wsrep_thd_trx_seqno(req), \
1466
1486
req->wsrep_exec_mode, req->wsrep_query_state, req->wsrep_conflict_state, \
1467
1487
req->get_command (), req->lex->sql_command, req->query(), \
@@ -1481,7 +1501,8 @@ void wsrep_to_isolation_end(THD *thd)
1481
1501
1482
1502
bool
1483
1503
wsrep_grant_mdl_exception (MDL_context *requestor_ctx,
1484
- MDL_ticket *ticket
1504
+ MDL_ticket *ticket,
1505
+ const MDL_key *key
1485
1506
) {
1486
1507
/* Fallback to the non-wsrep behaviour */
1487
1508
if (!WSREP_ON) return FALSE ;
@@ -1490,19 +1511,24 @@ wsrep_grant_mdl_exception(MDL_context *requestor_ctx,
1490
1511
THD *granted_thd = ticket->get_ctx ()->wsrep_get_thd ();
1491
1512
bool ret = FALSE ;
1492
1513
1514
+ const char * schema= key->db_name ();
1515
+ int schema_len= key->db_name_length ();
1516
+
1493
1517
mysql_mutex_lock (&request_thd->LOCK_wsrep_thd );
1494
1518
if (request_thd->wsrep_exec_mode == TOTAL_ORDER ||
1495
1519
request_thd->wsrep_exec_mode == REPL_RECV)
1496
1520
{
1497
1521
mysql_mutex_unlock (&request_thd->LOCK_wsrep_thd );
1498
- WSREP_MDL_LOG (DEBUG, " MDL conflict " , request_thd, granted_thd);
1522
+ WSREP_MDL_LOG (DEBUG, " MDL conflict " , schema, schema_len,
1523
+ request_thd, granted_thd);
1499
1524
ticket->wsrep_report (wsrep_debug);
1500
1525
1501
1526
mysql_mutex_lock (&granted_thd->LOCK_wsrep_thd );
1502
1527
if (granted_thd->wsrep_exec_mode == TOTAL_ORDER ||
1503
1528
granted_thd->wsrep_exec_mode == REPL_RECV)
1504
1529
{
1505
- WSREP_MDL_LOG (INFO, " MDL BF-BF conflict" , request_thd, granted_thd);
1530
+ WSREP_MDL_LOG (INFO, " MDL BF-BF conflict" , schema, schema_len,
1531
+ request_thd, granted_thd);
1506
1532
ticket->wsrep_report (true );
1507
1533
mysql_mutex_unlock (&granted_thd->LOCK_wsrep_thd );
1508
1534
ret = TRUE ;
@@ -1533,7 +1559,8 @@ wsrep_grant_mdl_exception(MDL_context *requestor_ctx,
1533
1559
}
1534
1560
else
1535
1561
{
1536
- WSREP_MDL_LOG (DEBUG, " MDL conflict-> BF abort" , request_thd, granted_thd);
1562
+ WSREP_MDL_LOG (DEBUG, " MDL conflict-> BF abort" , schema, schema_len,
1563
+ request_thd, granted_thd);
1537
1564
ticket->wsrep_report (wsrep_debug);
1538
1565
mysql_mutex_unlock (&granted_thd->LOCK_wsrep_thd );
1539
1566
wsrep_abort_thd ((void *)request_thd, (void *)granted_thd, 1 );
0 commit comments