-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
PageList.java
576 lines (514 loc) · 24.4 KB
/
PageList.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
/*
* Copyright (c) 2002-2018 "Neo Technology,"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.io.pagecache.impl.muninn;
import java.io.IOException;
import org.neo4j.io.mem.MemoryAllocator;
import org.neo4j.io.pagecache.PageCursor;
import org.neo4j.io.pagecache.PageSwapper;
import org.neo4j.io.pagecache.tracing.EvictionEvent;
import org.neo4j.io.pagecache.tracing.EvictionEventOpportunity;
import org.neo4j.io.pagecache.tracing.FlushEvent;
import org.neo4j.io.pagecache.tracing.PageFaultEvent;
import org.neo4j.unsafe.impl.internal.dragons.UnsafeUtil;
import static java.lang.String.format;
import static org.neo4j.util.FeatureToggles.flag;
/**
* The PageList maintains the off-heap meta-data for the individual memory pages.
*
* The meta-data for each page is the following:
*
* <table>
* <tr><th>Bytes</th><th>Use</th></tr>
* <tr><td>8</td><td>Sequence lock word.</td></tr>
* <tr><td>8</td><td>Pointer to the memory page.</td></tr>
* <tr><td>8</td><td>Last modified transaction id.</td></tr>
* <tr><td>5</td><td>File page id.</td></tr>
* <tr><td>1</td><td>Usage stamp. Optimistically incremented; truncated to a max of 4.</td></tr>
* <tr><td>2</td><td>Page swapper id.</td></tr>
* </table>
*/
class PageList
{
private static final boolean forceSlowMemoryClear = flag( PageList.class, "forceSlowMemoryClear", false );
public static final int META_DATA_BYTES_PER_PAGE = 32;
public static final long MAX_PAGES = Integer.MAX_VALUE;
private static final int UNBOUND_LAST_MODIFIED_TX_ID = -1;
// 40 bits for file page id
private static final long MAX_FILE_PAGE_ID = 0b11111111_11111111_11111111_11111111_11111111L;
private static final int OFFSET_LOCK_WORD = 0; // 8 bytes
private static final int OFFSET_ADDRESS = 8; // 8 bytes
private static final int OFFSET_LAST_TX_ID = 16; // 8 bytes
private static final int OFFSET_FILE_PAGE_ID = 24; // 5 bytes
@SuppressWarnings( "unused" )
private static final int OFFSET_SWAPPER_ID = 29; // 2 bytes, plus the 5 high-bits from usage counter
@SuppressWarnings( "unused" )
private static final int OFFSET_USAGE_COUNTER = 31; // 1 byte, but only the 3 low bits.
// todo we can alternatively also make use of the lower 12 bits of the address field, because
// todo the addresses are page aligned, and we can assume them to be at least 4096 bytes in size.
// xxx Thinking about it some more, it might even be possible to get down to just 16 bytes per page.
// xxx We cannot change the lock word, but if we change the eviction scheme to always go through the translation
// xxx tables to find pages, then we won't need the file page id. The address ought to have its lower 13 bits free.
// xxx Two of these can go to the usage counter, and the rest to the swapper id, for up to 2048 swappers.
// xxx Do we even need the swapper id at this point? If we can already infer the file page id, the same should be
// xxx true for the swapper.
// xxx The trouble with this idea is that we won't be able to seamlessly turn the translation tables into hash
// xxx tables when they get too big - at least not easily - since the index into the table no longer corresponds to
// xxx the file page id. We might still be able to get away with it, if with the page id we also keep a counter for
// xxx how many times the file page id loop around the translation table before arriving at the given entry.
// xxx That is, what the entry index should be multiplied by to get the file page id. To do this, we would, however,
// xxx have to either grab bits from the page id space, or make each entry more than 4 bytes. This will all depend
// xxx on where the cut-off point is. That is, what the max entry capacity for a translation table should be.
// xxx One potential cut-off point could be 2^29. That many 4 byte translation table entries would take up 2 GiB.
// xxx If we can then somehow put the wrap-around counter in the page meta-data by, for instance, taking a byte
// xxx from the bits in the address that we are no longer using for the swapper id, then we can support 255
// xxx wrap-arounds with bits to spare. This will allow us to address files that are up to 1 peta-byte in size.
// xxx At such extremes we'd only be able to keep up to 1/256th of the file in memory, which is 4 TiB, which in
// xxx turn is 1/8th of the 8192 * 2^32 = 32 TiB max memory capacity. To increase the potential utilisation, we can
// xxx raise the cut-off point to up to 2^32, which would require 16 GiBs of memory to represent.
// xxx Since we know up front how many pages we have at our disposal, and that 32 TiB of RAM is far from common,
// xxx we can place our preferred cut-off point at one or two bit-widths higher than the required bits to address
// xxx the memory. This would keep the risk of collisions down. Hopefully to a somewhat reasonable level.
// xxx Actually, if we don't need the swapper id in the page list anymore, then we could use those 11 spare bits
// xxx to store the wrap-around counter. We'd have to consult the page list before we know whether we've found the
// xxx correct translation table entry or not, but that is hopefully a rare occurrence. We can also use a few of the
// xxx bits to indicate the entry offset from its ideal location, such that collisions don't necessarily have to
// xxx cause an existing entry to be evicted. The offset can either be as a difference from the given file page id –
// xxx which might not work so well with scans, for instance – or it can be the levels of hashing, where a zero
// xxx would mean that the file page id is unhashed (directly addressed), and any number above this is the number of
// xxx recursive hashes that the file page id has gone through in search of a free translation table entry.
// xxx Not having the swapper id will, however, make it impossible to reconstruct the translation tables from the
// xxx page list, which would be required in order to resume a page cache from stored memory, e.g. a /dev/shm file.
// xxx Perhaps, if we stored the buffers base address separately (the address of the first page buffer we allocate),
// xxx and we then assume that 47 bits is enough to address all the memory we need (128 TiB of RAM addressable),
// xxx then we would be able to get 64-47=17 spare bits. 10 of those bits could go to the swapper id (1024 swappers
// xxx possible), 2 bits goes to the usage counter, 4 bits goes to the wrap-around counter allowing us to map files
// xxx up to 512 TiB in size, and one bit for whether the file page id was rehashed or not.
// xxx Store segments, if implemented, might change the dynamics around a bit; we might get an upper bound on file
// xxx sizes, and instead have a lot more files. In such a case, we might want to drop the wrap-around idea for
// xxx translation tables entirely, and instead invest those bits into the swapper id.
private final int pageCount;
private final int cachePageSize;
private final MemoryAllocator memoryAllocator;
private final SwapperSet swappers;
private final long victimPageAddress;
private final long baseAddress;
private final long bufferAlignment;
PageList( int pageCount, int cachePageSize, MemoryAllocator memoryAllocator, SwapperSet swappers,
long victimPageAddress, long bufferAlignment )
{
this.pageCount = pageCount;
this.cachePageSize = cachePageSize;
this.memoryAllocator = memoryAllocator;
this.swappers = swappers;
this.victimPageAddress = victimPageAddress;
long bytes = ((long) pageCount) * META_DATA_BYTES_PER_PAGE;
this.baseAddress = memoryAllocator.allocateAligned( bytes, Long.BYTES );
this.bufferAlignment = bufferAlignment;
clearMemory( baseAddress, pageCount );
}
/**
* This copy-constructor is useful for classes that want to extend the {@code PageList} class to inline its fields.
* All data and state will be shared between this and the given {@code PageList}. This means that changing the page
* list state through one has the same effect as changing it through the other – they are both effectively the same
* object.
* @param pageList The {@code PageList} instance whose state to copy.
*/
PageList( PageList pageList )
{
this.pageCount = pageList.pageCount;
this.cachePageSize = pageList.cachePageSize;
this.memoryAllocator = pageList.memoryAllocator;
this.swappers = pageList.swappers;
this.victimPageAddress = pageList.victimPageAddress;
this.baseAddress = pageList.baseAddress;
this.bufferAlignment = pageList.bufferAlignment;
}
private void clearMemory( long baseAddress, long pageCount )
{
long memcpyChunkSize = UnsafeUtil.pageSize();
long metaDataEntriesPerChunk = memcpyChunkSize / META_DATA_BYTES_PER_PAGE;
if ( pageCount < metaDataEntriesPerChunk || forceSlowMemoryClear )
{
clearMemorySimple( baseAddress, pageCount );
}
else
{
clearMemoryFast( baseAddress, pageCount, memcpyChunkSize, metaDataEntriesPerChunk );
}
UnsafeUtil.fullFence(); // Guarantee the visibility of the cleared memory.
}
private void clearMemorySimple( long baseAddress, long pageCount )
{
long address = baseAddress - Long.BYTES;
long initialLockWord = OffHeapPageLock.initialLockWordWithExclusiveLock();
for ( long i = 0; i < pageCount; i++ )
{
UnsafeUtil.putLong( address += Long.BYTES, initialLockWord ); // lock word
UnsafeUtil.putLong( address += Long.BYTES, 0 ); // pointer
UnsafeUtil.putLong( address += Long.BYTES, 0 ); // last tx id
UnsafeUtil.putLong( address += Long.BYTES, MAX_FILE_PAGE_ID << 24 );
}
}
private void clearMemoryFast( long baseAddress, long pageCount, long memcpyChunkSize, long metaDataEntriesPerChunk )
{
// Initialise one chunk worth of data.
clearMemorySimple( baseAddress, metaDataEntriesPerChunk );
// Since all entries contain the same data, we can now copy this chunk over and over.
long chunkCopies = pageCount / metaDataEntriesPerChunk - 1;
long address = baseAddress + memcpyChunkSize;
for ( int i = 0; i < chunkCopies; i++ )
{
UnsafeUtil.copyMemory( baseAddress, address, memcpyChunkSize );
address += memcpyChunkSize;
}
// Finally fill in the tail.
long tailCount = pageCount % metaDataEntriesPerChunk;
clearMemorySimple( address, tailCount );
}
/**
* @return The capacity of the page list.
*/
public int getPageCount()
{
return pageCount;
}
public SwapperSet getSwappers()
{
return swappers;
}
/**
* Turn a {@code pageId} into a {@code pageRef} that can be used for accessing and manipulating the given page
* using the other methods in this class.
* @param pageId The {@code pageId} to turn into a {@code pageRef}.
* @return A {@code pageRef} which is an opaque, internal and direct pointer to the meta-data of the given memory
* page.
*/
public long deref( int pageId )
{
//noinspection UnnecessaryLocalVariable
long id = pageId; // convert to long to avoid int multiplication
return baseAddress + (id * META_DATA_BYTES_PER_PAGE);
}
public int toId( long pageRef )
{
// >> 5 is equivalent to dividing by 32, META_DATA_BYTES_PER_PAGE.
return (int) ((pageRef - baseAddress) >> 5);
}
private long offLastModifiedTransactionId( long pageRef )
{
return pageRef + OFFSET_LAST_TX_ID;
}
private long offLock( long pageRef )
{
return pageRef + OFFSET_LOCK_WORD;
}
private long offAddress( long pageRef )
{
return pageRef + OFFSET_ADDRESS;
}
private long offFilePageId( long pageRef )
{
return pageRef + OFFSET_FILE_PAGE_ID;
}
public long tryOptimisticReadLock( long pageRef )
{
return OffHeapPageLock.tryOptimisticReadLock( offLock( pageRef ) );
}
public boolean validateReadLock( long pageRef, long stamp )
{
return OffHeapPageLock.validateReadLock( offLock( pageRef ), stamp );
}
public boolean isModified( long pageRef )
{
return OffHeapPageLock.isModified( offLock( pageRef ) );
}
public boolean isExclusivelyLocked( long pageRef )
{
return OffHeapPageLock.isExclusivelyLocked( offLock( pageRef ) );
}
public boolean tryWriteLock( long pageRef )
{
return OffHeapPageLock.tryWriteLock( offLock( pageRef ) );
}
public void unlockWrite( long pageRef )
{
OffHeapPageLock.unlockWrite( offLock( pageRef ) );
}
public long unlockWriteAndTryTakeFlushLock( long pageRef )
{
return OffHeapPageLock.unlockWriteAndTryTakeFlushLock( offLock( pageRef ) );
}
public boolean tryExclusiveLock( long pageRef )
{
return OffHeapPageLock.tryExclusiveLock( offLock( pageRef ) );
}
public long unlockExclusive( long pageRef )
{
return OffHeapPageLock.unlockExclusive( offLock( pageRef ) );
}
public void unlockExclusiveAndTakeWriteLock( long pageRef )
{
OffHeapPageLock.unlockExclusiveAndTakeWriteLock( offLock( pageRef ) );
}
public long tryFlushLock( long pageRef )
{
return OffHeapPageLock.tryFlushLock( offLock( pageRef ) );
}
public void unlockFlush( long pageRef, long stamp, boolean success )
{
OffHeapPageLock.unlockFlush( offLock( pageRef ), stamp, success );
}
public void explicitlyMarkPageUnmodifiedUnderExclusiveLock( long pageRef )
{
OffHeapPageLock.explicitlyMarkPageUnmodifiedUnderExclusiveLock( offLock( pageRef ) );
}
public int getCachePageSize()
{
return cachePageSize;
}
public long getAddress( long pageRef )
{
return UnsafeUtil.getLong( offAddress( pageRef ) );
}
public void initBuffer( long pageRef )
{
if ( getAddress( pageRef ) == 0L )
{
long addr = memoryAllocator.allocateAligned( getCachePageSize(), bufferAlignment );
UnsafeUtil.putLong( offAddress( pageRef ), addr );
}
}
private byte getUsageCounter( long pageRef )
{
return (byte) (UnsafeUtil.getLongVolatile( offFilePageId( pageRef ) ) & 0x07);
}
/**
* Increment the usage stamp to at most 4.
**/
public void incrementUsage( long pageRef )
{
// This is intentionally left benignly racy for performance.
long address = offFilePageId( pageRef );
long v = UnsafeUtil.getLongVolatile( address );
long usage = v & 0x07;
if ( usage < 4 ) // avoid cache sloshing by not doing a write if counter is already maxed out
{
usage++;
// Use compareAndSwapLong to only actually store the updated count if nothing else changed
// in this word-line. The word-line is shared with the file page id, and the swapper id.
// Those fields are updated under guard of the exclusive lock, but we *might* race with
// that here, and in that case we would never want a usage counter update to clobber a page
// binding update.
UnsafeUtil.compareAndSwapLong( null, address, v, (v & 0xFFFFFFFF_FFFFFFF8L) + usage );
}
}
/**
* Decrement the usage stamp. Returns true if it reaches 0.
**/
public boolean decrementUsage( long pageRef )
{
// This is intentionally left benignly racy for performance.
long address = offFilePageId( pageRef );
long v = UnsafeUtil.getLongVolatile( address );
long usage = v & 0x07;
if ( usage > 0 )
{
usage--;
// See `incrementUsage` about why we use `compareAndSwapLong`.
UnsafeUtil.compareAndSwapLong( null, address, v, (v & 0xFFFFFFFF_FFFFFFF8L) + usage );
}
return usage == 0;
}
public long getFilePageId( long pageRef )
{
long filePageId = UnsafeUtil.getLong( offFilePageId( pageRef ) ) >>> 24;
return filePageId == MAX_FILE_PAGE_ID ? PageCursor.UNBOUND_PAGE_ID : filePageId;
}
private void setFilePageId( long pageRef, long filePageId )
{
if ( filePageId > MAX_FILE_PAGE_ID )
{
throw new IllegalArgumentException(
format( "File page id: %s is bigger then max supported value %s.", filePageId, MAX_FILE_PAGE_ID ) );
}
long address = offFilePageId( pageRef );
long v = UnsafeUtil.getLong( address );
filePageId = (filePageId << 24) + (v & 0xFFFFFF);
UnsafeUtil.putLong( address, filePageId );
}
long getLastModifiedTxId( long pageRef )
{
return UnsafeUtil.getLongVolatile( offLastModifiedTransactionId( pageRef ) );
}
/**
* @return return last modifier transaction id and resets it to {@link #UNBOUND_LAST_MODIFIED_TX_ID}
*/
long getAndResetLastModifiedTransactionId( long pageRef )
{
return UnsafeUtil.getAndSetLong( null, offLastModifiedTransactionId( pageRef ), UNBOUND_LAST_MODIFIED_TX_ID );
}
void setLastModifiedTxId( long pageRef, long modifierTxId )
{
UnsafeUtil.compareAndSetMaxLong( null, offLastModifiedTransactionId( pageRef ), modifierTxId );
}
public int getSwapperId( long pageRef )
{
long v = UnsafeUtil.getLong( offFilePageId( pageRef ) ) >>> 3;
return (int) (v & 0b1_11111_11111_11111_11111); // 21 bits.
}
private void setSwapperId( long pageRef, int swapperId )
{
swapperId = swapperId << 3;
long address = offFilePageId( pageRef );
long v = UnsafeUtil.getLong( address ) & (~(0b1_11111_11111_11111_11111 << 3));
UnsafeUtil.putLong( address, v + swapperId );
}
public boolean isLoaded( long pageRef )
{
return getFilePageId( pageRef ) != PageCursor.UNBOUND_PAGE_ID;
}
public boolean isBoundTo( long pageRef, int swapperId, long filePageId )
{
return getSwapperId( pageRef ) == swapperId && getFilePageId( pageRef ) == filePageId;
}
public void fault( long pageRef, PageSwapper swapper, int swapperId, long filePageId, PageFaultEvent event )
throws IOException
{
if ( swapper == null )
{
throw swapperCannotBeNull();
}
int currentSwapper = getSwapperId( pageRef );
long currentFilePageId = getFilePageId( pageRef );
if ( filePageId == PageCursor.UNBOUND_PAGE_ID || !isExclusivelyLocked( pageRef )
|| currentSwapper != 0 || currentFilePageId != PageCursor.UNBOUND_PAGE_ID )
{
throw cannotFaultException( pageRef, swapper, swapperId, filePageId, currentSwapper, currentFilePageId );
}
// Note: It is important that we assign the filePageId before we swap
// the page in. If the swapping fails, the page will be considered
// loaded for the purpose of eviction, and will eventually return to
// the freelist. However, because we don't assign the swapper until the
// swapping-in has succeeded, the page will not be considered bound to
// the file page, so any subsequent thread that finds the page in their
// translation table will re-do the page fault.
setFilePageId( pageRef, filePageId ); // Page now considered isLoaded()
long bytesRead = swapper.read( filePageId, getAddress( pageRef ), cachePageSize );
event.addBytesRead( bytesRead );
event.setCachePageId( toId( pageRef ) );
setSwapperId( pageRef, swapperId ); // Page now considered isBoundTo( swapper, filePageId )
}
private static IllegalArgumentException swapperCannotBeNull()
{
return new IllegalArgumentException( "swapper cannot be null" );
}
private static IllegalStateException cannotFaultException( long pageRef, PageSwapper swapper, int swapperId,
long filePageId, int currentSwapper, long currentFilePageId )
{
String msg = format(
"Cannot fault page {filePageId = %s, swapper = %s (swapper id = %s)} into " +
"cache page %s. Already bound to {filePageId = " +
"%s, swapper id = %s}.",
filePageId, swapper, swapperId, pageRef, currentFilePageId, currentSwapper );
return new IllegalStateException( msg );
}
public boolean tryEvict( long pageRef, EvictionEventOpportunity evictionOpportunity ) throws IOException
{
if ( tryExclusiveLock( pageRef ) )
{
if ( isLoaded( pageRef ) )
{
try ( EvictionEvent evictionEvent = evictionOpportunity.beginEviction() )
{
evict( pageRef, evictionEvent );
return true;
}
}
unlockExclusive( pageRef );
}
return false;
}
private void evict( long pageRef, EvictionEvent evictionEvent ) throws IOException
{
long filePageId = getFilePageId( pageRef );
evictionEvent.setFilePageId( filePageId );
evictionEvent.setCachePageId( pageRef );
int swapperId = getSwapperId( pageRef );
if ( swapperId != 0 )
{
// If the swapper id is non-zero, then the page was not only loaded, but also bound, and possibly modified.
SwapperSet.SwapperMapping swapperMapping = swappers.getAllocation( swapperId );
if ( swapperMapping != null )
{
// The allocation can be null if the file has been unmapped, but there are still pages
// lingering in the cache that were bound to file page in that file.
PageSwapper swapper = swapperMapping.swapper;
evictionEvent.setSwapper( swapper );
if ( isModified( pageRef ) )
{
flushModifiedPage( pageRef, evictionEvent, filePageId, swapper );
}
swapper.evicted( filePageId );
}
}
clearBinding( pageRef );
}
private void flushModifiedPage( long pageRef, EvictionEvent evictionEvent, long filePageId, PageSwapper swapper )
throws IOException
{
FlushEvent flushEvent = evictionEvent.flushEventOpportunity().beginFlush( filePageId, pageRef, swapper );
try
{
long address = getAddress( pageRef );
long bytesWritten = swapper.write( filePageId, address );
explicitlyMarkPageUnmodifiedUnderExclusiveLock( pageRef );
flushEvent.addBytesWritten( bytesWritten );
flushEvent.addPagesFlushed( 1 );
flushEvent.done();
}
catch ( IOException e )
{
unlockExclusive( pageRef );
flushEvent.done( e );
evictionEvent.threwException( e );
throw e;
}
}
protected void clearBinding( long pageRef )
{
setFilePageId( pageRef, PageCursor.UNBOUND_PAGE_ID );
setSwapperId( pageRef, (short) 0 );
}
public String toString( long pageRef )
{
StringBuilder sb = new StringBuilder();
toString( pageRef, sb );
return sb.toString();
}
public void toString( long pageRef, StringBuilder sb )
{
sb.append( "Page[ id = " ).append( toId( pageRef ) );
sb.append( ", address = " ).append( getAddress( pageRef ) );
sb.append( ", filePageId = " ).append( getFilePageId( pageRef ) );
sb.append( ", swapperId = " ).append( getSwapperId( pageRef ) );
sb.append( ", usageCounter = " ).append( getUsageCounter( pageRef ) );
sb.append( " ] " ).append( OffHeapPageLock.toString( offLock( pageRef ) ) );
}
}