Commit 5badc84
committed
GOCBC-1827: Range scan - Use atomic types for variables intended to only be used with atomic operations
Motivation
==========
We use a number of variables in the range scan code which are only ever supposed to be used with atomic operations. We should use the more ergonomic atomic types, to avoid any accidental non-atomic usage of these variables. This also allows us to remove the direct dependency of gocb on the "unsafe" package.
These were added with Go 1.19 that we still supported when range scan was added, but since we no longer maintain compatibility with Go 1.19 we can now make use of these types.
Changes
=======
* Use appropriate atomic types for the various counters that are used with atomic operations
* Replace use of unsafe.Pointer for the peeked scan item with atomic.Pointer[ScanResultItem]
Change-Id: If0ef05dfc322c3ef3d2b1f42ba366918cedffda6
Reviewed-on: https://review.couchbase.org/c/gocb/+/245686
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Charles Dixon <chvckd@gmail.com>1 parent 9a8c1dc commit 5badc84
3 files changed
Lines changed: 25 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
| |||
60 | 59 | | |
61 | 60 | | |
62 | 61 | | |
63 | | - | |
| 62 | + | |
64 | 63 | | |
65 | 64 | | |
66 | 65 | | |
| |||
344 | 343 | | |
345 | 344 | | |
346 | 345 | | |
347 | | - | |
| 346 | + | |
348 | 347 | | |
349 | 348 | | |
350 | 349 | | |
| |||
373 | 372 | | |
374 | 373 | | |
375 | 374 | | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | 375 | | |
380 | | - | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
381 | 379 | | |
382 | 380 | | |
383 | 381 | | |
384 | 382 | | |
385 | 383 | | |
386 | 384 | | |
387 | 385 | | |
388 | | - | |
| 386 | + | |
389 | 387 | | |
390 | 388 | | |
391 | 389 | | |
392 | 390 | | |
393 | 391 | | |
394 | 392 | | |
395 | 393 | | |
396 | | - | |
| 394 | + | |
397 | 395 | | |
398 | 396 | | |
399 | 397 | | |
| |||
415 | 413 | | |
416 | 414 | | |
417 | 415 | | |
418 | | - | |
| 416 | + | |
419 | 417 | | |
420 | 418 | | |
421 | 419 | | |
| |||
479 | 477 | | |
480 | 478 | | |
481 | 479 | | |
482 | | - | |
483 | | - | |
| 480 | + | |
484 | 481 | | |
485 | 482 | | |
486 | 483 | | |
| |||
567 | 564 | | |
568 | 565 | | |
569 | 566 | | |
570 | | - | |
| 567 | + | |
571 | 568 | | |
572 | 569 | | |
573 | 570 | | |
| |||
775 | 772 | | |
776 | 773 | | |
777 | 774 | | |
778 | | - | |
| 775 | + | |
779 | 776 | | |
780 | 777 | | |
781 | 778 | | |
782 | 779 | | |
783 | 780 | | |
784 | 781 | | |
785 | | - | |
786 | | - | |
| 782 | + | |
| 783 | + | |
787 | 784 | | |
788 | 785 | | |
789 | 786 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
232 | | - | |
| 232 | + | |
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
| 236 | + | |
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
288 | | - | |
| 288 | + | |
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
292 | | - | |
| 292 | + | |
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
| |||
349 | 349 | | |
350 | 350 | | |
351 | 351 | | |
352 | | - | |
| 352 | + | |
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
359 | 359 | | |
360 | | - | |
| 360 | + | |
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
| |||
461 | 460 | | |
462 | 461 | | |
463 | 462 | | |
464 | | - | |
| 463 | + | |
465 | 464 | | |
466 | | - | |
| 465 | + | |
467 | 466 | | |
468 | 467 | | |
469 | 468 | | |
| |||
474 | 473 | | |
475 | 474 | | |
476 | 475 | | |
477 | | - | |
| 476 | + | |
478 | 477 | | |
479 | | - | |
480 | | - | |
| 478 | + | |
| 479 | + | |
481 | 480 | | |
482 | 481 | | |
483 | 482 | | |
| |||
488 | 487 | | |
489 | 488 | | |
490 | 489 | | |
491 | | - | |
| 490 | + | |
492 | 491 | | |
493 | 492 | | |
494 | 493 | | |
| |||
0 commit comments