@@ -154,10 +154,10 @@ find_pkey_tuple(ScanKey skey, Relation rel, Relation idxrel,
154154/* XXX: Improve handling here */
155155ereport (LOG ,
156156(errcode (ERRCODE_T_R_SERIALIZATION_FAILURE ),
157- errmsg ("concurrent update, retrying" )));
157+ MTM_ERRMSG ("concurrent update, retrying" )));
158158gotoretry ;
159159default :
160- elog (ERROR ,"unexpected HTSU_Result after locking: %u" ,res );
160+ MTM_ELOG (ERROR ,"unexpected HTSU_Result after locking: %u" ,res );
161161break ;
162162}
163163}
@@ -253,7 +253,7 @@ build_index_scan_key(ScanKey skey, Relation rel, Relation idxrel, TupleData *tup
253253BTEqualStrategyNumber );
254254
255255if (!OidIsValid (operator ))
256- elog (ERROR ,
256+ MTM_ELOG (ERROR ,
257257"could not lookup equality operator for type %u, optype %u in opfamily %u" ,
258258atttype ,optype ,opfamily );
259259
@@ -305,7 +305,7 @@ UserTableUpdateOpenIndexes(EState *estate, TupleTableSlot *slot)
305305if (recheckIndexes != NIL )
306306ereport (ERROR ,
307307(errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
308- errmsg ("bdr doesn't support index rechecks" )));
308+ MTM_ERRMSG ("bdr doesn't support index rechecks" )));
309309}
310310
311311/* FIXME: recheck the indexes */
@@ -359,7 +359,7 @@ process_remote_begin(StringInfo s)
359359rc = SPI_execute ("RESET SESSION AUTHORIZATION; reset all;" , false,0 );
360360SPI_finish ();
361361if (rc < 0 ) {
362- elog (ERROR ,"Failed to set reset context: %d" ,rc );
362+ MTM_ELOG (ERROR ,"Failed to set reset context: %d" ,rc );
363363}
364364}
365365
@@ -398,7 +398,7 @@ process_remote_message(StringInfo s)
398398rc = SPI_execute (messageBody , false,0 );
399399SPI_finish ();
400400if (rc < 0 ) {
401- elog (ERROR ,"Failed to execute utility statement %s" ,messageBody );
401+ MTM_ELOG (ERROR ,"Failed to execute utility statement %s" ,messageBody );
402402}else {
403403PushActiveSnapshot (GetTransactionSnapshot ());
404404
@@ -483,15 +483,15 @@ read_tuple_parts(StringInfo s, Relation rel, TupleData *tup)
483483action = pq_getmsgbyte (s );
484484
485485if (action != 'T' )
486- elog (ERROR ,"expected TUPLE, got %c" ,action );
486+ MTM_ELOG (ERROR ,"expected TUPLE, got %c" ,action );
487487
488488memset (tup -> isnull ,1 ,sizeof (tup -> isnull ));
489489memset (tup -> changed ,1 ,sizeof (tup -> changed ));
490490
491491rnatts = pq_getmsgint (s ,2 );
492492
493493if (desc -> natts < rnatts )
494- elog (ERROR ,"tuple natts mismatch, %u vs %u" ,desc -> natts ,rnatts );
494+ MTM_ELOG (ERROR ,"tuple natts mismatch, %u vs %u" ,desc -> natts ,rnatts );
495495
496496/* FIXME: unaligned data accesses */
497497
@@ -555,7 +555,7 @@ read_tuple_parts(StringInfo s, Relation rel, TupleData *tup)
555555if (buf .len != buf .cursor )
556556ereport (ERROR ,
557557(errcode (ERRCODE_INVALID_BINARY_REPRESENTATION ),
558- errmsg ("incorrect binary data format" )));
558+ MTM_ERRMSG ("incorrect binary data format" )));
559559break ;
560560}
561561case 't' :/* text format */
@@ -574,11 +574,11 @@ read_tuple_parts(StringInfo s, Relation rel, TupleData *tup)
574574}
575575break ;
576576default :
577- elog (ERROR ,"unknown column type '%c'" ,kind );
577+ MTM_ELOG (ERROR ,"unknown column type '%c'" ,kind );
578578}
579579
580580if (att -> attisdropped && !tup -> isnull [i ])
581- elog (ERROR ,"data for dropped column" );
581+ MTM_ELOG (ERROR ,"data for dropped column" );
582582}
583583}
584584
@@ -703,7 +703,7 @@ process_remote_commit(StringInfo in)
703703MtmSetCurrentTransactionCSN (csn );
704704MtmSetCurrentTransactionGID (gid );
705705FinishPreparedTransaction (gid , true);
706- MTM_LOG1 ("Distributed transaction %s is committed" ,gid );
706+ MTM_LOG2 ("Distributed transaction %s is committed" ,gid );
707707CommitTransactionCommand ();
708708Assert (!MtmTransIsActive ());
709709MtmEndSession (origin_node , true);
@@ -755,7 +755,7 @@ process_remote_insert(StringInfo s, Relation rel)
755755}
756756
757757// if (rel->rd_rel->relkind != RELKIND_RELATION) // RELKIND_MATVIEW
758- //elog (ERROR, "unexpected relkind '%c' rel \"%s\"",
758+ //MTM_ELOG (ERROR, "unexpected relkind '%c' rel \"%s\"",
759759// rel->rd_rel->relkind, RelationGetRelationName(rel));
760760
761761/* debug output */
@@ -804,7 +804,7 @@ process_remote_insert(StringInfo s, Relation rel)
804804/* TODO: Report tuple identity in log */
805805ereport (ERROR ,
806806 (errcode (ERRCODE_UNIQUE_VIOLATION ),
807- errmsg ("Unique constraints violated by remotely INSERTed tuple" ),
807+ MTM_ERRMSG ("Unique constraints violated by remotely INSERTed tuple" ),
808808errdetail ("Cannot apply transaction because remotely INSERTed tuple conflicts with a local tuple on UNIQUE constraint and/or PRIMARY KEY" )));
809809}
810810CHECK_FOR_INTERRUPTS ();
@@ -851,7 +851,7 @@ process_remote_update(StringInfo s, Relation rel)
851851
852852/* old key present, identifying key changed */
853853if (action != 'K' && action != 'N' )
854- elog (ERROR ,"expected action 'N' or 'K', got %c" ,
854+ MTM_ELOG (ERROR ,"expected action 'N' or 'K', got %c" ,
855855action );
856856
857857estate = create_rel_estate (rel );
@@ -871,11 +871,11 @@ process_remote_update(StringInfo s, Relation rel)
871871
872872/* check for new tuple */
873873if (action != 'N' )
874- elog (ERROR ,"expected action 'N', got %c" ,
874+ MTM_ELOG (ERROR ,"expected action 'N', got %c" ,
875875action );
876876
877877if (rel -> rd_rel -> relkind != RELKIND_RELATION )
878- elog (ERROR ,"unexpected relkind '%c' rel \"%s\"" ,
878+ MTM_ELOG (ERROR ,"unexpected relkind '%c' rel \"%s\"" ,
879879rel -> rd_rel -> relkind ,RelationGetRelationName (rel ));
880880
881881/* read new tuple */
@@ -887,7 +887,7 @@ process_remote_update(StringInfo s, Relation rel)
887887idxoid = rel -> rd_replidindex ;
888888if (!OidIsValid (idxoid ))
889889{
890- elog (ERROR ,"could not find primary key for table with oid %u" ,
890+ MTM_ELOG (ERROR ,"could not find primary key for table with oid %u" ,
891891RelationGetRelid (rel ));
892892return ;
893893}
@@ -936,7 +936,7 @@ process_remote_update(StringInfo s, Relation rel)
936936{
937937ereport (ERROR ,
938938 (errcode (ERRCODE_NO_DATA_FOUND ),
939- errmsg ("Record with specified key can not be located at this node" ),
939+ MTM_ERRMSG ("Record with specified key can not be located at this node" ),
940940errdetail ("Most likely we have DELETE-UPDATE conflict" )));
941941
942942}
@@ -976,7 +976,7 @@ process_remote_delete(StringInfo s, Relation rel)
976976idxoid = rel -> rd_replidindex ;
977977if (!OidIsValid (idxoid ))
978978{
979- elog (ERROR ,"could not find primary key for table with oid %u" ,
979+ MTM_ELOG (ERROR ,"could not find primary key for table with oid %u" ,
980980RelationGetRelid (rel ));
981981return ;
982982}
@@ -985,7 +985,7 @@ process_remote_delete(StringInfo s, Relation rel)
985985idxrel = index_open (idxoid ,RowExclusiveLock );
986986
987987if (rel -> rd_rel -> relkind != RELKIND_RELATION )
988- elog (ERROR ,"unexpected relkind '%c' rel \"%s\"" ,
988+ MTM_ELOG (ERROR ,"unexpected relkind '%c' rel \"%s\"" ,
989989rel -> rd_rel -> relkind ,RelationGetRelationName (rel ));
990990
991991#ifdef VERBOSE_DELETE
@@ -1013,7 +1013,7 @@ process_remote_delete(StringInfo s, Relation rel)
10131013{
10141014ereport (ERROR ,
10151015 (errcode (ERRCODE_NO_DATA_FOUND ),
1016- errmsg ("Record with specified key can not be located at this node" ),
1016+ MTM_ERRMSG ("Record with specified key can not be located at this node" ),
10171017errdetail ("Most likely we have DELETE-DELETE conflict" )));
10181018}
10191019
@@ -1127,7 +1127,7 @@ void MtmExecutor(void* work, size_t size)
11271127break ;
11281128}
11291129default :
1130- elog (ERROR ,"unknown action of type %c" ,action );
1130+ MTM_ELOG (ERROR ,"unknown action of type %c" ,action );
11311131 }
11321132break ;
11331133 }