@@ -70,13 +70,13 @@ public HollowSetSchema getSchema() {
70
70
return (HollowSetSchema )schema ;
71
71
}
72
72
73
- public void prepareForWrite () {
73
+ public void prepareForWrite (int numShards ) {
74
74
super .prepareForWrite ();
75
75
76
- gatherStatistics ();
76
+ gatherStatistics (numShards );
77
77
}
78
78
79
- private void gatherStatistics () {
79
+ private void gatherStatistics (int numShards ) {
80
80
maxOrdinal = ordinalMap .maxOrdinal ();
81
81
82
82
gatherShardingStats (maxOrdinal );
@@ -85,7 +85,7 @@ private void gatherStatistics() {
85
85
int maxSetSize = 0 ;
86
86
ByteData data = ordinalMap .getByteData ().getUnderlyingArray ();
87
87
88
- totalOfSetBuckets = new long [numShards ];
88
+ totalOfSetBuckets = new long [numShards ];// SNAP: TODO: called for delta and rev delta
89
89
90
90
for (int i =0 ;i <=maxOrdinal ;i ++) {
91
91
if (currentCyclePopulated .get (i ) || previousCyclePopulated .get (i )) {
@@ -303,26 +303,7 @@ private void writeSnapshotShard(DataOutputStream os, int shardNumber) throws IOE
303
303
}
304
304
305
305
@ Override
306
- public void calculateDelta () {
307
- calculateDelta (previousCyclePopulated , currentCyclePopulated );
308
- }
309
-
310
- @ Override
311
- public void writeDelta (DataOutputStream dos ) throws IOException {
312
- writeCalculatedDelta (dos );
313
- }
314
-
315
- @ Override
316
- public void calculateReverseDelta () {
317
- calculateDelta (currentCyclePopulated , previousCyclePopulated );
318
- }
319
-
320
- @ Override
321
- public void writeReverseDelta (DataOutputStream dos ) throws IOException {
322
- writeCalculatedDelta (dos );
323
- }
324
-
325
- public void calculateDelta (ThreadSafeBitSet fromCyclePopulated , ThreadSafeBitSet toCyclePopulated ) {
306
+ public void calculateDelta (ThreadSafeBitSet fromCyclePopulated , ThreadSafeBitSet toCyclePopulated , int numShards ) {
326
307
maxOrdinal = ordinalMap .maxOrdinal ();
327
308
int bitsPerSetFixedLengthPortion = bitsPerSetSizeValue + bitsPerSetPointer ;
328
309
@@ -430,16 +411,17 @@ public void calculateDelta(ThreadSafeBitSet fromCyclePopulated, ThreadSafeBitSet
430
411
}
431
412
}
432
413
433
- private void writeCalculatedDelta (DataOutputStream os ) throws IOException {
414
+ @ Override
415
+ public void writeCalculatedDelta (DataOutputStream os , int numShards , int [] maxShardOrdinal ) throws IOException {
434
416
/// for unsharded blobs, support pre v2.1.0 clients
435
417
if (numShards == 1 ) {
436
- writeCalculatedDeltaShard (os , 0 );
418
+ writeCalculatedDeltaShard (os , 0 , maxShardOrdinal );
437
419
} else {
438
420
/// overall max ordinal
439
421
VarInt .writeVInt (os , maxOrdinal );
440
422
441
423
for (int i =0 ;i <numShards ;i ++) {
442
- writeCalculatedDeltaShard (os , i );
424
+ writeCalculatedDeltaShard (os , i , maxShardOrdinal );
443
425
}
444
426
}
445
427
@@ -449,7 +431,7 @@ private void writeCalculatedDelta(DataOutputStream os) throws IOException {
449
431
deltaRemovedOrdinals = null ;
450
432
}
451
433
452
- private void writeCalculatedDeltaShard (DataOutputStream os , int shardNumber ) throws IOException {
434
+ private void writeCalculatedDeltaShard (DataOutputStream os , int shardNumber , int [] maxShardOrdinal ) throws IOException {
453
435
454
436
int bitsPerSetFixedLengthPortion = bitsPerSetSizeValue + bitsPerSetPointer ;
455
437
0 commit comments