I want to know when a new key is created in Redis (which matches a particular pattern to be specific).
The redis docs give an example of capturing all events on keys, but I don't see a way of actually capturing just the creation of a new key.
When I run the example in the docs and create a new key I only see the operation I performed on that key, not the keys creation itself.
To capture events from the example above I ran:
redis-cli -h host -a pass --csv psubscribe '__key*__:*'
I see SET events only when I run a SET operation, but I'm running XADD to create the key. I see the XADD operation, but I see every XADD operation with no way to distinguish a new key being generated.
Related
I have a subscription with DB2 for i (as400) as source and Kafka as target (11.4.0.2). The replication method is REFRESH.
There was a table in the subscription, which was running well.
But after I delete it and add it to another new subscription (with same source and target, also REFRESH), it cannot be replicated. The replication end with following message:
Subscription XXX has received a request for an abort shutdown. There are no other error messages. The table mapping (flag for refresh already) seems being ignored by CDC.
From the log, it returns:
Received normal shutdown request number 9 with reason OTHER_ENGINE_COMPLETE
I have no idea what is happening as there are no obvious hints from logs.
I tried (1) recreate table mapping and (2) update table definitions, but not working.
Other tables in the subscription can be replicated.
Please check after you delete table mapping from earlier subscription, is it still showing by checking 'replication tables' in MC (select datastore -> replication tables) select and remove and remap in new subscription.
Thanks
Sudarshan K
I am trying to understand what is the minimal set of parameters to uniquely identify a session in GV$SESSION. I have seen a few online examples there AUDSID, SID, and INST_ID are used, I am trying to understand why?
For a given instance, a session is uniquely identified by its SID and its SERIAL#, as explained in the documentation:
SID: Session identifier
SERIAL#: Session serial number. Used to uniquely identify a session's objects. Guarantees that session-level commands are applied to the correct session objects if the session ends and another session begins with the same session ID.
You can add INST_ID to that if you are running a RAC environment.
It's a pair of values SID and SERIAL#
Description on both of them in docs explains why:
SID
Session identifier
SERIAL#
Session serial number. Used to uniquely identify a session's objects. Guarantees that session-level commands are applied to the correct session objects if the session ends and another session begins with the same session ID.
SID and SERIAL# are enough in V$SESSION for single instance database.
SID, SERIAL#, INST_ID are enough for RAC cluster database in GV$SESSION.
NB: no need to use GV$SESSION if not RAC.
GV$session vs V$session is used on standalone database, an gv$session (g=global) is used mostly on RAC environments.
AUDSID is a unique identifier for the session and is used in sys.aud$ , as the SESSIONID column. It is the leading column of the only index on sys.aud$
INST_ID column displays the instance number from which the associated V$ view information was obtained
The best way to understand both of them to refer to Oracle documentation and understand what each column do,
https://docs.oracle.com/cd/B19306_01/server.102/b14237/dynviews_2088.htm#REFRN30223
I am trying to solve a problem of disconnected clients while using activejdbc. So the client app queues the inserts and subsequent updates and deletes when there is no internet. Then the batch of these come thru when they have connectivity.
To support this the client uses temporary primary keys which are replaced with the result of the the auto_increment key produced when the connectivity is restored and the batch applied. To do this I need to get the key generated when I do a save() or create(). Can activejdbc use https://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html#getGeneratedKeys%28%29 ?
When you save a model, its ID is in fact becomes the auto-generated value returned by the database:
Person p = new Person();
p.set("first_name", "John", "last_name", "Doe");
p.saveIt();
System.out.println("ID of this model: " + p.getId());
However, if you try to set the ID of a model manually, then the framework assumes you know what you are doing and tries to use that ID in the insert.
Please, see: http://javalite.io/surrogate_primary_keys.
I pushed a Ruby on Rails test application up to Heroku and, after running the command heroku run rake db:migrate, received a notification that says:
NOTICE: CREATE TABLE will create implicit sequence "microposts_id_seq" for serial column "microposts.id"
What is an implicit sequence? And, in this case, is a "serial column" another way to refer to a primary key?
Your table contains a column which is defined as serial which is just a shorthand for an integer column which default value is taken from a sequence. In order to do that, PostgreSQL automatically creates a sequence that is bound to that column. The message merely tells you that such a sequence was created.
If you didn't explicitely define a serial column, you probably defined it as "autoincremen" or whatever the Ruby term for that is.
For more details please read the manual: http://www.postgresql.org/docs/current/static/datatype-numeric.html#DATATYPE-SERIAL
Upsert (Replace)
Update If Exists
Insert If Not Exists
(Using Primary Key as Pipelined)
What do you mean by "update if exists"? The standard Redis SET commands (SET, MSET, HSET, LSET, etc.) will update (overwrite) an existing key if the key already exists or insert a new key if the key doesn't already exist.
Sounds like you are asking for the default behavior.
there are other data structures supported by redis for example SET, Sorted SET and SET command works for String values only as it expects a string key and string value.