Add more tests to ensure the interaction between TransactionEventHandlers and indexes

This verifies that github issues #3590, #2851, #2270 and #2714 are fixed in 2.2.