Not able to find data modifications entries in oplog in PSA setup

I have a PSA replica cluster, and after doing an insert I can see entries in collections but unable to find entries in oplog with this command.

db.oplog.rs.find().sort(
{$natural:-1}
)

I was always able to see all changes in oplog with this command in a single node replicaset but this command is not working in PSA setup. Does this always show latest entries in oplog?

Yes.

The oplog is in the local database, so use local before the query. Or you can do it in a one liner:
db.getSiblingDB('local').oplog.rs.find().sort({$natural:-1})

2 Likes

Thanks, I am already running it in local db and I can see other entries.

Now I see the issue, can’t see oplog entries when doing inserts in a transaction. Inserts are committed but still can’t see entries in oplog.

When inserts are not done in a transaction can see oplog entries for the inserts done

@Sameer_Kattel

Here is an oplog from the Callback API example, I used Python.

You will see that the transaction is an op of type c. The individual operations of the transaction are in the applyOps array.

{
	"lsid" : {
		"id" : UUID("0fbbf122-a1c0-43f5-8253-b8a9ede5968b"),
		"uid" : BinData(0,"Y5mrDaxi8gv8RmdTsQ+1j7fmkr7JUsabhNmXAheU0fg=")
	},
	"txnNumber" : NumberLong(3),
	"op" : "c",
	"ns" : "admin.$cmd",
	"o" : {
		"applyOps" : [
			{
				"op" : "i",
				"ns" : "mydb1.foo",
				"ui" : UUID("e479700c-d729-49f0-8917-e9bf4eb43831"),
				"o" : {
					"_id" : ObjectId("609fdc4c34d8db74b91a333a"),
					"abc" : 1
				}
			},
			{
				"op" : "i",
				"ns" : "mydb2.bar",
				"ui" : UUID("1234f9c0-696e-48a6-99c1-78bf59154093"),
				"o" : {
					"_id" : ObjectId("609fdc4c34d8db74b91a333b"),
					"xyz" : 999
				}
			}
		]
	},
	"ts" : Timestamp(1621089356, 3),
	"t" : NumberLong(1),
	"wall" : ISODate("2021-05-15T14:35:56.153Z"),
	"v" : NumberLong(2),
	"prevOpTime" : {
		"ts" : Timestamp(0, 0),
		"t" : NumberLong(-1)
	}
}

2 Likes

Thanks!
I realize my mistake, was looking for “op”: “i” entries and was looking for my collection “ns” .

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.