Skip to content

Implement keyAboveWatermark for composite chunker with restrictions #479

@morgo

Description

@morgo

It is documented that key{Above|Below}Watermark only applies to the optimistic chunker. We should add it to the composite chunker with restrictions:

  • Only applies to key[0].
  • Only applies when key[0] is numeric (initially, we could relax this in future).

The relevant code is:

// KeyAboveHighWatermark is not yet supported for composite chunker.
// See: https://github.com/block/spirit/issues/479
func (t *chunkerComposite) KeyAboveHighWatermark(key0 any) bool {
return false
}
// KeyBelowLowWatermark is not yet supported for composite chunker.
// See: https://github.com/block/spirit/issues/479
func (t *chunkerComposite) KeyBelowLowWatermark(key0 any) bool {
return true
}

The advantage of implementing this feature is as follows:

  1. For KeyAbove it eliminates some changes needing to be applied. This may be less important compared to auto_inc tables, because users are less likely to be inserting/modifying data at the end of the key range.
  2. For KeyBelow it delays applying changes until after the copier is guaranteed to be past that point. This can be really useful in preventing contention cases (deadlocks, lock waits), which have been observed a few times between applier and copier.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions