This is an automated email from the ASF dual-hosted git repository. dlmarion pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo.git
commit 2fe955be62afd05d8628375f4bba10cfbcbe5a80 Merge: 71e4ea4e7f 189e9c10c7 Author: Dave Marion <dlmar...@apache.org> AuthorDate: Wed May 28 14:47:58 2025 +0000 Merge branch '2.1' .../accumulo/server/conf/store/PropStore.java | 7 ++ .../server/conf/store/impl/ZooPropStore.java | 5 ++ .../accumulo/server/conf/util/PropSnapshot.java | 1 + .../server/conf/NamespaceConfigurationTest.java | 2 + .../server/conf/SystemConfigurationTest.java | 2 + .../server/conf/TableConfigurationTest.java | 14 ++++ .../server/conf/util/PropSnapshotTest.java | 6 ++ .../test/functional/AccumuloConfigurationIT.java | 87 ++++++++++++++++++++++ 8 files changed, 124 insertions(+) diff --cc server/base/src/main/java/org/apache/accumulo/server/conf/store/PropStore.java index ecb0b89d72,036c7a4e6a..9fe274e91e --- a/server/base/src/main/java/org/apache/accumulo/server/conf/store/PropStore.java +++ b/server/base/src/main/java/org/apache/accumulo/server/conf/store/PropStore.java @@@ -128,5 -128,12 +128,12 @@@ public interface PropStore * @param expectedVersion the expected data version * @return true if the stored version matches the provided expected version. */ - boolean validateDataVersion(PropStoreKey<?> storeKey, long expectedVersion); + boolean validateDataVersion(PropStoreKey storeKey, long expectedVersion); + + /** + * Invalidate the properties associated with the provided key so that they are re-fetched. + * + * @param storeKey the prop cache key + */ - void invalidate(PropStoreKey<?> storeKey); ++ void invalidate(PropStoreKey storeKey); } diff --cc server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/ZooPropStore.java index fc2ed1a792,6168e18d8c..43e57f1d14 --- a/server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/ZooPropStore.java +++ b/server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/ZooPropStore.java @@@ -432,4 -450,9 +432,9 @@@ public class ZooPropStore implements Pr return true; } + @Override - public void invalidate(PropStoreKey<?> storeKey) { ++ public void invalidate(PropStoreKey storeKey) { + cache.remove(storeKey); + } + } diff --cc server/base/src/test/java/org/apache/accumulo/server/conf/TableConfigurationTest.java index 7306606445,e01f2258d4..2b18812ac2 --- a/server/base/src/test/java/org/apache/accumulo/server/conf/TableConfigurationTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/conf/TableConfigurationTest.java @@@ -153,15 -155,17 +155,17 @@@ public class TableConfigurationTest String expectedPass = "aPassword1"; reset(propStore); - expect(propStore.get(eq(NamespacePropKey.of(instanceId, NID)))) - .andReturn(new VersionedProperties(13, Instant.now(), Map.of(TABLE_FILE_MAX.getKey(), "123", - Property.INSTANCE_SECRET.getKey(), expectedPass))) + expect(propStore.get(eq(NamespacePropKey.of(NID)))).andReturn(new VersionedProperties(13, + Instant.now(), + Map.of(TABLE_FILE_MAX.getKey(), "123", Property.INSTANCE_SECRET.getKey(), expectedPass))) .anyTimes(); - expect(propStore.get(eq(TablePropKey.of(instanceId, TID)))) - .andReturn(new VersionedProperties(Map.of())).anyTimes(); - propStore.invalidate(NamespacePropKey.of(instanceId, NID)); + expect(propStore.get(eq(TablePropKey.of(TID)))).andReturn(new VersionedProperties(Map.of())) + .anyTimes(); ++ propStore.invalidate(NamespacePropKey.of(NID)); + expectLastCall().atLeastOnce(); replay(propStore); - nsConfig.zkChangeEvent(NamespacePropKey.of(instanceId, NID)); + nsConfig.zkChangeEvent(NamespacePropKey.of(NID)); assertEquals("123", tableConfig.get(TABLE_FILE_MAX)); // from ns assertEquals("aPassword1", tableConfig.get(INSTANCE_SECRET)); // from sys @@@ -175,15 -179,19 +179,19 @@@ reset(propStore); - expect(propStore.get(eq(SystemPropKey.of(instanceId)))) + expect(propStore.get(eq(SystemPropKey.of()))) .andReturn(new VersionedProperties(1, Instant.now(), Map.of())); - expect(propStore.get(eq(NamespacePropKey.of(instanceId, NID)))) + expect(propStore.get(eq(NamespacePropKey.of(NID)))) .andReturn(new VersionedProperties(2, Instant.now(), Map.of("dog", "bark", "cat", "meow"))); - expect(propStore.get(eq(TablePropKey.of(instanceId, TID)))) + expect(propStore.get(eq(TablePropKey.of(TID)))) .andReturn(new VersionedProperties(4, Instant.now(), Map.of("foo", "bar", "tick", "tock"))) .anyTimes(); - propStore.invalidate(TablePropKey.of(instanceId, TID)); ++ propStore.invalidate(TablePropKey.of(TID)); + expectLastCall().atLeastOnce(); - propStore.invalidate(NamespacePropKey.of(instanceId, NID)); ++ propStore.invalidate(NamespacePropKey.of(NID)); + expectLastCall().atLeastOnce(); replay(propStore); @@@ -211,15 -219,20 +219,19 @@@ reset(propStore); - expect(propStore.get(eq(SystemPropKey.of(instanceId)))) + expect(propStore.get(eq(SystemPropKey.of()))) .andReturn(new VersionedProperties(1, Instant.now(), Map.of())); - expect(propStore.get(eq(NamespacePropKey.of(instanceId, NID)))) - .andReturn(new VersionedProperties(2, Instant.now(), - Map.of("dog", "bark", "cat", "meow", "filter", "from_parent"))); + expect(propStore.get(eq(NamespacePropKey.of(NID)))).andReturn(new VersionedProperties(2, + Instant.now(), Map.of("dog", "bark", "cat", "meow", "filter", "from_parent"))); - expect(propStore.get(eq(TablePropKey.of(instanceId, TID)))).andReturn(new VersionedProperties(4, + expect(propStore.get(eq(TablePropKey.of(TID)))).andReturn(new VersionedProperties(4, Instant.now(), Map.of("filter", "not_returned_by_table", "foo", "bar", "tick", "tock"))) .anyTimes(); - propStore.invalidate(TablePropKey.of(instanceId, TID)); ++ propStore.invalidate(TablePropKey.of(TID)); + expectLastCall().atLeastOnce(); - propStore.invalidate(NamespacePropKey.of(instanceId, NID)); ++ propStore.invalidate(NamespacePropKey.of(NID)); + expectLastCall().atLeastOnce(); replay(propStore); diff --cc server/base/src/test/java/org/apache/accumulo/server/conf/util/PropSnapshotTest.java index af420570b0,ae218626b0..22c618b59a --- a/server/base/src/test/java/org/apache/accumulo/server/conf/util/PropSnapshotTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/conf/util/PropSnapshotTest.java @@@ -64,11 -68,13 +64,13 @@@ class PropSnapshotTest .andReturn(new VersionedProperties(123, Instant.now(), Map.of("k1", "v1", "k2", "v2"))) .once(); // after update - expect(propStore.get(eq(SystemPropKey.of(instanceId)))) + expect(propStore.get(eq(SystemPropKey.of()))) .andReturn(new VersionedProperties(124, Instant.now(), Map.of("k3", "v3"))).once(); - propStore.invalidate(SystemPropKey.of(instanceId)); ++ propStore.invalidate(SystemPropKey.of()); + expectLastCall().atLeastOnce(); replay(propStore); - PropSnapshot snapshot = PropSnapshot.create(SystemPropKey.of(instanceId), propStore); + PropSnapshot snapshot = PropSnapshot.create(SystemPropKey.of(), propStore); assertEquals("v1", snapshot.getVersionedProperties().asMap().get("k1")); assertEquals("v2", snapshot.getVersionedProperties().asMap().get("k2")); @@@ -93,6 -99,8 +95,8 @@@ expect(propStore.get(eq(sysPropKey))).andReturn( new VersionedProperties(100, Instant.now(), Map.of(TABLE_BLOOM_ENABLED.getKey(), "false"))) .once(); - propStore.invalidate(SystemPropKey.of(instanceId)); ++ propStore.invalidate(SystemPropKey.of()); + expectLastCall().atLeastOnce(); replay(propStore);