@@ -2245,8 +2245,23 @@ MtmNoticeReceiver(void *i, const PGresult *res)
2245
2245
2246
2246
stripped_notice = palloc0 (len );
2247
2247
2248
- /* Strip "NOTICE: " from beginning and "\n" from end of error string */
2249
- strncpy (stripped_notice , notice + 9 , len - 1 - 9 );
2248
+ if (* notice == 'N' )
2249
+ {
2250
+ /* Strip "NOTICE: " from beginning and "\n" from end of error string */
2251
+ strncpy (stripped_notice , notice + 9 , len - 1 - 9 );
2252
+ elog (NOTICE , "%s" , stripped_notice );
2253
+ }
2254
+ else if (* notice == 'W' )
2255
+ {
2256
+ /* Strip "WARNING: " from beginning and "\n" from end of error string */
2257
+ strncpy (stripped_notice , notice + 10 , len - 1 - 10 );
2258
+ elog (WARNING , "%s" , stripped_notice );
2259
+ }
2260
+ else
2261
+ {
2262
+ stripped_notice = notice ;
2263
+ elog (WARNING , "%s" , stripped_notice );
2264
+ }
2250
2265
2251
2266
MTM_LOG1 ("%s" , stripped_notice );
2252
2267
pfree (stripped_notice );
@@ -2478,41 +2493,45 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
2478
2493
case T_PrepareStmt :
2479
2494
case T_ExecuteStmt :
2480
2495
case T_DeallocateStmt :
2481
- //case T_GrantStmt: /* XXX: we could replicate some of these these */;
2482
- //case T_GrantRoleStmt:
2483
- //case T_AlterDatabaseStmt:
2484
- //case T_AlterDatabaseSetStmt:
2485
2496
case T_NotifyStmt :
2486
2497
case T_ListenStmt :
2487
2498
case T_UnlistenStmt :
2488
2499
case T_LoadStmt :
2489
2500
case T_ClusterStmt : /* XXX: we could replicate these */ ;
2490
2501
case T_VacuumStmt :
2491
2502
case T_ExplainStmt :
2492
- //case T_AlterSystemStmt:
2493
2503
case T_VariableShowStmt :
2494
- case T_DiscardStmt :
2495
- //case T_CreateEventTrigStmt:
2496
- //case T_AlterEventTrigStmt:
2497
- //case T_CreateRoleStmt:
2498
- //case T_AlterRoleStmt:
2499
- //case T_AlterRoleSetStmt:
2500
- //case T_DropRoleStmt:
2501
2504
case T_ReassignOwnedStmt :
2502
2505
case T_LockStmt :
2503
- //case T_ConstraintsSetStmt:
2504
2506
case T_CheckPointStmt :
2505
2507
case T_ReindexStmt :
2506
2508
skipCommand = true;
2507
2509
break ;
2510
+ case T_DiscardStmt :
2511
+ {
2512
+ //DiscardStmt *stmt = (DiscardStmt *) parsetree;
2513
+ //skipCommand = stmt->target == DISCARD_TEMP;
2514
+
2515
+ skipCommand = true;
2516
+
2517
+ if (MtmGUCBufferAllocated )
2518
+ {
2519
+ // XXX: move allocation somewhere to backend startup and check
2520
+ // where buffer is empty in send routines.
2521
+ MtmGUCBufferAllocated = false;
2522
+ pfree (MtmGUCBuffer );
2523
+ }
2524
+
2525
+ }
2526
+ break ;
2508
2527
case T_VariableSetStmt :
2509
2528
{
2510
2529
VariableSetStmt * stmt = (VariableSetStmt * ) parsetree ;
2511
2530
2512
2531
skipCommand = true;
2513
2532
2514
2533
/* Prevent SET TRANSACTION from replication */
2515
- if (MtmTx . isTransactionBlock || stmt -> kind == VAR_SET_MULTI )
2534
+ if (stmt -> kind == VAR_SET_MULTI )
2516
2535
break ;
2517
2536
2518
2537
if (!MtmGUCBufferAllocated )
@@ -2525,13 +2544,10 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
2525
2544
MtmGUCBufferAllocated = true;
2526
2545
}
2527
2546
2528
- //appendStringInfoString(MtmGUCBuffer, "SET ");
2529
- //appendStringInfoString(MtmGUCBuffer, stmt->name);
2530
- //appendStringInfoString(MtmGUCBuffer, " TO ");
2531
- //appendStringInfoString(MtmGUCBuffer, ExtractSetVariableArgs(stmt));
2532
- //appendStringInfoString(MtmGUCBuffer, "; ");
2533
-
2534
2547
appendStringInfoString (MtmGUCBuffer , queryString );
2548
+
2549
+ // sometimes there is no ';' char at the end.
2550
+ appendStringInfoString (MtmGUCBuffer , ";" );
2535
2551
}
2536
2552
break ;
2537
2553
case T_CreateStmt :
0 commit comments