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