Changeset: 6b592f962890 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6b592f962890
Modified Files:
        clients/mapilib/mapi.c
Branch: Apr2012
Log Message:

mapi_mapi: don't stop searching at the first database not found error

monetdbd will return an error when the database does not exist, keep on
searching in that case: another monetdbd might serve the database we're
looking for

This is a recommit of changeset 81690726f3f4 that was backed out for
Aug2012-SP1.


diffs (43 lines):

diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -1036,6 +1036,7 @@ static int mapi_slice_row(struct MapiRes
 static void mapi_store_bind(struct MapiResultSet *result, int cr);
 static void parse_uri_query(Mapi mid, char *uri);
 static void set_uri(Mapi mid);
+static MapiMsg connect_to_server(Mapi mid);
 
 static int mapi_initialized = 0;
 
@@ -2046,10 +2047,11 @@ mapi_mapi(const char *host, int port, co
                                                tmid = mapi_mapi("/tmp", 
socks[i], "mero", "mero",
                                                                lang, dbname);
                                                tmid->redirmax = 0;
-                                               if (mapi_reconnect(tmid) == MOK 
||
-                                                               
*tmid->redirects != NULL ||
-                                                               (tmid->errorstr 
!= NULL &&
-                                                                
strstr(tmid->errorstr, "under maintenance") != NULL))
+                                               if (connect_to_server(tmid) == 
MOK &&
+                                                               
(mapi_start_talking(tmid) == MOK ||
+                                                                
*tmid->redirects != NULL ||
+                                                                
(tmid->errorstr != NULL &&
+                                                                 
strstr(tmid->errorstr, "under maintenance") != NULL)))
                                                {
                                                        host = buf;
                                                        port = socks[i];
@@ -2069,10 +2071,11 @@ mapi_mapi(const char *host, int port, co
                                                tmid = mapi_mapi("/tmp", 
socks[i], "mero", "mero",
                                                                lang, dbname);
                                                tmid->redirmax = 0;
-                                               if (mapi_reconnect(tmid) == MOK 
||
-                                                               
*tmid->redirects != NULL ||
-                                                               (tmid->errorstr 
!= NULL &&
-                                                                
strstr(tmid->errorstr, "under maintenance") != NULL))
+                                               if (connect_to_server(tmid) == 
MOK &&
+                                                               
(mapi_start_talking(tmid) == MOK ||
+                                                                
*tmid->redirects != NULL ||
+                                                                
(tmid->errorstr != NULL &&
+                                                                 
strstr(tmid->errorstr, "under maintenance") != NULL)))
                                                {
                                                        host = buf;
                                                        port = socks[i];
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to