@@ -196,6 +196,7 @@ char const* const MtmNodeStatusMnem[] =
196196
197197bool MtmDoReplication ;
198198char * MtmDatabaseName ;
199+ char * MtmDatabaseUser ;
199200char * MtmUtilityStmt = NULL ;
200201
201202int MtmNodes ;
@@ -1804,7 +1805,7 @@ static void MtmInitialize()
18041805 PGSemaphoreCreate (& Mtm -> votingSemaphore );
18051806 PGSemaphoreReset (& Mtm -> votingSemaphore );
18061807 SpinLockInit (& Mtm -> spinlock );
1807- BgwPoolInit (& Mtm -> pool , MtmExecutor , MtmDatabaseName , MtmQueueSize , MtmWorkers );
1808+ BgwPoolInit (& Mtm -> pool , MtmExecutor , MtmDatabaseName , MtmDatabaseUser , MtmQueueSize , MtmWorkers );
18081809 RegisterXactCallback (MtmXactCallback , NULL );
18091810 MtmTx .snapshot = INVALID_CSN ;
18101811 MtmTx .xid = InvalidTransactionId ;
@@ -1918,19 +1919,31 @@ static void MtmSplitConnStrs(void)
19181919
19191920 MtmUpdateNodeConnectionInfo (& MtmConnections [i ], connStr );
19201921
1921- if (i + 1 == MtmNodeId ) {
1922- char * dbName = strstr (connStr , "dbname=" );
1922+ if (i + 1 == MtmNodeId ) {
1923+ char * dbName = strstr (connStr , "dbname=" ); // XXX: shoud we care about string 'itisnotdbname=xxx'?
1924+ char * dbUser = strstr (connStr , "user=" );
19231925 char * end ;
19241926 size_t len ;
1925- if (dbName == NULL ) {
1926- elog (ERROR , "Database not specified in connection string: '%s'" , connStr );
1927- }
1927+
1928+ if (dbName == NULL )
1929+ elog (ERROR , "Database is not specified in connection string: '%s'" , connStr );
1930+
1931+ if (dbUser == NULL )
1932+ elog (ERROR , "Database user is not specified in connection string: '%s'" , connStr );
1933+
19281934 dbName += 7 ;
19291935 for (end = dbName ; * end != ' ' && * end != '\0' ; end ++ );
19301936 len = end - dbName ;
19311937 MtmDatabaseName = (char * )palloc (len + 1 );
19321938 memcpy (MtmDatabaseName , dbName , len );
19331939 MtmDatabaseName [len ] = '\0' ;
1940+
1941+ dbUser += 5 ;
1942+ for (end = dbUser ; * end != ' ' && * end != '\0' ; end ++ );
1943+ len = end - dbUser ;
1944+ MtmDatabaseUser = (char * )palloc (len + 1 );
1945+ memcpy (MtmDatabaseUser , dbUser , len );
1946+ MtmDatabaseUser [len ] = '\0' ;
19341947 }
19351948 connStr = p + 1 ;
19361949 }
@@ -3471,6 +3484,7 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
34713484 case T_LockStmt :
34723485 case T_CheckPointStmt :
34733486 case T_ReindexStmt :
3487+ case T_RefreshMatViewStmt :
34743488 skipCommand = true;
34753489 break ;
34763490
0 commit comments