Comments (9)
Sounds interesting.
Do you mean cleaning up of the current (single) session, or of all sessions
currently available?
Original comment by [email protected]
on 30 May 2012 at 5:53
from plv8.
All, preferably. I haven't found another way to do this other than restart the
entire db server.
In a traditional web-app, only the app code needs to be restarted, but now that
code lives in plv8 I need way to signal it as well. I've been looking at
http://www.postgresql.org/docs/current/static/functions-admin.html#FUNCTIONS-ADM
IN-SIGNAL-TABLE and plan to experiment a bit tomorrow.
An added bonus to being able to signal just plv8 to restart would be to knock
the process back down to it's startup memory size.
It would be best for the session to wait until it is not in a transaction and
idle, which is what I'll be testing tomorrow by sending various signals to the
process.
Original comment by [email protected]
on 30 May 2012 at 10:45
from plv8.
\c in psql does not reset the session - it starts a new connection. Instead of
restarting the server you could have the app server close all its sessions and
reconnect.
None of the PLs have the sort of functionality you are asking for, and AFAIK
there is no provision for them to. I don't know of any hook that can be
attached to a reset event, for example.
Original comment by [email protected]
on 4 Jul 2012 at 11:20
from plv8.
I guess it's not difficult to reset the JS context in the same session; c
function plv8_reset() can clear the GlobalContext for the user. I don't still
see how to reset the other session's context, though. IMHO it is possible in
plv8 and I don't care the fact that other PLs don't have such way.
Original comment by [email protected]
on 5 Jul 2012 at 2:41
from plv8.
Of course we can provide such a function. But ISTM that what the OP wants is a
way to do all this for all backends (or possibly some subset of backends, say
those that are connected to a named database) from one command. Doing that is
not going to be easy, as you say, and if it's to be doable I doubt that it can
just be done by a single PL - it would almost certainly need core
infrastructure to support it. But by all means start by providing a
plv8_reset() function. As you say that should just reset the context for the
calling user, and leave other contexts alone.
Original comment by [email protected]
on 5 Jul 2012 at 4:21
from plv8.
I ended using LISTEN/NOTIFY, new code deploys notify and clients disconnect and
reconnect. This still has issues, especially with things like pgbouncer. This
app is not running in production yet, and I'm curious as to whether postgres
ever reuses a process on the server for reconnecting clients?
Anyways, a plv8_reset() would be cleaner and more intentional than a reconnect
and can be propagated to all connected clients with LISTEN/NOTIFY at the app
layer.
I have no idea of the pg internals, but if plv8 could tap into LISTEN/NOTIFY
that would be very powerful as it would enable JSON/IPC as well as being able
to hook js code to events.
Original comment by [email protected]
on 5 Jul 2012 at 6:49
from plv8.
I attempt to introduce plv8_reset() in the "resetfunc" branch. Does it help
your use case? Or are you ok now with your LISTEN/NOTIFY solution? I'm a
little hesitant to add this function as Andrew concerned above, and there is
not an easy way to dispatch this to all sessions anyway.
I'm not familiar with LISTEN/NOTIFY internal at the moment. I'll study it.
Original comment by [email protected]
on 18 Jul 2012 at 8:00
from plv8.
Thanks so much for hacking on this. LISTEN/NOTIFY has been working
great to get the clients to disconnect for an upgrade. plv8_reset
seems to work great too, however my gut tells me that when we go to
production the "safest" method is going to be either restarting the
server or uninstall/reinstall plv8 (if the later is supported with
pg's transaction ddl then it's probably the way to go).
Original comment by [email protected]
on 18 Jul 2012 at 9:31
from plv8.
OK, then I defer my attempt to later development until we have good idea rather
than making it dirty for now.
Original comment by [email protected]
on 18 Jul 2012 at 4:45
from plv8.
Related Issues (20)
- plv8 function that returns a bytea is incorrectly returning previous invocations results HOT 6
- Returning a Uint8Array doesn't handle the byteOffset HOT 2
- A question HOT 1
- simple variables in template literals HOT 2
- Compatibility with Postgres 16 HOT 2
- Build error plv8 - using the `make` command HOT 8
- Upgrade from 2.3.12 to 2.3.15 failed in Postgresql v11.18 HOT 1
- Excited to Start working with 3.2alpha Branch HOT 2
- Invalid Discord link? HOT 2
- r3.2 Rocks HOT 2
- Many warnings when building v3.2.0 HOT 2
- /usr/bin/ld: cannot find -lv8_base_with_compiler: No such file or directory HOT 4
- Support for pg16 HOT 4
- plv8_info() causes segmentation fault HOT 2
- Unable to access transition tables declared in trigger HOT 1
- add functions setTimeout and setInterval HOT 11
- Async function call in trigger HOT 4
- Use of Promise HOT 2
- PGXN Build Fails
- undefined symbol: _ZTIN2v84base6ThreadE HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plv8.