Merge lp:~pbeaman/akiban-persistit/buffer-pool-warmup-sorted into lp:akiban-persistit
- buffer-pool-warmup-sorted
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~pbeaman/akiban-persistit/buffer-pool-warmup-sorted |
Merge into: | lp:akiban-persistit |
Prerequisite: | lp:~pbeaman/akiban-persistit/eclipse-canonical-format |
Diff against target: |
39118 lines (+7109/-5984) 317 files modified
doc/Configuration.rst (+13/-1) doc/ReleaseNotes.rst (+20/-0) pom.xml (+37/-1) src/etc/eclipse-cleanup-config.xml (+56/-0) src/etc/eclipse-format-config.xml (+291/-0) src/main/java/com/persistit/Accumulator.java (+10/-9) src/main/java/com/persistit/AccumulatorState.java (+4/-5) src/main/java/com/persistit/AlertMonitor.java (+27/-27) src/main/java/com/persistit/AntiValue.java (+15/-15) src/main/java/com/persistit/BackupTask.java (+14/-13) src/main/java/com/persistit/Buffer.java (+427/-421) src/main/java/com/persistit/BufferPool.java (+215/-169) src/main/java/com/persistit/BufferPoolMXBeanImpl.java (+6/-5) src/main/java/com/persistit/CLI.java (+66/-62) src/main/java/com/persistit/CheckpointManager.java (+28/-28) src/main/java/com/persistit/ClassIndex.java (+38/-36) src/main/java/com/persistit/ClassInfo.java (+10/-9) src/main/java/com/persistit/CleanupManager.java (+27/-26) src/main/java/com/persistit/Configuration.java (+152/-144) src/main/java/com/persistit/DefaultCoderManager.java (+46/-44) src/main/java/com/persistit/DefaultObjectCoder.java (+40/-39) src/main/java/com/persistit/DefaultValueCoder.java (+114/-113) src/main/java/com/persistit/Exchange.java (+177/-170) src/main/java/com/persistit/FastIndex.java (+43/-43) src/main/java/com/persistit/GetVersion.java (+10/-7) src/main/java/com/persistit/IOMeter.java (+35/-31) src/main/java/com/persistit/IOTaskRunnable.java (+11/-11) src/main/java/com/persistit/IntegrityCheck.java (+115/-106) src/main/java/com/persistit/JournalManager.java (+147/-119) src/main/java/com/persistit/JournalRecord.java (+6/-7) src/main/java/com/persistit/JournalTool.java (+47/-47) src/main/java/com/persistit/Key.java (+155/-149) src/main/java/com/persistit/KeyFilter.java (+109/-105) src/main/java/com/persistit/KeyHistogram.java (+10/-8) src/main/java/com/persistit/KeyParser.java (+35/-35) src/main/java/com/persistit/KeyState.java (+21/-21) src/main/java/com/persistit/LongRecordHelper.java (+11/-11) src/main/java/com/persistit/MVV.java (+24/-22) src/main/java/com/persistit/Management.java (+53/-44) src/main/java/com/persistit/ManagementImpl.java (+129/-126) src/main/java/com/persistit/MediatedFileChannel.java (+54/-53) src/main/java/com/persistit/Persistit.java (+134/-120) src/main/java/com/persistit/PersistitMap.java (+93/-85) src/main/java/com/persistit/RecoveryManager.java (+81/-63) src/main/java/com/persistit/SessionId.java (+1/-1) src/main/java/com/persistit/SharedResource.java (+18/-18) src/main/java/com/persistit/StatisticsTask.java (+17/-13) src/main/java/com/persistit/StreamLoader.java (+56/-55) src/main/java/com/persistit/StreamSaver.java (+32/-30) src/main/java/com/persistit/Task.java (+27/-26) src/main/java/com/persistit/TaskCheck.java (+14/-13) src/main/java/com/persistit/TimestampAllocator.java (+2/-2) src/main/java/com/persistit/Transaction.java (+21/-21) src/main/java/com/persistit/TransactionIndex.java (+32/-30) src/main/java/com/persistit/TransactionIndexBucket.java (+6/-6) src/main/java/com/persistit/TransactionPlayer.java (+17/-17) src/main/java/com/persistit/TransactionPlayerSupport.java (+0/-1) src/main/java/com/persistit/TransactionRunnable.java (+3/-3) src/main/java/com/persistit/TransactionStatus.java (+20/-17) src/main/java/com/persistit/Tree.java (+13/-13) src/main/java/com/persistit/TreeSelector.java (+6/-6) src/main/java/com/persistit/TreeState.java (+3/-3) src/main/java/com/persistit/TreeStatistics.java (+6/-6) src/main/java/com/persistit/Value.java (+433/-371) src/main/java/com/persistit/ValueHelper.java (+31/-28) src/main/java/com/persistit/ValueState.java (+8/-8) src/main/java/com/persistit/Volume.java (+8/-7) src/main/java/com/persistit/VolumeHandleLookup.java (+0/-2) src/main/java/com/persistit/VolumeHeader.java (+12/-12) src/main/java/com/persistit/VolumeSpecification.java (+15/-16) src/main/java/com/persistit/VolumeStatistics.java (+8/-8) src/main/java/com/persistit/VolumeStorage.java (+1/-3) src/main/java/com/persistit/VolumeStorageT2.java (+40/-17) src/main/java/com/persistit/VolumeStorageV2.java (+56/-28) src/main/java/com/persistit/VolumeStructure.java (+49/-49) src/main/java/com/persistit/encoding/CollectionValueCoder.java (+20/-19) src/main/java/com/persistit/encoding/EnumValueCoder.java (+4/-4) src/main/java/com/persistit/encoding/KeyDisplayer.java (+4/-4) src/main/java/com/persistit/encoding/KeyRenderer.java (+7/-7) src/main/java/com/persistit/encoding/ObjectCache.java (+19/-19) src/main/java/com/persistit/encoding/SerialValueCoder.java (+9/-9) src/main/java/com/persistit/exception/AppendableIOException.java (+1/-1) src/main/java/com/persistit/exception/BufferSizeUnavailableException.java (+1/-1) src/main/java/com/persistit/exception/ConversionException.java (+3/-3) src/main/java/com/persistit/exception/CorruptImportStreamException.java (+1/-1) src/main/java/com/persistit/exception/CorruptJournalException.java (+1/-1) src/main/java/com/persistit/exception/CorruptValueException.java (+1/-1) src/main/java/com/persistit/exception/CorruptVolumeException.java (+1/-1) src/main/java/com/persistit/exception/InUseException.java (+1/-1) src/main/java/com/persistit/exception/InvalidKeyException.java (+1/-1) src/main/java/com/persistit/exception/InvalidPageAddressException.java (+1/-1) src/main/java/com/persistit/exception/InvalidPageStructureException.java (+1/-1) src/main/java/com/persistit/exception/InvalidPageTypeException.java (+1/-1) src/main/java/com/persistit/exception/InvalidVolumeSpecificationException.java (+1/-1) src/main/java/com/persistit/exception/MalformedValueException.java (+1/-1) src/main/java/com/persistit/exception/MissingKeySegmentException.java (+1/-1) src/main/java/com/persistit/exception/MissingThreadException.java (+1/-1) src/main/java/com/persistit/exception/MissingVolumeException.java (+1/-1) src/main/java/com/persistit/exception/PersistitClosedException.java (+1/-1) src/main/java/com/persistit/exception/PersistitException.java (+3/-3) src/main/java/com/persistit/exception/PersistitIOException.java (+4/-4) src/main/java/com/persistit/exception/PersistitInterruptedException.java (+1/-2) src/main/java/com/persistit/exception/PropertiesNotFoundException.java (+1/-2) src/main/java/com/persistit/exception/ReadOnlyVolumeException.java (+1/-1) src/main/java/com/persistit/exception/RebalanceException.java (+1/-2) src/main/java/com/persistit/exception/RecoveryMissingVolumesException.java (+1/-1) src/main/java/com/persistit/exception/RollbackException.java (+2/-2) src/main/java/com/persistit/exception/TaskEndedException.java (+1/-2) src/main/java/com/persistit/exception/TestException.java (+1/-1) src/main/java/com/persistit/exception/TimeoutException.java (+1/-2) src/main/java/com/persistit/exception/TransactionFailedException.java (+2/-2) src/main/java/com/persistit/exception/TreeAlreadyExistsException.java (+1/-1) src/main/java/com/persistit/exception/TreeNotFoundException.java (+1/-1) src/main/java/com/persistit/exception/TruncateVolumeException.java (+1/-1) src/main/java/com/persistit/exception/VolumeAlreadyExistsException.java (+1/-1) src/main/java/com/persistit/exception/VolumeClosedException.java (+1/-2) src/main/java/com/persistit/exception/VolumeFullException.java (+1/-2) src/main/java/com/persistit/exception/VolumeNotFoundException.java (+1/-2) src/main/java/com/persistit/exception/WrongVolumeException.java (+1/-2) src/main/java/com/persistit/logging/ApacheCommonsLogAdapter.java (+4/-4) src/main/java/com/persistit/logging/DefaultPersistitLogger.java (+8/-5) src/main/java/com/persistit/logging/JDK14LoggingAdapter.java (+3/-4) src/main/java/com/persistit/logging/Log4JAdapter.java (+4/-5) src/main/java/com/persistit/logging/LogBase.java (+12/-4) src/main/java/com/persistit/logging/PersistitLevel.java (+0/-1) src/main/java/com/persistit/logging/PersistitLogMessage.java (+15/-12) src/main/java/com/persistit/logging/Slf4jAdapter.java (+3/-3) src/main/java/com/persistit/mxbeans/CleanupManagerMXBean.java (+2/-2) src/main/java/com/persistit/mxbeans/Description.java (+3/-1) src/main/java/com/persistit/mxbeans/IOMeterMXBean.java (+0/-2) src/main/java/com/persistit/mxbeans/JournalManagerMXBean.java (+2/-2) src/main/java/com/persistit/mxbeans/MXBeanWrapper.java (+30/-29) src/main/java/com/persistit/mxbeans/ManagementMXBean.java (+14/-10) src/main/java/com/persistit/mxbeans/PName.java (+3/-4) src/main/java/com/persistit/mxbeans/TransactionIndexMXBean.java (+0/-1) src/main/java/com/persistit/policy/JoinPolicy.java (+9/-10) src/main/java/com/persistit/policy/SplitPolicy.java (+25/-18) src/main/java/com/persistit/ref/AbstractReference.java (+2/-2) src/main/java/com/persistit/ref/AbstractWeakReference.java (+2/-2) src/main/java/com/persistit/ui/AbstractInspector.java (+1/-1) src/main/java/com/persistit/ui/AdminPanel.java (+1/-1) src/main/java/com/persistit/ui/AdminUI.java (+199/-179) src/main/java/com/persistit/ui/AdminUIBufferPanel.java (+24/-24) src/main/java/com/persistit/ui/AdminUISummaryPanel.java (+23/-22) src/main/java/com/persistit/ui/AdminUITaskPanel.java (+39/-39) src/main/java/com/persistit/ui/AdminUITreePanel.java (+38/-37) src/main/java/com/persistit/ui/InnerJarClassLoader.java (+14/-14) src/main/java/com/persistit/ui/InspectorDisplayablePanel.java (+3/-3) src/main/java/com/persistit/ui/InspectorHexPanel.java (+4/-4) src/main/java/com/persistit/ui/InspectorObjectPanel.java (+18/-17) src/main/java/com/persistit/ui/InspectorPanel.java (+27/-27) src/main/java/com/persistit/ui/ManagementListModel.java (+5/-5) src/main/java/com/persistit/ui/ManagementSlidingTableModel.java (+20/-19) src/main/java/com/persistit/ui/ManagementTableModel.java (+37/-36) src/main/java/com/persistit/ui/PersistitTableModel.java (+54/-54) src/main/java/com/persistit/ui/PoolDisplayPanel.java (+28/-28) src/main/java/com/persistit/ui/TaskSetupPanel.java (+48/-47) src/main/java/com/persistit/ui/TreeAndVolumeSelector.java (+57/-58) src/main/java/com/persistit/ui/VTComboBoxModel.java (+12/-13) src/main/java/com/persistit/ui/ValueInspectorTreeNode.java (+43/-42) src/main/java/com/persistit/ui/renderers/TaskStatusStateRenderer.java (+2/-2) src/main/java/com/persistit/util/ArgParser.java (+31/-32) src/main/java/com/persistit/util/Debug.java (+21/-19) src/main/java/com/persistit/util/InternalHashSet.java (+8/-8) src/main/java/com/persistit/util/SequencerConstants.java (+35/-35) src/main/java/com/persistit/util/ThreadSequencer.java (+22/-22) src/main/java/com/persistit/util/Util.java (+98/-99) src/test/java/com/persistit/AccumulatorMemoryTest.java (+6/-6) src/test/java/com/persistit/AccumulatorRecoveryTest.java (+46/-42) src/test/java/com/persistit/AccumulatorTest.java (+67/-68) src/test/java/com/persistit/AlertMonitorTest.java (+13/-10) src/test/java/com/persistit/BackupTaskTest.java (+8/-6) src/test/java/com/persistit/BufferMaxPack.java (+2/-2) src/test/java/com/persistit/BufferPoolTest.java (+16/-16) src/test/java/com/persistit/BufferTest.java (+14/-12) src/test/java/com/persistit/BufferTest2.java (+39/-38) src/test/java/com/persistit/Bug1003578Test.java (+5/-5) src/test/java/com/persistit/Bug1017957Test.java (+13/-12) src/test/java/com/persistit/Bug1018526Test.java (+8/-7) src/test/java/com/persistit/Bug706132Test.java (+2/-3) src/test/java/com/persistit/Bug708592Test.java (+0/-2) src/test/java/com/persistit/Bug739533Test.java (+1/-2) src/test/java/com/persistit/Bug777918Test.java (+5/-6) src/test/java/com/persistit/Bug790709Test.java (+2/-4) src/test/java/com/persistit/Bug870352Test.java (+1/-3) src/test/java/com/persistit/Bug877656Test.java (+4/-7) src/test/java/com/persistit/Bug882219Test.java (+5/-6) src/test/java/com/persistit/Bug885477Test.java (+0/-3) src/test/java/com/persistit/Bug889850Test.java (+0/-2) src/test/java/com/persistit/Bug911849Test.java (+6/-9) src/test/java/com/persistit/Bug912514Test.java (+6/-6) src/test/java/com/persistit/Bug915594Test.java (+2/-5) src/test/java/com/persistit/Bug918909Test.java (+0/-4) src/test/java/com/persistit/Bug920754Test.java (+0/-4) src/test/java/com/persistit/Bug923790Test.java (+5/-6) src/test/java/com/persistit/Bug927701Test.java (+3/-3) src/test/java/com/persistit/Bug937877Test.java (+4/-5) src/test/java/com/persistit/Bug942669Test.java (+6/-6) src/test/java/com/persistit/Bug947182Test.java (+10/-12) src/test/java/com/persistit/Bug974589Test.java (+2/-2) src/test/java/com/persistit/Bug980292Test.java (+1/-4) src/test/java/com/persistit/Bug989202Test.java (+3/-3) src/test/java/com/persistit/Bug992801Test.java (+0/-4) src/test/java/com/persistit/Bug996241Test.java (+14/-19) src/test/java/com/persistit/ClassIndexTest.java (+29/-27) src/test/java/com/persistit/CleanupManagerTest.java (+3/-3) src/test/java/com/persistit/CommandLineTest.java (+4/-4) src/test/java/com/persistit/ConfigurationTest.java (+21/-20) src/test/java/com/persistit/ConfirmEmptyVolume.java (+1/-1) src/test/java/com/persistit/ConfirmIntegrity.java (+0/-1) src/test/java/com/persistit/CorruptVolumeTest.java (+3/-3) src/test/java/com/persistit/DumpTaskTest.java (+8/-7) src/test/java/com/persistit/ErrorInjectingFileChannel.java (+40/-39) src/test/java/com/persistit/FastIndexTest.java (+19/-19) src/test/java/com/persistit/FatalErrorExceptionTest.java (+3/-3) src/test/java/com/persistit/IOFailureTest.java (+17/-14) src/test/java/com/persistit/IOMeterChargeBenchmark.java (+4/-4) src/test/java/com/persistit/InsertSequenceTest.java (+7/-6) src/test/java/com/persistit/IntegrityCheckTest.java (+28/-26) src/test/java/com/persistit/JournalManagerTest.java (+87/-84) src/test/java/com/persistit/KeyHistogramTest.java (+1/-1) src/test/java/com/persistit/MVCCBasicTest.java (+48/-48) src/test/java/com/persistit/MVCCConcurrentTest.java (+8/-9) src/test/java/com/persistit/MVCCPruneBufferTest.java (+31/-29) src/test/java/com/persistit/MVCCPruneTest.java (+14/-14) src/test/java/com/persistit/MVCCTestBase.java (+40/-36) src/test/java/com/persistit/MVVTest.java (+53/-43) src/test/java/com/persistit/MediatedFileChannelTest.java (+7/-6) src/test/java/com/persistit/MockSerializableObject.java (+1/-1) src/test/java/com/persistit/RecoveryTest.java (+62/-61) src/test/java/com/persistit/ScriptedKeyFilterTest.java (+8/-8) src/test/java/com/persistit/SplitPolicyTest.java (+18/-18) src/test/java/com/persistit/StressRunner.java (+16/-13) src/test/java/com/persistit/TestShim.java (+6/-5) src/test/java/com/persistit/TrackingFileChannel.java (+175/-0) src/test/java/com/persistit/TransactionIndexConcurrencyTest.java (+18/-17) src/test/java/com/persistit/TransactionIndexTest.java (+21/-18) src/test/java/com/persistit/TransactionLifetimeTest.java (+12/-9) src/test/java/com/persistit/TransactionTest2.java (+13/-11) src/test/java/com/persistit/TreeLifetimeTest.java (+16/-16) src/test/java/com/persistit/TreeTest2.java (+4/-4) src/test/java/com/persistit/ValueTest7.java (+6/-7) src/test/java/com/persistit/VolumeTest.java (+32/-32) src/test/java/com/persistit/WarmupTest.java (+89/-33) src/test/java/com/persistit/stress/AbstractStressTest.java (+3/-2) src/test/java/com/persistit/stress/AbstractSuite.java (+19/-19) src/test/java/com/persistit/stress/InsertUUIDs.java (+2/-1) src/test/java/com/persistit/stress/IntentionalFailure.java (+5/-4) src/test/java/com/persistit/stress/Mixture1.java (+2/-1) src/test/java/com/persistit/stress/Mixture2.java (+2/-1) src/test/java/com/persistit/stress/Mixture3.java (+2/-1) src/test/java/com/persistit/stress/MixtureTxn1.java (+1/-1) src/test/java/com/persistit/stress/MixtureTxn2.java (+2/-1) src/test/java/com/persistit/stress/PersistitMap1.java (+2/-1) src/test/java/com/persistit/stress/PreloadMixtureTxn1.java (+82/-0) src/test/java/com/persistit/stress/Recovery1.java (+2/-1) src/test/java/com/persistit/stress/Recovery2.java (+2/-1) src/test/java/com/persistit/stress/Recovery2_StdIn.java (+2/-1) src/test/java/com/persistit/stress/StartStop.java (+7/-5) src/test/java/com/persistit/stress/Stress10Suite.java (+2/-1) src/test/java/com/persistit/stress/Stress12txnSuite.java (+2/-1) src/test/java/com/persistit/stress/Stress4Suite.java (+2/-1) src/test/java/com/persistit/stress/Stress8txnSuite.java (+2/-1) src/test/java/com/persistit/stress/TestResult.java (+1/-1) src/test/java/com/persistit/stress/unit/CommitBench.java (+14/-13) src/test/java/com/persistit/stress/unit/MD5Sum.java (+2/-5) src/test/java/com/persistit/stress/unit/PersistitMapStress1.java (+9/-11) src/test/java/com/persistit/stress/unit/PersistitMapStress2.java (+11/-12) src/test/java/com/persistit/stress/unit/Stress1.java (+3/-4) src/test/java/com/persistit/stress/unit/Stress10.java (+3/-7) src/test/java/com/persistit/stress/unit/Stress11.java (+3/-7) src/test/java/com/persistit/stress/unit/Stress12txn.java (+2/-3) src/test/java/com/persistit/stress/unit/Stress1txn.java (+3/-4) src/test/java/com/persistit/stress/unit/Stress2.java (+5/-6) src/test/java/com/persistit/stress/unit/Stress2txn.java (+5/-7) src/test/java/com/persistit/stress/unit/Stress3.java (+3/-5) src/test/java/com/persistit/stress/unit/Stress3txn.java (+3/-5) src/test/java/com/persistit/stress/unit/Stress4Base.java (+1/-1) src/test/java/com/persistit/stress/unit/Stress4a.java (+1/-1) src/test/java/com/persistit/stress/unit/Stress4b.java (+1/-1) src/test/java/com/persistit/stress/unit/Stress5.java (+1/-2) src/test/java/com/persistit/stress/unit/Stress6.java (+5/-7) src/test/java/com/persistit/stress/unit/Stress7.java (+7/-11) src/test/java/com/persistit/stress/unit/Stress8txn.java (+2/-6) src/test/java/com/persistit/stress/unit/Stress9.java (+5/-6) src/test/java/com/persistit/stress/unit/StressBase.java (+1/-2) src/test/java/com/persistit/stress/unit/StressInsert.java (+3/-4) src/test/java/com/persistit/stress/unit/StressRecovery.java (+20/-21) src/test/java/com/persistit/stress/unit/StressRecoveryTxn1.java (+2/-2) src/test/java/com/persistit/stress/unit/StressUUID.java (+1/-1) src/test/java/com/persistit/stress/unit/TestSamePageOptimization.java (+6/-6) src/test/java/com/persistit/unit/BufferPoolMemConfigurationTest.java (+6/-6) src/test/java/com/persistit/unit/ConcurrentUtil.java (+28/-24) src/test/java/com/persistit/unit/ExchangeTest.java (+36/-35) src/test/java/com/persistit/unit/FileLockTest.java (+1/-1) src/test/java/com/persistit/unit/JoinTest1.java (+3/-2) src/test/java/com/persistit/unit/KeyCoderTest1.java (+41/-40) src/test/java/com/persistit/unit/KeyFilterTest2.java (+11/-11) src/test/java/com/persistit/unit/KeyTest1.java (+23/-22) src/test/java/com/persistit/unit/Log4JLoggerTest.java (+1/-1) src/test/java/com/persistit/unit/LongRecordTest1.java (+1/-1) src/test/java/com/persistit/unit/LotsaSmallKeys.java (+1/-1) src/test/java/com/persistit/unit/PersistitMapTest.java (+3/-1) src/test/java/com/persistit/unit/PersistitUnitTestCase.java (+11/-10) src/test/java/com/persistit/unit/SimpleTest1.java (+5/-4) src/test/java/com/persistit/unit/TemporaryVolumeTest1.java (+11/-10) src/test/java/com/persistit/unit/ThreadSequencerTest.java (+7/-5) src/test/java/com/persistit/unit/TransactionTest1.java (+6/-6) src/test/java/com/persistit/unit/TransactionTest3.java (+2/-1) src/test/java/com/persistit/unit/TreeSelectorTest.java (+8/-8) src/test/java/com/persistit/unit/UnitTestProperties.java (+0/-1) src/test/java/com/persistit/unit/ValueCoderTest1.java (+1/-1) src/test/java/com/persistit/unit/ValueTest1.java (+33/-22) src/test/java/com/persistit/unit/ValueTest2.java (+1/-1) src/test/java/com/persistit/unit/ValueTest3.java (+16/-0) src/test/java/com/persistit/unit/ValueTest4.java (+16/-0) src/test/java/com/persistit/unit/ValueTest5.java (+5/-5) |
To merge this branch: | bzr merge lp:~pbeaman/akiban-persistit/buffer-pool-warmup-sorted |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Akiban Technologies | Pending | ||
Review via email: mp+121188@code.launchpad.net |
This proposal supersedes a proposal from 2012-08-23.
This proposal has been superseded by a proposal from 2012-08-25.
Commit message
Description of the change
This proposal is a re-work of the original buffer pool warm-up code. Instead of creating a text file, this version stores the inventory in the system volume. It also loads pages in file-address order to reduce I/O time. There is a new stress test that pushes this into a medium-sized buffer pool (25K pages) but we still need to test it with a 1M page pool in TPCC or some other big test.
There are two config options, one to turn on inventory recording and the other to enable pre-loading pages. They are separate so that a server can start up without waiting for the pre-load but still be set to perform the inventory function.
Other changes include Configuration, Configuration.rst (documentation), etc.
- 383. By Peter Beaman
-
Merge from release-notes-3.16
Nathan Williams (nwilliams) wrote : | # |
- 384. By Peter Beaman
-
Fix failures in WarmupTest
- 385. By Peter Beaman
-
Fix WarmupTest (again)
Unmerged revisions
Preview Diff
1 | === modified file 'doc/Configuration.rst' |
2 | --- doc/Configuration.rst 2012-06-11 21:25:37 +0000 |
3 | +++ doc/Configuration.rst 2012-08-24 18:21:19 +0000 |
4 | @@ -221,7 +221,7 @@ |
5 | ``serialOverride``, ``constructorOverride``: (``com.persistit.Configuration#setSerialOverride`` ``com.persistit.Configuration#setConstructorOverride``) |
6 | Control aspects of object serialization. See :ref:`Serialization`. |
7 | |
8 | - ``showgui``: (``com.persistit.Configuration#setShowGUI``), True of False. |
9 | + ``showgui``: (``com.persistit.Configuration#setShowGUI``), True or False (default). |
10 | If true, Persistit attempts to create and display an instance of the AdminUI utility panel within the current JVM. |
11 | Alternatively, AdminUI uses RMI and can be launched and run remotely if ``rmiport`` or ``rmihost`` has been |
12 | specified. |
13 | @@ -231,6 +231,18 @@ |
14 | install a logging adapter to reroute messages through Log4J, SLF4J or other logger. The ``logfile`` property is used |
15 | only when no adapter has been installed. |
16 | |
17 | + ``bufferinventory``: (``com.persistit.Configuration#setBufferInventoryEnabled``), True or False (default). |
18 | + If true, Persistit periodically records an inventory of all the buffes in the buffers pools to the System Volume. The inventory |
19 | + enables Persistit to preload the buffer pools then next time it starts up with approximately the same pages that were present |
20 | + before shutdown. To enable buffer preloading, the bufferpreload property must also be true. |
21 | + |
22 | + ``bufferpreload``: (``com.persistit.Configuration#setBufferPreloadEnabled``), True or False (default). |
23 | + If true, and if a buffer pool inventory was previously recorded, Persistit attempts to "warm up" the buffer pool |
24 | + by preloading pages that were present in the buffer pool when Persistit last shut down. This may allow a freshly started |
25 | + Persistit instance to begin service a workload similar to what it had previously been processing without incurring the |
26 | + cost of many random disk reads to load pages. |
27 | + |
28 | + |
29 | For all integer-valued properties, the suffix “K” may be used to represent kilo, “M” for mega, “G” for giga and “T” for tera. For example, “2M” represents the value 2,097,152. |
30 | |
31 | A Configuration Example |
32 | |
33 | === modified file 'doc/ReleaseNotes.rst' |
34 | --- doc/ReleaseNotes.rst 2012-08-06 14:43:42 +0000 |
35 | +++ doc/ReleaseNotes.rst 2012-08-24 18:21:19 +0000 |
36 | @@ -44,6 +44,26 @@ |
37 | | |
38 | | |
39 | |
40 | + |
41 | +************************************ |
42 | +3.1.6 |
43 | +************************************ |
44 | + |
45 | +Release Date |
46 | +============ |
47 | +August 24, 2012 |
48 | + |
49 | +Overview |
50 | +======== |
51 | +This version of Persistit fixes one bug. |
52 | + |
53 | +Fixed Issues |
54 | +============ |
55 | + |
56 | +https://bugs.launchpad.net/akiban-persistit/+bug/1036422 |
57 | + |
58 | +With CommitPolicy HARD we observed a CPU-soaking loop in the commit logic. |
59 | + |
60 | ************************************ |
61 | 3.1.5 |
62 | ************************************ |
63 | |
64 | === modified file 'pom.xml' |
65 | --- pom.xml 2012-08-07 21:11:28 +0000 |
66 | +++ pom.xml 2012-08-24 18:21:19 +0000 |
67 | @@ -82,6 +82,14 @@ |
68 | </dependency> |
69 | </dependencies> |
70 | |
71 | + <pluginRepositories> |
72 | + <pluginRepository> |
73 | + <id>maven-java-formatter-plugin</id> |
74 | + <name>Maven2 Java Formatter Plugin repository</name> |
75 | + <url>https://raw.github.com/benalexau/maven-java-formatter-plugin/master/releases/</url> |
76 | + </pluginRepository> |
77 | + </pluginRepositories> |
78 | + |
79 | <build> |
80 | <finalName>${project.artifactId}-${project.version}${BZR_REVISION}</finalName> |
81 | <resources> |
82 | @@ -256,6 +264,7 @@ |
83 | <exclude>.project</exclude> |
84 | <exclude>.classpath</exclude> |
85 | <exclude>.bzrignore</exclude> |
86 | + <exclude>src/etc/eclipse*.xml</exclude> |
87 | <!-- Other --> |
88 | <exclude>LICENSE.txt</exclude> |
89 | </excludes> |
90 | @@ -273,6 +282,21 @@ |
91 | <artifactId>maven-eclipse-plugin</artifactId> |
92 | <version>2.6</version> |
93 | </plugin> |
94 | + <plugin> |
95 | + <groupId>com.googlecode.maven-java-formatter-plugin</groupId> |
96 | + <artifactId>maven-java-formatter-plugin</artifactId> |
97 | + <version>0.4.0.e371sr1</version> |
98 | + <configuration> |
99 | + <configFile>${project.basedir}/src/etc/eclipse-format-config.xml</configFile> |
100 | + </configuration> |
101 | + <executions> |
102 | + <execution> |
103 | + <goals> |
104 | + <goal>format</goal> |
105 | + </goals> |
106 | + </execution> |
107 | + </executions> |
108 | + </plugin> |
109 | </plugins> |
110 | <pluginManagement> |
111 | <plugins> |
112 | @@ -324,6 +348,19 @@ |
113 | <ignore /> |
114 | </action> |
115 | </pluginExecution> |
116 | + <pluginExecution> |
117 | + <pluginExecutionFilter> |
118 | + <groupId>com.googlecode.maven-java-formatter-plugin</groupId> |
119 | + <artifactId>maven-java-formatter-plugin</artifactId> |
120 | + <versionRange>[0.4.0.e371sr1,)</versionRange> |
121 | + <goals> |
122 | + <goal>format</goal> |
123 | + </goals> |
124 | + </pluginExecutionFilter> |
125 | + <action> |
126 | + <ignore></ignore> |
127 | + </action> |
128 | + </pluginExecution> |
129 | </pluginExecutions> |
130 | </lifecycleMappingMetadata> |
131 | </configuration> |
132 | @@ -331,7 +368,6 @@ |
133 | </plugins> |
134 | </pluginManagement> |
135 | </build> |
136 | - |
137 | <reporting> |
138 | <plugins> |
139 | <plugin> |
140 | |
141 | === added file 'src/etc/eclipse-cleanup-config.xml' |
142 | --- src/etc/eclipse-cleanup-config.xml 1970-01-01 00:00:00 +0000 |
143 | +++ src/etc/eclipse-cleanup-config.xml 2012-08-24 18:21:19 +0000 |
144 | @@ -0,0 +1,56 @@ |
145 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
146 | +<profiles version="2"> |
147 | +<profile kind="CleanUpProfile" name="Akiban-Persistit" version="2"> |
148 | +<setting id="cleanup.format_source_code" value="true"/> |
149 | +<setting id="cleanup.add_missing_annotations" value="true"/> |
150 | +<setting id="cleanup.use_this_for_non_static_method_access_only_if_necessary" value="true"/> |
151 | +<setting id="cleanup.remove_unused_private_types" value="true"/> |
152 | +<setting id="cleanup.qualify_static_member_accesses_through_instances_with_declaring_class" value="true"/> |
153 | +<setting id="cleanup.qualify_static_method_accesses_with_declaring_class" value="false"/> |
154 | +<setting id="cleanup.add_generated_serial_version_id" value="false"/> |
155 | +<setting id="cleanup.make_variable_declarations_final" value="true"/> |
156 | +<setting id="cleanup.add_missing_methods" value="false"/> |
157 | +<setting id="cleanup.always_use_this_for_non_static_field_access" value="false"/> |
158 | +<setting id="cleanup.remove_trailing_whitespaces_ignore_empty" value="false"/> |
159 | +<setting id="cleanup.correct_indentation" value="true"/> |
160 | +<setting id="cleanup.never_use_parentheses_in_expressions" value="true"/> |
161 | +<setting id="cleanup.add_serial_version_id" value="false"/> |
162 | +<setting id="cleanup.remove_unused_private_methods" value="true"/> |
163 | +<setting id="cleanup.use_this_for_non_static_field_access" value="false"/> |
164 | +<setting id="cleanup.use_blocks_only_for_return_and_throw" value="false"/> |
165 | +<setting id="cleanup.remove_unused_private_members" value="false"/> |
166 | +<setting id="cleanup.add_missing_override_annotations_interface_methods" value="true"/> |
167 | +<setting id="cleanup.remove_trailing_whitespaces_all" value="true"/> |
168 | +<setting id="cleanup.make_type_abstract_if_missing_method" value="false"/> |
169 | +<setting id="cleanup.always_use_this_for_non_static_method_access" value="false"/> |
170 | +<setting id="cleanup.remove_unnecessary_nls_tags" value="true"/> |
171 | +<setting id="cleanup.format_source_code_changes_only" value="false"/> |
172 | +<setting id="cleanup.qualify_static_field_accesses_with_declaring_class" value="false"/> |
173 | +<setting id="cleanup.add_missing_nls_tags" value="false"/> |
174 | +<setting id="cleanup.use_this_for_non_static_field_access_only_if_necessary" value="true"/> |
175 | +<setting id="cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class" value="false"/> |
176 | +<setting id="cleanup.remove_unnecessary_casts" value="true"/> |
177 | +<setting id="cleanup.qualify_static_member_accesses_with_declaring_class" value="true"/> |
178 | +<setting id="cleanup.use_parentheses_in_expressions" value="false"/> |
179 | +<setting id="cleanup.remove_unused_private_fields" value="true"/> |
180 | +<setting id="cleanup.make_parameters_final" value="true"/> |
181 | +<setting id="cleanup.remove_trailing_whitespaces" value="true"/> |
182 | +<setting id="cleanup.remove_unused_imports" value="true"/> |
183 | +<setting id="cleanup.organize_imports" value="true"/> |
184 | +<setting id="cleanup.sort_members" value="false"/> |
185 | +<setting id="cleanup.remove_private_constructors" value="true"/> |
186 | +<setting id="cleanup.convert_to_enhanced_for_loop" value="false"/> |
187 | +<setting id="cleanup.always_use_blocks" value="true"/> |
188 | +<setting id="cleanup.never_use_blocks" value="false"/> |
189 | +<setting id="cleanup.always_use_parentheses_in_expressions" value="false"/> |
190 | +<setting id="cleanup.use_this_for_non_static_method_access" value="false"/> |
191 | +<setting id="cleanup.remove_unused_local_variables" value="false"/> |
192 | +<setting id="cleanup.make_private_fields_final" value="true"/> |
193 | +<setting id="cleanup.add_missing_deprecated_annotations" value="true"/> |
194 | +<setting id="cleanup.add_default_serial_version_id" value="true"/> |
195 | +<setting id="cleanup.sort_members_all" value="false"/> |
196 | +<setting id="cleanup.use_blocks" value="false"/> |
197 | +<setting id="cleanup.add_missing_override_annotations" value="true"/> |
198 | +<setting id="cleanup.make_local_variable_final" value="true"/> |
199 | +</profile> |
200 | +</profiles> |
201 | |
202 | === added file 'src/etc/eclipse-format-config.xml' |
203 | --- src/etc/eclipse-format-config.xml 1970-01-01 00:00:00 +0000 |
204 | +++ src/etc/eclipse-format-config.xml 2012-08-24 18:21:19 +0000 |
205 | @@ -0,0 +1,291 @@ |
206 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
207 | +<profiles version="12"> |
208 | +<profile kind="CodeFormatterProfile" name="Akiban-code-format" version="12"> |
209 | +<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/> |
210 | +<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/> |
211 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/> |
212 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/> |
213 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/> |
214 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/> |
215 | +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/> |
216 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/> |
217 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/> |
218 | +<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/> |
219 | +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/> |
220 | +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/> |
221 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/> |
222 | +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/> |
223 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/> |
224 | +<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="false"/> |
225 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/> |
226 | +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/> |
227 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/> |
228 | +<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/> |
229 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/> |
230 | +<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/> |
231 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/> |
232 | +<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/> |
233 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/> |
234 | +<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/> |
235 | +<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/> |
236 | +<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/> |
237 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/> |
238 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/> |
239 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/> |
240 | +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/> |
241 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/> |
242 | +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/> |
243 | +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/> |
244 | +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/> |
245 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/> |
246 | +<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/> |
247 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/> |
248 | +<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/> |
249 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/> |
250 | +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/> |
251 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/> |
252 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/> |
253 | +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/> |
254 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/> |
255 | +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/> |
256 | +<setting id="org.eclipse.jdt.core.compiler.source" value="1.7"/> |
257 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/> |
258 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/> |
259 | +<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/> |
260 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/> |
261 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/> |
262 | +<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/> |
263 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/> |
264 | +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/> |
265 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/> |
266 | +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/> |
267 | +<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/> |
268 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/> |
269 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/> |
270 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/> |
271 | +<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/> |
272 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/> |
273 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/> |
274 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/> |
275 | +<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/> |
276 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/> |
277 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/> |
278 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/> |
279 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/> |
280 | +<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/> |
281 | +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/> |
282 | +<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/> |
283 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/> |
284 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/> |
285 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/> |
286 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/> |
287 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/> |
288 | +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/> |
289 | +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/> |
290 | +<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/> |
291 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/> |
292 | +<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/> |
293 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/> |
294 | +<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/> |
295 | +<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/> |
296 | +<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/> |
297 | +<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/> |
298 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/> |
299 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/> |
300 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/> |
301 | +<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/> |
302 | +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/> |
303 | +<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/> |
304 | +<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/> |
305 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/> |
306 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/> |
307 | +<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/> |
308 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/> |
309 | +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/> |
310 | +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/> |
311 | +<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/> |
312 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/> |
313 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/> |
314 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/> |
315 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/> |
316 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/> |
317 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/> |
318 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/> |
319 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/> |
320 | +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/> |
321 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/> |
322 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/> |
323 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/> |
324 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/> |
325 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/> |
326 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/> |
327 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/> |
328 | +<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/> |
329 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/> |
330 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/> |
331 | +<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/> |
332 | +<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="false"/> |
333 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/> |
334 | +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/> |
335 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/> |
336 | +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/> |
337 | +<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/> |
338 | +<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/> |
339 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/> |
340 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/> |
341 | +<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/> |
342 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/> |
343 | +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/> |
344 | +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/> |
345 | +<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/> |
346 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/> |
347 | +<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/> |
348 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/> |
349 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/> |
350 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/> |
351 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/> |
352 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/> |
353 | +<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/> |
354 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/> |
355 | +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/> |
356 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/> |
357 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/> |
358 | +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/> |
359 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/> |
360 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/> |
361 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/> |
362 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/> |
363 | +<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/> |
364 | +<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/> |
365 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/> |
366 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/> |
367 | +<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/> |
368 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/> |
369 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/> |
370 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/> |
371 | +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/> |
372 | +<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/> |
373 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/> |
374 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/> |
375 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/> |
376 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/> |
377 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/> |
378 | +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/> |
379 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/> |
380 | +<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.7"/> |
381 | +<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/> |
382 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/> |
383 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/> |
384 | +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/> |
385 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/> |
386 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/> |
387 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/> |
388 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/> |
389 | +<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/> |
390 | +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/> |
391 | +<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/> |
392 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/> |
393 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/> |
394 | +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/> |
395 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/> |
396 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/> |
397 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/> |
398 | +<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/> |
399 | +<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/> |
400 | +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/> |
401 | +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/> |
402 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/> |
403 | +<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/> |
404 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/> |
405 | +<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/> |
406 | +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/> |
407 | +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/> |
408 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/> |
409 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/> |
410 | +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/> |
411 | +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/> |
412 | +<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/> |
413 | +<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/> |
414 | +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/> |
415 | +<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/> |
416 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/> |
417 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/> |
418 | +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/> |
419 | +<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/> |
420 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/> |
421 | +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/> |
422 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/> |
423 | +<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/> |
424 | +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/> |
425 | +<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/> |
426 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/> |
427 | +<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/> |
428 | +<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/> |
429 | +<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/> |
430 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/> |
431 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/> |
432 | +<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/> |
433 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/> |
434 | +<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/> |
435 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/> |
436 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/> |
437 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/> |
438 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/> |
439 | +<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/> |
440 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/> |
441 | +<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/> |
442 | +<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/> |
443 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/> |
444 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/> |
445 | +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/> |
446 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/> |
447 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/> |
448 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/> |
449 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/> |
450 | +<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/> |
451 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/> |
452 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/> |
453 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/> |
454 | +<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/> |
455 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/> |
456 | +<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.7"/> |
457 | +<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/> |
458 | +<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/> |
459 | +<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/> |
460 | +<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/> |
461 | +<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/> |
462 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/> |
463 | +<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/> |
464 | +<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/> |
465 | +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/> |
466 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/> |
467 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/> |
468 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/> |
469 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/> |
470 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/> |
471 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/> |
472 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/> |
473 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/> |
474 | +<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/> |
475 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/> |
476 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/> |
477 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/> |
478 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/> |
479 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/> |
480 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/> |
481 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/> |
482 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/> |
483 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/> |
484 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/> |
485 | +<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/> |
486 | +<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/> |
487 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/> |
488 | +<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/> |
489 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/> |
490 | +<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/> |
491 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/> |
492 | +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/> |
493 | +<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/> |
494 | +<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/> |
495 | +</profile> |
496 | +</profiles> |
497 | |
498 | === modified file 'src/main/java/com/persistit/Accumulator.java' |
499 | --- src/main/java/com/persistit/Accumulator.java 2012-08-02 04:45:28 +0000 |
500 | +++ src/main/java/com/persistit/Accumulator.java 2012-08-24 18:21:19 +0000 |
501 | @@ -97,10 +97,10 @@ |
502 | final static Comparator<Accumulator> SORT_COMPARATOR = new Comparator<Accumulator>() { |
503 | |
504 | @Override |
505 | - public int compare(Accumulator a, Accumulator b) { |
506 | + public int compare(final Accumulator a, final Accumulator b) { |
507 | final String treeNameA = a.getTree() == null ? "" : a.getTree().getName(); |
508 | final String treeNameB = b.getTree() == null ? "" : b.getTree().getName(); |
509 | - int compare = treeNameA.compareTo(treeNameB); |
510 | + final int compare = treeNameA.compareTo(treeNameB); |
511 | if (compare != 0) { |
512 | return compare; |
513 | } else { |
514 | @@ -144,7 +144,7 @@ |
515 | * longer present in live TransactionStatus objects. This array has one |
516 | * element per TransactionIndexBucket. |
517 | */ |
518 | - private long[] _bucketValues; |
519 | + private final long[] _bucketValues; |
520 | |
521 | /* |
522 | * Object held on the accumulators list in {@link Persistit}. An |
523 | @@ -374,7 +374,7 @@ |
524 | } |
525 | |
526 | Accumulator takeCheckpointRef() { |
527 | - Accumulator result = _checkpointRef; |
528 | + final Accumulator result = _checkpointRef; |
529 | _checkpointRef = null; |
530 | return result; |
531 | } |
532 | @@ -551,7 +551,7 @@ |
533 | long getSnapshotValue(final long timestamp, final int step) throws PersistitInterruptedException { |
534 | try { |
535 | return _transactionIndex.getAccumulatorSnapshot(this, timestamp, step, _baseValue); |
536 | - } catch (InterruptedException ie) { |
537 | + } catch (final InterruptedException ie) { |
538 | throw new PersistitInterruptedException(ie); |
539 | } |
540 | } |
541 | @@ -588,6 +588,7 @@ |
542 | /** |
543 | * Update the Accumulator by contributing a value. The contribution is |
544 | * immediately accumulated into the live value, and it is also posted with a |
545 | + * |
546 | * @{link {@link Delta} instance to the supplied {@link Transaction}. |
547 | * |
548 | * @param value |
549 | @@ -636,8 +637,8 @@ |
550 | * values for this <code>Accumulator</code>. |
551 | */ |
552 | public String toString() { |
553 | - return String.format("Accumulator(tree=%s index=%d type=%s base=%,d live=%,d)", _tree == null ? "null" : _tree |
554 | - .getName(), _index, getType(), _baseValue, _liveValue.get()); |
555 | + return String.format("Accumulator(tree=%s index=%d type=%s base=%,d live=%,d)", |
556 | + _tree == null ? "null" : _tree.getName(), _index, getType(), _baseValue, _liveValue.get()); |
557 | } |
558 | |
559 | void store(final Value value) { |
560 | @@ -649,8 +650,8 @@ |
561 | |
562 | static AccumulatorState getAccumulatorState(final Tree tree, final int index) throws PersistitException { |
563 | final Exchange exchange = tree.getVolume().getStructure().directoryExchange(); |
564 | - exchange.clear().append(VolumeStructure.DIRECTORY_TREE_NAME).append(VolumeStructure.TREE_ACCUMULATOR).append( |
565 | - tree.getName()).append(index).fetch(); |
566 | + exchange.clear().append(VolumeStructure.DIRECTORY_TREE_NAME).append(VolumeStructure.TREE_ACCUMULATOR) |
567 | + .append(tree.getName()).append(index).fetch(); |
568 | if (exchange.getValue().isDefined()) { |
569 | return (AccumulatorState) exchange.getValue().get(); |
570 | } else { |
571 | |
572 | === modified file 'src/main/java/com/persistit/AccumulatorState.java' |
573 | --- src/main/java/com/persistit/AccumulatorState.java 2012-08-02 04:45:28 +0000 |
574 | +++ src/main/java/com/persistit/AccumulatorState.java 2012-08-24 18:21:19 +0000 |
575 | @@ -15,7 +15,6 @@ |
576 | |
577 | package com.persistit; |
578 | |
579 | - |
580 | /** |
581 | * State of an accumulator recovered from a checkpoint. |
582 | * |
583 | @@ -48,19 +47,19 @@ |
584 | public String toString() { |
585 | return String.format("Accumulator(tree=%s index=%d type=%s value=%,d)", _treeName, _index, _type, _value); |
586 | } |
587 | - |
588 | + |
589 | public String getTreeName() { |
590 | return _treeName; |
591 | } |
592 | - |
593 | + |
594 | public int getIndex() { |
595 | return _index; |
596 | } |
597 | - |
598 | + |
599 | public Accumulator.Type getType() { |
600 | return _type; |
601 | } |
602 | - |
603 | + |
604 | public long getValue() { |
605 | return _value; |
606 | } |
607 | |
608 | === modified file 'src/main/java/com/persistit/AlertMonitor.java' |
609 | --- src/main/java/com/persistit/AlertMonitor.java 2012-08-02 04:45:28 +0000 |
610 | +++ src/main/java/com/persistit/AlertMonitor.java 2012-08-24 18:21:19 +0000 |
611 | @@ -113,7 +113,7 @@ |
612 | */ |
613 | public class History { |
614 | private AlertLevel _level = AlertLevel.NORMAL; |
615 | - private List<Event> _eventList = new ArrayList<Event>(); |
616 | + private final List<Event> _eventList = new ArrayList<Event>(); |
617 | private volatile long _firstEventTime = Long.MAX_VALUE; |
618 | private volatile long _lastWarnLogTime = Long.MIN_VALUE; |
619 | private volatile long _lastErrorLogTime = Long.MIN_VALUE; |
620 | @@ -142,7 +142,7 @@ |
621 | public String getDetailedHistory() { |
622 | final StringBuilder sb = new StringBuilder(); |
623 | synchronized (AlertMonitor.this) { |
624 | - int size = _eventList.size(); |
625 | + final int size = _eventList.size(); |
626 | if (_count > 0) { |
627 | sb.append(String.format(EVENT_FORMAT, 1, format(_firstEvent))); |
628 | for (int index = _count > size ? 0 : 1; index < size; index++) { |
629 | @@ -250,7 +250,7 @@ |
630 | * does nothing unless the interval has elapsed. |
631 | */ |
632 | public void poll(final long now, final boolean force) { |
633 | - int count = getCount(); |
634 | + final int count = getCount(); |
635 | if (count > _reportedCount) { |
636 | switch (_level) { |
637 | case ERROR: |
638 | @@ -316,7 +316,7 @@ |
639 | * event was posted. |
640 | */ |
641 | public static class Event { |
642 | - private AlertLevel _level; |
643 | + private final AlertLevel _level; |
644 | private final LogItem _logItem; |
645 | private final Object[] _args; |
646 | private final long _time; |
647 | @@ -332,7 +332,7 @@ |
648 | * @param args |
649 | * arguments specific to the <code>LogItem</code> |
650 | */ |
651 | - public Event(AlertLevel level, LogItem logItem, Object... args) { |
652 | + public Event(final AlertLevel level, final LogItem logItem, final Object... args) { |
653 | this(level, System.currentTimeMillis(), logItem, args); |
654 | } |
655 | |
656 | @@ -349,7 +349,7 @@ |
657 | * @param args |
658 | * arguments specific to the <code>LogItem</code> |
659 | */ |
660 | - public Event(AlertLevel level, long time, LogItem logItem, Object... args) { |
661 | + public Event(final AlertLevel level, final long time, final LogItem logItem, final Object... args) { |
662 | _level = level; |
663 | _logItem = logItem; |
664 | _args = args; |
665 | @@ -492,7 +492,7 @@ |
666 | private volatile long _errorLogTimeInterval = DEFAULT_ERROR_INTERVAL; |
667 | private volatile int _historyLength = DEFAULT_HISTORY_LENGTH; |
668 | |
669 | - private AtomicLong _notificationSequence = new AtomicLong(); |
670 | + private final AtomicLong _notificationSequence = new AtomicLong(); |
671 | private volatile ObjectName _objectName; |
672 | |
673 | /** |
674 | @@ -533,7 +533,7 @@ |
675 | * A String describing the nature of the event. A separate |
676 | * event-history is maintained for each unique category. |
677 | */ |
678 | - public synchronized final void post(Event event, final String category) { |
679 | + public synchronized final void post(final Event event, final String category) { |
680 | History history = _historyMap.get(category); |
681 | if (history == null) { |
682 | history = new History(); |
683 | @@ -570,7 +570,7 @@ |
684 | * the interval in milliseconds |
685 | */ |
686 | @Override |
687 | - public void setWarnLogTimeInterval(long warnLogTimeInterval) { |
688 | + public void setWarnLogTimeInterval(final long warnLogTimeInterval) { |
689 | Util.rangeCheck(warnLogTimeInterval, MINIMUM_WARN_INTERVAL, MAXIMUM_WARN_INTERVAL); |
690 | _warnLogTimeInterval = warnLogTimeInterval; |
691 | } |
692 | @@ -592,7 +592,7 @@ |
693 | * the interval in milliseconds |
694 | */ |
695 | @Override |
696 | - public void setErrorLogTimeInterval(long errorLogTimeInterval) { |
697 | + public void setErrorLogTimeInterval(final long errorLogTimeInterval) { |
698 | Util.rangeCheck(errorLogTimeInterval, MINIMUM_ERROR_INTERVAL, MAXIMUM_ERROR_INTERVAL); |
699 | _errorLogTimeInterval = errorLogTimeInterval; |
700 | } |
701 | @@ -613,7 +613,7 @@ |
702 | * @return the <code>History</code> for that category or <code>null</code> |
703 | * if the specified category has no <code>History</code>. |
704 | */ |
705 | - public synchronized History getHistory(String name) { |
706 | + public synchronized History getHistory(final String name) { |
707 | return _historyMap.get(name); |
708 | } |
709 | |
710 | @@ -637,7 +637,7 @@ |
711 | * the historyLength to set |
712 | */ |
713 | @Override |
714 | - public synchronized void setHistoryLength(int historyLength) { |
715 | + public synchronized void setHistoryLength(final int historyLength) { |
716 | Util.rangeCheck(historyLength, MINIMUM_HISTORY_LENGTH, MAXIMUM_HISTORY_LENGTH); |
717 | _historyLength = historyLength; |
718 | for (final History history : _historyMap.values()) { |
719 | @@ -652,7 +652,7 @@ |
720 | * @return List of AlertRecord elements. |
721 | */ |
722 | public synchronized AlertRecord[] getAlertRecordArray() { |
723 | - List<AlertRecord> list = new ArrayList<AlertRecord>(); |
724 | + final List<AlertRecord> list = new ArrayList<AlertRecord>(); |
725 | for (final Map.Entry<String, History> entry : _historyMap.entrySet()) { |
726 | for (final Event event : entry.getValue().getEventList()) { |
727 | list.add(new AlertRecord(entry.getKey(), event)); |
728 | @@ -681,7 +681,7 @@ |
729 | */ |
730 | @Override |
731 | public synchronized String toString() { |
732 | - StringBuilder sb = new StringBuilder(); |
733 | + final StringBuilder sb = new StringBuilder(); |
734 | for (final Map.Entry<String, History> entry : _historyMap.entrySet()) { |
735 | sb.append(String.format("%12s: %s\n", entry.getKey(), entry.getValue())); |
736 | } |
737 | @@ -705,8 +705,8 @@ |
738 | */ |
739 | @Override |
740 | public synchronized String getDetailedHistory(final String select) { |
741 | - Pattern pattern = Util.pattern(select, true); |
742 | - StringBuilder sb = new StringBuilder(); |
743 | + final Pattern pattern = Util.pattern(select, true); |
744 | + final StringBuilder sb = new StringBuilder(); |
745 | for (final Map.Entry<String, History> entry : _historyMap.entrySet()) { |
746 | if (pattern.matcher(entry.getKey()).matches()) { |
747 | sb.append(String.format("%s:\n", entry.getKey())); |
748 | @@ -737,10 +737,10 @@ |
749 | */ |
750 | @Override |
751 | public MBeanNotificationInfo[] getNotificationInfo() { |
752 | - String[] types = new String[] { NOTIFICATION_TYPE }; |
753 | - String name = Notification.class.getName(); |
754 | - String description = "Alert raised by Akiban PersistIT"; |
755 | - MBeanNotificationInfo info = new MBeanNotificationInfo(types, name, description); |
756 | + final String[] types = new String[] { NOTIFICATION_TYPE }; |
757 | + final String name = Notification.class.getName(); |
758 | + final String description = "Alert raised by Akiban PersistIT"; |
759 | + final MBeanNotificationInfo info = new MBeanNotificationInfo(types, name, description); |
760 | return new MBeanNotificationInfo[] { info }; |
761 | } |
762 | |
763 | @@ -751,7 +751,7 @@ |
764 | * |
765 | * @param history |
766 | */ |
767 | - private void log(History history) { |
768 | + private void log(final History history) { |
769 | final Event event = history.getLastEvent(); |
770 | if (event != null && event.getLogItem().isEnabled()) { |
771 | if (history.getCount() == 1) { |
772 | @@ -767,13 +767,13 @@ |
773 | * |
774 | * @param history |
775 | */ |
776 | - private void sendNotification(History history) { |
777 | + private void sendNotification(final History history) { |
778 | final Event event = history.getLastEvent(); |
779 | if (event != null && event.getLogItem().isEnabled()) { |
780 | - final String description = LogBase.recurring(event.getLogItem().logMessage(event.getArgs()), history |
781 | - .getCount(), history.getDuration()); |
782 | - Notification notification = new Notification(NOTIFICATION_TYPE, getClass().getName(), _notificationSequence |
783 | - .incrementAndGet(), description); |
784 | + final String description = LogBase.recurring(event.getLogItem().logMessage(event.getArgs()), |
785 | + history.getCount(), history.getDuration()); |
786 | + final Notification notification = new Notification(NOTIFICATION_TYPE, getClass().getName(), |
787 | + _notificationSequence.incrementAndGet(), description); |
788 | sendNotification(notification); |
789 | } |
790 | } |
791 | @@ -796,7 +796,7 @@ |
792 | * @param event |
793 | * @return |
794 | */ |
795 | - private String format(Event event) { |
796 | + private String format(final Event event) { |
797 | return event == null ? "null" : event.toString(); |
798 | } |
799 | |
800 | |
801 | === modified file 'src/main/java/com/persistit/AntiValue.java' |
802 | --- src/main/java/com/persistit/AntiValue.java 2012-08-02 04:45:28 +0000 |
803 | +++ src/main/java/com/persistit/AntiValue.java 2012-08-24 18:21:19 +0000 |
804 | @@ -15,10 +15,10 @@ |
805 | |
806 | package com.persistit; |
807 | |
808 | +import java.util.Arrays; |
809 | + |
810 | import com.persistit.exception.InvalidKeyException; |
811 | |
812 | -import java.util.Arrays; |
813 | - |
814 | /** |
815 | * Represents the end of a key range to be removed. Used in Transactions. |
816 | * |
817 | @@ -26,29 +26,29 @@ |
818 | * @version 1.1 |
819 | */ |
820 | class AntiValue { |
821 | - private int _elisionCount; |
822 | - private byte[] _bytes; |
823 | + private final int _elisionCount; |
824 | + private final byte[] _bytes; |
825 | |
826 | - AntiValue(int ec, byte[] bytes) { |
827 | + AntiValue(final int ec, final byte[] bytes) { |
828 | _elisionCount = ec; |
829 | _bytes = bytes; |
830 | } |
831 | |
832 | - static void putAntiValue(Value value, Key key1, Key key2) { |
833 | - int elisionCount = key1.firstUniqueByteIndex(key2); |
834 | - int size = key2.getEncodedSize() - elisionCount; |
835 | - byte[] bytes = new byte[size]; |
836 | + static void putAntiValue(final Value value, final Key key1, final Key key2) { |
837 | + final int elisionCount = key1.firstUniqueByteIndex(key2); |
838 | + final int size = key2.getEncodedSize() - elisionCount; |
839 | + final byte[] bytes = new byte[size]; |
840 | System.arraycopy(key2.getEncodedBytes(), elisionCount, bytes, 0, size); |
841 | value.putAntiValue((short) elisionCount, bytes); |
842 | } |
843 | |
844 | - static void fixUpKeys(Exchange exchange, int elisionCount, byte[] bytes, int offset, int length) |
845 | - throws InvalidKeyException { |
846 | - Key spareKey1 = exchange.getAuxiliaryKey1(); |
847 | - Key spareKey2 = exchange.getAuxiliaryKey2(); |
848 | + static void fixUpKeys(final Exchange exchange, final int elisionCount, final byte[] bytes, final int offset, |
849 | + final int length) throws InvalidKeyException { |
850 | + final Key spareKey1 = exchange.getAuxiliaryKey1(); |
851 | + final Key spareKey2 = exchange.getAuxiliaryKey2(); |
852 | spareKey1.copyTo(spareKey2); |
853 | - byte[] baseBytes = spareKey2.getEncodedBytes(); |
854 | - int baseSize = spareKey2.getEncodedSize(); |
855 | + final byte[] baseBytes = spareKey2.getEncodedBytes(); |
856 | + final int baseSize = spareKey2.getEncodedSize(); |
857 | if (baseSize < elisionCount || elisionCount + length > Key.MAX_KEY_LENGTH) { |
858 | throw new InvalidKeyException("Key encoding in transaction is invalid"); |
859 | } |
860 | |
861 | === modified file 'src/main/java/com/persistit/BackupTask.java' |
862 | --- src/main/java/com/persistit/BackupTask.java 2012-08-02 04:45:28 +0000 |
863 | +++ src/main/java/com/persistit/BackupTask.java 2012-08-24 18:21:19 +0000 |
864 | @@ -76,12 +76,13 @@ |
865 | private volatile String _backupStatus; |
866 | |
867 | @Cmd("backup") |
868 | - static Task setupTask(@Arg("file|string|Archive file path") String file, |
869 | - @Arg("_flag|a|Start appendOnly mode") boolean start, @Arg("_flag|e|End appendOnly mode") boolean end, |
870 | - @Arg("_flag|c|Request checkpoint before backup") boolean checkpoint, |
871 | - @Arg("_flag|z|Compress output to ZIP format") boolean compressed, |
872 | - @Arg("_flag|f|Emit a list of files that need to be copied") boolean showFiles, |
873 | - @Arg("_flag|y|Copyback pages before starting") boolean copyback) throws Exception { |
874 | + static Task setupTask(@Arg("file|string|Archive file path") final String file, |
875 | + @Arg("_flag|a|Start appendOnly mode") final boolean start, |
876 | + @Arg("_flag|e|End appendOnly mode") final boolean end, |
877 | + @Arg("_flag|c|Request checkpoint before backup") final boolean checkpoint, |
878 | + @Arg("_flag|z|Compress output to ZIP format") final boolean compressed, |
879 | + @Arg("_flag|f|Emit a list of files that need to be copied") final boolean showFiles, |
880 | + @Arg("_flag|y|Copyback pages before starting") final boolean copyback) throws Exception { |
881 | final BackupTask task = new BackupTask(); |
882 | task._toFile = file; |
883 | task._start = start; |
884 | @@ -103,7 +104,7 @@ |
885 | protected void runTask() throws Exception { |
886 | validate(); |
887 | final Management management = _persistit.getManagement(); |
888 | - boolean wasAppendOnly = management.getJournalInfo().isAppendOnly(); |
889 | + final boolean wasAppendOnly = management.getJournalInfo().isAppendOnly(); |
890 | if (_checkpoint) { |
891 | postMessage("Waiting for checkpoint", 0); |
892 | final Checkpoint cp = _persistit.checkpoint(); |
893 | @@ -115,9 +116,9 @@ |
894 | } |
895 | if (_copyback && !wasAppendOnly) { |
896 | postMessage("Copying back pages from journal", 0); |
897 | - long start = _persistit.getJournalManager().getCopiedPageCount(); |
898 | + final long start = _persistit.getJournalManager().getCopiedPageCount(); |
899 | _persistit.copyBackPages(); |
900 | - long end = _persistit.getJournalManager().getCopiedPageCount(); |
901 | + final long end = _persistit.getJournalManager().getCopiedPageCount(); |
902 | postMessage((end - start) + " pages copied", 0); |
903 | } |
904 | try { |
905 | @@ -128,7 +129,7 @@ |
906 | doBackup(); |
907 | } |
908 | } |
909 | - } catch (Exception e) { |
910 | + } catch (final Exception e) { |
911 | _backupStatus = "Failed: " + e; |
912 | } finally { |
913 | management.setAppendOnly(_start ? true : _end ? false : wasAppendOnly); |
914 | @@ -136,7 +137,7 @@ |
915 | } |
916 | |
917 | @Override |
918 | - protected void postMessage(final String message, int level) { |
919 | + protected void postMessage(final String message, final int level) { |
920 | super.postMessage(message, level); |
921 | _backupStatus = message; |
922 | } |
923 | @@ -152,9 +153,9 @@ |
924 | final long baseAddress = info.getBaseAddress(); |
925 | final long currentAddress = info.getCurrentJournalAddress(); |
926 | final long blockSize = info.getBlockSize(); |
927 | - String path = JournalManager.fileToPath(new File(info.getCurrentJournalFile())); |
928 | + final String path = JournalManager.fileToPath(new File(info.getCurrentJournalFile())); |
929 | for (long generation = baseAddress / blockSize; generation <= currentAddress / blockSize; generation++) { |
930 | - File file = JournalManager.generationToFile(path, generation); |
931 | + final File file = JournalManager.generationToFile(path, generation); |
932 | _files.add(file.getAbsolutePath()); |
933 | } |
934 | final StringBuilder sb = new StringBuilder(); |
935 | |
936 | === modified file 'src/main/java/com/persistit/Buffer.java' |
937 | --- src/main/java/com/persistit/Buffer.java 2012-08-02 04:45:28 +0000 |
938 | +++ src/main/java/com/persistit/Buffer.java 2012-08-24 18:21:19 +0000 |
939 | @@ -266,17 +266,18 @@ |
940 | |
941 | abstract static class VerifyVisitor { |
942 | |
943 | - protected void visitPage(long timestamp, Volume volume, long page, int type, int bufferSize, int keyBlockStart, |
944 | - int keyBlockEnd, int alloc, int available, long rightSibling) throws PersistitException { |
945 | - } |
946 | - |
947 | - protected void visitIndexRecord(Key key, int foundAt, int tail, int kLength, long pointer) |
948 | - throws PersistitException { |
949 | - |
950 | - } |
951 | - |
952 | - protected void visitDataRecord(Key key, int foundAt, int tail, int klength, int offset, int length, byte[] bytes) |
953 | - throws PersistitException { |
954 | + protected void visitPage(final long timestamp, final Volume volume, final long page, final int type, |
955 | + final int bufferSize, final int keyBlockStart, final int keyBlockEnd, final int alloc, |
956 | + final int available, final long rightSibling) throws PersistitException { |
957 | + } |
958 | + |
959 | + protected void visitIndexRecord(final Key key, final int foundAt, final int tail, final int kLength, |
960 | + final long pointer) throws PersistitException { |
961 | + |
962 | + } |
963 | + |
964 | + protected void visitDataRecord(final Key key, final int foundAt, final int tail, final int klength, |
965 | + final int offset, final int length, final byte[] bytes) throws PersistitException { |
966 | } |
967 | } |
968 | |
969 | @@ -323,7 +324,7 @@ |
970 | * The bytes in this buffer. Note these bytes are also the backing store of |
971 | * _byteBuffer. |
972 | */ |
973 | - private byte[] _bytes; |
974 | + private final byte[] _bytes; |
975 | |
976 | /** |
977 | * FastIndex structure used for rapid page searching |
978 | @@ -382,7 +383,7 @@ |
979 | * @param size |
980 | * The buffer size, in bytes. |
981 | */ |
982 | - Buffer(int size, int index, BufferPool pool, Persistit persistit) { |
983 | + Buffer(int size, final int index, final BufferPool pool, final Persistit persistit) { |
984 | super(persistit); |
985 | boolean ok = false; |
986 | for (int s = MIN_BUFFER_SIZE; !ok && s <= MAX_BUFFER_SIZE; s *= 2) { |
987 | @@ -402,7 +403,7 @@ |
988 | _fastIndex = new FastIndex(this, 1 + (size - HEADER_SIZE) / MAX_KEY_RATIO); |
989 | } |
990 | |
991 | - Buffer(Buffer original) { |
992 | + Buffer(final Buffer original) { |
993 | this(original._bufferSize, original._poolIndex, original._pool, original._persistit); |
994 | setStatus(original); |
995 | _type = original._type; |
996 | @@ -421,7 +422,7 @@ |
997 | /** |
998 | * Initializes the buffer so that it contains no keys or data. |
999 | */ |
1000 | - void init(int type) { |
1001 | + void init(final int type) { |
1002 | _type = type; |
1003 | setKeyBlockEnd(KEY_BLOCK_START); |
1004 | _tailHeaderSize = isIndexPage() ? TAILBLOCK_HDR_SIZE_INDEX : TAILBLOCK_HDR_SIZE_DATA; |
1005 | @@ -449,7 +450,7 @@ |
1006 | * @throws InUseException |
1007 | * @throws PersistitInterruptedException |
1008 | */ |
1009 | - void load(Volume vol, long page) throws PersistitIOException, InvalidPageAddressException, |
1010 | + void load(final Volume vol, final long page) throws PersistitIOException, InvalidPageAddressException, |
1011 | InvalidPageStructureException, VolumeClosedException, InUseException, PersistitInterruptedException { |
1012 | _vol = vol; |
1013 | _page = page; |
1014 | @@ -463,7 +464,7 @@ |
1015 | _timestamp = getLong(TIMESTAMP_OFFSET); |
1016 | |
1017 | if (_page != 0) { |
1018 | - int type = getByte(TYPE_OFFSET); |
1019 | + final int type = getByte(TYPE_OFFSET); |
1020 | if (type > PAGE_TYPE_MAX) { |
1021 | throw new InvalidPageStructureException("Invalid type " + type); |
1022 | } |
1023 | @@ -519,6 +520,7 @@ |
1024 | } |
1025 | } |
1026 | |
1027 | + @Override |
1028 | boolean clearDirty() { |
1029 | if (super.clearDirty()) { |
1030 | _pool.decrementDirtyPageCount(); |
1031 | @@ -527,6 +529,7 @@ |
1032 | return false; |
1033 | } |
1034 | |
1035 | + @Override |
1036 | boolean setDirty() { |
1037 | throw new UnsupportedOperationException(); |
1038 | } |
1039 | @@ -543,12 +546,12 @@ |
1040 | } |
1041 | |
1042 | @Override |
1043 | - boolean claim(boolean writer) throws PersistitInterruptedException { |
1044 | + boolean claim(final boolean writer) throws PersistitInterruptedException { |
1045 | return claim(writer, DEFAULT_MAX_WAIT_TIME); |
1046 | } |
1047 | |
1048 | @Override |
1049 | - boolean claim(boolean writer, long timeout) throws PersistitInterruptedException { |
1050 | + boolean claim(final boolean writer, final long timeout) throws PersistitInterruptedException { |
1051 | if (super.claim(writer, timeout)) { |
1052 | if (!isDirty()) { |
1053 | _timestamp = _persistit.getCurrentTimestamp(); |
1054 | @@ -579,7 +582,7 @@ |
1055 | Util.clearBytes(_bytes, 0, _bufferSize); |
1056 | } |
1057 | |
1058 | - void clearBytes(int from, int to) { |
1059 | + void clearBytes(final int from, final int to) { |
1060 | Util.clearBytes(_bytes, from, to); |
1061 | } |
1062 | |
1063 | @@ -733,7 +736,7 @@ |
1064 | * @param pageAddress |
1065 | * the sibling's address |
1066 | */ |
1067 | - void setRightSibling(long pageAddress) { |
1068 | + void setRightSibling(final long pageAddress) { |
1069 | Debug.$assert0.t(isMine()); |
1070 | _rightSibling = pageAddress; |
1071 | } |
1072 | @@ -803,15 +806,15 @@ |
1073 | * it follows the last key in the page. |
1074 | * @throws PersistitInterruptedException |
1075 | */ |
1076 | - int findKey(Key key) throws PersistitInterruptedException { |
1077 | + int findKey(final Key key) throws PersistitInterruptedException { |
1078 | final FastIndex fastIndex = getFastIndex(); |
1079 | - byte[] kbytes = key.getEncodedBytes(); |
1080 | - int klength = key.getEncodedSize(); |
1081 | + final byte[] kbytes = key.getEncodedBytes(); |
1082 | + final int klength = key.getEncodedSize(); |
1083 | int depth = 0; |
1084 | int left = KEY_BLOCK_START; |
1085 | int right = _keyBlockEnd; |
1086 | - int start = left; |
1087 | - int tailHeaderSize = _tailHeaderSize; |
1088 | + final int start = left; |
1089 | + final int tailHeaderSize = _tailHeaderSize; |
1090 | |
1091 | for (int p = start; p < right;) { |
1092 | // |
1093 | @@ -820,7 +823,7 @@ |
1094 | int kbData = getInt(p); |
1095 | int index = (p - start) >> 2; |
1096 | int runCount = fastIndex.getRunCount(index); |
1097 | - int ebc = decodeKeyBlockEbc(kbData); |
1098 | + final int ebc = decodeKeyBlockEbc(kbData); |
1099 | |
1100 | if (depth < ebc) { |
1101 | // We know that depth < ebc for a bunch of KeyBlocks - we |
1102 | @@ -836,7 +839,7 @@ |
1103 | } |
1104 | |
1105 | else if (depth > ebc) { |
1106 | - int result = p | (depth << DEPTH_SHIFT); |
1107 | + final int result = p | (depth << DEPTH_SHIFT); |
1108 | return result; |
1109 | } |
1110 | |
1111 | @@ -847,7 +850,7 @@ |
1112 | int kb = kbytes[depth] & 0xFF; |
1113 | |
1114 | if (kb < db) { |
1115 | - int result = p | (depth << DEPTH_SHIFT); |
1116 | + final int result = p | (depth << DEPTH_SHIFT); |
1117 | return result; |
1118 | } |
1119 | if (kb > db) { |
1120 | @@ -858,13 +861,13 @@ |
1121 | // either do a linear search or perform a binary search |
1122 | // within the run. |
1123 | // |
1124 | - int p2 = p + (runCount * KEYBLOCK_LENGTH); |
1125 | + final int p2 = p + (runCount * KEYBLOCK_LENGTH); |
1126 | // |
1127 | // p2 now points to the last key block with the same |
1128 | // ebc in this run. |
1129 | // |
1130 | - int kbData2 = getInt(p2); |
1131 | - int db2 = decodeKeyBlockDb(kbData2); |
1132 | + final int kbData2 = getInt(p2); |
1133 | + final int db2 = decodeKeyBlockDb(kbData2); |
1134 | // |
1135 | // For the common case that runCount == 1, we avoid |
1136 | // setting up the binary search loop. Instead, the |
1137 | @@ -877,7 +880,7 @@ |
1138 | // This is right because we already know |
1139 | // that kb > db. |
1140 | // |
1141 | - int result = p2 | (depth << DEPTH_SHIFT); |
1142 | + final int result = p2 | (depth << DEPTH_SHIFT); |
1143 | return result; |
1144 | } else if (db2 < kb) { |
1145 | // |
1146 | @@ -888,7 +891,7 @@ |
1147 | // - |
1148 | // in that case we use the cross count to skip |
1149 | // all of them. |
1150 | - int runCount2 = fastIndex.getRunCount(index + runCount); |
1151 | + final int runCount2 = fastIndex.getRunCount(index + runCount); |
1152 | assert runCount2 <= 0; |
1153 | p = p2 + KEYBLOCK_LENGTH * (-runCount + 1); |
1154 | continue; |
1155 | @@ -921,8 +924,8 @@ |
1156 | // we are seeking. |
1157 | // |
1158 | if (runCount > BINARY_SEARCH_THRESHOLD) { |
1159 | - int distance = (right - left) >> 2; |
1160 | - int oldRight = right; |
1161 | + final int distance = (right - left) >> 2; |
1162 | + final int oldRight = right; |
1163 | if (distance > kb - db + 1) { |
1164 | right = left + ((kb - db + 1) << 2); |
1165 | } |
1166 | @@ -942,7 +945,7 @@ |
1167 | // that kb > db and less than db2, so the |
1168 | // final answer is know to be in right. |
1169 | // |
1170 | - int result = right | (depth << DEPTH_SHIFT); |
1171 | + final int result = right | (depth << DEPTH_SHIFT); |
1172 | return result; |
1173 | } |
1174 | // |
1175 | @@ -950,7 +953,7 @@ |
1176 | // mid-point and |
1177 | // adjust the ends depending on the comparison. |
1178 | // |
1179 | - int db1 = getDb(p); |
1180 | + final int db1 = getDb(p); |
1181 | |
1182 | if (db1 == kb) { |
1183 | db = db1; |
1184 | @@ -998,10 +1001,10 @@ |
1185 | // for each byte in the key. |
1186 | // |
1187 | kbData = getInt(p); |
1188 | - int tail = decodeKeyBlockTail(kbData); |
1189 | - int tbData = getInt(tail); |
1190 | - int tlength = decodeTailBlockKLength(tbData) + depth + 1; |
1191 | - int qlength = tlength < klength ? tlength : klength; |
1192 | + final int tail = decodeKeyBlockTail(kbData); |
1193 | + final int tbData = getInt(tail); |
1194 | + final int tlength = decodeTailBlockKLength(tbData) + depth + 1; |
1195 | + final int qlength = tlength < klength ? tlength : klength; |
1196 | // |
1197 | // Walk down the key, increasing depth |
1198 | // |
1199 | @@ -1025,7 +1028,7 @@ |
1200 | // Key is less than tail, so we return |
1201 | // this keyblock |
1202 | // |
1203 | - int result = p | (depth << DEPTH_SHIFT) | FIXUP_MASK; |
1204 | + final int result = p | (depth << DEPTH_SHIFT) | FIXUP_MASK; |
1205 | return result; |
1206 | } |
1207 | matched = false; |
1208 | @@ -1045,7 +1048,7 @@ |
1209 | // And the key lengths are equal so this is an |
1210 | // exact match. |
1211 | // |
1212 | - int result = p | (depth << DEPTH_SHIFT) | EXACT_MASK; |
1213 | + final int result = p | (depth << DEPTH_SHIFT) | EXACT_MASK; |
1214 | return result; |
1215 | } |
1216 | } else if (tlength > qlength) { |
1217 | @@ -1054,7 +1057,7 @@ |
1218 | // key is less than tail, so we return the |
1219 | // this keyblock since it is greater than the key |
1220 | // |
1221 | - int result = p | (depth << DEPTH_SHIFT) | FIXUP_MASK; |
1222 | + final int result = p | (depth << DEPTH_SHIFT) | FIXUP_MASK; |
1223 | return result; |
1224 | } |
1225 | // Otherwise, the key is longer, so we move to the next |
1226 | @@ -1066,7 +1069,7 @@ |
1227 | |
1228 | } |
1229 | |
1230 | - int result = right | (depth << DEPTH_SHIFT); |
1231 | + final int result = right | (depth << DEPTH_SHIFT); |
1232 | return result; |
1233 | } |
1234 | |
1235 | @@ -1074,13 +1077,13 @@ |
1236 | if (isDataPage()) { |
1237 | final int p = foundAt & P_MASK; |
1238 | if (p >= KEY_BLOCK_START && p < _keyBlockEnd) { |
1239 | - int kbData = getInt(p); |
1240 | - int tail = decodeKeyBlockTail(kbData); |
1241 | - int tbData = getInt(tail); |
1242 | - int klength = decodeTailBlockKLength(tbData); |
1243 | - int size = decodeTailBlockSize(tbData); |
1244 | - int offset = tail + _tailHeaderSize + klength; |
1245 | - int valueSize = size - klength - _tailHeaderSize; |
1246 | + final int kbData = getInt(p); |
1247 | + final int tail = decodeKeyBlockTail(kbData); |
1248 | + final int tbData = getInt(tail); |
1249 | + final int klength = decodeTailBlockKLength(tbData); |
1250 | + final int size = decodeTailBlockSize(tbData); |
1251 | + final int offset = tail + _tailHeaderSize + klength; |
1252 | + final int valueSize = size - klength - _tailHeaderSize; |
1253 | return valueSize == 1 && _bytes[offset] == MVV.TYPE_ANTIVALUE; |
1254 | } |
1255 | } |
1256 | @@ -1099,13 +1102,13 @@ |
1257 | if (isDataPage() || isIndexPage()) { |
1258 | final int p = foundAt & P_MASK; |
1259 | if (p >= KEY_BLOCK_START && p < _keyBlockEnd) { |
1260 | - int kbData = getInt(p); |
1261 | - int tail = decodeKeyBlockTail(kbData); |
1262 | - int tbData = getInt(tail); |
1263 | - int klength = decodeTailBlockKLength(tbData); |
1264 | - int size = decodeTailBlockSize(tbData); |
1265 | - int offset = tail + _tailHeaderSize + klength; |
1266 | - int valueSize = size - klength - _tailHeaderSize; |
1267 | + final int kbData = getInt(p); |
1268 | + final int tail = decodeKeyBlockTail(kbData); |
1269 | + final int tbData = getInt(tail); |
1270 | + final int klength = decodeTailBlockKLength(tbData); |
1271 | + final int size = decodeTailBlockSize(tbData); |
1272 | + final int offset = tail + _tailHeaderSize + klength; |
1273 | + final int valueSize = size - klength - _tailHeaderSize; |
1274 | return ((long) offset) << 32 | valueSize; |
1275 | } |
1276 | } |
1277 | @@ -1116,13 +1119,13 @@ |
1278 | Debug.$assert0.t(foundAt > 0 && foundAt < _keyBlockEnd); |
1279 | if (isDataPage() || isIndexPage()) { |
1280 | for (int p = KEY_BLOCK_START; p <= foundAt; p += KEYBLOCK_LENGTH) { |
1281 | - int kbData = getInt(p); |
1282 | - int tail = decodeKeyBlockTail(kbData); |
1283 | - int ebc = decodeKeyBlockEbc(kbData); |
1284 | - int db = decodeKeyBlockDb(kbData); |
1285 | - int tbData = getInt(tail); |
1286 | - int klength = decodeTailBlockKLength(tbData); |
1287 | - byte[] keyBytes = key.getEncodedBytes(); |
1288 | + final int kbData = getInt(p); |
1289 | + final int tail = decodeKeyBlockTail(kbData); |
1290 | + final int ebc = decodeKeyBlockEbc(kbData); |
1291 | + final int db = decodeKeyBlockDb(kbData); |
1292 | + final int tbData = getInt(tail); |
1293 | + final int klength = decodeTailBlockKLength(tbData); |
1294 | + final byte[] keyBytes = key.getEncodedBytes(); |
1295 | keyBytes[ebc] = (byte) db; |
1296 | System.arraycopy(_bytes, tail + _tailHeaderSize, keyBytes, ebc + 1, klength); |
1297 | key.setEncodedSize(ebc + klength + 1); |
1298 | @@ -1130,32 +1133,32 @@ |
1299 | } |
1300 | } |
1301 | |
1302 | - Value fetch(int foundAt, Value value) { |
1303 | + Value fetch(final int foundAt, final Value value) { |
1304 | if ((foundAt & EXACT_MASK) == 0) { |
1305 | value.clear(); |
1306 | } else { |
1307 | Debug.$assert0.t(foundAt > 0 && (foundAt & P_MASK) < _keyBlockEnd); |
1308 | - int kbData = getInt(foundAt & P_MASK); |
1309 | - int tail = decodeKeyBlockTail(kbData); |
1310 | - int tbData = getInt(tail); |
1311 | - int klength = decodeTailBlockKLength(tbData); |
1312 | - int size = decodeTailBlockSize(tbData); |
1313 | - int valueSize = size - klength - _tailHeaderSize; |
1314 | + final int kbData = getInt(foundAt & P_MASK); |
1315 | + final int tail = decodeKeyBlockTail(kbData); |
1316 | + final int tbData = getInt(tail); |
1317 | + final int klength = decodeTailBlockKLength(tbData); |
1318 | + final int size = decodeTailBlockSize(tbData); |
1319 | + final int valueSize = size - klength - _tailHeaderSize; |
1320 | value.putEncodedBytes(_bytes, tail + _tailHeaderSize + klength, valueSize); |
1321 | } |
1322 | return value; |
1323 | } |
1324 | |
1325 | - long fetchLongRecordPointer(int foundAt) { |
1326 | + long fetchLongRecordPointer(final int foundAt) { |
1327 | if (!isDataPage()) { |
1328 | return 0; |
1329 | } |
1330 | - int kbData = getInt(foundAt & P_MASK); |
1331 | - int tail = decodeKeyBlockTail(kbData); |
1332 | - int tbData = getInt(tail); |
1333 | - int klength = decodeTailBlockKLength(tbData); |
1334 | - int size = decodeTailBlockSize(tbData); |
1335 | - int valueSize = size - klength - _tailHeaderSize; |
1336 | + final int kbData = getInt(foundAt & P_MASK); |
1337 | + final int tail = decodeKeyBlockTail(kbData); |
1338 | + final int tbData = getInt(tail); |
1339 | + final int klength = decodeTailBlockKLength(tbData); |
1340 | + final int size = decodeTailBlockSize(tbData); |
1341 | + final int valueSize = size - klength - _tailHeaderSize; |
1342 | if (valueSize != LONGREC_SIZE) { |
1343 | return 0; |
1344 | } |
1345 | @@ -1163,16 +1166,16 @@ |
1346 | return 0; |
1347 | } |
1348 | |
1349 | - long pointer = getLong(tail + _tailHeaderSize + klength + LONGREC_PAGE_OFFSET); |
1350 | + final long pointer = getLong(tail + _tailHeaderSize + klength + LONGREC_PAGE_OFFSET); |
1351 | return pointer; |
1352 | } |
1353 | |
1354 | - long getPointer(int foundAt) throws PersistitException { |
1355 | + long getPointer(final int foundAt) throws PersistitException { |
1356 | if (!isIndexPage()) { |
1357 | throw new InvalidPageTypeException("type=" + _type); |
1358 | } |
1359 | - int kbData = getInt(foundAt & P_MASK); |
1360 | - int tail = decodeKeyBlockTail(kbData); |
1361 | + final int kbData = getInt(foundAt & P_MASK); |
1362 | + final int tail = decodeKeyBlockTail(kbData); |
1363 | return getInt(tail + 4); |
1364 | } |
1365 | |
1366 | @@ -1185,8 +1188,8 @@ |
1367 | * @param foundAt |
1368 | * @return |
1369 | */ |
1370 | - int traverse(Key key, Key.Direction mode, int foundAt) { |
1371 | - boolean exactMatch = (foundAt & EXACT_MASK) > 0; |
1372 | + int traverse(final Key key, final Key.Direction mode, final int foundAt) { |
1373 | + final boolean exactMatch = (foundAt & EXACT_MASK) > 0; |
1374 | if (mode == Key.EQ || exactMatch && (mode == Key.LTEQ || mode == Key.GTEQ)) { |
1375 | return foundAt; |
1376 | } |
1377 | @@ -1205,21 +1208,21 @@ |
1378 | * @param foundAt |
1379 | * @return |
1380 | */ |
1381 | - int previousKey(Key key, int foundAt) { |
1382 | + int previousKey(final Key key, final int foundAt) { |
1383 | int p = (foundAt & P_MASK) - KEYBLOCK_LENGTH; |
1384 | - int depth = (foundAt & DEPTH_MASK) >>> DEPTH_SHIFT; |
1385 | + final int depth = (foundAt & DEPTH_MASK) >>> DEPTH_SHIFT; |
1386 | |
1387 | if (p < KEY_BLOCK_START) |
1388 | return foundAt; |
1389 | |
1390 | - byte[] kbytes = key.getEncodedBytes(); |
1391 | + final byte[] kbytes = key.getEncodedBytes(); |
1392 | |
1393 | // Compute the count of prefix bytes in the supplied key that |
1394 | // are known to match. The leftmost knownGood bytes do not need |
1395 | // to be recovered by traversing keys in the page. |
1396 | // |
1397 | - int kbData2 = getInt(p + KEYBLOCK_LENGTH); |
1398 | - int ebc2 = decodeKeyBlockEbc(kbData2); |
1399 | + final int kbData2 = getInt(p + KEYBLOCK_LENGTH); |
1400 | + final int ebc2 = decodeKeyBlockEbc(kbData2); |
1401 | int kbData = getInt(p); |
1402 | int ebc = decodeKeyBlockEbc(kbData); |
1403 | int knownGood = ebc; |
1404 | @@ -1244,7 +1247,7 @@ |
1405 | int unknown = decodeTailBlockKLength(getInt(tail)) + ebc + 1; |
1406 | key.setEncodedSize(unknown); |
1407 | |
1408 | - int result = p | (unknown << DEPTH_SHIFT) | EXACT_MASK; |
1409 | + final int result = p | (unknown << DEPTH_SHIFT) | EXACT_MASK; |
1410 | // |
1411 | // Reconstruct the previous key. |
1412 | // |
1413 | @@ -1252,7 +1255,7 @@ |
1414 | if (ebc < unknown) { |
1415 | // move bytes from this keyblock into the result key. |
1416 | kbytes[ebc] = (byte) decodeKeyBlockDb(kbData); |
1417 | - int more = unknown - ebc - 1; |
1418 | + final int more = unknown - ebc - 1; |
1419 | if (more > 0) { |
1420 | System.arraycopy(_bytes, tail + _tailHeaderSize, kbytes, ebc + 1, more); |
1421 | } |
1422 | @@ -1278,7 +1281,7 @@ |
1423 | * @param foundAt |
1424 | * @return |
1425 | */ |
1426 | - int nextKey(Key key, int foundAt) { |
1427 | + int nextKey(final Key key, final int foundAt) { |
1428 | int p = foundAt & P_MASK; |
1429 | if ((foundAt & EXACT_MASK) != 0) |
1430 | p += KEYBLOCK_LENGTH; |
1431 | @@ -1286,16 +1289,16 @@ |
1432 | if (p >= _keyBlockEnd) |
1433 | return foundAt; |
1434 | |
1435 | - byte[] kbytes = key.getEncodedBytes(); |
1436 | - int kbData = getInt(p); |
1437 | - int ebc = decodeKeyBlockEbc(kbData); |
1438 | - int tail = decodeKeyBlockTail(kbData); |
1439 | - int tbData = getInt(tail); |
1440 | - int klength = decodeTailBlockKLength(tbData); |
1441 | - int keyLength = klength + ebc + 1; |
1442 | + final byte[] kbytes = key.getEncodedBytes(); |
1443 | + final int kbData = getInt(p); |
1444 | + final int ebc = decodeKeyBlockEbc(kbData); |
1445 | + final int tail = decodeKeyBlockTail(kbData); |
1446 | + final int tbData = getInt(tail); |
1447 | + final int klength = decodeTailBlockKLength(tbData); |
1448 | + final int keyLength = klength + ebc + 1; |
1449 | key.setEncodedSize(keyLength); |
1450 | |
1451 | - int result = p | (keyLength << DEPTH_SHIFT) | EXACT_MASK; |
1452 | + final int result = p | (keyLength << DEPTH_SHIFT) | EXACT_MASK; |
1453 | // |
1454 | // Note: the findKey method is guaranteed to return the offset of a |
1455 | // keyblock whose first ebc bytes match the supplied key. |
1456 | @@ -1313,15 +1316,15 @@ |
1457 | * @param foundAt |
1458 | * @return |
1459 | */ |
1460 | - int nextLongRecord(Value value, int foundAt) { |
1461 | + int nextLongRecord(final Value value, final int foundAt) { |
1462 | Debug.$assert0.t(isDataPage()); |
1463 | for (int p = foundAt & P_MASK; p < _keyBlockEnd; p += KEYBLOCK_LENGTH) { |
1464 | - int kbData = getInt(p); |
1465 | - int tail = decodeKeyBlockTail(kbData); |
1466 | - int tbData = getInt(tail); |
1467 | - int klength = decodeTailBlockKLength(tbData); |
1468 | - int size = decodeTailBlockSize(tbData); |
1469 | - int valueSize = size - klength - _tailHeaderSize; |
1470 | + final int kbData = getInt(p); |
1471 | + final int tail = decodeKeyBlockTail(kbData); |
1472 | + final int tbData = getInt(tail); |
1473 | + final int klength = decodeTailBlockKLength(tbData); |
1474 | + final int size = decodeTailBlockSize(tbData); |
1475 | + final int valueSize = size - klength - _tailHeaderSize; |
1476 | if ((valueSize > 0) && ((_bytes[tail + _tailHeaderSize + klength] & 0xFF) == LONGREC_TYPE)) { |
1477 | value.putEncodedBytes(_bytes, tail + _tailHeaderSize + klength, valueSize); |
1478 | return p; |
1479 | @@ -1330,15 +1333,15 @@ |
1480 | return -1; |
1481 | } |
1482 | |
1483 | - int previousKeyBlock(int foundAt) { |
1484 | - int p = (foundAt & P_MASK) - KEYBLOCK_LENGTH; |
1485 | + int previousKeyBlock(final int foundAt) { |
1486 | + final int p = (foundAt & P_MASK) - KEYBLOCK_LENGTH; |
1487 | if (p < KEY_BLOCK_START || p > _keyBlockEnd) |
1488 | return -1; |
1489 | return p; |
1490 | } |
1491 | |
1492 | - int nextKeyBlock(int foundAt) { |
1493 | - int p = (foundAt & P_MASK) + KEYBLOCK_LENGTH; |
1494 | + int nextKeyBlock(final int foundAt) { |
1495 | + final int p = (foundAt & P_MASK) + KEYBLOCK_LENGTH; |
1496 | if (p >= _keyBlockEnd || p < KEY_BLOCK_START) |
1497 | return -1; |
1498 | return p; |
1499 | @@ -1366,8 +1369,8 @@ |
1500 | * The value, converted to a byte array |
1501 | * @throws PersistitInterruptedException |
1502 | */ |
1503 | - int putValue(Key key, ValueHelper valueHelper) throws PersistitInterruptedException { |
1504 | - int p = findKey(key); |
1505 | + int putValue(final Key key, final ValueHelper valueHelper) throws PersistitInterruptedException { |
1506 | + final int p = findKey(key); |
1507 | return putValue(key, valueHelper, p, false); |
1508 | } |
1509 | |
1510 | @@ -1383,13 +1386,13 @@ |
1511 | * @param foundAt |
1512 | * The keyblock before which this record will be inserted |
1513 | */ |
1514 | - int putValue(Key key, ValueHelper valueHelper, int foundAt, boolean postSplit) { |
1515 | + int putValue(final Key key, final ValueHelper valueHelper, final int foundAt, final boolean postSplit) { |
1516 | if (Debug.ENABLED) { |
1517 | assertVerify(); |
1518 | } |
1519 | |
1520 | - boolean exactMatch = (foundAt & EXACT_MASK) > 0; |
1521 | - int p = foundAt & P_MASK; |
1522 | + final boolean exactMatch = (foundAt & EXACT_MASK) > 0; |
1523 | + final int p = foundAt & P_MASK; |
1524 | |
1525 | if (exactMatch) { |
1526 | return replaceValue(key, valueHelper, p); |
1527 | @@ -1401,9 +1404,9 @@ |
1528 | length = valueHelper.requiredLength(_bytes, 0, -1); |
1529 | } |
1530 | |
1531 | - int depth = (foundAt & DEPTH_MASK) >>> DEPTH_SHIFT; |
1532 | - boolean fixupSuccessor = (foundAt & FIXUP_MASK) > 0; |
1533 | - byte[] kbytes = key.getEncodedBytes(); |
1534 | + final int depth = (foundAt & DEPTH_MASK) >>> DEPTH_SHIFT; |
1535 | + final boolean fixupSuccessor = (foundAt & FIXUP_MASK) > 0; |
1536 | + final byte[] kbytes = key.getEncodedBytes(); |
1537 | |
1538 | int ebcNew; |
1539 | int ebcSuccessor; |
1540 | @@ -1429,8 +1432,8 @@ |
1541 | ebcSuccessor = 0; |
1542 | ebcNew = depth; |
1543 | } |
1544 | - int klength = key.getEncodedSize() - ebcNew - 1; |
1545 | - int newTailSize = klength + length + _tailHeaderSize; |
1546 | + final int klength = key.getEncodedSize() - ebcNew - 1; |
1547 | + final int newTailSize = klength + length + _tailHeaderSize; |
1548 | |
1549 | if (getKeyCount() >= _pool.getMaxKeys() || !willFit(newTailSize + KEYBLOCK_LENGTH - (free1 - free2))) { |
1550 | Debug.$assert0.t(!postSplit); |
1551 | @@ -1443,8 +1446,8 @@ |
1552 | // is correct. |
1553 | // |
1554 | if (fixupSuccessor && ebcNew != ebcSuccessor) { |
1555 | - int successorKeyLength = decodeTailBlockKLength(successorTailBlock); |
1556 | - int successorDb = getByte(successorTail + _tailHeaderSize + delta - 1); |
1557 | + final int successorKeyLength = decodeTailBlockKLength(successorTailBlock); |
1558 | + final int successorDb = getByte(successorTail + _tailHeaderSize + delta - 1); |
1559 | |
1560 | // Write updated successor tail block |
1561 | putInt(successorTail, encodeTailBlock(successorTailSize - delta, successorKeyLength - delta)); |
1562 | @@ -1460,7 +1463,7 @@ |
1563 | |
1564 | putInt(p, kbSuccessor); |
1565 | } |
1566 | - int dbNew = kbytes[ebcNew] & 0xFF; |
1567 | + final int dbNew = kbytes[ebcNew] & 0xFF; |
1568 | // |
1569 | // Allocate space for the new tail block |
1570 | // |
1571 | @@ -1481,7 +1484,7 @@ |
1572 | System.arraycopy(_bytes, p, _bytes, p + KEYBLOCK_LENGTH, _keyBlockEnd - p - KEYBLOCK_LENGTH); |
1573 | |
1574 | // Write new key block |
1575 | - int newKeyBlock = encodeKeyBlock(ebcNew, dbNew, newTail); |
1576 | + final int newKeyBlock = encodeKeyBlock(ebcNew, dbNew, newTail); |
1577 | putInt(p, newKeyBlock); |
1578 | |
1579 | // Write new tail block |
1580 | @@ -1493,12 +1496,12 @@ |
1581 | System.arraycopy(kbytes, ebcNew + 1, _bytes, newTail + _tailHeaderSize, klength); |
1582 | |
1583 | if (isIndexPage()) { |
1584 | - int pointer = (int) valueHelper.getPointerValue(); |
1585 | + final int pointer = (int) valueHelper.getPointerValue(); |
1586 | |
1587 | Debug.$assert0.t(p + KEYBLOCK_LENGTH < _keyBlockEnd ? pointer > 0 : true); |
1588 | putInt(newTail + TAILBLOCK_POINTER, pointer); |
1589 | } else { |
1590 | - int storedLength = valueHelper.storeVersion(_bytes, newTail + _tailHeaderSize + klength, -1, |
1591 | + final int storedLength = valueHelper.storeVersion(_bytes, newTail + _tailHeaderSize + klength, -1, |
1592 | _bytes.length); // TODO limit |
1593 | incCountIfMvv(_bytes, newTail + _tailHeaderSize + klength, storedLength & MVV.STORE_LENGTH_MASK); |
1594 | } |
1595 | @@ -1532,12 +1535,12 @@ |
1596 | */ |
1597 | private boolean adjacentKeyCheck(int p) { |
1598 | p &= P_MASK; |
1599 | - int kbData1 = getInt(p); |
1600 | - int kbData2 = getInt(p + KEYBLOCK_LENGTH); |
1601 | - int db1 = decodeKeyBlockDb(kbData1); |
1602 | - int ebc1 = decodeKeyBlockEbc(kbData1); |
1603 | - int db2 = decodeKeyBlockDb(kbData2); |
1604 | - int ebc2 = decodeKeyBlockEbc(kbData2); |
1605 | + final int kbData1 = getInt(p); |
1606 | + final int kbData2 = getInt(p + KEYBLOCK_LENGTH); |
1607 | + final int db1 = decodeKeyBlockDb(kbData1); |
1608 | + final int ebc1 = decodeKeyBlockEbc(kbData1); |
1609 | + final int db2 = decodeKeyBlockDb(kbData2); |
1610 | + final int ebc2 = decodeKeyBlockEbc(kbData2); |
1611 | |
1612 | if (db1 == 0 && p > KEY_BLOCK_START) { |
1613 | return false; // Can set breakpoint here |
1614 | @@ -1551,9 +1554,9 @@ |
1615 | if (ebc2 < ebc1) |
1616 | return true; |
1617 | if (ebc2 > ebc1) { |
1618 | - int tail1 = decodeKeyBlockTail(kbData1); |
1619 | - int tbData1 = getInt(tail1); |
1620 | - int klength1 = decodeTailBlockKLength(tbData1); |
1621 | + final int tail1 = decodeKeyBlockTail(kbData1); |
1622 | + final int tbData1 = getInt(tail1); |
1623 | + final int klength1 = decodeTailBlockKLength(tbData1); |
1624 | int db = -1; |
1625 | if (klength1 >= ebc2 - ebc1) { |
1626 | db = _bytes[tail1 + _tailHeaderSize + ebc2 - ebc1 - 1] & DB_MASK; |
1627 | @@ -1569,12 +1572,12 @@ |
1628 | return false; // Can set breakpoint here |
1629 | } |
1630 | |
1631 | - private int replaceValue(Key key, ValueHelper valueHelper, int p) { |
1632 | - int kbData = getInt(p); |
1633 | - int tail = decodeKeyBlockTail(kbData); |
1634 | - int tbData = getInt(tail); |
1635 | - int klength = decodeTailBlockKLength(tbData); |
1636 | - int oldTailSize = decodeTailBlockSize(tbData); |
1637 | + private int replaceValue(final Key key, final ValueHelper valueHelper, final int p) { |
1638 | + final int kbData = getInt(p); |
1639 | + final int tail = decodeKeyBlockTail(kbData); |
1640 | + final int tbData = getInt(tail); |
1641 | + final int klength = decodeTailBlockKLength(tbData); |
1642 | + final int oldTailSize = decodeTailBlockSize(tbData); |
1643 | boolean wasMVV = false; |
1644 | boolean isMVV = false; |
1645 | |
1646 | @@ -1587,9 +1590,9 @@ |
1647 | wasMVV = isValueMVV(_bytes, tail + _tailHeaderSize + klength, oldTailSize - _tailHeaderSize - klength); |
1648 | } |
1649 | |
1650 | - int newTailSize = klength + length + _tailHeaderSize; |
1651 | - int oldNext = (tail + oldTailSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
1652 | - int newNext = (tail + newTailSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
1653 | + final int newTailSize = klength + length + _tailHeaderSize; |
1654 | + final int oldNext = (tail + oldTailSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
1655 | + final int newNext = (tail + newTailSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
1656 | int newTail = tail; |
1657 | if (newNext < oldNext) { |
1658 | // Free the remainder of the old tail block |
1659 | @@ -1622,7 +1625,7 @@ |
1660 | } |
1661 | |
1662 | if (isIndexPage()) { |
1663 | - long pointer = valueHelper.getPointerValue(); |
1664 | + final long pointer = valueHelper.getPointerValue(); |
1665 | Debug.$assert0.t(p + KEYBLOCK_LENGTH < _keyBlockEnd ? pointer > 0 : pointer == -1); |
1666 | putInt(newTail + TAILBLOCK_POINTER, (int) pointer); |
1667 | } else { |
1668 | @@ -1658,11 +1661,11 @@ |
1669 | * @return <i>true</i> if the key was found and the value removed, else |
1670 | * <i>false</i> |
1671 | */ |
1672 | - boolean removeKeys(int foundAt1, int foundAt2, Key spareKey) { |
1673 | + boolean removeKeys(final int foundAt1, final int foundAt2, final Key spareKey) { |
1674 | if (Debug.ENABLED) { |
1675 | assertVerify(); |
1676 | } |
1677 | - int p1 = foundAt1 & P_MASK; |
1678 | + final int p1 = foundAt1 & P_MASK; |
1679 | int p2 = foundAt2 & P_MASK; |
1680 | if ((foundAt2 & EXACT_MASK) != 0) |
1681 | p2 += KEYBLOCK_LENGTH; |
1682 | @@ -1675,24 +1678,24 @@ |
1683 | |
1684 | int ebc = Integer.MAX_VALUE; |
1685 | |
1686 | - byte[] spareBytes = spareKey.getEncodedBytes(); |
1687 | + final byte[] spareBytes = spareKey.getEncodedBytes(); |
1688 | int keySize = 0; |
1689 | for (int p = p1; p < p2; p += KEYBLOCK_LENGTH) { |
1690 | - int kbData = getInt(p); |
1691 | - int ebcCandidate = decodeKeyBlockEbc(kbData); |
1692 | + final int kbData = getInt(p); |
1693 | + final int ebcCandidate = decodeKeyBlockEbc(kbData); |
1694 | if (ebcCandidate < ebc) { |
1695 | ebc = ebcCandidate; |
1696 | } |
1697 | - int db = decodeKeyBlockDb(kbData); |
1698 | - int tail = decodeKeyBlockTail(kbData); |
1699 | - int tbData = getInt(tail); |
1700 | - int klength = decodeTailBlockKLength(tbData); |
1701 | + final int db = decodeKeyBlockDb(kbData); |
1702 | + final int tail = decodeKeyBlockTail(kbData); |
1703 | + final int tbData = getInt(tail); |
1704 | + final int klength = decodeTailBlockKLength(tbData); |
1705 | spareBytes[ebcCandidate] = (byte) db; |
1706 | if (klength > 0) { |
1707 | System.arraycopy(_bytes, tail + _tailHeaderSize, spareBytes, ebcCandidate + 1, klength); |
1708 | } |
1709 | keySize = klength + ebcCandidate + 1; |
1710 | - int size = (decodeTailBlockSize(tbData) + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
1711 | + final int size = (decodeTailBlockSize(tbData) + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
1712 | deallocTail(tail, size); |
1713 | } |
1714 | spareKey.setEncodedSize(keySize); |
1715 | @@ -1711,22 +1714,22 @@ |
1716 | // |
1717 | if (p1 < _keyBlockEnd) { |
1718 | int kbNext = getInt(p1); |
1719 | - int ebcNext = decodeKeyBlockEbc(kbNext); |
1720 | + final int ebcNext = decodeKeyBlockEbc(kbNext); |
1721 | |
1722 | // |
1723 | // If ebcNext > ebc then the successor key will need to expand. |
1724 | // |
1725 | if (ebcNext > ebc) { |
1726 | int tailNext = decodeKeyBlockTail(kbNext); |
1727 | - int dbNext = decodeKeyBlockDb(kbNext); |
1728 | - int tbNext = getInt(tailNext); |
1729 | - int nextTailSize = decodeTailBlockSize(tbNext); |
1730 | - |
1731 | - int nextTailBlockSize = (nextTailSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
1732 | - |
1733 | - int newNextTailBlockSize = (nextTailSize + ebcNext - ebc + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
1734 | - |
1735 | - int delta = newNextTailBlockSize - nextTailBlockSize; |
1736 | + final int dbNext = decodeKeyBlockDb(kbNext); |
1737 | + final int tbNext = getInt(tailNext); |
1738 | + final int nextTailSize = decodeTailBlockSize(tbNext); |
1739 | + |
1740 | + final int nextTailBlockSize = (nextTailSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
1741 | + |
1742 | + final int newNextTailBlockSize = (nextTailSize + ebcNext - ebc + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
1743 | + |
1744 | + final int delta = newNextTailBlockSize - nextTailBlockSize; |
1745 | boolean freeNextTailBlock = false; |
1746 | int newNextTail = tailNext; |
1747 | if (delta > 0) { |
1748 | @@ -1786,17 +1789,17 @@ |
1749 | // |
1750 | // Now construct the new tail block |
1751 | // |
1752 | - int newNextKLength = decodeTailBlockKLength(tbNext) + ebcNext - ebc; |
1753 | - int newNextTailSize = nextTailSize + ebcNext - ebc; |
1754 | + final int newNextKLength = decodeTailBlockKLength(tbNext) + ebcNext - ebc; |
1755 | + final int newNextTailSize = nextTailSize + ebcNext - ebc; |
1756 | putInt(newNextTail, encodeTailBlock(newNextTailSize, newNextKLength)); |
1757 | if (freeNextTailBlock) { |
1758 | - int toFree = (nextTailSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
1759 | + final int toFree = (nextTailSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
1760 | deallocTail(tailNext, toFree); |
1761 | } |
1762 | // |
1763 | // Fix up the successor key block |
1764 | // |
1765 | - int kbNewNext = encodeKeyBlock(ebc, spareBytes[ebc], newNextTail); |
1766 | + final int kbNewNext = encodeKeyBlock(ebc, spareBytes[ebc], newNextTail); |
1767 | putInt(p1, kbNewNext); |
1768 | } |
1769 | } |
1770 | @@ -1820,7 +1823,7 @@ |
1771 | * The amount by which that block is to be expanded. |
1772 | * @return int Offset of the expanded tail block, or -1 if it does not fit. |
1773 | */ |
1774 | - private int wedgeTail(int tail, int delta) { |
1775 | + private int wedgeTail(final int tail, int delta) { |
1776 | delta = (delta + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
1777 | if (delta == 0) { |
1778 | return tail; |
1779 | @@ -1836,8 +1839,8 @@ |
1780 | _alloc -= delta; |
1781 | |
1782 | for (int p = KEY_BLOCK_START; p < _keyBlockEnd; p += KEYBLOCK_LENGTH) { |
1783 | - int kbData = getInt(p); |
1784 | - int oldTail = decodeKeyBlockTail(kbData); |
1785 | + final int kbData = getInt(p); |
1786 | + final int oldTail = decodeKeyBlockTail(kbData); |
1787 | if (oldTail < tail) { |
1788 | putInt(p, encodeKeyBlockTail(kbData, oldTail - delta)); |
1789 | } |
1790 | @@ -1869,8 +1872,8 @@ |
1791 | * the right sibling Buffer. |
1792 | * @throws PersistitException |
1793 | */ |
1794 | - final int split(Buffer rightSibling, Key key, ValueHelper valueHelper, int foundAt, Key indexKey, |
1795 | - Sequence sequence, SplitPolicy policy) throws PersistitException { |
1796 | + final int split(final Buffer rightSibling, final Key key, final ValueHelper valueHelper, int foundAt, |
1797 | + final Key indexKey, final Sequence sequence, final SplitPolicy policy) throws PersistitException { |
1798 | // Make sure the right sibling page is empty. |
1799 | |
1800 | Debug.$assert0.t(rightSibling._keyBlockEnd == KEY_BLOCK_START); |
1801 | @@ -1888,10 +1891,10 @@ |
1802 | // |
1803 | int currentSize = _bufferSize - _alloc - _slack + _keyBlockEnd - KEY_BLOCK_START; |
1804 | |
1805 | - int foundAtPosition = foundAt & P_MASK; |
1806 | - boolean exact = (foundAt & EXACT_MASK) != 0; |
1807 | + final int foundAtPosition = foundAt & P_MASK; |
1808 | + final boolean exact = (foundAt & EXACT_MASK) != 0; |
1809 | int depth = (foundAt & DEPTH_MASK) >>> DEPTH_SHIFT; |
1810 | - boolean fixupSuccessor = (foundAt & FIXUP_MASK) > 0; |
1811 | + final boolean fixupSuccessor = (foundAt & FIXUP_MASK) > 0; |
1812 | |
1813 | int ebcNew; |
1814 | int ebcSuccessor; |
1815 | @@ -1899,18 +1902,18 @@ |
1816 | int deltaSuccessorEbc = 0; |
1817 | |
1818 | if (fixupSuccessor) { |
1819 | - int kbSuccessor = getInt(foundAtPosition); |
1820 | - int tbSuccessor = getInt(decodeKeyBlockTail(kbSuccessor)); |
1821 | + final int kbSuccessor = getInt(foundAtPosition); |
1822 | + final int tbSuccessor = getInt(decodeKeyBlockTail(kbSuccessor)); |
1823 | ebcNew = decodeKeyBlockEbc(kbSuccessor); |
1824 | ebcSuccessor = depth; |
1825 | - int tbSize = decodeTailBlockSize(tbSuccessor); |
1826 | + final int tbSize = decodeTailBlockSize(tbSuccessor); |
1827 | |
1828 | // This is the number of bytes by which the successor key |
1829 | // can have its elided byte count increased. |
1830 | deltaSuccessorEbc = ebcSuccessor - ebcNew; |
1831 | |
1832 | - int oldSize = (tbSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
1833 | - int newSize = (tbSize - deltaSuccessorEbc + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
1834 | + final int oldSize = (tbSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
1835 | + final int newSize = (tbSize - deltaSuccessorEbc + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
1836 | |
1837 | // This is the number of bytes by which the successor tail block |
1838 | // can be reduced (because its elision count has increased.) |
1839 | @@ -1924,11 +1927,11 @@ |
1840 | int newTailBlockSize; |
1841 | int newValueSize; |
1842 | if (exact) { |
1843 | - int kbData = getInt(foundAtPosition); |
1844 | - int tail = decodeKeyBlockTail(kbData); |
1845 | - int tbData = getInt(tail); |
1846 | - int tbSize = decodeTailBlockSize(tbData); |
1847 | - int klength = decodeTailBlockKLength(tbData); |
1848 | + final int kbData = getInt(foundAtPosition); |
1849 | + final int tail = decodeKeyBlockTail(kbData); |
1850 | + final int tbData = getInt(tail); |
1851 | + final int tbSize = decodeTailBlockSize(tbData); |
1852 | + final int klength = decodeTailBlockKLength(tbData); |
1853 | oldTailBlockSize = (tbSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
1854 | keyBlockSizeDelta = 0; |
1855 | ebcNew = decodeKeyBlockEbc(kbData); |
1856 | @@ -1940,7 +1943,7 @@ |
1857 | newTailBlockSize = ((isIndexPage() ? 0 : newValueSize) + _tailHeaderSize + key.getEncodedSize() - ebcNew - 1 + ~TAILBLOCK_MASK) |
1858 | & TAILBLOCK_MASK; |
1859 | |
1860 | - int virtualSize = currentSize + newTailBlockSize - oldTailBlockSize + keyBlockSizeDelta |
1861 | + final int virtualSize = currentSize + newTailBlockSize - oldTailBlockSize + keyBlockSizeDelta |
1862 | - deltaSuccessorTailSize; |
1863 | |
1864 | int splitBest = 0; // Maximal fitness measure |
1865 | @@ -1951,7 +1954,7 @@ |
1866 | boolean armed = true; |
1867 | int whereInserted = -1; |
1868 | |
1869 | - int rightKeyBlock = _keyBlockEnd - KEYBLOCK_LENGTH; |
1870 | + final int rightKeyBlock = _keyBlockEnd - KEYBLOCK_LENGTH; |
1871 | for (int p = KEY_BLOCK_START; p < rightKeyBlock;) { |
1872 | int splitCandidate = 0; |
1873 | if (p == foundAtPosition && armed) { |
1874 | @@ -1968,18 +1971,18 @@ |
1875 | // Compute the number of bytes by which the successor tailblock |
1876 | // will grow due to its elision count becoming zero. |
1877 | // |
1878 | - int kbData = getInt(p); |
1879 | - int tbData = getInt(decodeKeyBlockTail(kbData)); |
1880 | - int ebc = decodeKeyBlockEbc(kbData); |
1881 | - int tbSize = decodeTailBlockSize(tbData); |
1882 | - int tbSizeDelta = ((tbSize + ebc + ~TAILBLOCK_MASK) & TAILBLOCK_MASK) |
1883 | + final int kbData = getInt(p); |
1884 | + final int tbData = getInt(decodeKeyBlockTail(kbData)); |
1885 | + final int ebc = decodeKeyBlockEbc(kbData); |
1886 | + final int tbSize = decodeTailBlockSize(tbData); |
1887 | + final int tbSizeDelta = ((tbSize + ebc + ~TAILBLOCK_MASK) & TAILBLOCK_MASK) |
1888 | - ((tbSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK); |
1889 | |
1890 | - int edgeTailBlockSize = (decodeTailBlockKLength(tbData) - deltaSuccessorEbc + _tailHeaderSize + ~TAILBLOCK_MASK) |
1891 | + final int edgeTailBlockSize = (decodeTailBlockKLength(tbData) - deltaSuccessorEbc + _tailHeaderSize + ~TAILBLOCK_MASK) |
1892 | & TAILBLOCK_MASK; |
1893 | |
1894 | if (p < rightKeyBlock) { |
1895 | - int rightSize = virtualSize - leftSize + tbSizeDelta; |
1896 | + final int rightSize = virtualSize - leftSize + tbSizeDelta; |
1897 | |
1898 | splitCandidate = policy.splitFit(this, p, foundAtPosition, exact, leftSize + KEYBLOCK_LENGTH |
1899 | + edgeTailBlockSize, rightSize, currentSize, virtualSize, _bufferSize - KEY_BLOCK_START, |
1900 | @@ -1996,7 +1999,7 @@ |
1901 | int kbData = getInt(p); |
1902 | int tbData = getInt(decodeKeyBlockTail(kbData)); |
1903 | int tbSizeDelta; |
1904 | - int tailBlockSize = (decodeTailBlockSize(tbData) + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
1905 | + final int tailBlockSize = (decodeTailBlockSize(tbData) + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
1906 | leftSize += tailBlockSize + KEYBLOCK_LENGTH; |
1907 | |
1908 | p += KEYBLOCK_LENGTH; |
1909 | @@ -2011,8 +2014,8 @@ |
1910 | } else { |
1911 | kbData = getInt(p); |
1912 | tbData = getInt(decodeKeyBlockTail(kbData)); |
1913 | - int ebc = decodeKeyBlockEbc(kbData); |
1914 | - int tbSize = decodeTailBlockSize(tbData); |
1915 | + final int ebc = decodeKeyBlockEbc(kbData); |
1916 | + final int tbSize = decodeTailBlockSize(tbData); |
1917 | |
1918 | tbSizeDelta = ((tbSize + ebc + ~TAILBLOCK_MASK) & TAILBLOCK_MASK) |
1919 | - ((tbSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK); |
1920 | @@ -2022,7 +2025,7 @@ |
1921 | } |
1922 | |
1923 | if (p < rightKeyBlock) { |
1924 | - int rightSize = virtualSize - leftSize + tbSizeDelta; |
1925 | + final int rightSize = virtualSize - leftSize + tbSizeDelta; |
1926 | |
1927 | splitCandidate = policy.splitFit(this, p, foundAtPosition, exact, leftSize + KEYBLOCK_LENGTH |
1928 | + edgeTailBlockSize, rightSize, currentSize, virtualSize, _bufferSize - KEY_BLOCK_START, |
1929 | @@ -2048,11 +2051,11 @@ |
1930 | // |
1931 | // Now move the keys and records. |
1932 | // |
1933 | - byte[] indexKeyBytes = indexKey.getEncodedBytes(); |
1934 | - int splitAtPosition = splitAt & P_MASK; |
1935 | + final byte[] indexKeyBytes = indexKey.getEncodedBytes(); |
1936 | + final int splitAtPosition = splitAt & P_MASK; |
1937 | |
1938 | - boolean lastLeft = (splitAt & EXACT_MASK) != 0; |
1939 | - boolean firstRight = !lastLeft && splitAtPosition == foundAtPosition; |
1940 | + final boolean lastLeft = (splitAt & EXACT_MASK) != 0; |
1941 | + final boolean firstRight = !lastLeft && splitAtPosition == foundAtPosition; |
1942 | int indexKeyDepth = 0; |
1943 | // |
1944 | // First we need to compute the full key in the right sibling page. |
1945 | @@ -2074,18 +2077,18 @@ |
1946 | // |
1947 | if (!firstRight) { |
1948 | for (int p = scanStart; p <= splitAtPosition; p += KEYBLOCK_LENGTH) { |
1949 | - int kbData = getInt(p); |
1950 | - int ebc = decodeKeyBlockEbc(kbData); |
1951 | - int db = decodeKeyBlockDb(kbData); |
1952 | - int tail = decodeKeyBlockTail(kbData); |
1953 | + final int kbData = getInt(p); |
1954 | + final int ebc = decodeKeyBlockEbc(kbData); |
1955 | + final int db = decodeKeyBlockDb(kbData); |
1956 | + final int tail = decodeKeyBlockTail(kbData); |
1957 | if (ebc > indexKeyDepth) { |
1958 | throw new InvalidPageStructureException("ebc at " + p + " ebc=" + ebc + " > indexKeyDepth=" |
1959 | + indexKeyDepth); |
1960 | } |
1961 | indexKeyDepth = ebc; |
1962 | indexKeyBytes[indexKeyDepth++] = (byte) db; |
1963 | - int tbData = getInt(tail); |
1964 | - int klength = decodeTailBlockKLength(tbData); |
1965 | + final int tbData = getInt(tail); |
1966 | + final int klength = decodeTailBlockKLength(tbData); |
1967 | |
1968 | System.arraycopy(_bytes, tail + _tailHeaderSize, indexKeyBytes, indexKeyDepth, klength); |
1969 | indexKeyDepth += klength; |
1970 | @@ -2202,7 +2205,7 @@ |
1971 | if (isDataPage()) { |
1972 | currentSize = (tailBlockSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
1973 | |
1974 | - int newSize = (tailBlockSize - dataSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
1975 | + final int newSize = (tailBlockSize - dataSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
1976 | if (newSize != currentSize) { |
1977 | deallocTail(tail + newSize, currentSize - newSize); |
1978 | } |
1979 | @@ -2217,9 +2220,9 @@ |
1980 | // |
1981 | // Fix up the right edge key in the left page. |
1982 | // |
1983 | - int kbData = getInt(splitAtPosition); |
1984 | + final int kbData = getInt(splitAtPosition); |
1985 | int edgeTail = decodeKeyBlockTail(kbData); |
1986 | - int ebc = decodeKeyBlockEbc(kbData); |
1987 | + final int ebc = decodeKeyBlockEbc(kbData); |
1988 | depth = (foundAt & DEPTH_MASK) >>> DEPTH_SHIFT; |
1989 | |
1990 | if (firstRight && !exact) { |
1991 | @@ -2230,10 +2233,10 @@ |
1992 | if (fixupSuccessor) { |
1993 | depth = ebc; |
1994 | } |
1995 | - int db = indexKeyBytes[depth]; |
1996 | + final int db = indexKeyBytes[depth]; |
1997 | |
1998 | - int edgeKeyLength = indexKey.getEncodedSize() - depth - 1; |
1999 | - int edgeTailBlockSize = edgeKeyLength + _tailHeaderSize; |
2000 | + final int edgeKeyLength = indexKey.getEncodedSize() - depth - 1; |
2001 | + final int edgeTailBlockSize = edgeKeyLength + _tailHeaderSize; |
2002 | edgeTail = allocTail(edgeTailBlockSize); |
2003 | if (edgeTail == -1) { |
2004 | setKeyBlockEnd(splitAtPosition); |
2005 | @@ -2367,8 +2370,8 @@ |
2006 | * in the rare case where no rearrangement of the records is |
2007 | * possible. |
2008 | */ |
2009 | - final boolean join(Buffer buffer, int foundAt1, int foundAt2, Key indexKey, Key spareKey, JoinPolicy policy) |
2010 | - throws RebalanceException { |
2011 | + final boolean join(final Buffer buffer, int foundAt1, int foundAt2, final Key indexKey, final Key spareKey, |
2012 | + final JoinPolicy policy) throws RebalanceException { |
2013 | foundAt1 &= P_MASK; |
2014 | foundAt2 &= P_MASK; |
2015 | |
2016 | @@ -2401,17 +2404,17 @@ |
2017 | // |
2018 | buffer.keyAt(foundAt2, spareKey); |
2019 | |
2020 | - long measureLeft = joinMeasure(foundAt1, _keyBlockEnd); |
2021 | - long measureRight = buffer.joinMeasure(KEY_BLOCK_START, foundAt2); |
2022 | + final long measureLeft = joinMeasure(foundAt1, _keyBlockEnd); |
2023 | + final long measureRight = buffer.joinMeasure(KEY_BLOCK_START, foundAt2); |
2024 | kbData = buffer.getInt(foundAt2); |
2025 | - int oldEbc = decodeKeyBlockEbc(kbData); |
2026 | - int newEbc = Math.min(oldEbc, Math.min((int) (measureLeft >>> 32), (int) (measureRight >>> 32))); |
2027 | + final int oldEbc = decodeKeyBlockEbc(kbData); |
2028 | + final int newEbc = Math.min(oldEbc, Math.min((int) (measureLeft >>> 32), (int) (measureRight >>> 32))); |
2029 | tail = decodeKeyBlockTail(kbData); |
2030 | tbData = buffer.getInt(tail); |
2031 | |
2032 | - int oldSize = decodeTailBlockSize(tbData); |
2033 | - int newSize = oldSize + (oldEbc - newEbc); |
2034 | - int adjustmentForNewEbc = ((newSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK) |
2035 | + final int oldSize = decodeTailBlockSize(tbData); |
2036 | + final int newSize = oldSize + (oldEbc - newEbc); |
2037 | + final int adjustmentForNewEbc = ((newSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK) |
2038 | - ((oldSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK); |
2039 | |
2040 | /* |
2041 | @@ -2424,7 +2427,7 @@ |
2042 | final int virtualKeyCount = ((foundAt1 - KEY_BLOCK_START) + (buffer.getKeyBlockEnd() - foundAt2)) |
2043 | / KEYBLOCK_LENGTH; |
2044 | |
2045 | - boolean okayToRejoin = virtualKeyCount < _pool.getMaxKeys() && policy.acceptJoin(this, virtualSize); |
2046 | + final boolean okayToRejoin = virtualKeyCount < _pool.getMaxKeys() && policy.acceptJoin(this, virtualSize); |
2047 | |
2048 | boolean result; |
2049 | |
2050 | @@ -2473,7 +2476,7 @@ |
2051 | /* |
2052 | * unsplice the right buffer from the right sibling chain. |
2053 | */ |
2054 | - long rightSibling = buffer.getRightSibling(); |
2055 | + final long rightSibling = buffer.getRightSibling(); |
2056 | setRightSibling(rightSibling); |
2057 | if (hasMVV) { |
2058 | _mvvCount = Integer.MAX_VALUE; |
2059 | @@ -2520,7 +2523,7 @@ |
2060 | buffer.joinDeallocateTails(KEY_BLOCK_START, foundAt2); |
2061 | buffer.clearBytes(KEY_BLOCK_START, foundAt2); |
2062 | buffer.reduceEbc(foundAt2, newEbc, spareKeyBytes); |
2063 | - int rightSize = buffer._keyBlockEnd - joinOffset; |
2064 | + final int rightSize = buffer._keyBlockEnd - joinOffset; |
2065 | |
2066 | moveRecords(buffer, foundAt2, joinOffset, _keyBlockEnd, true); |
2067 | |
2068 | @@ -2540,7 +2543,7 @@ |
2069 | |
2070 | buffer.joinDeallocateTails(KEY_BLOCK_START, foundAt2); |
2071 | |
2072 | - int rightSize = buffer._keyBlockEnd - foundAt2; |
2073 | + final int rightSize = buffer._keyBlockEnd - foundAt2; |
2074 | System.arraycopy(buffer._bytes, foundAt2, buffer._bytes, KEY_BLOCK_START, rightSize); |
2075 | buffer.clearBytes(KEY_BLOCK_START + rightSize, buffer._keyBlockEnd); |
2076 | buffer.setKeyBlockEnd(KEY_BLOCK_START + rightSize); |
2077 | @@ -2629,18 +2632,18 @@ |
2078 | * @return long encoding the size being deleted and the minimum ebc |
2079 | * |
2080 | */ |
2081 | - long joinMeasure(int from, int to) { |
2082 | + long joinMeasure(final int from, final int to) { |
2083 | int minimumEbc = Integer.MAX_VALUE; |
2084 | int totalDeallocatedSize = 0; |
2085 | for (int index = from; index < to; index += KEYBLOCK_LENGTH) { |
2086 | - int kbData = getInt(index); |
2087 | - int ebc = decodeKeyBlockEbc(kbData); |
2088 | + final int kbData = getInt(index); |
2089 | + final int ebc = decodeKeyBlockEbc(kbData); |
2090 | if (index != KEY_BLOCK_START && ebc < minimumEbc) { |
2091 | minimumEbc = ebc; |
2092 | } |
2093 | - int tail = decodeKeyBlockTail(kbData); |
2094 | - int tbData = getInt(tail); |
2095 | - int size = decodeTailBlockSize(tbData); |
2096 | + final int tail = decodeKeyBlockTail(kbData); |
2097 | + final int tbData = getInt(tail); |
2098 | + final int size = decodeTailBlockSize(tbData); |
2099 | totalDeallocatedSize += ((size + ~TAILBLOCK_MASK) & TAILBLOCK_MASK) + KEYBLOCK_LENGTH; |
2100 | } |
2101 | return (((long) minimumEbc) << 32) | totalDeallocatedSize; |
2102 | @@ -2660,12 +2663,12 @@ |
2103 | * @param to |
2104 | * offset of the next key block not being deleted |
2105 | */ |
2106 | - void joinDeallocateTails(int from, int to) { |
2107 | + void joinDeallocateTails(final int from, final int to) { |
2108 | for (int index = from; index < to; index += KEYBLOCK_LENGTH) { |
2109 | - int kbData = getInt(index); |
2110 | - int tail = decodeKeyBlockTail(kbData); |
2111 | - int tbData = getInt(tail); |
2112 | - int size = (decodeTailBlockSize(tbData) + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
2113 | + final int kbData = getInt(index); |
2114 | + final int tail = decodeKeyBlockTail(kbData); |
2115 | + final int tbData = getInt(tail); |
2116 | + final int size = (decodeTailBlockSize(tbData) + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
2117 | deallocTail(tail, size); |
2118 | } |
2119 | } |
2120 | @@ -2739,23 +2742,24 @@ |
2121 | // |
2122 | for (int p = KEY_BLOCK_START; p < foundAt1; p += KEYBLOCK_LENGTH) { |
2123 | kbData = getInt(p); |
2124 | - int ebc = decodeKeyBlockEbc(kbData); |
2125 | + final int ebc = decodeKeyBlockEbc(kbData); |
2126 | tail = decodeKeyBlockTail(kbData); |
2127 | tbData = getInt(tail); |
2128 | - int size = decodeTailBlockSize(tbData); |
2129 | + final int size = decodeTailBlockSize(tbData); |
2130 | klength = decodeTailBlockKLength(tbData); |
2131 | |
2132 | - int delta = ((size + ebc + ~TAILBLOCK_MASK) & TAILBLOCK_MASK) - ((size + ~TAILBLOCK_MASK) & TAILBLOCK_MASK); |
2133 | - |
2134 | - int candidateRightSize = virtualSize - leftSize + delta; |
2135 | - |
2136 | - int candidateLeftSize = leftSize + KEYBLOCK_LENGTH + ((klength + ~TAILBLOCK_MASK) & TAILBLOCK_MASK) |
2137 | + final int delta = ((size + ebc + ~TAILBLOCK_MASK) & TAILBLOCK_MASK) |
2138 | + - ((size + ~TAILBLOCK_MASK) & TAILBLOCK_MASK); |
2139 | + |
2140 | + final int candidateRightSize = virtualSize - leftSize + delta; |
2141 | + |
2142 | + final int candidateLeftSize = leftSize + KEYBLOCK_LENGTH + ((klength + ~TAILBLOCK_MASK) & TAILBLOCK_MASK) |
2143 | + _tailHeaderSize; |
2144 | |
2145 | - int rightKeyCount = ((buffer.getKeyBlockEnd() - foundAt2) + (foundAt1 - p)) / KEYBLOCK_LENGTH; |
2146 | + final int rightKeyCount = ((buffer.getKeyBlockEnd() - foundAt2) + (foundAt1 - p)) / KEYBLOCK_LENGTH; |
2147 | |
2148 | - int joinFit = policy.rebalanceFit(this, buffer, p, foundAt1, foundAt2, virtualSize, candidateLeftSize, |
2149 | - candidateRightSize, _bufferSize - KEY_BLOCK_START); |
2150 | + final int joinFit = policy.rebalanceFit(this, buffer, p, foundAt1, foundAt2, virtualSize, |
2151 | + candidateLeftSize, candidateRightSize, _bufferSize - KEY_BLOCK_START); |
2152 | |
2153 | if (joinFit > joinBest && rightKeyCount < _pool.getMaxKeys()) { |
2154 | joinBest = joinFit; |
2155 | @@ -2770,10 +2774,10 @@ |
2156 | */ |
2157 | for (int p = foundAt2; p < buffer._keyBlockEnd; p += KEYBLOCK_LENGTH) { |
2158 | kbData = buffer.getInt(p); |
2159 | - int ebc = decodeKeyBlockEbc(kbData); |
2160 | + final int ebc = decodeKeyBlockEbc(kbData); |
2161 | tail = decodeKeyBlockTail(kbData); |
2162 | tbData = buffer.getInt(tail); |
2163 | - int size = decodeTailBlockSize(tbData); |
2164 | + final int size = decodeTailBlockSize(tbData); |
2165 | klength = decodeTailBlockKLength(tbData); |
2166 | |
2167 | /* |
2168 | @@ -2781,23 +2785,24 @@ |
2169 | * rebalance key would have to grow if it became the first key on |
2170 | * the right page and its ebc became zero. |
2171 | */ |
2172 | - int delta = ((size + ebc + ~TAILBLOCK_MASK) & TAILBLOCK_MASK) - ((size + ~TAILBLOCK_MASK) & TAILBLOCK_MASK); |
2173 | + final int delta = ((size + ebc + ~TAILBLOCK_MASK) & TAILBLOCK_MASK) |
2174 | + - ((size + ~TAILBLOCK_MASK) & TAILBLOCK_MASK); |
2175 | |
2176 | /* |
2177 | * Amount by which the current tail block needs to grow to |
2178 | * accommodate reduced ebc. |
2179 | */ |
2180 | - int adjustment = (p == foundAt2) ? adjustmentForNewEbc : 0; |
2181 | - |
2182 | - int candidateRightSize = virtualSize - leftSize + delta; |
2183 | - |
2184 | - int candidateLeftSize = leftSize + ((klength + ~TAILBLOCK_MASK) & TAILBLOCK_MASK) + adjustment |
2185 | + final int adjustment = (p == foundAt2) ? adjustmentForNewEbc : 0; |
2186 | + |
2187 | + final int candidateRightSize = virtualSize - leftSize + delta; |
2188 | + |
2189 | + final int candidateLeftSize = leftSize + ((klength + ~TAILBLOCK_MASK) & TAILBLOCK_MASK) + adjustment |
2190 | + _tailHeaderSize + KEYBLOCK_LENGTH; |
2191 | |
2192 | - int leftKeyCount = ((foundAt1 - KEY_BLOCK_START) + (p - foundAt2)) / KEYBLOCK_LENGTH; |
2193 | + final int leftKeyCount = ((foundAt1 - KEY_BLOCK_START) + (p - foundAt2)) / KEYBLOCK_LENGTH; |
2194 | |
2195 | - int joinFit = policy.rebalanceFit(this, buffer, p, foundAt1, foundAt2, virtualSize, candidateLeftSize, |
2196 | - candidateRightSize, _bufferSize - KEY_BLOCK_START); |
2197 | + final int joinFit = policy.rebalanceFit(this, buffer, p, foundAt1, foundAt2, virtualSize, |
2198 | + candidateLeftSize, candidateRightSize, _bufferSize - KEY_BLOCK_START); |
2199 | |
2200 | if (joinFit > joinBest && leftKeyCount < _pool.getMaxKeys()) { |
2201 | joinBest = joinFit; |
2202 | @@ -2821,12 +2826,12 @@ |
2203 | return _fastIndex; |
2204 | } |
2205 | |
2206 | - private void reduceEbc(int p, int newEbc, byte[] indexKeyBytes) { |
2207 | + private void reduceEbc(final int p, final int newEbc, final byte[] indexKeyBytes) { |
2208 | int kbData = getInt(p); |
2209 | - int oldDb = decodeKeyBlockDb(kbData); |
2210 | - int oldEbc = decodeKeyBlockEbc(kbData); |
2211 | + final int oldDb = decodeKeyBlockDb(kbData); |
2212 | + final int oldEbc = decodeKeyBlockEbc(kbData); |
2213 | int tail = decodeKeyBlockTail(kbData); |
2214 | - int tbData = getInt(tail); |
2215 | + final int tbData = getInt(tail); |
2216 | int size = decodeTailBlockSize(tbData); |
2217 | int klength = decodeTailBlockKLength(tbData); |
2218 | |
2219 | @@ -2836,7 +2841,7 @@ |
2220 | throw new IllegalArgumentException("newEbc=" + newEbc + " must be less than oldEbc=" + oldEbc); |
2221 | } |
2222 | |
2223 | - int delta = ((size + oldEbc - newEbc + ~TAILBLOCK_MASK) & TAILBLOCK_MASK) |
2224 | + final int delta = ((size + oldEbc - newEbc + ~TAILBLOCK_MASK) & TAILBLOCK_MASK) |
2225 | - ((size + ~TAILBLOCK_MASK) & TAILBLOCK_MASK); |
2226 | int newTail; |
2227 | boolean wedged = false; |
2228 | @@ -2881,7 +2886,7 @@ |
2229 | |
2230 | size += oldEbc - newEbc; |
2231 | klength += oldEbc - newEbc; |
2232 | - int newDb = indexKeyBytes[newEbc] & 0xFF; |
2233 | + final int newDb = indexKeyBytes[newEbc] & 0xFF; |
2234 | |
2235 | putInt(newTail, encodeTailBlock(size, klength)); |
2236 | |
2237 | @@ -2897,7 +2902,7 @@ |
2238 | * @param insertAt |
2239 | * @param includesRightEdge |
2240 | */ |
2241 | - void moveRecords(Buffer buffer, int p1, int p2, int insertAt, boolean includesRightEdge) { |
2242 | + void moveRecords(final Buffer buffer, final int p1, final int p2, int insertAt, final boolean includesRightEdge) { |
2243 | if (p2 - p1 + _keyBlockEnd > _alloc) { |
2244 | repack(); |
2245 | } |
2246 | @@ -2912,15 +2917,15 @@ |
2247 | setKeyBlockEnd(getKeyBlockEnd() + KEYBLOCK_LENGTH); |
2248 | |
2249 | for (int p = p1; p < p2 || includesRightEdge && p == p2; p += KEYBLOCK_LENGTH) { |
2250 | - int kbData = buffer.getInt(p); |
2251 | - int ebc = decodeKeyBlockEbc(kbData); |
2252 | - int db = decodeKeyBlockDb(kbData); |
2253 | - int tail = decodeKeyBlockTail(kbData); |
2254 | - int tbData = buffer.getInt(tail); |
2255 | - int size = decodeTailBlockSize(tbData); |
2256 | - int klength = decodeTailBlockKLength(tbData); |
2257 | + final int kbData = buffer.getInt(p); |
2258 | + final int ebc = decodeKeyBlockEbc(kbData); |
2259 | + final int db = decodeKeyBlockDb(kbData); |
2260 | + final int tail = decodeKeyBlockTail(kbData); |
2261 | + final int tbData = buffer.getInt(tail); |
2262 | + final int size = decodeTailBlockSize(tbData); |
2263 | + final int klength = decodeTailBlockKLength(tbData); |
2264 | int newSize = size; |
2265 | - boolean edgeCase = includesRightEdge && p == p2; |
2266 | + final boolean edgeCase = includesRightEdge && p == p2; |
2267 | if (edgeCase) { |
2268 | // this is just for the right edge key of the left page |
2269 | newSize = _tailHeaderSize + klength; |
2270 | @@ -2972,7 +2977,7 @@ |
2271 | */ |
2272 | private int allocTail(int size) { |
2273 | size = (size + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
2274 | - int alloc = _alloc - size; |
2275 | + final int alloc = _alloc - size; |
2276 | if (alloc >= _keyBlockEnd) { |
2277 | _alloc = alloc; |
2278 | return alloc; |
2279 | @@ -2981,7 +2986,7 @@ |
2280 | } |
2281 | } |
2282 | |
2283 | - private void deallocTail(int tail, int size) { |
2284 | + private void deallocTail(final int tail, int size) { |
2285 | size = (size + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
2286 | |
2287 | Debug.$assert0.t((size > 0 && size <= _bufferSize - _alloc) && (tail >= _alloc && tail < _bufferSize) |
2288 | @@ -2993,9 +2998,9 @@ |
2289 | // any free space above this block. |
2290 | // |
2291 | while (tail + size < _bufferSize) { |
2292 | - int kbNext = getInt(tail + size); |
2293 | + final int kbNext = getInt(tail + size); |
2294 | if ((kbNext & TAILBLOCK_INUSE_MASK) == 0) { |
2295 | - int sizeNext = decodeTailBlockSize(kbNext); |
2296 | + final int sizeNext = decodeTailBlockSize(kbNext); |
2297 | Debug.$assert0.t((sizeNext & ~TAILBLOCK_MASK) == 0 && sizeNext != 0); |
2298 | _slack -= sizeNext; |
2299 | putInt(tail + size, 0); |
2300 | @@ -3018,7 +3023,7 @@ |
2301 | private void repack() { |
2302 | Debug.$assert0.t(isMine()); |
2303 | |
2304 | - int[] plan = getRepackPlanBuffer(); |
2305 | + final int[] plan = getRepackPlanBuffer(); |
2306 | // |
2307 | // Phase 1: |
2308 | // For each allocated tail block, post the offset of its |
2309 | @@ -3028,9 +3033,9 @@ |
2310 | int free = 0; |
2311 | int back = 0; |
2312 | for (int tail = _alloc; tail < _bufferSize;) { |
2313 | - int tbData = getInt(tail); |
2314 | + final int tbData = getInt(tail); |
2315 | |
2316 | - int size = (decodeTailBlockSize(tbData) + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
2317 | + final int size = (decodeTailBlockSize(tbData) + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
2318 | if (size <= 0) { |
2319 | _persistit.fatal("Buffer has invalid tailblock length " + size + " at " + tail + " in " + this, null); |
2320 | } |
2321 | @@ -3058,9 +3063,9 @@ |
2322 | if (free > 0) |
2323 | moveSize += alloc - tail - free; |
2324 | alloc = tail + free; |
2325 | - int planData = plan[tail / TAILBLOCK_FACTOR]; |
2326 | + final int planData = plan[tail / TAILBLOCK_FACTOR]; |
2327 | plan[tail / TAILBLOCK_FACTOR] = free + tail; |
2328 | - int deltaFree = planData & 0xFFFF; |
2329 | + final int deltaFree = planData & 0xFFFF; |
2330 | if (deltaFree > 0 && moveSize > 0 && free > 0) { |
2331 | System.arraycopy(_bytes, moveFrom, _bytes, moveFrom + free, moveSize); |
2332 | moveSize = 0; |
2333 | @@ -3080,14 +3085,14 @@ |
2334 | // |
2335 | if (free > 0) { |
2336 | for (int p = KEY_BLOCK_START; p < _keyBlockEnd; p += KEYBLOCK_LENGTH) { |
2337 | - int kbData = getInt(p); |
2338 | + final int kbData = getInt(p); |
2339 | // |
2340 | // For certain remove operations, we may have invalid keyblocks |
2341 | // in range. We can safely ignore them here. |
2342 | // |
2343 | if (kbData != 0) { |
2344 | - int tail = decodeKeyBlockTail(kbData); |
2345 | - int newTail = plan[tail / KEYBLOCK_LENGTH]; |
2346 | + final int tail = decodeKeyBlockTail(kbData); |
2347 | + final int newTail = plan[tail / KEYBLOCK_LENGTH]; |
2348 | |
2349 | if (newTail != tail) { |
2350 | putInt(p, encodeKeyBlockTail(kbData, newTail)); |
2351 | @@ -3105,7 +3110,7 @@ |
2352 | * The size required by the proposed new tailblock. |
2353 | * @return boolean <i>true</i> if it will fit, else <i>false</i>. |
2354 | */ |
2355 | - private boolean willFit(int needed) { |
2356 | + private boolean willFit(final int needed) { |
2357 | return needed <= (_alloc - _keyBlockEnd + _slack); |
2358 | } |
2359 | |
2360 | @@ -3116,8 +3121,8 @@ |
2361 | * @param foundAt |
2362 | * The keyblock index |
2363 | */ |
2364 | - boolean isAfterRightEdge(int foundAt) { |
2365 | - int p = foundAt & P_MASK; |
2366 | + boolean isAfterRightEdge(final int foundAt) { |
2367 | + final int p = foundAt & P_MASK; |
2368 | return (p >= _keyBlockEnd) || ((p == _keyBlockEnd - KEYBLOCK_LENGTH && (foundAt & EXACT_MASK) != 0)); |
2369 | } |
2370 | |
2371 | @@ -3127,7 +3132,7 @@ |
2372 | * |
2373 | * @param foundAt |
2374 | */ |
2375 | - boolean isBeforeLeftEdge(int foundAt) { |
2376 | + boolean isBeforeLeftEdge(final int foundAt) { |
2377 | return (((foundAt & EXACT_MASK) == 0 && (foundAt & P_MASK) <= KEY_BLOCK_START) || (foundAt & P_MASK) < KEY_BLOCK_START); |
2378 | } |
2379 | |
2380 | @@ -3136,11 +3141,11 @@ |
2381 | return _bytes; |
2382 | } |
2383 | |
2384 | - int getByte(int index) { |
2385 | + int getByte(final int index) { |
2386 | return (_bytes[index] & 0xFF); |
2387 | } |
2388 | |
2389 | - int getChar(int index) { |
2390 | + int getChar(final int index) { |
2391 | if (Persistit.BIG_ENDIAN) { |
2392 | return (_bytes[index + 1] & 0xFF) | (_bytes[index] & 0xFF) << 8; |
2393 | } else { |
2394 | @@ -3148,7 +3153,7 @@ |
2395 | } |
2396 | } |
2397 | |
2398 | - int getInt(int index) { |
2399 | + int getInt(final int index) { |
2400 | if (Persistit.BIG_ENDIAN) { |
2401 | return (_bytes[index + 3] & 0xFF) | (_bytes[index + 2] & 0xFF) << 8 | (_bytes[index + 1] & 0xFF) << 16 |
2402 | | (_bytes[index] & 0xFF) << 24; |
2403 | @@ -3158,21 +3163,21 @@ |
2404 | } |
2405 | } |
2406 | |
2407 | - long getLong(int index) { |
2408 | + long getLong(final int index) { |
2409 | if (Persistit.BIG_ENDIAN) { |
2410 | - return (long) (_bytes[index + 7] & 0xFF) | (long) (_bytes[index + 6] & 0xFF) << 8 |
2411 | + return _bytes[index + 7] & 0xFF | (long) (_bytes[index + 6] & 0xFF) << 8 |
2412 | | (long) (_bytes[index + 5] & 0xFF) << 16 | (long) (_bytes[index + 4] & 0xFF) << 24 |
2413 | | (long) (_bytes[index + 3] & 0xFF) << 32 | (long) (_bytes[index + 2] & 0xFF) << 40 |
2414 | | (long) (_bytes[index + 1] & 0xFF) << 48 | (long) (_bytes[index] & 0xFF) << 56; |
2415 | } else { |
2416 | - return (long) (_bytes[index] & 0xFF) | (long) (_bytes[index + 1] & 0xFF) << 8 |
2417 | + return _bytes[index] & 0xFF | (long) (_bytes[index + 1] & 0xFF) << 8 |
2418 | | (long) (_bytes[index + 2] & 0xFF) << 16 | (long) (_bytes[index + 3] & 0xFF) << 24 |
2419 | | (long) (_bytes[index + 4] & 0xFF) << 32 | (long) (_bytes[index + 5] & 0xFF) << 40 |
2420 | | (long) (_bytes[index + 6] & 0xFF) << 48 | (long) (_bytes[index + 7] & 0xFF) << 56; |
2421 | } |
2422 | } |
2423 | |
2424 | - int getDb(int index) { |
2425 | + int getDb(final int index) { |
2426 | if (Persistit.BIG_ENDIAN) { |
2427 | return _bytes[index + 3] & 0xFF; |
2428 | } else { |
2429 | @@ -3180,12 +3185,12 @@ |
2430 | } |
2431 | } |
2432 | |
2433 | - void putByte(int index, int value) { |
2434 | + void putByte(final int index, final int value) { |
2435 | Debug.$assert0.t(index >= 0 && index + 1 <= _bytes.length); |
2436 | _bytes[index] = (byte) (value); |
2437 | } |
2438 | |
2439 | - void putChar(int index, int value) { |
2440 | + void putChar(final int index, final int value) { |
2441 | Debug.$assert0.t(index >= 0 && index + 2 <= _bytes.length); |
2442 | if (Persistit.BIG_ENDIAN) { |
2443 | _bytes[index + 1] = (byte) (value); |
2444 | @@ -3196,7 +3201,7 @@ |
2445 | } |
2446 | } |
2447 | |
2448 | - void putInt(int index, int value) { |
2449 | + void putInt(final int index, final int value) { |
2450 | Debug.$assert0.t(index >= 0 && index + 4 <= _bytes.length); |
2451 | if (Persistit.BIG_ENDIAN) { |
2452 | _bytes[index + 3] = (byte) (value); |
2453 | @@ -3211,7 +3216,7 @@ |
2454 | } |
2455 | } |
2456 | |
2457 | - void putLong(int index, long value) { |
2458 | + void putLong(final int index, final long value) { |
2459 | Debug.$assert0.t(index >= 0 && index + 8 <= _bytes.length); |
2460 | |
2461 | if (Persistit.BIG_ENDIAN) { |
2462 | @@ -3235,7 +3240,7 @@ |
2463 | } |
2464 | } |
2465 | |
2466 | - static void writeLongRecordDescriptor(byte[] bytes, int size, long pageAddr) { |
2467 | + static void writeLongRecordDescriptor(final byte[] bytes, final int size, final long pageAddr) { |
2468 | if (bytes.length != LONGREC_SIZE) { |
2469 | throw new IllegalArgumentException("Bad LONG_RECORD descriptor size: " + size); |
2470 | } |
2471 | @@ -3246,7 +3251,7 @@ |
2472 | Util.putLong(bytes, LONGREC_PAGE_OFFSET, pageAddr); |
2473 | } |
2474 | |
2475 | - static int decodeLongRecordDescriptorSize(byte[] bytes, int offset) { |
2476 | + static int decodeLongRecordDescriptorSize(final byte[] bytes, final int offset) { |
2477 | int type; |
2478 | if ((type = (bytes[offset] & 0xFF)) != LONGREC_TYPE) { |
2479 | throw new IllegalArgumentException("Bad LONG_RECORD descriptor type: " + type); |
2480 | @@ -3254,7 +3259,7 @@ |
2481 | return (int) Util.getLong(bytes, offset + LONGREC_SIZE_OFFSET); |
2482 | } |
2483 | |
2484 | - static long decodeLongRecordDescriptorPointer(byte[] bytes, int offset) { |
2485 | + static long decodeLongRecordDescriptorPointer(final byte[] bytes, final int offset) { |
2486 | int type; |
2487 | if ((type = (bytes[offset] & 0xFF)) != LONGREC_TYPE) { |
2488 | throw new IllegalArgumentException("Bad LONG_RECORD descriptor type: " + type); |
2489 | @@ -3263,7 +3268,7 @@ |
2490 | } |
2491 | |
2492 | static int bufferSizeWithOverhead(final int bufferSize) { |
2493 | - int fastIndexSize = ((bufferSize - HEADER_SIZE) / MAX_KEY_RATIO) * FastIndex.BYTES_PER_ENTRY; |
2494 | + final int fastIndexSize = ((bufferSize - HEADER_SIZE) / MAX_KEY_RATIO) * FastIndex.BYTES_PER_ENTRY; |
2495 | return bufferSize + fastIndexSize + ESTIMATED_FIXED_BUFFER_OVERHEAD; |
2496 | } |
2497 | |
2498 | @@ -3314,16 +3319,16 @@ |
2499 | return (size + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
2500 | } |
2501 | |
2502 | - static int encodeKeyBlock(int ebc, int db, int tail) { |
2503 | + static int encodeKeyBlock(final int ebc, final int db, final int tail) { |
2504 | return ((ebc << EBC_SHIFT) & EBC_MASK) | ((db /* << DB_SHIFT */) & DB_MASK) |
2505 | | ((tail << TAIL_SHIFT) & TAIL_MASK); |
2506 | } |
2507 | |
2508 | - static int encodeKeyBlockTail(int kbData, int tail) { |
2509 | + static int encodeKeyBlockTail(final int kbData, final int tail) { |
2510 | return (kbData & ~TAIL_MASK) | ((tail << TAIL_SHIFT) & TAIL_MASK); |
2511 | } |
2512 | |
2513 | - static int encodeTailBlock(int size, int klength) { |
2514 | + static int encodeTailBlock(final int size, final int klength) { |
2515 | return ((klength << TAILBLOCK_KLENGTH_SHIFT) & TAILBLOCK_KLENGTH_MASK) | ((size /* |
2516 | * << |
2517 | * TAILBLOCK_SIZE_SHIFT |
2518 | @@ -3331,35 +3336,35 @@ |
2519 | | TAILBLOCK_INUSE_MASK; |
2520 | } |
2521 | |
2522 | - static int encodeFreeBlock(int size) { |
2523 | + static int encodeFreeBlock(final int size) { |
2524 | return ((size /* << TAILBLOCK_SIZE_SHIFT */) & TAILBLOCK_SIZE_MASK); |
2525 | } |
2526 | |
2527 | - static int decodeKeyBlockEbc(int kbData) { |
2528 | + static int decodeKeyBlockEbc(final int kbData) { |
2529 | return (kbData & EBC_MASK) >>> EBC_SHIFT; |
2530 | } |
2531 | |
2532 | - static int decodeKeyBlockDb(int kbData) { |
2533 | + static int decodeKeyBlockDb(final int kbData) { |
2534 | return (kbData & DB_MASK) /* >>> DB_SHIFT */; |
2535 | } |
2536 | |
2537 | - static int decodeKeyBlockTail(int kbData) { |
2538 | + static int decodeKeyBlockTail(final int kbData) { |
2539 | return (kbData & TAIL_MASK) >>> TAIL_SHIFT; |
2540 | } |
2541 | |
2542 | - static int decodeTailBlockSize(int tbData) { |
2543 | + static int decodeTailBlockSize(final int tbData) { |
2544 | return (tbData & TAILBLOCK_SIZE_MASK) /* >>> TAILBLOCK_SIZE_SHIFT */; |
2545 | } |
2546 | |
2547 | - static int decodeTailBlockKLength(int tbData) { |
2548 | + static int decodeTailBlockKLength(final int tbData) { |
2549 | return (tbData & TAILBLOCK_KLENGTH_MASK) >>> TAILBLOCK_KLENGTH_SHIFT; |
2550 | } |
2551 | |
2552 | - static boolean decodeTailBlockInUse(int tbData) { |
2553 | + static boolean decodeTailBlockInUse(final int tbData) { |
2554 | return (tbData & TAILBLOCK_INUSE_MASK) != 0; |
2555 | } |
2556 | |
2557 | - static int decodeDepth(int foundAt) { |
2558 | + static int decodeDepth(final int foundAt) { |
2559 | return (foundAt & DEPTH_MASK) >>> DEPTH_SHIFT; |
2560 | } |
2561 | |
2562 | @@ -3367,7 +3372,7 @@ |
2563 | return _persistit.getThreadLocalIntArray(MAX_BUFFER_SIZE / TAILBLOCK_FACTOR); |
2564 | } |
2565 | |
2566 | - PersistitException verify(Key key, VerifyVisitor visitor) { |
2567 | + PersistitException verify(Key key, final VerifyVisitor visitor) { |
2568 | try { |
2569 | if (_page == 0) { |
2570 | return new InvalidPageStructureException("head page is neither a data page nor an index page"); |
2571 | @@ -3380,8 +3385,8 @@ |
2572 | key = new Key(_persistit); |
2573 | } |
2574 | |
2575 | - byte[] kb = key.getEncodedBytes(); |
2576 | - int[] plan = getRepackPlanBuffer(); |
2577 | + final byte[] kb = key.getEncodedBytes(); |
2578 | + final int[] plan = getRepackPlanBuffer(); |
2579 | for (int index = 0; index < plan.length; index++) { |
2580 | plan[index] = 0; |
2581 | } |
2582 | @@ -3392,10 +3397,10 @@ |
2583 | } |
2584 | |
2585 | for (int p = KEY_BLOCK_START; p < _keyBlockEnd; p += KEYBLOCK_LENGTH) { |
2586 | - int kbData = getInt(p); |
2587 | - int db = decodeKeyBlockDb(kbData); |
2588 | - int ebc = decodeKeyBlockEbc(kbData); |
2589 | - int tail = decodeKeyBlockTail(kbData); |
2590 | + final int kbData = getInt(p); |
2591 | + final int db = decodeKeyBlockDb(kbData); |
2592 | + final int ebc = decodeKeyBlockEbc(kbData); |
2593 | + final int tail = decodeKeyBlockTail(kbData); |
2594 | |
2595 | if (p == KEY_BLOCK_START && ebc != 0) { |
2596 | return new InvalidPageStructureException("invalid initial ebc " + ebc + " for keyblock at " + p |
2597 | @@ -3407,8 +3412,8 @@ |
2598 | return new InvalidPageStructureException("invalid tail block offset " + tail + " for keyblock at " |
2599 | + p + " --[" + summarize() + "]"); |
2600 | } |
2601 | - int tbData = getInt(tail); |
2602 | - int klength = decodeTailBlockKLength(tbData); |
2603 | + final int tbData = getInt(tail); |
2604 | + final int klength = decodeTailBlockKLength(tbData); |
2605 | if ((tbData & TAILBLOCK_INUSE_MASK) == 0) { |
2606 | return new InvalidPageStructureException("not in-use tail block offset " + tail |
2607 | + " for keyblock at " + p + " --[" + summarize() + "]"); |
2608 | @@ -3426,14 +3431,14 @@ |
2609 | compare = (kb[index] & 0xFF) - (_bytes[tail + _tailHeaderSize + index - 1] & 0xFF); |
2610 | } |
2611 | if (compare != 0) { |
2612 | - String s = compare < 0 ? "too big" : "too small"; |
2613 | + final String s = compare < 0 ? "too big" : "too small"; |
2614 | return new InvalidPageStructureException("initial key " + s + " at offset " + index |
2615 | + " for keyblock at " + p + " --[" + summarize() + "]"); |
2616 | } |
2617 | } |
2618 | // Verify that successor keys follow in sequence. |
2619 | if (p > KEY_BLOCK_START && ebc < key.getEncodedSize()) { |
2620 | - int dbPrev = kb[ebc] & 0xFF; |
2621 | + final int dbPrev = kb[ebc] & 0xFF; |
2622 | if (db < dbPrev) { |
2623 | return new InvalidPageStructureException("db not greater: db=" + db + " dbPrev=" + dbPrev |
2624 | + " for keyblock at " + p + " --[" + summarize() + "]"); |
2625 | @@ -3444,7 +3449,7 @@ |
2626 | // redundant |
2627 | // |
2628 | if (isIndexPage()) { |
2629 | - int pointer = getInt(tail + 4); |
2630 | + final int pointer = getInt(tail + 4); |
2631 | if (visitor != null) { |
2632 | visitor.visitIndexRecord(key, p, tail, klength, pointer); |
2633 | } |
2634 | @@ -3455,9 +3460,9 @@ |
2635 | } |
2636 | } |
2637 | } else if (isDataPage()) { |
2638 | - int size = decodeTailBlockSize(tbData); |
2639 | - int offset = tail + _tailHeaderSize + klength; |
2640 | - int length = size - klength - _tailHeaderSize; |
2641 | + final int size = decodeTailBlockSize(tbData); |
2642 | + final int offset = tail + _tailHeaderSize + klength; |
2643 | + final int length = size - klength - _tailHeaderSize; |
2644 | if (visitor != null) { |
2645 | visitor.visitDataRecord(key, p, tail, klength, offset, length, getBytes()); |
2646 | } |
2647 | @@ -3477,13 +3482,13 @@ |
2648 | |
2649 | // Now check the free blocks |
2650 | |
2651 | - int formerBlock = _alloc; |
2652 | + final int formerBlock = _alloc; |
2653 | for (int tail = _alloc; tail < _bufferSize;) { |
2654 | if ((tail & ~TAILBLOCK_MASK) != 0 || tail < 0 || tail > _bufferSize) { |
2655 | return new InvalidPageStructureException("Tail block at " + formerBlock + " is invalid"); |
2656 | } |
2657 | - int tbData = getInt(tail); |
2658 | - int size = decodeTailBlockSize(tbData); |
2659 | + final int tbData = getInt(tail); |
2660 | + final int size = decodeTailBlockSize(tbData); |
2661 | if (size <= ~TAILBLOCK_MASK || size >= _bufferSize - _keyBlockEnd) { |
2662 | return new InvalidPageStructureException("Tailblock at " + tail + " has invalid size=" + size); |
2663 | } |
2664 | @@ -3492,7 +3497,7 @@ |
2665 | return new InvalidPageStructureException("Tailblock at " + tail + " is in use, but no key " |
2666 | + " block points to it."); |
2667 | } |
2668 | - int klength = decodeTailBlockKLength(tbData); |
2669 | + final int klength = decodeTailBlockKLength(tbData); |
2670 | { |
2671 | if (klength + _tailHeaderSize > size) { |
2672 | return new InvalidPageStructureException("Tailblock at " + tail + " has klength=" + klength |
2673 | @@ -3508,7 +3513,7 @@ |
2674 | tail += ((size + ~TAILBLOCK_MASK) & TAILBLOCK_MASK); |
2675 | } |
2676 | return null; |
2677 | - } catch (PersistitException pe) { |
2678 | + } catch (final PersistitException pe) { |
2679 | return pe; |
2680 | } |
2681 | |
2682 | @@ -3528,7 +3533,7 @@ |
2683 | * @return |
2684 | * @throws PersistitException |
2685 | */ |
2686 | - boolean pruneMvvValues(final Tree tree, boolean pruneLongMVVs) throws PersistitException { |
2687 | + boolean pruneMvvValues(final Tree tree, final boolean pruneLongMVVs) throws PersistitException { |
2688 | |
2689 | boolean changed = false; |
2690 | try { |
2691 | @@ -3541,7 +3546,7 @@ |
2692 | final long timestamp = _persistit.getTimestampAllocator().updateTimestamp(); |
2693 | _mvvCount = 0; |
2694 | writePageOnCheckpoint(timestamp); |
2695 | - List<PrunedVersion> prunedVersions = new ArrayList<PrunedVersion>(); |
2696 | + final List<PrunedVersion> prunedVersions = new ArrayList<PrunedVersion>(); |
2697 | for (int p = KEY_BLOCK_START; p < _keyBlockEnd; p += KEYBLOCK_LENGTH) { |
2698 | final int kbData = getInt(p); |
2699 | final int tail = decodeKeyBlockTail(kbData); |
2700 | @@ -3567,9 +3572,9 @@ |
2701 | true, prunedVersions); |
2702 | if (newSize != oldSize) { |
2703 | changed = true; |
2704 | - int newTailSize = klength + newSize + _tailHeaderSize; |
2705 | - int oldNext = (tail + oldTailSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
2706 | - int newNext = (tail + newTailSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
2707 | + final int newTailSize = klength + newSize + _tailHeaderSize; |
2708 | + final int oldNext = (tail + oldTailSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
2709 | + final int newNext = (tail + newTailSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
2710 | if (newNext < oldNext) { |
2711 | // Free the remainder of the old tail block |
2712 | deallocTail(newNext, oldNext - newNext); |
2713 | @@ -3600,11 +3605,11 @@ |
2714 | prunedVersions.clear(); |
2715 | |
2716 | if (pruneLongMVVs && hasLongMvvRecords) { |
2717 | - List<PersistitException> deferredExceptions = new ArrayList<PersistitException>(); |
2718 | - List<Long> oldChainsToDeallocate = new ArrayList<Long>(); |
2719 | + final List<PersistitException> deferredExceptions = new ArrayList<PersistitException>(); |
2720 | + final List<Long> oldChainsToDeallocate = new ArrayList<Long>(); |
2721 | |
2722 | - Buffer copy = new Buffer(this); |
2723 | - boolean copyChanged = copy.pruneLongMvvValues(tree, prunedVersions, deferredExceptions, |
2724 | + final Buffer copy = new Buffer(this); |
2725 | + final boolean copyChanged = copy.pruneLongMvvValues(tree, prunedVersions, deferredExceptions, |
2726 | oldChainsToDeallocate); |
2727 | if (copyChanged) { |
2728 | changed = true; |
2729 | @@ -3666,17 +3671,17 @@ |
2730 | boolean pruned = false; |
2731 | try { |
2732 | pruned = pruneLongMvv(_bytes, offset, oldSize, value, prunedVersions, toDeallocate); |
2733 | - } catch (PersistitException pe) { |
2734 | + } catch (final PersistitException pe) { |
2735 | deferredExceptions.add(pe); |
2736 | } |
2737 | if (pruned) { |
2738 | changed = true; |
2739 | - int newSize = value.getEncodedSize(); |
2740 | + final int newSize = value.getEncodedSize(); |
2741 | assert newSize <= oldSize : "Pruned long value overflow"; |
2742 | System.arraycopy(value.getEncodedBytes(), 0, _bytes, offset, newSize); |
2743 | - int newTailSize = klength + newSize + _tailHeaderSize; |
2744 | - int oldNext = (tail + oldTailSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
2745 | - int newNext = (tail + newTailSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
2746 | + final int newTailSize = klength + newSize + _tailHeaderSize; |
2747 | + final int oldNext = (tail + oldTailSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
2748 | + final int newNext = (tail + newTailSize + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
2749 | if (newNext < oldNext) { |
2750 | // Free the remainder of the old tail block |
2751 | deallocTail(newNext, oldNext - newNext); |
2752 | @@ -3709,8 +3714,7 @@ |
2753 | if (!_enqueuedForAntiValuePruning) { |
2754 | final int treeHandle = tree.getHandle(); |
2755 | assert treeHandle != 0 : "MVV found in a temporary tree " + tree; |
2756 | - if (_persistit.getCleanupManager().offer( |
2757 | - new CleanupAntiValue(treeHandle, getPageAddress()))) { |
2758 | + if (_persistit.getCleanupManager().offer(new CleanupAntiValue(treeHandle, getPageAddress()))) { |
2759 | _enqueuedForAntiValuePruning = true; |
2760 | } |
2761 | } |
2762 | @@ -3731,19 +3735,19 @@ |
2763 | private boolean pruneLongMvv(final byte[] bytes, final int offset, final int oldSize, final Value value, |
2764 | final List<PrunedVersion> prunedVersions, final List<Long> toDeallocate) throws PersistitException { |
2765 | assert isLongMVV(bytes, offset, oldSize) : "Not a long MVV"; |
2766 | - long oldLongRecordChain = decodeLongRecordDescriptorPointer(bytes, offset); |
2767 | + final long oldLongRecordChain = decodeLongRecordDescriptorPointer(bytes, offset); |
2768 | value.changeLongRecordMode(false); |
2769 | value.ensureFit(oldSize); |
2770 | System.arraycopy(bytes, offset, value.getEncodedBytes(), 0, oldSize); |
2771 | value.setEncodedSize(oldSize); |
2772 | final LongRecordHelper helper = new LongRecordHelper(_persistit, _vol); |
2773 | helper.fetchLongRecord(value, Integer.MAX_VALUE); |
2774 | - byte[] rawBytes = value.getEncodedBytes(); |
2775 | - int oldLongSize = value.getEncodedSize(); |
2776 | + final byte[] rawBytes = value.getEncodedBytes(); |
2777 | + final int oldLongSize = value.getEncodedSize(); |
2778 | // TODO - perhaps remove. Done as a precaution for now. |
2779 | MVV.verify(rawBytes, 0, oldLongSize); |
2780 | - List<PrunedVersion> provisionalPrunedVersions = new ArrayList<PrunedVersion>(); |
2781 | - int newLongSize = MVV.prune(rawBytes, 0, oldLongSize, _persistit.getTransactionIndex(), true, |
2782 | + final List<PrunedVersion> provisionalPrunedVersions = new ArrayList<PrunedVersion>(); |
2783 | + final int newLongSize = MVV.prune(rawBytes, 0, oldLongSize, _persistit.getTransactionIndex(), true, |
2784 | provisionalPrunedVersions); |
2785 | if (newLongSize == oldLongSize) { |
2786 | // No pruning done. |
2787 | @@ -3771,6 +3775,7 @@ |
2788 | getTimestamp(), getGeneration()); |
2789 | } |
2790 | |
2791 | + @Override |
2792 | public String toString() { |
2793 | if (_toStringDebug) { |
2794 | return toStringDetail(); |
2795 | @@ -3818,7 +3823,7 @@ |
2796 | } |
2797 | boolean elision = false; |
2798 | for (int index = 0; index < records.length; index++) { |
2799 | - RecordInfo r = records[index]; |
2800 | + final RecordInfo r = records[index]; |
2801 | r.getKeyState().copyTo(key); |
2802 | String mark = " "; |
2803 | boolean selected = all | index < contextLines || index >= records.length - contextLines; |
2804 | @@ -3843,16 +3848,16 @@ |
2805 | r.getValueState().getEncodedBytes().length, Util.abridge(value.toString(), |
2806 | maxValueDisplayLength))); |
2807 | } else { |
2808 | - sb.append(String.format("\n%s %5d: db=%3d ebc=%3d tb=%,5d [%,d]%s->%,d", mark, r |
2809 | - .getKbOffset(), r.getDb(), r.getEbc(), r.getTbOffset(), r.getKLength(), Util |
2810 | - .abridge(key.toString(), maxKeyDisplayLength), r.getPointerValue())); |
2811 | + sb.append(String.format("\n%s %5d: db=%3d ebc=%3d tb=%,5d [%,d]%s->%,d", mark, |
2812 | + r.getKbOffset(), r.getDb(), r.getEbc(), r.getTbOffset(), r.getKLength(), |
2813 | + Util.abridge(key.toString(), maxKeyDisplayLength), r.getPointerValue())); |
2814 | } |
2815 | } else { |
2816 | elision = true; |
2817 | } |
2818 | |
2819 | } |
2820 | - } catch (Exception e) { |
2821 | + } catch (final Exception e) { |
2822 | sb.append(" - " + e); |
2823 | } |
2824 | } else if (isHeadPage()) { |
2825 | @@ -3876,7 +3881,7 @@ |
2826 | } |
2827 | |
2828 | String foundAtString(int p) { |
2829 | - StringBuilder sb = new StringBuilder("<"); |
2830 | + final StringBuilder sb = new StringBuilder("<"); |
2831 | sb.append(p & P_MASK); |
2832 | if ((p & EXACT_MASK) != 0) |
2833 | sb.append(":exact"); |
2834 | @@ -3892,7 +3897,7 @@ |
2835 | else if (p + KEYBLOCK_LENGTH == _keyBlockEnd) |
2836 | sb.append(":end"); |
2837 | else { |
2838 | - int kbData = getInt(p); |
2839 | + final int kbData = getInt(p); |
2840 | sb.append(":ebc=" + decodeKeyBlockEbc(kbData)); |
2841 | sb.append(":db=" + decodeKeyBlockDb(kbData)); |
2842 | sb.append(":tail=" + decodeKeyBlockTail(kbData)); |
2843 | @@ -3908,23 +3913,23 @@ |
2844 | ManagementImpl.RecordInfo[] result = null; |
2845 | |
2846 | if (isIndexPage() || isDataPage()) { |
2847 | - Key key = new Key(_persistit); |
2848 | - Value value = new Value(_persistit); |
2849 | + final Key key = new Key(_persistit); |
2850 | + final Value value = new Value(_persistit); |
2851 | |
2852 | - int count = (_keyBlockEnd - KEY_BLOCK_START) / KEYBLOCK_LENGTH; |
2853 | + final int count = (_keyBlockEnd - KEY_BLOCK_START) / KEYBLOCK_LENGTH; |
2854 | result = new ManagementImpl.RecordInfo[count]; |
2855 | int n = 0; |
2856 | for (int p = KEY_BLOCK_START; p < _keyBlockEnd; p += KEYBLOCK_LENGTH) { |
2857 | - int kbData = getInt(p); |
2858 | - int db = decodeKeyBlockDb(kbData); |
2859 | - int ebc = decodeKeyBlockEbc(kbData); |
2860 | - int tail = decodeKeyBlockTail(kbData); |
2861 | - int tbData = tail != 0 ? getInt(tail) : 0; |
2862 | - int size = decodeTailBlockSize(tbData); |
2863 | - int klength = decodeTailBlockKLength(tbData); |
2864 | - boolean inUse = decodeTailBlockInUse(tbData); |
2865 | + final int kbData = getInt(p); |
2866 | + final int db = decodeKeyBlockDb(kbData); |
2867 | + final int ebc = decodeKeyBlockEbc(kbData); |
2868 | + final int tail = decodeKeyBlockTail(kbData); |
2869 | + final int tbData = tail != 0 ? getInt(tail) : 0; |
2870 | + final int size = decodeTailBlockSize(tbData); |
2871 | + final int klength = decodeTailBlockKLength(tbData); |
2872 | + final boolean inUse = decodeTailBlockInUse(tbData); |
2873 | |
2874 | - ManagementImpl.RecordInfo rec = new ManagementImpl.RecordInfo(); |
2875 | + final ManagementImpl.RecordInfo rec = new ManagementImpl.RecordInfo(); |
2876 | rec._kbOffset = p; |
2877 | rec._tbOffset = tail; |
2878 | rec._ebc = ebc; |
2879 | @@ -3933,7 +3938,7 @@ |
2880 | rec._size = size; |
2881 | rec._inUse = inUse; |
2882 | |
2883 | - byte[] kbytes = key.getEncodedBytes(); |
2884 | + final byte[] kbytes = key.getEncodedBytes(); |
2885 | kbytes[ebc] = (byte) db; |
2886 | System.arraycopy(_bytes, tail + _tailHeaderSize, kbytes, ebc + 1, klength); |
2887 | key.setEncodedSize(ebc + 1 + klength); |
2888 | @@ -3956,11 +3961,11 @@ |
2889 | result[n++] = rec; |
2890 | } |
2891 | } else if (isGarbagePage()) { |
2892 | - int count = (_bufferSize - _alloc) / GARBAGE_BLOCK_SIZE; |
2893 | + final int count = (_bufferSize - _alloc) / GARBAGE_BLOCK_SIZE; |
2894 | result = new ManagementImpl.RecordInfo[count]; |
2895 | int n = 0; |
2896 | for (int p = _alloc; p < _bufferSize; p += GARBAGE_BLOCK_SIZE) { |
2897 | - ManagementImpl.RecordInfo rec = new ManagementImpl.RecordInfo(); |
2898 | + final ManagementImpl.RecordInfo rec = new ManagementImpl.RecordInfo(); |
2899 | rec._tbOffset = p; |
2900 | rec._garbageStatus = getInt(p + GARBAGE_BLOCK_STATUS); |
2901 | rec._garbageLeftPage = getLong(p + GARBAGE_BLOCK_LEFT_PAGE); |
2902 | @@ -3973,12 +3978,12 @@ |
2903 | |
2904 | void assertVerify() { |
2905 | if (Debug.VERIFY_PAGES) { |
2906 | - Exception verifyException = verify(null, null); |
2907 | + final Exception verifyException = verify(null, null); |
2908 | Debug.$assert1.t(verifyException == null); |
2909 | } |
2910 | } |
2911 | |
2912 | - boolean addGarbageChain(long left, long right, long expectedCount) { |
2913 | + boolean addGarbageChain(final long left, final long right, final long expectedCount) { |
2914 | Debug.$assert0.t(left > 0 && left <= MAX_VALID_PAGE_ADDR && left != _page && right != _page && isGarbagePage()); |
2915 | |
2916 | if (_alloc - GARBAGE_BLOCK_SIZE < _keyBlockEnd) { |
2917 | @@ -4006,7 +4011,7 @@ |
2918 | Debug.$assert0.t(isGarbagePage()); |
2919 | if (_alloc + GARBAGE_BLOCK_SIZE > _bufferSize) |
2920 | return -1; |
2921 | - long page = getLong(_alloc + GARBAGE_BLOCK_LEFT_PAGE); |
2922 | + final long page = getLong(_alloc + GARBAGE_BLOCK_LEFT_PAGE); |
2923 | Debug.$assert0.t(page > 0 && page <= MAX_VALID_PAGE_ADDR && page != _page); |
2924 | return page; |
2925 | } |
2926 | @@ -4019,13 +4024,13 @@ |
2927 | return getLong(_alloc + GARBAGE_BLOCK_RIGHT_PAGE); |
2928 | } |
2929 | |
2930 | - long getGarbageChainLeftPage(int p) { |
2931 | - long page = getLong(p + GARBAGE_BLOCK_LEFT_PAGE); |
2932 | + long getGarbageChainLeftPage(final int p) { |
2933 | + final long page = getLong(p + GARBAGE_BLOCK_LEFT_PAGE); |
2934 | Debug.$assert1.t(page > 0 && page <= MAX_VALID_PAGE_ADDR && page != _page); |
2935 | return page; |
2936 | } |
2937 | |
2938 | - long getGarbageChainRightPage(int p) { |
2939 | + long getGarbageChainRightPage(final int p) { |
2940 | return getLong(p + GARBAGE_BLOCK_RIGHT_PAGE); |
2941 | } |
2942 | |
2943 | @@ -4036,18 +4041,18 @@ |
2944 | bumpGeneration(); |
2945 | } |
2946 | |
2947 | - void setGarbageLeftPage(long left) { |
2948 | + void setGarbageLeftPage(final long left) { |
2949 | Debug.$assert1.t(isMine() && isGarbagePage() && left > 0 && left <= MAX_VALID_PAGE_ADDR && left != _page |
2950 | && _alloc + GARBAGE_BLOCK_SIZE <= _bufferSize && _alloc >= _keyBlockEnd); |
2951 | putLong(_alloc + GARBAGE_BLOCK_LEFT_PAGE, left); |
2952 | bumpGeneration(); |
2953 | } |
2954 | |
2955 | - void populateInfo(ManagementImpl.BufferInfo info) { |
2956 | + void populateInfo(final ManagementImpl.BufferInfo info) { |
2957 | info.poolIndex = _poolIndex; |
2958 | info.pageAddress = _page; |
2959 | info.rightSiblingAddress = _rightSibling; |
2960 | - Volume vol = _vol; |
2961 | + final Volume vol = _vol; |
2962 | if (vol != null) { |
2963 | info.volumeName = vol.getPath(); |
2964 | } else { |
2965 | @@ -4064,7 +4069,7 @@ |
2966 | info.timestamp = _timestamp; |
2967 | info.status = getStatus(); |
2968 | info.statusName = getStatusCode(); |
2969 | - Thread writerThread = getWriterThread(); |
2970 | + final Thread writerThread = getWriterThread(); |
2971 | if (writerThread != null) { |
2972 | info.writerThreadName = writerThread.getName(); |
2973 | } else { |
2974 | @@ -4075,10 +4080,10 @@ |
2975 | |
2976 | void enqueuePruningAction(final int treeHandle) { |
2977 | if (_mvvCount > 0) { |
2978 | - long delay = _persistit.getCleanupManager().getMinimumPruningDelay(); |
2979 | + final long delay = _persistit.getCleanupManager().getMinimumPruningDelay(); |
2980 | if (delay > 0) { |
2981 | - long last = _lastPrunedTime; |
2982 | - long now = System.currentTimeMillis(); |
2983 | + final long last = _lastPrunedTime; |
2984 | + final long now = System.currentTimeMillis(); |
2985 | if (now - last > delay) { |
2986 | _lastPrunedTime = now; |
2987 | _persistit.getCleanupManager().offer( |
2988 | @@ -4105,9 +4110,9 @@ |
2989 | * writes an IV record. |
2990 | * @throws Exception |
2991 | */ |
2992 | - void dump(final ByteBuffer bb, final boolean secure, boolean verbose, final Set<Volume> identifiedVolumes) |
2993 | + void dump(final ByteBuffer bb, final boolean secure, final boolean verbose, final Set<Volume> identifiedVolumes) |
2994 | throws Exception { |
2995 | - byte[] bytes = new byte[_bufferSize]; |
2996 | + final byte[] bytes = new byte[_bufferSize]; |
2997 | int type; |
2998 | int keyBlockEnd; |
2999 | int alloc; |
3000 | @@ -4120,7 +4125,7 @@ |
3001 | /* |
3002 | * Copy all the information needed quickly and then release the buffer. |
3003 | */ |
3004 | - boolean claimed = claim(false, Persistit.SHORT_DELAY); |
3005 | + final boolean claimed = claim(false, Persistit.SHORT_DELAY); |
3006 | try { |
3007 | bufferSize = _bufferSize; |
3008 | type = _type; |
3009 | @@ -4138,12 +4143,12 @@ |
3010 | } |
3011 | } |
3012 | |
3013 | - String toString = toString(); |
3014 | + final String toString = toString(); |
3015 | if (verbose) { |
3016 | System.out.println(toString); |
3017 | } |
3018 | |
3019 | - int volumeHandle = volume == null ? 0 : volume.getHandle(); |
3020 | + final int volumeHandle = volume == null ? 0 : volume.getHandle(); |
3021 | if (volume != null && !identifiedVolumes.contains(volume)) { |
3022 | IV.putType(bb); |
3023 | IV.putHandle(bb, volumeHandle); |
3024 | @@ -4154,9 +4159,9 @@ |
3025 | identifiedVolumes.add(volume); |
3026 | } |
3027 | |
3028 | - boolean isDataPage = type == PAGE_TYPE_DATA; |
3029 | - boolean isIndexPage = type >= PAGE_TYPE_INDEX_MIN && type <= PAGE_TYPE_INDEX_MAX; |
3030 | - boolean isLongRecordPage = type == PAGE_TYPE_LONG_RECORD; |
3031 | + final boolean isDataPage = type == PAGE_TYPE_DATA; |
3032 | + final boolean isIndexPage = type >= PAGE_TYPE_INDEX_MIN && type <= PAGE_TYPE_INDEX_MAX; |
3033 | + final boolean isLongRecordPage = type == PAGE_TYPE_LONG_RECORD; |
3034 | |
3035 | /* |
3036 | * Following is equivalent to the save method, except written to the |
3037 | @@ -4187,7 +4192,7 @@ |
3038 | } else if (secure && isLongRecordPage) { |
3039 | left = KEY_BLOCK_START; |
3040 | } |
3041 | - int recordSize = PA.OVERHEAD + left + right; |
3042 | + final int recordSize = PA.OVERHEAD + left + right; |
3043 | PA.putLength(bb, recordSize); |
3044 | PA.putType(bb); |
3045 | PA.putVolumeHandle(bb, volumeHandle); |
3046 | @@ -4207,7 +4212,7 @@ |
3047 | * @param bytes |
3048 | * buffer image |
3049 | */ |
3050 | - private void dumpSecureOverwriteValues(byte[] bytes) { |
3051 | + private void dumpSecureOverwriteValues(final byte[] bytes) { |
3052 | if (bytes[0] != PAGE_TYPE_DATA) { |
3053 | return; |
3054 | } |
3055 | @@ -4216,12 +4221,12 @@ |
3056 | * overwrite values. |
3057 | */ |
3058 | for (int p = KEY_BLOCK_START; p < Util.getInt(bytes, KEY_BLOCK_END_OFFSET); p += KEYBLOCK_LENGTH) { |
3059 | - int kbData = Util.getInt(bytes, p); |
3060 | - int db = decodeKeyBlockDb(kbData); |
3061 | + final int kbData = Util.getInt(bytes, p); |
3062 | + final int db = decodeKeyBlockDb(kbData); |
3063 | if (db == 0 && p == KEY_BLOCK_START) { |
3064 | continue; |
3065 | } else if (db == Key.TYPE_STRING) { |
3066 | - int tail = decodeKeyBlockTail(kbData); |
3067 | + final int tail = decodeKeyBlockTail(kbData); |
3068 | if (bytes[tail + TAILBLOCK_HDR_SIZE_DATA] == '_') { |
3069 | // Probably a system key - don't overwrite values |
3070 | return; |
3071 | @@ -4235,9 +4240,9 @@ |
3072 | |
3073 | int tail = Util.getChar(bytes, FREE_OFFSET); |
3074 | for (; tail < bytes.length;) { |
3075 | - int tbData = Util.getInt(bytes, tail); |
3076 | - int tbSize = (decodeTailBlockSize(tbData) + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
3077 | - int tbKLength = decodeTailBlockKLength(tbData); |
3078 | + final int tbData = Util.getInt(bytes, tail); |
3079 | + final int tbSize = (decodeTailBlockSize(tbData) + ~TAILBLOCK_MASK) & TAILBLOCK_MASK; |
3080 | + final int tbKLength = decodeTailBlockKLength(tbData); |
3081 | // |
3082 | // If the tbSize field is corrupt then just dump the |
3083 | // remainder of the buffer |
3084 | @@ -4250,7 +4255,7 @@ |
3085 | // Otherwise, dump just the portion of the tailblock we |
3086 | // need for analysis and fill the rest with 'x's. |
3087 | // |
3088 | - boolean tbInUse = decodeTailBlockInUse(tbData); |
3089 | + final boolean tbInUse = decodeTailBlockInUse(tbData); |
3090 | // Number of bytes we need to dump |
3091 | int keep; |
3092 | if (tbInUse) { |
3093 | @@ -4272,7 +4277,8 @@ |
3094 | } |
3095 | } |
3096 | |
3097 | - static void deallocatePrunedVersions(Persistit persistit, Volume volume, List<PrunedVersion> prunedVersions) { |
3098 | + static void deallocatePrunedVersions(final Persistit persistit, final Volume volume, |
3099 | + final List<PrunedVersion> prunedVersions) { |
3100 | for (final PrunedVersion pv : prunedVersions) { |
3101 | final TransactionStatus ts = persistit.getTransactionIndex().getStatus(pv.getTs()); |
3102 | if (ts != null && ts.getTc() == TransactionStatus.ABORTED) { |
3103 | @@ -4281,7 +4287,7 @@ |
3104 | if (pv.getLongRecordPage() != 0) { |
3105 | try { |
3106 | volume.getStructure().deallocateGarbageChain(pv.getLongRecordPage(), 0); |
3107 | - } catch (PersistitException e) { |
3108 | + } catch (final PersistitException e) { |
3109 | persistit.getLogBase().pruneException.log(e, ts); |
3110 | } |
3111 | } |
3112 | @@ -4289,20 +4295,20 @@ |
3113 | prunedVersions.clear(); |
3114 | } |
3115 | |
3116 | - static boolean isLongRecord(byte[] bytes, int offset, int length) { |
3117 | + static boolean isLongRecord(final byte[] bytes, final int offset, final int length) { |
3118 | return (length > 0) && ((bytes[offset] & 0xFF) == LONGREC_TYPE); |
3119 | } |
3120 | |
3121 | - static boolean isLongMVV(byte[] bytes, int offset, int length) { |
3122 | + static boolean isLongMVV(final byte[] bytes, final int offset, final int length) { |
3123 | return isLongRecord(bytes, offset, length) && (length > LONGREC_PREFIX_OFFSET) |
3124 | && MVV.isArrayMVV(bytes, offset + LONGREC_PREFIX_OFFSET, length - LONGREC_PREFIX_OFFSET); |
3125 | } |
3126 | |
3127 | - static boolean isValueMVV(byte[] bytes, int offset, int length) { |
3128 | + static boolean isValueMVV(final byte[] bytes, final int offset, final int length) { |
3129 | return MVV.isArrayMVV(bytes, offset, length) || isLongMVV(bytes, offset, length); |
3130 | } |
3131 | |
3132 | - private void incCountIfMvv(byte[] bytes, int offset, int length) { |
3133 | + private void incCountIfMvv(final byte[] bytes, final int offset, final int length) { |
3134 | if (isValueMVV(bytes, offset, length)) { |
3135 | ++_mvvCount; |
3136 | } |
3137 | |
3138 | === modified file 'src/main/java/com/persistit/BufferPool.java' |
3139 | --- src/main/java/com/persistit/BufferPool.java 2012-08-07 21:11:28 +0000 |
3140 | +++ src/main/java/com/persistit/BufferPool.java 2012-08-24 18:21:19 +0000 |
3141 | @@ -16,9 +16,13 @@ |
3142 | package com.persistit; |
3143 | |
3144 | import java.io.DataOutputStream; |
3145 | +import java.io.IOException; |
3146 | import java.nio.ByteBuffer; |
3147 | +import java.util.ArrayList; |
3148 | import java.util.Arrays; |
3149 | +import java.util.Collections; |
3150 | import java.util.HashSet; |
3151 | +import java.util.List; |
3152 | import java.util.Set; |
3153 | import java.util.concurrent.atomic.AtomicBoolean; |
3154 | import java.util.concurrent.atomic.AtomicInteger; |
3155 | @@ -26,6 +30,7 @@ |
3156 | import java.util.concurrent.atomic.AtomicLongArray; |
3157 | import java.util.concurrent.locks.ReentrantLock; |
3158 | |
3159 | +import com.persistit.JournalManager.PageNode; |
3160 | import com.persistit.exception.InUseException; |
3161 | import com.persistit.exception.InvalidPageAddressException; |
3162 | import com.persistit.exception.InvalidPageStructureException; |
3163 | @@ -36,7 +41,6 @@ |
3164 | import com.persistit.exception.VolumeClosedException; |
3165 | import com.persistit.util.Debug; |
3166 | import com.persistit.util.Util; |
3167 | -import java.io.*; |
3168 | |
3169 | /** |
3170 | * A pool of {@link Buffer} objects, maintained on various lists that permit |
3171 | @@ -52,7 +56,7 @@ |
3172 | private final static long DEFAULT_WRITER_POLL_INTERVAL = 5000; |
3173 | |
3174 | private final static int PAGE_WRITER_TRANCHE_SIZE = 5000; |
3175 | - |
3176 | + |
3177 | /** |
3178 | * Sleep time when buffers are exhausted |
3179 | */ |
3180 | @@ -87,6 +91,17 @@ |
3181 | */ |
3182 | private final static int WRITE_AGE_THRESHOLD_RATIO = 4; |
3183 | |
3184 | + private final static String INVENTORY_TREE_NAME = "_buffers"; |
3185 | + /** |
3186 | + * Maximum number of buffer inventory versions to retain |
3187 | + */ |
3188 | + private final static int INVENTORY_VERSIONS = 3; |
3189 | + |
3190 | + /** |
3191 | + * Preload log multiple |
3192 | + */ |
3193 | + private final static int INVENTORY_PRELOAD_LOG_MESSAGE_MULTIPLE = 10000; |
3194 | + |
3195 | /** |
3196 | * The Persistit instance that references this BufferPool. |
3197 | */ |
3198 | @@ -148,7 +163,7 @@ |
3199 | /** |
3200 | * Count of newly created pages |
3201 | */ |
3202 | - private AtomicLong _newCounter = new AtomicLong(); |
3203 | + private final AtomicLong _newCounter = new AtomicLong(); |
3204 | |
3205 | /** |
3206 | * Count of valid buffers evicted to make room for another page. |
3207 | @@ -188,7 +203,7 @@ |
3208 | * Timestamp to which all dirty pages should be written. PAGE_WRITER writes |
3209 | * any page with a lower update timestamp regardless of urgency. |
3210 | */ |
3211 | - private AtomicLong _flushTimestamp = new AtomicLong(); |
3212 | + private final AtomicLong _flushTimestamp = new AtomicLong(); |
3213 | |
3214 | /** |
3215 | * Polling interval for PageWriter |
3216 | @@ -196,24 +211,12 @@ |
3217 | private volatile long _writerPollInterval = DEFAULT_WRITER_POLL_INTERVAL; |
3218 | |
3219 | private volatile int _pageWriterTrancheSize = PAGE_WRITER_TRANCHE_SIZE; |
3220 | - |
3221 | - /** |
3222 | - * Polling interval for PageCacher |
3223 | - */ |
3224 | - private volatile long _cacherPollInterval; |
3225 | - |
3226 | + |
3227 | /** |
3228 | * The PAGE_WRITER IOTaskRunnable |
3229 | */ |
3230 | private PageWriter _writer; |
3231 | - |
3232 | - /** |
3233 | - * The PAGE_CACHER IOTaskRunnable |
3234 | - */ |
3235 | - private PageCacher _cacher; |
3236 | - |
3237 | - private String _defaultLogPath; |
3238 | - |
3239 | + |
3240 | /** |
3241 | * Construct a BufferPool with the specified count of <code>Buffer</code>s |
3242 | * of the specified size. |
3243 | @@ -223,7 +226,7 @@ |
3244 | * @param size |
3245 | * The size (in bytes) of each buffer |
3246 | */ |
3247 | - BufferPool(int count, int size, Persistit persistit) { |
3248 | + BufferPool(final int count, final int size, final Persistit persistit) { |
3249 | _persistit = persistit; |
3250 | if (count < MINIMUM_POOL_COUNT) { |
3251 | throw new IllegalArgumentException("Buffer pool count too small: " + count); |
3252 | @@ -250,7 +253,7 @@ |
3253 | _hashTable = new Buffer[_bufferCount * HASH_MULTIPLE]; |
3254 | _hashLocks = new ReentrantLock[HASH_LOCKS]; |
3255 | _maxKeys = (_bufferSize - Buffer.HEADER_SIZE) / Buffer.MAX_KEY_RATIO; |
3256 | - |
3257 | + |
3258 | for (int index = 0; index < HASH_LOCKS; index++) { |
3259 | _hashLocks[index] = new ReentrantLock(); |
3260 | } |
3261 | @@ -263,11 +266,11 @@ |
3262 | byte[] reserve = new byte[1024 * 1024]; |
3263 | try { |
3264 | for (int index = 0; index < _bufferCount; index++) { |
3265 | - Buffer buffer = new Buffer(size, index, this, _persistit); |
3266 | + final Buffer buffer = new Buffer(size, index, this, _persistit); |
3267 | _buffers[index] = buffer; |
3268 | buffers++; |
3269 | } |
3270 | - } catch (OutOfMemoryError e) { |
3271 | + } catch (final OutOfMemoryError e) { |
3272 | // |
3273 | // Note: written this way to try to avoid another OOME. |
3274 | // Do not use String.format here. |
3275 | @@ -284,38 +287,6 @@ |
3276 | throw e; |
3277 | } |
3278 | _writer = new PageWriter(); |
3279 | - _cacher = new PageCacher(); |
3280 | - } |
3281 | - |
3282 | - void warmupBufferPool(String pathName, String fname) throws PersistitException { |
3283 | - File file = new File(pathName, fname + ".log"); |
3284 | - _defaultLogPath = file.getAbsolutePath(); |
3285 | - |
3286 | - try { |
3287 | - if (!file.exists()) { |
3288 | - file.createNewFile(); |
3289 | - } |
3290 | - |
3291 | - BufferedReader reader = new BufferedReader(new FileReader(file)); |
3292 | - String currLine; |
3293 | - while ((currLine = reader.readLine()) != null) { |
3294 | - String[] info = currLine.split(" "); |
3295 | - if (info.length == 2) { |
3296 | - Volume vol = _persistit.getVolume(info[1]); |
3297 | - if (vol != null) { |
3298 | - long page = Long.parseLong(info[0]); |
3299 | - Buffer buff = get(vol, page, false, true); |
3300 | - buff.release(); |
3301 | - } |
3302 | - } |
3303 | - } |
3304 | - reader.close(); |
3305 | - _cacherPollInterval = _persistit.getConfiguration().getBufferInventoryPollingInterval(); |
3306 | - _cacher.start(); |
3307 | - } |
3308 | - catch (IOException e) { |
3309 | - throw new PersistitException(e); |
3310 | - } |
3311 | } |
3312 | |
3313 | void startThreads() throws PersistitException { |
3314 | @@ -325,18 +296,15 @@ |
3315 | void close() { |
3316 | _closed.set(true); |
3317 | _persistit.waitForIOTaskStop(_writer); |
3318 | - _persistit.waitForIOTaskStop(_cacher); |
3319 | _writer = null; |
3320 | - _cacher = null; |
3321 | } |
3322 | |
3323 | /** |
3324 | - * Abruptly stop (using {@link Thread#stop()}) the writer, cacher, and collector |
3325 | - * threads. This method should be used only by tests. |
3326 | + * Abruptly stop (using {@link Thread#stop()}) the writer, cacher, and |
3327 | + * collector threads. This method should be used only by tests. |
3328 | */ |
3329 | void crash() { |
3330 | IOTaskRunnable.crash(_writer); |
3331 | - IOTaskRunnable.crash(_cacher); |
3332 | } |
3333 | |
3334 | void flush(final long timestamp) throws PersistitInterruptedException { |
3335 | @@ -351,14 +319,14 @@ |
3336 | return _flushTimestamp.get() != 0; |
3337 | } |
3338 | |
3339 | - int hashIndex(Volume vol, long page) { |
3340 | + int hashIndex(final Volume vol, final long page) { |
3341 | return (int) (((page ^ vol.hashCode()) & Integer.MAX_VALUE) % _hashTable.length); |
3342 | } |
3343 | |
3344 | - int countInUse(Volume vol, boolean writer) { |
3345 | + int countInUse(final Volume vol, final boolean writer) { |
3346 | int count = 0; |
3347 | for (int i = 0; i < _bufferCount; i++) { |
3348 | - Buffer buffer = _buffers[i]; |
3349 | + final Buffer buffer = _buffers[i]; |
3350 | if ((vol == null || buffer.getVolume() == vol) |
3351 | && ((buffer.getStatus() & SharedResource.CLAIMED_MASK) != 0 && (!writer || (buffer.getStatus() & SharedResource.WRITER_MASK) != 0))) { |
3352 | count++; |
3353 | @@ -367,7 +335,7 @@ |
3354 | return count; |
3355 | } |
3356 | |
3357 | - void populateBufferPoolInfo(ManagementImpl.BufferPoolInfo info) { |
3358 | + void populateBufferPoolInfo(final ManagementImpl.BufferPoolInfo info) { |
3359 | info.bufferCount = _bufferCount; |
3360 | info.bufferSize = _bufferSize; |
3361 | info.missCount = _missCounter.get(); |
3362 | @@ -383,8 +351,8 @@ |
3363 | int writerClaimedPages = 0; |
3364 | |
3365 | for (int index = 0; index < _bufferCount; index++) { |
3366 | - Buffer buffer = _buffers[index]; |
3367 | - int status = buffer.getStatus(); |
3368 | + final Buffer buffer = _buffers[index]; |
3369 | + final int status = buffer.getStatus(); |
3370 | if ((status & SharedResource.VALID_MASK) != 0) |
3371 | validPages++; |
3372 | if ((status & SharedResource.WRITER_MASK) != 0) |
3373 | @@ -400,12 +368,13 @@ |
3374 | info.updateAcquisitonTime(); |
3375 | } |
3376 | |
3377 | - int populateInfo(ManagementImpl.BufferInfo[] array, int traveralType, int includeMask, int excludeMask) { |
3378 | + int populateInfo(final ManagementImpl.BufferInfo[] array, final int traveralType, final int includeMask, |
3379 | + final int excludeMask) { |
3380 | int index = 0; |
3381 | switch (traveralType) { |
3382 | case 0: |
3383 | for (int i = 0; i < _bufferCount; i++) { |
3384 | - Buffer buffer = _buffers[i]; |
3385 | + final Buffer buffer = _buffers[i]; |
3386 | if (selected(buffer, includeMask, excludeMask)) { |
3387 | populateInfo1(array, index, buffer); |
3388 | index++; |
3389 | @@ -420,44 +389,15 @@ |
3390 | return index; |
3391 | } |
3392 | |
3393 | - private static void populateInfo1(ManagementImpl.BufferInfo[] array, int index, Buffer buffer) { |
3394 | + private static void populateInfo1(final ManagementImpl.BufferInfo[] array, final int index, final Buffer buffer) { |
3395 | if (index < array.length) { |
3396 | if (array[index] == null) |
3397 | array[index] = new ManagementImpl.BufferInfo(); |
3398 | buffer.populateInfo(array[index]); |
3399 | } |
3400 | } |
3401 | - |
3402 | - private void populateWarmupFile() throws PersistitException { |
3403 | - File file = new File(_defaultLogPath); |
3404 | - |
3405 | - try { |
3406 | - BufferedWriter writer = new BufferedWriter(new FileWriter(file)); |
3407 | - for (int i = 0; i < _buffers.length; ++i) { |
3408 | - Buffer b = _buffers[i]; |
3409 | - if (b != null && b.isValid() && !b.isDirty()) { |
3410 | - long page = b.getPageAddress(); |
3411 | - Volume volume = b.getVolume(); |
3412 | - long page2 = b.getPageAddress(); |
3413 | - Volume volume2 = b.getVolume(); |
3414 | - |
3415 | - // Check if buffer has changed while reading |
3416 | - if (page == page2 && volume == volume2 && volume != null) { |
3417 | - String addr = Long.toString(page); |
3418 | - String vol = volume.getName(); |
3419 | - writer.append(addr + " " + vol); |
3420 | - writer.newLine(); |
3421 | - writer.flush(); |
3422 | - } |
3423 | - } |
3424 | - } |
3425 | - writer.close(); |
3426 | - } catch (IOException e) { |
3427 | - throw new PersistitException(e); |
3428 | - } |
3429 | - } |
3430 | |
3431 | - private boolean selected(Buffer buffer, int includeMask, int excludeMask) { |
3432 | + private boolean selected(final Buffer buffer, final int includeMask, final int excludeMask) { |
3433 | return ((includeMask == 0) || (buffer.getStatus() & includeMask) != 0) |
3434 | && (buffer.getStatus() & excludeMask) == 0; |
3435 | } |
3436 | @@ -599,7 +539,7 @@ |
3437 | * The volume |
3438 | * @throws PersistitInterruptedException |
3439 | */ |
3440 | - boolean invalidate(Volume volume) throws PersistitInterruptedException { |
3441 | + boolean invalidate(final Volume volume) throws PersistitInterruptedException { |
3442 | final float ratio = (float) volume.getStorage().getNextAvailablePage() / (float) _bufferCount; |
3443 | if (ratio < SMALL_VOLUME_RATIO) { |
3444 | return invalidateSmallVolume(volume); |
3445 | @@ -612,7 +552,7 @@ |
3446 | boolean result = true; |
3447 | int markedAvailable = 0; |
3448 | for (long page = 1; page < volume.getStorage().getNextAvailablePage(); page++) { |
3449 | - int hashIndex = hashIndex(volume, page); |
3450 | + final int hashIndex = hashIndex(volume, page); |
3451 | _hashLocks[hashIndex % HASH_LOCKS].lock(); |
3452 | try { |
3453 | for (Buffer buffer = _hashTable[hashIndex]; buffer != null; buffer = buffer.getNext()) { |
3454 | @@ -630,9 +570,9 @@ |
3455 | buffer.release(); |
3456 | } |
3457 | if (invalidated) { |
3458 | - int q = buffer.getIndex() / 64; |
3459 | - int p = buffer.getIndex() % 64; |
3460 | - long bits = _availablePagesBits.get(q); |
3461 | + final int q = buffer.getIndex() / 64; |
3462 | + final int p = buffer.getIndex() % 64; |
3463 | + final long bits = _availablePagesBits.get(q); |
3464 | if (_availablePagesBits.compareAndSet(q, bits, bits | (1L << p))) { |
3465 | markedAvailable++; |
3466 | } |
3467 | @@ -657,7 +597,7 @@ |
3468 | boolean result = true; |
3469 | int markedAvailable = 0; |
3470 | for (int index = 0; index < _bufferCount; index++) { |
3471 | - Buffer buffer = _buffers[index]; |
3472 | + final Buffer buffer = _buffers[index]; |
3473 | if ((buffer.getVolume() == volume || volume == null) && !buffer.isFixed() && buffer.isValid()) { |
3474 | if (buffer.claim(true, 0)) { |
3475 | // re-check after claim |
3476 | @@ -671,9 +611,9 @@ |
3477 | buffer.release(); |
3478 | } |
3479 | if (invalidated) { |
3480 | - int q = buffer.getIndex() / 64; |
3481 | - int p = buffer.getIndex() % 64; |
3482 | - long bits = _availablePagesBits.get(q); |
3483 | + final int q = buffer.getIndex() / 64; |
3484 | + final int p = buffer.getIndex() % 64; |
3485 | + final long bits = _availablePagesBits.get(q); |
3486 | if (_availablePagesBits.compareAndSet(q, bits, bits | (1L << p))) { |
3487 | markedAvailable++; |
3488 | } |
3489 | @@ -689,29 +629,33 @@ |
3490 | return result; |
3491 | } |
3492 | |
3493 | - private void invalidate(Buffer buffer) { |
3494 | + private void invalidate(final Buffer buffer) { |
3495 | Debug.$assert0.t(buffer.isValid() && buffer.isMine()); |
3496 | |
3497 | while (!detach(buffer)) { |
3498 | // |
3499 | - // Spin until detach succeeds. Note: this method must not throw an Exception |
3500 | - // because it is called in at at critical time when cleanup must be done. |
3501 | - // It is not possible to lock the hash bucket here due to possible deadlock. |
3502 | - // However, the likelihood of a lengthy live-lock is infinitesimal so polling |
3503 | + // Spin until detach succeeds. Note: this method must not throw an |
3504 | + // Exception |
3505 | + // because it is called in at at critical time when cleanup must be |
3506 | + // done. |
3507 | + // It is not possible to lock the hash bucket here due to possible |
3508 | + // deadlock. |
3509 | + // However, the likelihood of a lengthy live-lock is infinitesimal |
3510 | + // so polling |
3511 | // is acceptable. |
3512 | // |
3513 | - try { |
3514 | - Thread.sleep(1); |
3515 | - } catch (InterruptedException ie) { |
3516 | - // ignore |
3517 | - } |
3518 | + try { |
3519 | + Thread.sleep(1); |
3520 | + } catch (final InterruptedException ie) { |
3521 | + // ignore |
3522 | + } |
3523 | } |
3524 | buffer.clearValid(); |
3525 | buffer.clearDirty(); |
3526 | buffer.setPageAddressAndVolume(0, null); |
3527 | } |
3528 | |
3529 | - private boolean detach(Buffer buffer) { |
3530 | + private boolean detach(final Buffer buffer) { |
3531 | final int hash = hashIndex(buffer.getVolume(), buffer.getPageAddress()); |
3532 | if (!_hashLocks[hash % HASH_LOCKS].tryLock()) { |
3533 | return false; |
3534 | @@ -756,8 +700,9 @@ |
3535 | * @return Buffer The Buffer describing the buffer containing the page. |
3536 | * @throws InUseException |
3537 | */ |
3538 | - Buffer get(Volume vol, long page, boolean writer, boolean wantRead) throws PersistitException { |
3539 | - int hash = hashIndex(vol, page); |
3540 | + Buffer get(final Volume vol, final long page, final boolean writer, final boolean wantRead) |
3541 | + throws PersistitException { |
3542 | + final int hash = hashIndex(vol, page); |
3543 | Buffer buffer = null; |
3544 | |
3545 | for (;;) { |
3546 | @@ -904,10 +849,10 @@ |
3547 | * @throws RetryException |
3548 | * @throws IOException |
3549 | */ |
3550 | - public Buffer getBufferCopy(Volume vol, long page) throws InvalidPageAddressException, |
3551 | + public Buffer getBufferCopy(final Volume vol, final long page) throws InvalidPageAddressException, |
3552 | InvalidPageStructureException, VolumeClosedException, InUseException, PersistitIOException, |
3553 | PersistitInterruptedException { |
3554 | - int hash = hashIndex(vol, page); |
3555 | + final int hash = hashIndex(vol, page); |
3556 | Buffer buffer = null; |
3557 | _hashLocks[hash % HASH_LOCKS].lock(); |
3558 | try { |
3559 | @@ -934,7 +879,7 @@ |
3560 | // Didn't find it in the pool, so we'll read a copy. |
3561 | // |
3562 | buffer = new Buffer(_bufferSize, -1, this, _persistit); |
3563 | - boolean acquired = buffer.claim(true); |
3564 | + final boolean acquired = buffer.claim(true); |
3565 | assert acquired : "buffer not unavailable"; |
3566 | buffer.load(vol, page); |
3567 | buffer.setValid(); |
3568 | @@ -968,7 +913,7 @@ |
3569 | // since no valid page will need to be evicted. |
3570 | // |
3571 | if (_availablePages.get()) { |
3572 | - int start = (_clock.get() / 64) * 64; |
3573 | + final int start = (_clock.get() / 64) * 64; |
3574 | for (int q = start;;) { |
3575 | q += 64; |
3576 | if (q >= _bufferCount) { |
3577 | @@ -1007,12 +952,12 @@ |
3578 | // Look for a page to evict. |
3579 | // |
3580 | for (int retry = 0; retry < _bufferCount * 2;) { |
3581 | - int clock = _clock.get(); |
3582 | + final int clock = _clock.get(); |
3583 | assert clock < _bufferCount; |
3584 | if (!_clock.compareAndSet(clock, (clock + 1) % _bufferCount)) { |
3585 | continue; |
3586 | } |
3587 | - Buffer buffer = _buffers[clock]; |
3588 | + final Buffer buffer = _buffers[clock]; |
3589 | if (buffer.isTouched()) { |
3590 | buffer.clearTouched(); |
3591 | } else { |
3592 | @@ -1081,7 +1026,7 @@ |
3593 | |
3594 | void setFlushTimestamp(final long timestamp) { |
3595 | while (true) { |
3596 | - long current = _flushTimestamp.get(); |
3597 | + final long current = _flushTimestamp.get(); |
3598 | if (timestamp > current) { |
3599 | if (_flushTimestamp.compareAndSet(current, timestamp)) { |
3600 | break; |
3601 | @@ -1099,7 +1044,7 @@ |
3602 | * polling cycle |
3603 | */ |
3604 | boolean shouldWritePages() { |
3605 | - int cleanCount = _bufferCount - _dirtyPageCount.get(); |
3606 | + final int cleanCount = _bufferCount - _dirtyPageCount.get(); |
3607 | if (getEarliestDirtyTimestamp() < _flushTimestamp.get()) { |
3608 | return true; |
3609 | } |
3610 | @@ -1116,7 +1061,7 @@ |
3611 | } |
3612 | |
3613 | void writeDirtyBuffers(final int[] priorities, final BufferHolder[] selectedBuffers) throws PersistitException { |
3614 | - int count = selectDirtyBuffers(priorities, selectedBuffers); |
3615 | + final int count = selectDirtyBuffers(priorities, selectedBuffers); |
3616 | if (count > 0) { |
3617 | Arrays.sort(selectedBuffers, 0, count); |
3618 | for (int index = 0; index < count; index++) { |
3619 | @@ -1144,7 +1089,7 @@ |
3620 | final long currentTimestamp = _persistit.getCurrentTimestamp(); |
3621 | |
3622 | long earliestDirtyTimestamp = currentTimestamp; |
3623 | - long flushTimestamp = _flushTimestamp.get(); |
3624 | + final long flushTimestamp = _flushTimestamp.get(); |
3625 | |
3626 | boolean flushed = true; |
3627 | for (int index = clock; index < clock + _bufferCount; index++) { |
3628 | @@ -1202,8 +1147,9 @@ |
3629 | } |
3630 | return count; |
3631 | } |
3632 | - |
3633 | - int addSelectedBufferByPriority(final Buffer buffer, final int priority, final int[] priorities, final BufferHolder[] holders, final int initialCount) { |
3634 | + |
3635 | + int addSelectedBufferByPriority(final Buffer buffer, final int priority, final int[] priorities, |
3636 | + final BufferHolder[] holders, final int initialCount) { |
3637 | int count = initialCount; |
3638 | if (priority > 0) { |
3639 | if (count == 0 || priorities[count - 1] > priority) { |
3640 | @@ -1214,13 +1160,13 @@ |
3641 | } |
3642 | } else { |
3643 | count = Math.min(count, priorities.length - 1); |
3644 | - int where = count; |
3645 | + int where = count; |
3646 | while (where > 0 && priorities[where - 1] < priority) { |
3647 | where--; |
3648 | } |
3649 | - int move = count - where ; |
3650 | + final int move = count - where; |
3651 | if (move > 0) { |
3652 | - BufferHolder lastHolder = holders[count]; |
3653 | + final BufferHolder lastHolder = holders[count]; |
3654 | System.arraycopy(priorities, where, priorities, where + 1, move); |
3655 | System.arraycopy(holders, where, holders, where + 1, move); |
3656 | holders[where] = lastHolder; |
3657 | @@ -1240,8 +1186,8 @@ |
3658 | * |
3659 | * @return priority |
3660 | */ |
3661 | - int writePriority(final Buffer buffer, int clock, long checkpointTimestamp, final long currentTimestamp) { |
3662 | - int status = buffer.getStatus(); |
3663 | + int writePriority(final Buffer buffer, final int clock, final long checkpointTimestamp, final long currentTimestamp) { |
3664 | + final int status = buffer.getStatus(); |
3665 | if ((status & Buffer.VALID_MASK) == 0 || (status & Buffer.DIRTY_MASK) == 0) { |
3666 | // ineligible |
3667 | return 0; |
3668 | @@ -1336,7 +1282,7 @@ |
3669 | * address order. |
3670 | */ |
3671 | @Override |
3672 | - public int compareTo(BufferHolder buffer) { |
3673 | + public int compareTo(final BufferHolder buffer) { |
3674 | return _volumeId > buffer._volumeId ? 1 : _volumeId < buffer._volumeId ? -1 : _page > buffer._page ? 1 |
3675 | : _page < buffer._page ? -1 : 0; |
3676 | |
3677 | @@ -1367,7 +1313,7 @@ |
3678 | |
3679 | @Override |
3680 | public void runTask() throws PersistitException { |
3681 | - int size = _pageWriterTrancheSize; |
3682 | + final int size = _pageWriterTrancheSize; |
3683 | if (size != _priorities.length) { |
3684 | _priorities = new int[size]; |
3685 | _selectedBuffers = new BufferHolder[size]; |
3686 | @@ -1391,35 +1337,6 @@ |
3687 | return isFlushing() ? 0 : _writerPollInterval; |
3688 | } |
3689 | } |
3690 | - |
3691 | - /** |
3692 | - * Implementation of PAGE_CACHER thread |
3693 | - */ |
3694 | - class PageCacher extends IOTaskRunnable { |
3695 | - |
3696 | - PageCacher() { |
3697 | - super(BufferPool.this._persistit); |
3698 | - } |
3699 | - |
3700 | - void start() { |
3701 | - start("PAGE_CACHER:" + _bufferSize, _cacherPollInterval); |
3702 | - } |
3703 | - |
3704 | - @Override |
3705 | - public void runTask() throws Exception { |
3706 | - populateWarmupFile(); |
3707 | - } |
3708 | - |
3709 | - @Override |
3710 | - protected boolean shouldStop() { |
3711 | - return _closed.get() && !isFlushing(); |
3712 | - } |
3713 | - |
3714 | - @Override |
3715 | - protected long pollInterval() { |
3716 | - return isFlushing() ? 0 : _cacherPollInterval; |
3717 | - } |
3718 | - } |
3719 | |
3720 | @Override |
3721 | public String toString() { |
3722 | @@ -1431,7 +1348,7 @@ |
3723 | * @param detail |
3724 | * @return toString value for buffer at index <code>i</code>. |
3725 | */ |
3726 | - String toString(int i, boolean detail) { |
3727 | + String toString(final int i, final boolean detail) { |
3728 | if (detail) { |
3729 | return _buffers[i].toStringDetail(); |
3730 | } else { |
3731 | @@ -1475,4 +1392,133 @@ |
3732 | } |
3733 | stream.flush(); |
3734 | } |
3735 | + |
3736 | + void recordBufferInventory(final long timestamp) throws PersistitException { |
3737 | + final Exchange exchange = getBufferInventoryExchange(); |
3738 | + /* |
3739 | + * Advisory only - transaction integrity not needed |
3740 | + */ |
3741 | + exchange.ignoreTransactions(); |
3742 | + try { |
3743 | + int total = 0; |
3744 | + exchange.clear().append(_bufferSize).append(timestamp).append(Key.BEFORE); |
3745 | + final Value value = exchange.getValue(); |
3746 | + final int clockValueBefore = _clock.get(); |
3747 | + for (int index = 0; index < _buffers.length; index++) { |
3748 | + final Buffer buffer = _buffers[index]; |
3749 | + long page1 = -1, page2 = -1; |
3750 | + Volume volume1 = null, volume2 = null; |
3751 | + if (buffer != null && buffer.isValid()) { |
3752 | + while (true) { |
3753 | + page1 = buffer.getPageAddress(); |
3754 | + volume1 = buffer.getVolume(); |
3755 | + page2 = buffer.getPageAddress(); |
3756 | + volume2 = buffer.getVolume(); |
3757 | + if (page1 == page2 && volume1 == volume2) { |
3758 | + break; |
3759 | + } |
3760 | + Util.spinSleep(); |
3761 | + } |
3762 | + if (volume1 != null && !volume1.isTemporary()) { |
3763 | + value.clear().setStreamMode(true); |
3764 | + value.put(volume1.getHandle()); |
3765 | + value.put(page1); |
3766 | + exchange.to(index).store(); |
3767 | + total++; |
3768 | + } |
3769 | + } |
3770 | + } |
3771 | + final int clockValueAfter = _clock.get(); |
3772 | + exchange.cut(); |
3773 | + value.clear().setStreamMode(true); |
3774 | + value.put(_bufferCount); |
3775 | + value.put(total); |
3776 | + value.put(clockValueBefore); |
3777 | + value.put(clockValueAfter); |
3778 | + value.put(System.currentTimeMillis()); |
3779 | + exchange.store(); |
3780 | + int count = 0; |
3781 | + while (exchange.previous()) { |
3782 | + if (++count > INVENTORY_VERSIONS) { |
3783 | + exchange.remove(Key.GTEQ); |
3784 | + } |
3785 | + } |
3786 | + } catch (final PersistitException e) { |
3787 | + _persistit.getLogBase().bufferInventoryException.log(e); |
3788 | + } |
3789 | + } |
3790 | + |
3791 | + void preloadBufferInventory() { |
3792 | + int count = 0; |
3793 | + int total = 0; |
3794 | + try { |
3795 | + final JournalManager jman = _persistit.getJournalManager(); |
3796 | + final Exchange exchange = getBufferInventoryExchange(); |
3797 | + final Value value = exchange.getValue(); |
3798 | + final List<PageNode> pageNodes = new ArrayList<PageNode>(); |
3799 | + boolean foundInventory = false; |
3800 | + exchange.clear().append(_bufferSize).append(Key.AFTER); |
3801 | + while (exchange.previous()) { |
3802 | + if (exchange.getValue().isDefined()) { |
3803 | + foundInventory = true; |
3804 | + break; |
3805 | + } |
3806 | + } |
3807 | + if (!foundInventory) { |
3808 | + return; |
3809 | + } |
3810 | + value.setStreamMode(true); |
3811 | + /* int bufferCount = */value.getInt(); |
3812 | + total = value.getInt(); |
3813 | + /* int clockValueBefore = */value.getInt(); |
3814 | + /* int clockValueAfter = */value.getInt(); |
3815 | + final long systemTime = value.getLong(); |
3816 | + |
3817 | + _persistit.getLogBase().bufferInventoryLoad.log(systemTime); |
3818 | + |
3819 | + exchange.append(Key.BEFORE); |
3820 | + |
3821 | + while (exchange.next()) { |
3822 | + value.setStreamMode(true); |
3823 | + final int volumeHandle = value.getInt(); |
3824 | + final long pageAddress = value.getLong(); |
3825 | + final PageNode pn = new PageNode(volumeHandle, pageAddress); |
3826 | + pageNodes.add(pn); |
3827 | + } |
3828 | + |
3829 | + Collections.sort(pageNodes, PageNode.READ_COMPARATOR); |
3830 | + for (final PageNode pn : pageNodes) { |
3831 | + final Volume vol = jman.volumeForHandle(pn.getVolumeHandle()); |
3832 | + if (vol == null) { |
3833 | + continue; |
3834 | + } |
3835 | + try { |
3836 | + final Buffer buff = get(vol, pn.getPageAddress(), false, true); |
3837 | + buff.release(); |
3838 | + count++; |
3839 | + if ((count % INVENTORY_PRELOAD_LOG_MESSAGE_MULTIPLE) == 0) { |
3840 | + _persistit.getLogBase().bufferInventoryProgress.log(count, total); |
3841 | + } |
3842 | + if (count >= _bufferCount) { |
3843 | + // |
3844 | + // If the buffer pool is now smaller, no need to load |
3845 | + // more pages |
3846 | + // |
3847 | + break; |
3848 | + } |
3849 | + } catch (final PersistitException e) { |
3850 | + // ignore it |
3851 | + } |
3852 | + } |
3853 | + } catch (final PersistitException e) { |
3854 | + _persistit.getLogBase().bufferInventoryException.log(e); |
3855 | + } finally { |
3856 | + _persistit.getLogBase().bufferInventoryProgress.log(count, total); |
3857 | + } |
3858 | + } |
3859 | + |
3860 | + private Exchange getBufferInventoryExchange() throws PersistitException { |
3861 | + final Volume sysvol = _persistit.getSystemVolume(); |
3862 | + return _persistit.getExchange(sysvol, INVENTORY_TREE_NAME, true); |
3863 | + } |
3864 | } |
3865 | |
3866 | === modified file 'src/main/java/com/persistit/BufferPoolMXBeanImpl.java' |
3867 | --- src/main/java/com/persistit/BufferPoolMXBeanImpl.java 2012-08-02 04:45:28 +0000 |
3868 | +++ src/main/java/com/persistit/BufferPoolMXBeanImpl.java 2012-08-24 18:21:19 +0000 |
3869 | @@ -23,8 +23,9 @@ |
3870 | |
3871 | /** |
3872 | * MXBean that exposes information about a {@link BufferPool}. |
3873 | + * |
3874 | * @author peter |
3875 | - * |
3876 | + * |
3877 | */ |
3878 | class BufferPoolMXBeanImpl implements BufferPoolMXBean { |
3879 | |
3880 | @@ -47,16 +48,16 @@ |
3881 | } |
3882 | |
3883 | private BufferPoolInfo recent() { |
3884 | - long now = System.currentTimeMillis(); |
3885 | + final long now = System.currentTimeMillis(); |
3886 | if (_recent.getAcquisitionTime() < now - MAX_STALE) { |
3887 | try { |
3888 | - BufferPoolInfo[] array = _persistit.getManagement().getBufferPoolInfoArray(); |
3889 | - for (BufferPoolInfo info : array) { |
3890 | + final BufferPoolInfo[] array = _persistit.getManagement().getBufferPoolInfoArray(); |
3891 | + for (final BufferPoolInfo info : array) { |
3892 | if (info.getBufferSize() == _bufferSize) { |
3893 | _recent = info; |
3894 | } |
3895 | } |
3896 | - } catch (RemoteException e) { |
3897 | + } catch (final RemoteException e) { |
3898 | // TODO Auto-generated catch block |
3899 | e.printStackTrace(); |
3900 | } |
3901 | |
3902 | === modified file 'src/main/java/com/persistit/CLI.java' |
3903 | --- src/main/java/com/persistit/CLI.java 2012-08-02 04:45:28 +0000 |
3904 | +++ src/main/java/com/persistit/CLI.java 2012-08-24 18:21:19 +0000 |
3905 | @@ -168,12 +168,12 @@ |
3906 | public static void registerCommands(final Class<?> clazz) { |
3907 | for (final Method method : clazz.getDeclaredMethods()) { |
3908 | if (method.isAnnotationPresent(Cmd.class)) { |
3909 | - String name = method.getAnnotation(Cmd.class).value(); |
3910 | - Annotation[][] parameters = method.getParameterAnnotations(); |
3911 | - String[] argTemplate = new String[parameters.length]; |
3912 | + final String name = method.getAnnotation(Cmd.class).value(); |
3913 | + final Annotation[][] parameters = method.getParameterAnnotations(); |
3914 | + final String[] argTemplate = new String[parameters.length]; |
3915 | int index = 0; |
3916 | - for (Annotation[] annotations : parameters) { |
3917 | - Arg argAnnotation = (Arg) annotations[0]; |
3918 | + for (final Annotation[] annotations : parameters) { |
3919 | + final Arg argAnnotation = (Arg) annotations[0]; |
3920 | argTemplate[index++] = argAnnotation.value(); |
3921 | } |
3922 | COMMANDS.put(name, new Command(name, argTemplate, method)); |
3923 | @@ -228,7 +228,7 @@ |
3924 | int port = -1; |
3925 | String host = null; |
3926 | |
3927 | - String[] hostPieces = args[0].split(":"); |
3928 | + final String[] hostPieces = args[0].split(":"); |
3929 | switch (hostPieces.length) { |
3930 | case 1: |
3931 | port = Integer.parseInt(hostPieces[0]); |
3932 | @@ -275,7 +275,7 @@ |
3933 | */ |
3934 | public static void runScript(final Persistit persistit, final BufferedReader reader, final PrintWriter writer) |
3935 | throws Exception { |
3936 | - CLI cli = new CLI(persistit, reader, writer); |
3937 | + final CLI cli = new CLI(persistit, reader, writer); |
3938 | cli.commandLoop(); |
3939 | cli.close(false); |
3940 | writer.println(); |
3941 | @@ -307,7 +307,7 @@ |
3942 | |
3943 | boolean quoted = false; |
3944 | for (int index = 0; index < commandLine.length(); index++) { |
3945 | - char c = commandLine.charAt(index); |
3946 | + final char c = commandLine.charAt(index); |
3947 | if (index == 0 && !Character.isLetter(c)) { |
3948 | commandDelimiter = c; |
3949 | continue; |
3950 | @@ -342,17 +342,17 @@ |
3951 | } |
3952 | |
3953 | static Task parseTask(final Persistit persistit, final String line) throws Exception { |
3954 | - List<String> pieces = pieces(line); |
3955 | + final List<String> pieces = pieces(line); |
3956 | if (pieces.isEmpty()) { |
3957 | return null; |
3958 | } |
3959 | final String commandName = pieces.remove(0); |
3960 | - Command command = COMMANDS.get(commandName); |
3961 | + final Command command = COMMANDS.get(commandName); |
3962 | if (command == null) { |
3963 | return null; |
3964 | } |
3965 | - Task task = command.createTask(persistit, new ArgParser(commandName, pieces.toArray(new String[pieces.size()]), |
3966 | - command.argTemplate).strict()); |
3967 | + final Task task = command.createTask(persistit, |
3968 | + new ArgParser(commandName, pieces.toArray(new String[pieces.size()]), command.argTemplate).strict()); |
3969 | if (task != null) { |
3970 | task.setPersistit(persistit); |
3971 | } |
3972 | @@ -433,14 +433,14 @@ |
3973 | private final BufferedReader _reader; |
3974 | private final PrintWriter _writer; |
3975 | |
3976 | - private ScriptReader(final BufferedReader reader, PrintWriter writer) { |
3977 | + private ScriptReader(final BufferedReader reader, final PrintWriter writer) { |
3978 | _reader = reader; |
3979 | _writer = writer; |
3980 | } |
3981 | |
3982 | @Override |
3983 | public String readLine() throws IOException { |
3984 | - String line = _reader.readLine(); |
3985 | + final String line = _reader.readLine(); |
3986 | if (line != null) { |
3987 | _writer.println(); |
3988 | _writer.println(">> " + line); |
3989 | @@ -476,10 +476,10 @@ |
3990 | private String execute(final CLI cli, final ArgParser ap) throws Exception { |
3991 | final Object[] args = invocationArgs(ap); |
3992 | if (method.getReturnType() == String.class) { |
3993 | - String result = (String) method.invoke(cli, args); |
3994 | + final String result = (String) method.invoke(cli, args); |
3995 | return result; |
3996 | } else if (Task.class.isAssignableFrom(method.getReturnType())) { |
3997 | - Task task = (Task) method.invoke(cli, args); |
3998 | + final Task task = (Task) method.invoke(cli, args); |
3999 | task.setPersistit(cli._persistit); |
4000 | task.setMaximumTime(-1); |
4001 | task.setMessageWriter(cli._writer); |
4002 | @@ -493,9 +493,9 @@ |
4003 | |
4004 | private Task createTask(final Persistit persistit, final ArgParser ap) throws Exception { |
4005 | if (Task.class.isAssignableFrom(method.getReturnType())) { |
4006 | - CLI cli = persistit.getSessionCLI(); |
4007 | + final CLI cli = persistit.getSessionCLI(); |
4008 | final Object[] args = invocationArgs(ap); |
4009 | - Task task = (Task) method.invoke(cli, args); |
4010 | + final Task task = (Task) method.invoke(cli, args); |
4011 | return task; |
4012 | } else { |
4013 | return null; |
4014 | @@ -503,10 +503,10 @@ |
4015 | } |
4016 | |
4017 | private Object[] invocationArgs(final ArgParser ap) { |
4018 | - Class<?>[] types = method.getParameterTypes(); |
4019 | + final Class<?>[] types = method.getParameterTypes(); |
4020 | final Object[] args = new Object[types.length]; |
4021 | for (int index = 0; index < types.length; index++) { |
4022 | - Class<?> type = types[index]; |
4023 | + final Class<?> type = types[index]; |
4024 | if (String.class.equals(type)) { |
4025 | args[index] = ap.stringValue(index); |
4026 | } else if (int.class.equals(type)) { |
4027 | @@ -525,7 +525,7 @@ |
4028 | |
4029 | @Override |
4030 | public String toString() { |
4031 | - StringBuilder sb = new StringBuilder(name); |
4032 | + final StringBuilder sb = new StringBuilder(name); |
4033 | sb.append(Util.NEW_LINE); |
4034 | sb.append(new ArgParser(name, new String[0], argTemplate).strict()); |
4035 | return sb.toString(); |
4036 | @@ -540,7 +540,7 @@ |
4037 | |
4038 | private LineReader _lineReader; |
4039 | PrintWriter _writer = new PrintWriter(System.out); |
4040 | - private Stack<BufferedReader> _sourceStack = new Stack<BufferedReader>(); |
4041 | + private final Stack<BufferedReader> _sourceStack = new Stack<BufferedReader>(); |
4042 | private Persistit _persistit; |
4043 | private boolean _stop = false; |
4044 | private Volume _currentVolume; |
4045 | @@ -635,19 +635,19 @@ |
4046 | final String[] args = list.toArray(new String[list.size()]); |
4047 | final ArgParser ap = new ArgParser(commandName, args, command.argTemplate).strict(); |
4048 | if (!ap.isUsageOnly()) { |
4049 | - String result = command.execute(this, ap); |
4050 | + final String result = command.execute(this, ap); |
4051 | if (result != null) { |
4052 | _writer.println(result); |
4053 | } |
4054 | _lastStatus += " - done"; |
4055 | } |
4056 | - } catch (InvocationTargetException e) { |
4057 | + } catch (final InvocationTargetException e) { |
4058 | _lastStatus += e.getTargetException(); |
4059 | _writer.println(e.getTargetException()); |
4060 | - } catch (RuntimeException e) { |
4061 | + } catch (final RuntimeException e) { |
4062 | _lastStatus += e; |
4063 | e.printStackTrace(_writer); |
4064 | - } catch (Exception e) { |
4065 | + } catch (final Exception e) { |
4066 | _lastStatus += e; |
4067 | _writer.println(e); |
4068 | } |
4069 | @@ -680,28 +680,28 @@ |
4070 | * @throws Exception |
4071 | */ |
4072 | @Cmd("open") |
4073 | - String open(@Arg("datapath|string|Data path") String datapath, |
4074 | - @Arg("journalpath|string|Journal path") String journalpath, |
4075 | - @Arg("volumepath|string|Volume file") String volumepath, |
4076 | - @Arg("rmiport|int:1099:0:99999|RMI Management port") int rmiport, |
4077 | - @Arg("_flag|y|Recover committed transactions") boolean y) throws Exception { |
4078 | + String open(@Arg("datapath|string|Data path") final String datapath, |
4079 | + @Arg("journalpath|string|Journal path") final String journalpath, |
4080 | + @Arg("volumepath|string|Volume file") final String volumepath, |
4081 | + @Arg("rmiport|int:1099:0:99999|RMI Management port") final int rmiport, |
4082 | + @Arg("_flag|y|Recover committed transactions") final boolean y) throws Exception { |
4083 | |
4084 | if (_live) { |
4085 | return "Cannot open another Persistit instance within a live system"; |
4086 | } |
4087 | close(false); |
4088 | |
4089 | - String jpath = journalPath(filesOnPath(journalpath.isEmpty() ? datapath : journalpath)); |
4090 | - List<VolumeSpecification> volumeSpecifications = volumeSpecifications( |
4091 | + final String jpath = journalPath(filesOnPath(journalpath.isEmpty() ? datapath : journalpath)); |
4092 | + final List<VolumeSpecification> volumeSpecifications = volumeSpecifications( |
4093 | filesOnPath(volumepath.isEmpty() ? datapath : volumepath), Long.MAX_VALUE); |
4094 | - Set<Integer> bufferSizes = new HashSet<Integer>(); |
4095 | + final Set<Integer> bufferSizes = new HashSet<Integer>(); |
4096 | for (final VolumeSpecification vs : volumeSpecifications) { |
4097 | bufferSizes.add(vs.getPageSize()); |
4098 | } |
4099 | final Properties properties = new Properties(); |
4100 | - long bpoolMemory = availableMemory() / 2; |
4101 | + final long bpoolMemory = availableMemory() / 2; |
4102 | for (final Integer size : bufferSizes) { |
4103 | - int alloc = (int) (size * 1.25); |
4104 | + final int alloc = (int) (size * 1.25); |
4105 | final int count = (int) ((bpoolMemory / bufferSizes.size()) / alloc); |
4106 | properties.put(Persistit.BUFFERS_PROPERTY_NAME + size, Integer.toString(count)); |
4107 | } |
4108 | @@ -755,7 +755,7 @@ |
4109 | } |
4110 | |
4111 | @Cmd("close") |
4112 | - String close(@Arg("_flag|f|Flush modifications to disk") boolean flush) throws Exception { |
4113 | + String close(@Arg("_flag|f|Flush modifications to disk") final boolean flush) throws Exception { |
4114 | if (_persistit != null) { |
4115 | try { |
4116 | if (_live) { |
4117 | @@ -764,7 +764,7 @@ |
4118 | _persistit.shutdownGUI(); |
4119 | _persistit.close(flush); |
4120 | } |
4121 | - } catch (Exception e) { |
4122 | + } catch (final Exception e) { |
4123 | return e.toString(); |
4124 | } finally { |
4125 | _persistit = null; |
4126 | @@ -832,6 +832,7 @@ |
4127 | public void runTask() throws Exception { |
4128 | final JournalTool jt = new JournalTool(_persistit); |
4129 | jt.setAction(jt.new SimpleDumpAction() { |
4130 | + @Override |
4131 | protected void write(final String msg) { |
4132 | postMessage(msg, LOG_NORMAL); |
4133 | } |
4134 | @@ -923,7 +924,7 @@ |
4135 | return; |
4136 | } |
4137 | |
4138 | - List<Object> selected = new ArrayList<Object>(); |
4139 | + final List<Object> selected = new ArrayList<Object>(); |
4140 | final TreeSelector selector = TreeSelector.parseSelector(tstring, r, '\\'); |
4141 | |
4142 | for (final Volume volume : _persistit.getVolumes()) { |
4143 | @@ -988,10 +989,10 @@ |
4144 | if (!keyString.isEmpty()) { |
4145 | new KeyParser(keyString).parseKey(exchange.getKey()); |
4146 | } |
4147 | - StringBuilder sb = new StringBuilder(); |
4148 | - int depth = _currentTree.getDepth(); |
4149 | + final StringBuilder sb = new StringBuilder(); |
4150 | + final int depth = _currentTree.getDepth(); |
4151 | for (int level = depth; --level >= 0;) { |
4152 | - Buffer copy = exchange.fetchBufferCopy(level); |
4153 | + final Buffer copy = exchange.fetchBufferCopy(level); |
4154 | if (sb.length() > 0) { |
4155 | sb.append(Util.NEW_LINE); |
4156 | } |
4157 | @@ -1051,7 +1052,7 @@ |
4158 | return; |
4159 | } |
4160 | if (index >= 0) { |
4161 | - BufferPool pool = _persistit.getBufferPool(pageSize); |
4162 | + final BufferPool pool = _persistit.getBufferPool(pageSize); |
4163 | buffer = pool.getBufferCopy(index); |
4164 | } else if (journalAddress >= 0) { |
4165 | buffer = _persistit.getJournalManager().readPageBuffer(journalAddress); |
4166 | @@ -1088,12 +1089,13 @@ |
4167 | } |
4168 | } |
4169 | |
4170 | + @Override |
4171 | public String getStatus() { |
4172 | return ""; |
4173 | } |
4174 | }; |
4175 | } |
4176 | - |
4177 | + |
4178 | @Cmd("pviewchain") |
4179 | Task pviewchain(final @Arg("page|long:0:0:99999999999999999|Starting page address") long pageAddress, |
4180 | final @Arg("find|long:-1:0:99999999999999999|Optional page pointer to find") long findPointer, |
4181 | @@ -1102,7 +1104,7 @@ |
4182 | final @Arg("maxvalue|int:42:4:100000|Maximum displayed value length") int maxvalue, |
4183 | final @Arg("context|int:3:0:100000|Context lines") int context, |
4184 | final @Arg("_flag|a|All lines") boolean allLines, final @Arg("_flag|s|Summary only") boolean summary) { |
4185 | - |
4186 | + |
4187 | return new Task() { |
4188 | |
4189 | @Override |
4190 | @@ -1121,15 +1123,15 @@ |
4191 | postMessage(buffer.toStringDetail(findPointer, maxkey, maxvalue, context, allLines), LOG_NORMAL); |
4192 | } |
4193 | currentPage = buffer.getRightSibling(); |
4194 | - } |
4195 | + } |
4196 | } |
4197 | |
4198 | @Override |
4199 | public String getStatus() { |
4200 | return ""; |
4201 | } |
4202 | - |
4203 | - }; |
4204 | + |
4205 | + }; |
4206 | } |
4207 | |
4208 | @Cmd("jquery") |
4209 | @@ -1140,6 +1142,7 @@ |
4210 | final @Arg("_flag|V|Show volume handle map") boolean showTreeMap, |
4211 | final @Arg("_flag|T|Show tree handle map") boolean showVolumeMap) { |
4212 | return new Task() { |
4213 | + @Override |
4214 | public void runTask() throws Exception { |
4215 | if (!showVolumeMap && !showTreeMap && pageAddress == -1 && ts == -1) { |
4216 | postMessage("No items requested", LOG_NORMAL); |
4217 | @@ -1147,20 +1150,20 @@ |
4218 | } |
4219 | if (showVolumeMap) { |
4220 | postMessage("Volume Handle Map", LOG_NORMAL); |
4221 | - Map<Integer, Volume> map = _persistit.getJournalManager().queryVolumeMap(); |
4222 | + final Map<Integer, Volume> map = _persistit.getJournalManager().queryVolumeMap(); |
4223 | for (final Map.Entry<Integer, Volume> entry : map.entrySet()) { |
4224 | postMessage(String.format("%,5d -> %s", entry.getKey(), entry.getValue()), LOG_NORMAL); |
4225 | } |
4226 | } |
4227 | if (showVolumeMap) { |
4228 | postMessage("Tree Handle Map", LOG_NORMAL); |
4229 | - Map<Integer, TreeDescriptor> map = _persistit.getJournalManager().queryTreeMap(); |
4230 | + final Map<Integer, TreeDescriptor> map = _persistit.getJournalManager().queryTreeMap(); |
4231 | for (final Map.Entry<Integer, TreeDescriptor> entry : map.entrySet()) { |
4232 | postMessage(String.format("%,5d -> %s", entry.getKey(), entry.getValue()), LOG_NORMAL); |
4233 | } |
4234 | } |
4235 | if (ts != -1) { |
4236 | - TransactionMapItem item = _persistit.getJournalManager().queryTransactionMap(ts); |
4237 | + final TransactionMapItem item = _persistit.getJournalManager().queryTransactionMap(ts); |
4238 | postMessage(String.format("TransactionMapItem for ts=%,d -> %s", ts, item), LOG_NORMAL); |
4239 | } |
4240 | if (pageAddress != -1) { |
4241 | @@ -1168,7 +1171,7 @@ |
4242 | if (volumeHandle != -1) { |
4243 | queryPageNode(volumeHandle, pageAddress, verbose); |
4244 | } else { |
4245 | - Map<Integer, Volume> volumeMap = _persistit.getJournalManager().queryVolumeMap(); |
4246 | + final Map<Integer, Volume> volumeMap = _persistit.getJournalManager().queryVolumeMap(); |
4247 | for (final int handle : volumeMap.keySet()) { |
4248 | queryPageNode(handle, pageAddress, verbose); |
4249 | } |
4250 | @@ -1202,6 +1205,7 @@ |
4251 | final @Arg("_flag|v|Verbose") boolean verbose) throws Exception { |
4252 | |
4253 | return new Task() { |
4254 | + @Override |
4255 | public void runTask() throws Exception { |
4256 | final File target = new File(file); |
4257 | if (target.exists() && !ovewrite) { |
4258 | @@ -1255,12 +1259,12 @@ |
4259 | zos.closeEntry(); |
4260 | bb.clear(); |
4261 | |
4262 | - PrintWriter writer = new PrintWriter(zos); |
4263 | + final PrintWriter writer = new PrintWriter(zos); |
4264 | ze = new ZipEntry(basePath + ".txt"); |
4265 | ze.setSize(Integer.MAX_VALUE); |
4266 | ze.setTime(baseTime); |
4267 | zos.putNextEntry(ze); |
4268 | - List<Volume> volumes = _persistit.getVolumes(); |
4269 | + final List<Volume> volumes = _persistit.getVolumes(); |
4270 | |
4271 | writer.printf("@volumes=%d\n", volumes.size()); |
4272 | for (final Volume volume : volumes) { |
4273 | @@ -1314,7 +1318,7 @@ |
4274 | |
4275 | @Cmd("cliserver") |
4276 | static Task cliserver(final @Arg("port|int:9999:1024:99999999") int port) throws Exception { |
4277 | - Task task = new Task() { |
4278 | + final Task task = new Task() { |
4279 | CLI _cli; |
4280 | |
4281 | @Override |
4282 | @@ -1325,9 +1329,9 @@ |
4283 | |
4284 | @Override |
4285 | public String getStatus() { |
4286 | - CLI cli = _cli; |
4287 | + final CLI cli = _cli; |
4288 | if (cli != null) { |
4289 | - String status = cli._lastStatus; |
4290 | + final String status = cli._lastStatus; |
4291 | if (status != null) { |
4292 | return status; |
4293 | } |
4294 | @@ -1339,12 +1343,12 @@ |
4295 | return task; |
4296 | } |
4297 | |
4298 | - private static String journalPath(List<String> files) { |
4299 | + private static String journalPath(final List<String> files) { |
4300 | String journalPath = null; |
4301 | for (final String file : files) { |
4302 | - Matcher matcher = JournalManager.PATH_PATTERN.matcher(file); |
4303 | + final Matcher matcher = JournalManager.PATH_PATTERN.matcher(file); |
4304 | if (matcher.matches()) { |
4305 | - String path = matcher.group(1); |
4306 | + final String path = matcher.group(1); |
4307 | if (journalPath == null) { |
4308 | journalPath = path; |
4309 | } else if (!journalPath.equals(path)) { |
4310 | @@ -1355,7 +1359,7 @@ |
4311 | return journalPath; |
4312 | } |
4313 | |
4314 | - private static List<VolumeSpecification> volumeSpecifications(List<String> files, long systemTimestamp) { |
4315 | + private static List<VolumeSpecification> volumeSpecifications(final List<String> files, final long systemTimestamp) { |
4316 | final List<VolumeSpecification> list = new ArrayList<VolumeSpecification>(); |
4317 | for (final String path : files) { |
4318 | if (JournalManager.PATH_PATTERN.matcher(path).matches()) { |
4319 | @@ -1366,7 +1370,7 @@ |
4320 | if (VolumeHeader.verifyVolumeHeader(specification, systemTimestamp)) { |
4321 | list.add(specification); |
4322 | } |
4323 | - } catch (PersistitException e) { |
4324 | + } catch (final PersistitException e) { |
4325 | // ignore this file |
4326 | } |
4327 | } |
4328 | |
4329 | === modified file 'src/main/java/com/persistit/CheckpointManager.java' |
4330 | --- src/main/java/com/persistit/CheckpointManager.java 2012-08-02 04:45:28 +0000 |
4331 | +++ src/main/java/com/persistit/CheckpointManager.java 2012-08-24 18:21:19 +0000 |
4332 | @@ -43,7 +43,7 @@ |
4333 | private final long _systemTime; |
4334 | |
4335 | private volatile boolean _completed = false; |
4336 | - |
4337 | + |
4338 | Checkpoint(final long timestamp, final long systemTime) { |
4339 | _timestamp = timestamp; |
4340 | _systemTime = systemTime; |
4341 | @@ -72,8 +72,8 @@ |
4342 | |
4343 | @Override |
4344 | public String toString() { |
4345 | - return String.format("Checkpoint %,d%s @ %s", _timestamp, isCompleted() ? "c" : "u", SDF.format(new Date( |
4346 | - _systemTime))); |
4347 | + return String.format("Checkpoint %,d%s @ %s", _timestamp, isCompleted() ? "c" : "u", |
4348 | + SDF.format(new Date(_systemTime))); |
4349 | } |
4350 | |
4351 | @Override |
4352 | @@ -81,7 +81,7 @@ |
4353 | if (!(object instanceof Checkpoint)) { |
4354 | return false; |
4355 | } |
4356 | - Checkpoint cp = (Checkpoint) object; |
4357 | + final Checkpoint cp = (Checkpoint) object; |
4358 | return cp._systemTime == _systemTime && cp._timestamp == _timestamp; |
4359 | } |
4360 | } |
4361 | @@ -92,9 +92,9 @@ |
4362 | * Default interval in nanoseconds between checkpoints - two minutes. |
4363 | */ |
4364 | private final static long DEFAULT_CHECKPOINT_INTERVAL = 120; |
4365 | - |
4366 | + |
4367 | private final static long MINIMUM_CHECKPOINT_INTERVAL = 10; |
4368 | - |
4369 | + |
4370 | private final static long MAXIMUM_CHECKPOINT_INTERVAL = 1800; |
4371 | |
4372 | private final static Checkpoint UNAVALABLE_CHECKPOINT = new Checkpoint(0, 0); |
4373 | @@ -110,13 +110,12 @@ |
4374 | private final static long FLUSH_CHECKPOINT_INTERVAL = 5000; |
4375 | |
4376 | private volatile Checkpoint _currentCheckpoint = new Checkpoint(0, 0, true); |
4377 | - |
4378 | - private List<Checkpoint> _outstandingCheckpoints = new ArrayList<Checkpoint>(); |
4379 | - |
4380 | - |
4381 | - private AtomicBoolean _closed = new AtomicBoolean(); |
4382 | - |
4383 | - private AtomicBoolean _fastClose = new AtomicBoolean(); |
4384 | + |
4385 | + private final List<Checkpoint> _outstandingCheckpoints = new ArrayList<Checkpoint>(); |
4386 | + |
4387 | + private final AtomicBoolean _closed = new AtomicBoolean(); |
4388 | + |
4389 | + private final AtomicBoolean _fastClose = new AtomicBoolean(); |
4390 | |
4391 | CheckpointManager(final Persistit persistit) { |
4392 | super(persistit); |
4393 | @@ -139,12 +138,12 @@ |
4394 | Checkpoint getCurrentCheckpoint() { |
4395 | return _currentCheckpoint; |
4396 | } |
4397 | - |
4398 | + |
4399 | long getCheckpointIntervalNanos() { |
4400 | return _checkpointIntervalNanos; |
4401 | } |
4402 | |
4403 | - void setCheckpointIntervalNanos(long interval) { |
4404 | + void setCheckpointIntervalNanos(final long interval) { |
4405 | _checkpointIntervalNanos = interval; |
4406 | } |
4407 | |
4408 | @@ -159,19 +158,19 @@ |
4409 | } |
4410 | |
4411 | @Override |
4412 | - public void setCheckpointInterval(long interval) { |
4413 | + public void setCheckpointInterval(final long interval) { |
4414 | Util.rangeCheck(interval, MINIMUM_CHECKPOINT_INTERVAL, MAXIMUM_CHECKPOINT_INTERVAL); |
4415 | _checkpointIntervalNanos = interval * NS_PER_S; |
4416 | } |
4417 | - |
4418 | + |
4419 | @Override |
4420 | - public synchronized int getOutstandingCheckpointCount() { |
4421 | + public synchronized int getOutstandingCheckpointCount() { |
4422 | return _outstandingCheckpoints.size(); |
4423 | } |
4424 | - |
4425 | + |
4426 | @Override |
4427 | public synchronized String outstandingCheckpointReport() { |
4428 | - StringBuilder sb = new StringBuilder(); |
4429 | + final StringBuilder sb = new StringBuilder(); |
4430 | for (final Checkpoint cp : _outstandingCheckpoints) { |
4431 | sb.append(cp); |
4432 | sb.append(Util.NEW_LINE); |
4433 | @@ -180,7 +179,7 @@ |
4434 | } |
4435 | |
4436 | Checkpoint checkpoint() throws PersistitException { |
4437 | - Checkpoint checkpoint = createCheckpoint(); |
4438 | + final Checkpoint checkpoint = createCheckpoint(); |
4439 | _persistit.flushBuffers(checkpoint.getTimestamp()); |
4440 | |
4441 | while (true) { |
4442 | @@ -202,6 +201,7 @@ |
4443 | void pollCreateCheckpoint() throws PersistitException { |
4444 | final long now = System.nanoTime(); |
4445 | if (_lastCheckpointNanos + _checkpointIntervalNanos < now) { |
4446 | + _persistit.recordBufferPoolInventory(); |
4447 | createCheckpoint(); |
4448 | } |
4449 | } |
4450 | @@ -239,26 +239,26 @@ |
4451 | final SessionId saveSessionId = _persistit.getSessionId(); |
4452 | try { |
4453 | _persistit.setSessionId(_checkpointTxnSessionId); |
4454 | - Transaction txn = _persistit.getTransaction(); |
4455 | + final Transaction txn = _persistit.getTransaction(); |
4456 | |
4457 | _lastCheckpointNanos = System.nanoTime(); |
4458 | |
4459 | txn.beginCheckpoint(); |
4460 | try { |
4461 | _persistit.flushTransactions(txn.getStartTimestamp()); |
4462 | - List<Accumulator> accumulators = _persistit.getCheckpointAccumulators(); |
4463 | + final List<Accumulator> accumulators = _persistit.getCheckpointAccumulators(); |
4464 | _persistit.getTransactionIndex().checkpointAccumulatorSnapshots(txn.getStartTimestamp(), accumulators); |
4465 | Accumulator.saveAccumulatorCheckpointValues(accumulators); |
4466 | txn.commit(CommitPolicy.HARD); |
4467 | _currentCheckpoint = new Checkpoint(txn.getStartTimestamp(), System.currentTimeMillis()); |
4468 | _outstandingCheckpoints.add(_currentCheckpoint); |
4469 | _persistit.getLogBase().checkpointProposed.log(_currentCheckpoint); |
4470 | - return _currentCheckpoint; |
4471 | - } catch (InterruptedException ie) { |
4472 | + } catch (final InterruptedException ie) { |
4473 | throw new PersistitInterruptedException(ie); |
4474 | } finally { |
4475 | txn.end(); |
4476 | } |
4477 | + return _currentCheckpoint; |
4478 | } finally { |
4479 | _persistit.setSessionId(saveSessionId); |
4480 | } |
4481 | @@ -272,9 +272,9 @@ |
4482 | void pollFlushCheckpoint() { |
4483 | final long earliestDirtyTimestamp = _persistit.earliestDirtyTimestamp(); |
4484 | Checkpoint checkpoint = null; |
4485 | - synchronized(this) { |
4486 | + synchronized (this) { |
4487 | while (!_outstandingCheckpoints.isEmpty()) { |
4488 | - Checkpoint cp = _outstandingCheckpoints.get(0); |
4489 | + final Checkpoint cp = _outstandingCheckpoints.get(0); |
4490 | if (cp.getTimestamp() <= earliestDirtyTimestamp) { |
4491 | checkpoint = cp; |
4492 | _outstandingCheckpoints.remove(0); |
4493 | @@ -286,7 +286,7 @@ |
4494 | if (checkpoint != null) { |
4495 | try { |
4496 | _persistit.getJournalManager().writeCheckpointToJournal(checkpoint); |
4497 | - } catch (PersistitException e) { |
4498 | + } catch (final PersistitException e) { |
4499 | _persistit.getLogBase().exception.log(e); |
4500 | } |
4501 | } |
4502 | |
4503 | === modified file 'src/main/java/com/persistit/ClassIndex.java' |
4504 | --- src/main/java/com/persistit/ClassIndex.java 2012-08-02 04:45:28 +0000 |
4505 | +++ src/main/java/com/persistit/ClassIndex.java 2012-08-24 18:21:19 +0000 |
4506 | @@ -71,8 +71,8 @@ |
4507 | INITIAL_CAPACITY); |
4508 | |
4509 | private int _testIdFloor = Integer.MIN_VALUE; |
4510 | - private AtomicInteger _cacheMisses = new AtomicInteger(); |
4511 | - private AtomicInteger _discardedDuplicates = new AtomicInteger(); |
4512 | + private final AtomicInteger _cacheMisses = new AtomicInteger(); |
4513 | + private final AtomicInteger _discardedDuplicates = new AtomicInteger(); |
4514 | |
4515 | /** |
4516 | * A structure holding a ClassInfo, plus links to other related |
4517 | @@ -82,7 +82,7 @@ |
4518 | final ClassInfoEntry _next; |
4519 | final ClassInfo _classInfo; |
4520 | |
4521 | - ClassInfoEntry(ClassInfo ci, ClassInfoEntry next) { |
4522 | + ClassInfoEntry(final ClassInfo ci, final ClassInfoEntry next) { |
4523 | _classInfo = ci; |
4524 | _next = next; |
4525 | } |
4526 | @@ -95,7 +95,7 @@ |
4527 | * @param persistit |
4528 | * Owning Persistit instance. |
4529 | */ |
4530 | - ClassIndex(Persistit persistit) { |
4531 | + ClassIndex(final Persistit persistit) { |
4532 | _persistit = persistit; |
4533 | } |
4534 | |
4535 | @@ -117,8 +117,8 @@ |
4536 | * The handle |
4537 | * @return The associated ClassInfo, or <i>null</i> if there is none. |
4538 | */ |
4539 | - public ClassInfo lookupByHandle(int handle) { |
4540 | - AtomicReferenceArray<ClassInfoEntry> hashTable = _hashTable; |
4541 | + public ClassInfo lookupByHandle(final int handle) { |
4542 | + final AtomicReferenceArray<ClassInfoEntry> hashTable = _hashTable; |
4543 | ClassInfoEntry cie = hashTable.get(handle % hashTable.length()); |
4544 | while (cie != null) { |
4545 | if (cie._classInfo.getHandle() == handle) |
4546 | @@ -138,43 +138,44 @@ |
4547 | try { |
4548 | ex.clear().append(BY_HANDLE).append(handle).fetch(); |
4549 | txn.commit(); |
4550 | - } catch (Exception e) { |
4551 | + } catch (final Exception e) { |
4552 | _persistit.getLogBase().exception.log(e); |
4553 | throw new ConversionException(e); |
4554 | } finally { |
4555 | txn.end(); |
4556 | } |
4557 | - Value value = ex.getValue(); |
4558 | + final Value value = ex.getValue(); |
4559 | if (value.isDefined()) { |
4560 | value.setStreamMode(true); |
4561 | - int storedId = value.getInt(); |
4562 | - String storedName = value.getString(); |
4563 | - long storedSuid = value.getLong(); |
4564 | + final int storedId = value.getInt(); |
4565 | + final String storedName = value.getString(); |
4566 | + final long storedSuid = value.getLong(); |
4567 | if (storedId != handle) { |
4568 | throw new IllegalStateException("ClassInfo stored for handle=" + handle |
4569 | + " has invalid stored handle=" + storedId); |
4570 | } |
4571 | - Class<?> cl = Class.forName(storedName, false, Thread.currentThread().getContextClassLoader()); |
4572 | + final Class<?> cl = Class |
4573 | + .forName(storedName, false, Thread.currentThread().getContextClassLoader()); |
4574 | |
4575 | long suid = 0; |
4576 | - ObjectStreamClass osc = ObjectStreamClass.lookupAny(cl); |
4577 | + final ObjectStreamClass osc = ObjectStreamClass.lookupAny(cl); |
4578 | if (osc != null) |
4579 | suid = osc.getSerialVersionUID(); |
4580 | if (storedSuid != suid) { |
4581 | throw new ConversionException("Class " + cl.getName() + " persistent SUID=" + storedSuid |
4582 | + " does not match current class SUID=" + suid); |
4583 | } |
4584 | - ClassInfo ci = new ClassInfo(cl, suid, handle, osc); |
4585 | + final ClassInfo ci = new ClassInfo(cl, suid, handle, osc); |
4586 | hashClassInfo(ci); |
4587 | return ci; |
4588 | } else { |
4589 | - ClassInfo ci = new ClassInfo(null, 0, handle, null); |
4590 | + final ClassInfo ci = new ClassInfo(null, 0, handle, null); |
4591 | hashClassInfo(ci); |
4592 | return ci; |
4593 | } |
4594 | - } catch (ClassNotFoundException cnfe) { |
4595 | + } catch (final ClassNotFoundException cnfe) { |
4596 | throw new ConversionException(cnfe); |
4597 | - } catch (PersistitException pe) { |
4598 | + } catch (final PersistitException pe) { |
4599 | throw new ConversionException(pe); |
4600 | } finally { |
4601 | if (ex != null) |
4602 | @@ -191,13 +192,13 @@ |
4603 | * The <code>Class</code> |
4604 | * @return The ClassInfo for the specified Class. |
4605 | */ |
4606 | - public ClassInfo lookupByClass(Class<?> clazz) { |
4607 | - AtomicReferenceArray<ClassInfoEntry> hashTable = _hashTable; |
4608 | + public ClassInfo lookupByClass(final Class<?> clazz) { |
4609 | + final AtomicReferenceArray<ClassInfoEntry> hashTable = _hashTable; |
4610 | |
4611 | ObjectStreamClass osc = null; |
4612 | long suid = 0; |
4613 | |
4614 | - int nh = clazz.getName().hashCode() & 0x7FFFFFFF; |
4615 | + final int nh = clazz.getName().hashCode() & 0x7FFFFFFF; |
4616 | ClassInfoEntry cie = hashTable.get(nh % hashTable.length()); |
4617 | |
4618 | while (cie != null) { |
4619 | @@ -260,14 +261,14 @@ |
4620 | final int handle; |
4621 | txn.begin(); |
4622 | ex.clear().append(BY_NAME).append(clazz.getName()).append(suid).fetch(); |
4623 | - Value value = ex.getValue(); |
4624 | + final Value value = ex.getValue(); |
4625 | try { |
4626 | if (value.isDefined()) { |
4627 | value.setStreamMode(true); |
4628 | |
4629 | handle = value.getInt(); |
4630 | - String storedName = value.getString(); |
4631 | - long storedSuid = value.getLong(); |
4632 | + final String storedName = value.getString(); |
4633 | + final long storedSuid = value.getLong(); |
4634 | |
4635 | if (storedSuid != suid || !clazz.getName().equals(storedName)) { |
4636 | throw new ConversionException("Class " + clazz.getName() + " persistent SUID=" + storedSuid |
4637 | @@ -301,7 +302,7 @@ |
4638 | } finally { |
4639 | txn.end(); |
4640 | } |
4641 | - } catch (PersistitException pe) { |
4642 | + } catch (final PersistitException pe) { |
4643 | throw new ConversionException(pe); |
4644 | } finally { |
4645 | if (ex != null) { |
4646 | @@ -322,16 +323,16 @@ |
4647 | * @param clazz |
4648 | * Class instance to register. |
4649 | */ |
4650 | - public void registerClass(Class<?> clazz) { |
4651 | + public void registerClass(final Class<?> clazz) { |
4652 | lookupByClass(clazz); |
4653 | } |
4654 | |
4655 | - private void hashClassInfo(ClassInfo ci) { |
4656 | - int size = _size.get(); |
4657 | + private void hashClassInfo(final ClassInfo ci) { |
4658 | + final int size = _size.get(); |
4659 | if (size * EXTRA_FACTOR > _hashTable.length()) { |
4660 | - int discarded = _discardedDuplicates.get(); |
4661 | - AtomicReferenceArray<ClassInfoEntry> newHashTable = new AtomicReferenceArray<ClassInfoEntry>(EXTRA_FACTOR |
4662 | - * 2 * size); |
4663 | + final int discarded = _discardedDuplicates.get(); |
4664 | + final AtomicReferenceArray<ClassInfoEntry> newHashTable = new AtomicReferenceArray<ClassInfoEntry>( |
4665 | + EXTRA_FACTOR * 2 * size); |
4666 | for (int i = 0; i < _hashTable.length(); i++) { |
4667 | ClassInfoEntry cie = _hashTable.get(i); |
4668 | while (cie != null) { |
4669 | @@ -345,7 +346,7 @@ |
4670 | addHashEntry(_hashTable, ci); |
4671 | } |
4672 | |
4673 | - private void addHashEntry(final AtomicReferenceArray<ClassInfoEntry> hashTable, ClassInfo ci) { |
4674 | + private void addHashEntry(final AtomicReferenceArray<ClassInfoEntry> hashTable, final ClassInfo ci) { |
4675 | final int hh = ci.getHandle() % hashTable.length(); |
4676 | final int nh = ci.getDescribedClass() == null ? -1 |
4677 | : ((ci.getDescribedClass().getName().hashCode() & 0x7FFFFFFF) % hashTable.length()); |
4678 | @@ -358,7 +359,8 @@ |
4679 | } |
4680 | } |
4681 | |
4682 | - private boolean addHashEntry(final AtomicReferenceArray<ClassInfoEntry> hashTable, ClassInfo ci, final int hash) { |
4683 | + private boolean addHashEntry(final AtomicReferenceArray<ClassInfoEntry> hashTable, final ClassInfo ci, |
4684 | + final int hash) { |
4685 | ClassInfoEntry cie = hashTable.get(hash); |
4686 | while (cie != null) { |
4687 | if (ci.equals(cie._classInfo)) { |
4688 | @@ -367,7 +369,7 @@ |
4689 | cie = cie._next; |
4690 | } |
4691 | cie = hashTable.get(hash); |
4692 | - ClassInfoEntry newCie = new ClassInfoEntry(ci, cie); |
4693 | + final ClassInfoEntry newCie = new ClassInfoEntry(ci, cie); |
4694 | hashTable.set(hash, newCie); |
4695 | _size.incrementAndGet(); |
4696 | return true; |
4697 | @@ -375,14 +377,14 @@ |
4698 | |
4699 | private Exchange getExchange() throws PersistitException { |
4700 | try { |
4701 | - Volume volume = _persistit.getSystemVolume(); |
4702 | + final Volume volume = _persistit.getSystemVolume(); |
4703 | return _persistit.getExchange(volume, CLASS_INDEX_TREE_NAME, true); |
4704 | - } catch (PersistitException pe) { |
4705 | + } catch (final PersistitException pe) { |
4706 | throw new ConversionException(pe); |
4707 | } |
4708 | } |
4709 | |
4710 | - private void releaseExchange(Exchange ex) { |
4711 | + private void releaseExchange(final Exchange ex) { |
4712 | _persistit.releaseExchange(ex); |
4713 | } |
4714 | |
4715 | |
4716 | === modified file 'src/main/java/com/persistit/ClassInfo.java' |
4717 | --- src/main/java/com/persistit/ClassInfo.java 2012-08-02 04:45:28 +0000 |
4718 | +++ src/main/java/com/persistit/ClassInfo.java 2012-08-24 18:21:19 +0000 |
4719 | @@ -24,21 +24,22 @@ |
4720 | */ |
4721 | |
4722 | class ClassInfo { |
4723 | - private Class<?> _class; |
4724 | - private long _suid; |
4725 | - private int _handle; |
4726 | - private ObjectStreamClass _osc; |
4727 | + private final Class<?> _class; |
4728 | + private final long _suid; |
4729 | + private final int _handle; |
4730 | + private final ObjectStreamClass _osc; |
4731 | |
4732 | - ClassInfo(Class<?> cl, long suid, int handle, ObjectStreamClass osc) { |
4733 | + ClassInfo(final Class<?> cl, final long suid, final int handle, final ObjectStreamClass osc) { |
4734 | _class = cl; |
4735 | _suid = suid; |
4736 | _handle = handle; |
4737 | _osc = osc; |
4738 | } |
4739 | |
4740 | + @Override |
4741 | public boolean equals(final Object object) { |
4742 | if (object instanceof ClassInfo) { |
4743 | - ClassInfo ci = (ClassInfo) object; |
4744 | + final ClassInfo ci = (ClassInfo) object; |
4745 | if (equals(_class, ci._class) && _handle == ci._handle && _suid == ci._suid) { |
4746 | return true; |
4747 | } |
4748 | @@ -46,6 +47,7 @@ |
4749 | return false; |
4750 | } |
4751 | |
4752 | + @Override |
4753 | public int hashCode() { |
4754 | return _class.hashCode() ^ _handle ^ (int) _suid; |
4755 | } |
4756 | @@ -86,9 +88,8 @@ |
4757 | public ObjectStreamClass getClassDescriptor() { |
4758 | return _osc; |
4759 | } |
4760 | - |
4761 | - private boolean equals(Class<?> a, Class<?> b) { |
4762 | + |
4763 | + private boolean equals(final Class<?> a, final Class<?> b) { |
4764 | return a == null ? b == null : a.equals(b); |
4765 | } |
4766 | } |
4767 | - |
4768 | |
4769 | === modified file 'src/main/java/com/persistit/CleanupManager.java' |
4770 | --- src/main/java/com/persistit/CleanupManager.java 2012-08-02 04:45:28 +0000 |
4771 | +++ src/main/java/com/persistit/CleanupManager.java 2012-08-24 18:21:19 +0000 |
4772 | @@ -46,17 +46,17 @@ |
4773 | |
4774 | final Queue<CleanupAction> _cleanupActionQueue = new ArrayBlockingQueue<CleanupAction>(DEFAULT_QUEUE_SIZE); |
4775 | |
4776 | - private AtomicBoolean _closed = new AtomicBoolean(); |
4777 | - |
4778 | - private AtomicLong _accepted = new AtomicLong(); |
4779 | - |
4780 | - private AtomicLong _refused = new AtomicLong(); |
4781 | - |
4782 | - private AtomicLong _performed = new AtomicLong(); |
4783 | - |
4784 | - private AtomicLong _errors = new AtomicLong(); |
4785 | - |
4786 | - private AtomicLong _minimumPruningDelay = new AtomicLong(DEFAULT_MINIMUM_PRUNING_DELAY); |
4787 | + private final AtomicBoolean _closed = new AtomicBoolean(); |
4788 | + |
4789 | + private final AtomicLong _accepted = new AtomicLong(); |
4790 | + |
4791 | + private final AtomicLong _refused = new AtomicLong(); |
4792 | + |
4793 | + private final AtomicLong _performed = new AtomicLong(); |
4794 | + |
4795 | + private final AtomicLong _errors = new AtomicLong(); |
4796 | + |
4797 | + private final AtomicLong _minimumPruningDelay = new AtomicLong(DEFAULT_MINIMUM_PRUNING_DELAY); |
4798 | |
4799 | CleanupManager(final Persistit persistit) { |
4800 | super(persistit); |
4801 | @@ -81,8 +81,8 @@ |
4802 | return _closed.get(); |
4803 | } |
4804 | |
4805 | - synchronized boolean offer(CleanupAction action) { |
4806 | - boolean accepted = _cleanupActionQueue.offer(action); |
4807 | + synchronized boolean offer(final CleanupAction action) { |
4808 | + final boolean accepted = _cleanupActionQueue.offer(action); |
4809 | if (accepted) { |
4810 | _accepted.incrementAndGet(); |
4811 | } else { |
4812 | @@ -148,9 +148,10 @@ |
4813 | try { |
4814 | action.performAction(_persistit); |
4815 | _performed.incrementAndGet(); |
4816 | - } catch (PersistitException e) { |
4817 | + } catch (final PersistitException e) { |
4818 | lastException(e); |
4819 | - _persistit.getAlertMonitor().post(new Event(AlertLevel.ERROR, _persistit.getLogBase().cleanupException, e, action), |
4820 | + _persistit.getAlertMonitor().post( |
4821 | + new Event(AlertLevel.ERROR, _persistit.getLogBase().cleanupException, e, action), |
4822 | AlertMonitor.CLEANUP_CATEGORY); |
4823 | _errors.incrementAndGet(); |
4824 | } |
4825 | @@ -164,7 +165,7 @@ |
4826 | |
4827 | @Override |
4828 | public synchronized String toString() { |
4829 | - StringBuilder sb = new StringBuilder("["); |
4830 | + final StringBuilder sb = new StringBuilder("["); |
4831 | for (final CleanupAction a : _cleanupActionQueue) { |
4832 | if (sb.length() > 1) { |
4833 | sb.append(",\n "); |
4834 | @@ -188,9 +189,9 @@ |
4835 | } |
4836 | |
4837 | @Override |
4838 | - public boolean equals(Object other) { |
4839 | + public boolean equals(final Object other) { |
4840 | if (other instanceof CleanupTreePage) { |
4841 | - CleanupTreePage a = (CleanupTreePage) other; |
4842 | + final CleanupTreePage a = (CleanupTreePage) other; |
4843 | return a._page == _page && a._treeHandle == _treeHandle && getClass().equals(a.getClass()); |
4844 | } else { |
4845 | return false; |
4846 | @@ -199,10 +200,10 @@ |
4847 | } |
4848 | |
4849 | @Override |
4850 | - public int compareTo(CleanupAction other) { |
4851 | + public int compareTo(final CleanupAction other) { |
4852 | if (other instanceof CleanupTreePage) { |
4853 | - CleanupTreePage a = (CleanupTreePage) other; |
4854 | - int d = _treeHandle - a._treeHandle; |
4855 | + final CleanupTreePage a = (CleanupTreePage) other; |
4856 | + final int d = _treeHandle - a._treeHandle; |
4857 | if (d != 0) { |
4858 | return d; |
4859 | } |
4860 | @@ -222,15 +223,15 @@ |
4861 | if (tree == null) { |
4862 | return null; |
4863 | } |
4864 | - WeakReference<Exchange> ref = _exchangeThreadLocal.get(); |
4865 | + final WeakReference<Exchange> ref = _exchangeThreadLocal.get(); |
4866 | if (ref != null) { |
4867 | - Exchange exchange = ref.get(); |
4868 | + final Exchange exchange = ref.get(); |
4869 | if (exchange != null) { |
4870 | exchange.init(tree); |
4871 | return exchange; |
4872 | } |
4873 | } |
4874 | - Exchange exchange = new Exchange(tree); |
4875 | + final Exchange exchange = new Exchange(tree); |
4876 | _exchangeThreadLocal.set(new WeakReference<Exchange>(exchange)); |
4877 | return exchange; |
4878 | } |
4879 | @@ -253,7 +254,7 @@ |
4880 | |
4881 | static class CleanupPruneAction extends CleanupTreePage { |
4882 | |
4883 | - CleanupPruneAction(int treeHandle, long page) { |
4884 | + CleanupPruneAction(final int treeHandle, final long page) { |
4885 | super(treeHandle, page); |
4886 | } |
4887 | |
4888 | @@ -269,7 +270,7 @@ |
4889 | static class CleanupIndexHole extends CleanupTreePage { |
4890 | int _level; |
4891 | |
4892 | - CleanupIndexHole(int treeHandle, long page, int level) { |
4893 | + CleanupIndexHole(final int treeHandle, final long page, final int level) { |
4894 | super(treeHandle, page); |
4895 | _level = level; |
4896 | } |
4897 | |
4898 | === modified file 'src/main/java/com/persistit/Configuration.java' |
4899 | --- src/main/java/com/persistit/Configuration.java 2012-08-07 21:11:28 +0000 |
4900 | +++ src/main/java/com/persistit/Configuration.java 2012-08-24 18:21:19 +0000 |
4901 | @@ -263,24 +263,27 @@ |
4902 | /** |
4903 | * Property name for the "append only" property. |
4904 | */ |
4905 | - public final static String APPEND_ONLY_PROPERTY = "appendonly"; |
4906 | - |
4907 | + public final static String APPEND_ONLY_PROPERTY_NAME = "appendonly"; |
4908 | + |
4909 | /** |
4910 | * Property name for the "ignore missing volumes" property. |
4911 | */ |
4912 | public final static String IGNORE_MISSING_VOLUMES_PROPERTY = "ignoremissingvolumes"; |
4913 | - |
4914 | + |
4915 | /** |
4916 | * Property name to specify the default {@link SplitPolicy}. |
4917 | */ |
4918 | public final static String SPLIT_POLICY_PROPERTY_NAME = "splitpolicy"; |
4919 | - |
4920 | - /** |
4921 | - * Property name to specify the"buffer inventory" property name. |
4922 | + |
4923 | + /** |
4924 | + * Property name to specify whether buffer preloading is enabled. |
4925 | + */ |
4926 | + public final static String BUFFER_PRELOAD_PROPERTY_NAME = "bufferpreload"; |
4927 | + |
4928 | + /** |
4929 | + * Property name to specify whether buffer inventory is enabled. |
4930 | */ |
4931 | public final static String BUFFER_INVENTORY_PROPERTY_NAME = "bufferinventory"; |
4932 | - |
4933 | - public final static String BUFFER_POLLING_INTERVAL_PROPERTY = "bufferpollinginterval"; |
4934 | |
4935 | /** |
4936 | * Property name to specify the default {@link JoinPolicy}. |
4937 | @@ -392,7 +395,7 @@ |
4938 | * @param minimumCount |
4939 | * the minimumCount to set |
4940 | */ |
4941 | - public void setMinimumCount(int minimumCount) { |
4942 | + public void setMinimumCount(final int minimumCount) { |
4943 | this.minimumCount = minimumCount; |
4944 | } |
4945 | |
4946 | @@ -407,7 +410,7 @@ |
4947 | * @param maximumCount |
4948 | * the maximumCount to set |
4949 | */ |
4950 | - public void setMaximumCount(int maximumCount) { |
4951 | + public void setMaximumCount(final int maximumCount) { |
4952 | this.maximumCount = maximumCount; |
4953 | } |
4954 | |
4955 | @@ -416,7 +419,7 @@ |
4956 | * |
4957 | * @param count |
4958 | */ |
4959 | - public void setCount(int count) { |
4960 | + public void setCount(final int count) { |
4961 | setMinimumCount(count); |
4962 | setMaximumCount(count); |
4963 | } |
4964 | @@ -432,7 +435,7 @@ |
4965 | * @param minimumMemory |
4966 | * the minimumMemory to set |
4967 | */ |
4968 | - public void setMinimumMemory(long minimumMemory) { |
4969 | + public void setMinimumMemory(final long minimumMemory) { |
4970 | this.minimumMemory = minimumMemory; |
4971 | } |
4972 | |
4973 | @@ -447,7 +450,7 @@ |
4974 | * @param maximumMemory |
4975 | * the maximumMemory to set |
4976 | */ |
4977 | - public void setMaximumMemory(long maximumMemory) { |
4978 | + public void setMaximumMemory(final long maximumMemory) { |
4979 | this.maximumMemory = maximumMemory; |
4980 | } |
4981 | |
4982 | @@ -462,7 +465,7 @@ |
4983 | * @param reservedMemory |
4984 | * the reservedMemory to set |
4985 | */ |
4986 | - public void setReservedMemory(long reservedMemory) { |
4987 | + public void setReservedMemory(final long reservedMemory) { |
4988 | this.reservedMemory = reservedMemory; |
4989 | } |
4990 | |
4991 | @@ -477,7 +480,7 @@ |
4992 | * @param fraction |
4993 | * the fraction to set |
4994 | */ |
4995 | - public void setFraction(float fraction) { |
4996 | + public void setFraction(final float fraction) { |
4997 | this.fraction = fraction; |
4998 | } |
4999 | |
5000 | @@ -496,10 +499,11 @@ |
This has a pre-req of the reformatting, but it doesn't look to have kicked in.
Could you try resubmitting? If that doesn't work then I'll do the diff manually for review.