public inbox for [email protected]  
help / color / mirror / Atom feed
From: Akshay Joshi <[email protected]>
To: Khushboo Vashi <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: [pgAdmin4][Patch]: RM 3927 Unable to debug the procedure inside package
Date: Wed, 30 Jan 2019 13:05:06 +0530
Message-ID: <CANxoLDcpg8jp78U7FPDGSaxdbyZZAjMqW3xJyqCUTeKvmqpcUQ@mail.gmail.com> (raw)
In-Reply-To: <CAFOhELfkaH0Edrv7VNmQXNjypo3pyL7NtyV9e-64Q8oGoif5Bg@mail.gmail.com>
References: <CANxoLDe5=7hu-K66nXcRHB2sQ84CjEGkBC8Fg=5FFepbh7vbbA@mail.gmail.com>
	<CA+OCxoyxdYFWdCPcwqmeVAjhB=NdRF7aOAb0HptPRDv0FY7meA@mail.gmail.com>
	<CAFOhELfkaH0Edrv7VNmQXNjypo3pyL7NtyV9e-64Q8oGoif5Bg@mail.gmail.com>

Hi Khushboo

On Wed, Jan 30, 2019 at 10:17 AM Khushboo Vashi <
[email protected]> wrote:

> Hi Akshay,
>
> The issue has been fixed with this patch but I feel we need code
> refactoring of the existing code especially the loop in which we find the
> required string.
> What's your thought?
>

    Attached is the updated patch. Please review it.

>
> Also, please remove the datagrid/__init__.py file from the patch which I
> assume you have sent by mistake.
>

    No that file contains fix to cancel the transaction of Query Tool. By
mistake that line is commented out.

>
> Thanks,
> Khushboo
>
>
> On Tue, Jan 29, 2019 at 4:49 PM Dave Page <[email protected]> wrote:
>
>> Khushboo, can you review this please? If you're happy with it, Akshay
>> can commit.
>>
>> Thanks.
>>
>> On Mon, Jan 28, 2019 at 12:33 PM Akshay Joshi
>> <[email protected]> wrote:
>> >
>> > Hi Hackers,
>> >
>> > Attached is the patch to fix RM 3927 "Unable to debug the procedure
>> inside package". Problem with the existing code is we assume that
>> "PLDBGBREAK" will be always found in the first element of the notification
>> list.
>> >
>> > In this patch we loop through the list and found the string. Apart from
>> that patch contains small fix to cancel the transaction of Query Tool when
>> panel is closed.
>> >
>> > Please review it.
>> >
>> > --
>> > Akshay Joshi
>> > Sr. Software Architect
>> >
>> >
>> > Phone: +91 20-3058-9517
>> > Mobile: +91 976-788-8246
>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>>

-- 
*Akshay Joshi*

*Sr. Software Architect *



*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*


Attachments:

  [application/octet-stream] RM_3927_v2.patch (2.1K, 3-RM_3927_v2.patch)
  download | inline diff:
diff --git a/web/pgadmin/tools/datagrid/__init__.py b/web/pgadmin/tools/datagrid/__init__.py
index ded06de..85ab5da 100644
--- a/web/pgadmin/tools/datagrid/__init__.py
+++ b/web/pgadmin/tools/datagrid/__init__.py
@@ -409,6 +409,7 @@ def close(trans_id):
 
         # Release the connection
         if conn.connected():
+            conn.cancel_transaction(cmd_obj.conn_id, cmd_obj.did)
             manager.release(did=cmd_obj.did, conn_id=cmd_obj.conn_id)
 
         # Remove the information of unique transaction id from the
diff --git a/web/pgadmin/tools/debugger/__init__.py b/web/pgadmin/tools/debugger/__init__.py
index 9e5ff91..42fa12f 100644
--- a/web/pgadmin/tools/debugger/__init__.py
+++ b/web/pgadmin/tools/debugger/__init__.py
@@ -13,6 +13,7 @@ MODULE_NAME = 'debugger'
 
 import simplejson as json
 import random
+import re
 
 from flask import url_for, Response, render_template, request, session, \
     current_app
@@ -1301,20 +1302,16 @@ def messages(trans_id):
             # From the above message we need to find out port number
             # as "7" so below logic will find 7 as port number
             # and attach listened to that port number
-            offset = notify[0].find('PLDBGBREAK')
-            str_len = len('PLDBGBREAK')
-            str_len += 1
-            tmpOffset = 0
-            tmpFlag = False
-
-            while notify[0][offset + str_len + tmpOffset].isdigit():
-                status = 'Success'
-                tmpFlag = True
-                port_number = port_number + \
-                    notify[0][offset + str_len + tmpOffset]
-                tmpOffset += 1
-
-            if not tmpFlag:
+            port_found = False
+            tmp_list = list(filter(lambda x: 'PLDBGBREAK' in x, notify))
+            if len(tmp_list) > 0:
+                port_number = re.search(r'\d+', tmp_list[0])
+                if port_number is not None:
+                    status = 'Success'
+                    port_number = port_number.group(0)
+                    port_found = True
+
+            if not port_found:
                 status = 'Busy'
         else:
             status = 'Busy'


view thread (5+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: [pgAdmin4][Patch]: RM 3927 Unable to debug the procedure inside package
  In-Reply-To: <CANxoLDcpg8jp78U7FPDGSaxdbyZZAjMqW3xJyqCUTeKvmqpcUQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox