Merge lp:~mmcm/akiban-persistit/config-reload-properties into lp:akiban-persistit

Proposed by Mike McMahon
Status: Needs review
Proposed branch: lp:~mmcm/akiban-persistit/config-reload-properties
Merge into: lp:akiban-persistit
Diff against target: 22 lines (+12/-0)
1 file modified
src/main/java/com/persistit/Configuration.java (+12/-0)
To merge this branch: bzr merge lp:~mmcm/akiban-persistit/config-reload-properties
Reviewer Review Type Date Requested Status
Peter Beaman Needs Information
Review via email: mp+159531@code.launchpad.net

Description of the change

Add Configuration.reloadProperties().

Configuration has various bits of state that are initialized from the properties when the Configuration(Properties) ctor is called. It also has an no-arg ctor and it also has a setProperty() method. Which means that that state can sometimes be out-of-date. Rather than trying to guess when that might be the case, or copy the state lazily, this branch just adds a method that an advanced caller can invoke to get the copies state back in sync with the underlying Properties.

I am open to suggestions on how else to do this. See lp:~mmcm/akiban-server/tree-schema-map-wildcards for the server use case.

To post a comment you must log in.
Revision history for this message
Peter Beaman (pbeaman) wrote :

Could the dynamic volume loading be done without changing the Configuration? The volumeSpecifications list in Configuration is used only during system initialization. You can create and/or open volumes not specified in the Configuration with Persistit#loadVolume(VolumeSpecification)*. It is not necessary for every volume to specified in the Configuration's volume list. The API is messy in that respect due to the late addition of an API for creating and opening new volumes.

In the server branch I saw code that laboriously creates new properties, but I did not see any code to open the associated volumes. I think we could simplify the process by creating a VolumeSpecification for each dynamic volume, calling the loadVolume method, and ignoring the Configuration.

I am inclined to remove or at least deprecate Configuration#setProperty. There appear to be no callers.

* I think Persistit#loadVolume is broken; there's code in the initializeVolumes loop to try to match existing volumes described by the journal but not yet open; I think this code also has to appear in the loadVolume code, and further that initializeVolumes should simply be calling the corrected loadVolume for each VolumeSpecification. I will investigate that further.

review: Needs Information
Revision history for this message
Mike McMahon (mmcm) wrote :

Look at the earlier revisions of the referenced server branch: that's how the first cut worked. It has trouble if there are journal entries for one of the dynamic volumes, because recovery is done right away, on Persisit.initialize, before loadVolume gets a chance.

Revision history for this message
Peter Beaman (pbeaman) wrote :

Yes indeed. I will fix that soonest.
On Apr 18, 2013 12:36 AM, "Mike McMahon" <email address hidden> wrote:

> Look at the earlier revisions of the referenced server branch: that's how
> the first cut worked. It has trouble if there are journal entries for one
> of the dynamic volumes, because recovery is done right away, on
> Persisit.initialize, before loadVolume gets a chance.
> --
>
> https://code.launchpad.net/~mmcm/akiban-persistit/config-reload-properties/+merge/159531
> You are reviewing the proposed merge of
> lp:~mmcm/akiban-persistit/config-reload-properties into lp:akiban-persistit.
>

Unmerged revisions

430. By Mike McMahon

Add a method to Configuration to update cached values after properties have changed.
Already has a setProperty method.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/main/java/com/persistit/Configuration.java'
2--- src/main/java/com/persistit/Configuration.java 2013-01-19 17:42:22 +0000
3+++ src/main/java/com/persistit/Configuration.java 2013-04-18 00:55:30 +0000
4@@ -793,6 +793,18 @@
5 }
6 }
7
8+ /**
9+ * Reload properties after calling {@link #setProperty} or changing the
10+ * underlying <code>Properties</code>.
11+ *
12+ * @throws IllegalArgumentException
13+ * of a property contains an invalid value
14+ */
15+ public void reloadProperties() throws InvalidVolumeSpecificationException {
16+ volumeSpecifications.clear();
17+ loadProperties();
18+ }
19+
20 void loadProperties() throws InvalidVolumeSpecificationException {
21 setAppendOnly(getBooleanProperty(APPEND_ONLY_PROPERTY_NAME, false));
22 setCommitPolicy(getProperty(COMMIT_POLICY_PROPERTY_NAME));

Subscribers

People subscribed via source and target branches