Skip to content

Simplify EventKeeperTranslator so that it references pre-existing events rather than creating copies#3990

Draft
alecgrieser wants to merge 2 commits intoFoundationDB:mainfrom
alecgrieser:simplify-event-keeper-translator
Draft

Simplify EventKeeperTranslator so that it references pre-existing events rather than creating copies#3990
alecgrieser wants to merge 2 commits intoFoundationDB:mainfrom
alecgrieser:simplify-event-keeper-translator

Conversation

@alecgrieser
Copy link
Collaborator

For a smattering of EventKeeper.Events, we have corresponding StoreTimer.Events already defined in the enums we use for this. There's no real reason for the EventKeeper to recreate those, I don't think, so replace those references with references to the enum values.

@alecgrieser alecgrieser added the cleanup Style/code cleanup with no behavioral change label Mar 4, 2026
static {
eventKeeperMap.put(EventKeeper.Events.JNI_CALL,
new Count("JNI_CALLS", "jni calls", false));
FDBStoreTimer.Counts.JNI_CALLS);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

java.lang.UnsupportedOperationException: Programmer error: Counter(name = jni calls) is not a timer
	at com.apple.foundationdb.relational.recordlayer.util.MetricRegistryStoreTimer$RegistryCounter.record(MetricRegistryStoreTimer.java:108)
	at com.apple.foundationdb.record.provider.common.StoreTimer.record(StoreTimer.java:558)
	at com.apple.foundationdb.record.provider.foundationdb.EventKeeperTranslator.count(EventKeeperTranslator.java:72)
	at com.apple.foundationdb.EventKeeper.increment(EventKeeper.java:46)
	at com.apple.foundationdb.FDBTransaction.closeInternal(FDBTransaction.java:790)
	at com.apple.foundationdb.NativeObjectWrapper.close(NativeObjectWrapper.java:75)
	at com.apple.foundationdb.FDBDatabase.createTransaction(FDBDatabase.java:174)
	at com.apple.foundationdb.record.provider.foundationdb.FDBDatabase.createTransaction(FDBDatabase.java:784)
	at com.apple.foundationdb.record.provider.foundationdb.FDBDatabase.openContext(FDBDatabase.java:449)
	at com.apple.foundationdb.relational.recordlayer.RecordLayerTransactionManager.createTransaction(RecordLayerTransactionManager.java:49)
	at com.apple.foundationdb.relational.server.FRL.<init>(FRL.java:105)
	at com.apple.foundationdb.relational.yamltests.configs.EmbeddedConfig.beforeAll(EmbeddedConfig.java:52)
	at CustomTagTest.beforeAll(CustomTagTest.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I tracked this down. The error isn't that JNI_CALLS shouldn't be a COUNT. The error is that the logic that was supposed to figure out if it was a count or not was using the wrong class/interface. Fix here: 7e6b582

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Style/code cleanup with no behavioral change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants