apple / foundationdb

FoundationDB - the open source, distributed, transactional key-value store
https://apple.github.io/foundationdb/
Apache License 2.0
14.19k stars 1.29k forks source link

Bulk Loading Part 1: Transaction-Based User Interface #11343

Open kakaiu opened 2 months ago

kakaiu commented 2 months ago

Design principles to make it simple and avoid error-prone:

  1. Bulk loading is managed based on KeyRange. The bulk loading UI must guarantee that a bulk loading task is running on at most one KeyRange, and a KeyRange can have at most one bulk loading task at a time.
  2. Users can never overwrite a key range that is running a bulk loading task, unless the user has manually cancelled it.
  3. Even for a key range which bulk loading task has been completed, users cannot start a new task overlapping the range unless users have explicitly removed the old task on the range.
  4. When users input a range to remove or cancel bulk loading tasks, the system must cancel all tasks intersecting the input range.
  5. Each transaction issued by users can only include one of the three types of the operation: new task, check status, cancel task.

User interface: Say, tr is a readwrite transaction. Each transaction can only include one of the three following types of operation:

  1. New task: tr->set("\xff\xff/bulk_loading/task/", bulkLoadStateValue(range, path)); wait(tr->commit()); Succeed if no existing bulk loading task (in metadata) intersecting the input task range; Otherwise, throwing an error.
  2. Check status: wait(tr->getRange("\xff\xff/bulk_loading/status/a", "\xff\xff/bulk_loading/status/b")); Return all tasks's status intersecting the input range.
  3. Cancel task: tr->clear("\xff\xff/bulk_loading/cancel/a", "\xff\xff/bulk_loading/cancel/b"); wait(tr->commit()); Cancel all tasks intersecting the input range.

Those operations to the special key space are mapped to read/write operation on "\xff/bulkLoad/" system key space, which in turn to control the actual bulk loading in FDB internal.

Code-Reviewer Section

The general pull request guidelines can be found here.

Please check each of the following things and check all boxes before accepting a PR.

For Release-Branches

If this PR is made against a release-branch, please also check the following:

foundationdb-ci commented 2 months ago

Result of foundationdb-pr on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-clang on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-clang-ide on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-cluster-tests on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-macos on macOS Ventura 13.x

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-macos-m1 on macOS Ventura 13.x

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-clang-ide on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-clang-ide on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-clang on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-clang on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-cluster-tests on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-cluster-tests on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-clang-ide on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-macos-m1 on macOS Ventura 13.x

foundationdb-ci commented 2 months ago

Result of foundationdb-pr on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-clang-ide on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-macos on macOS Ventura 13.x

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-clang on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-clang on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-clang-ide on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-cluster-tests on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-cluster-tests on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-macos-m1 on macOS Ventura 13.x

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-clang on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-cluster-tests on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-clang-ide on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-macos-m1 on macOS Ventura 13.x

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-macos on macOS Ventura 13.x

foundationdb-ci commented 2 months ago

Result of foundationdb-pr on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-cluster-tests on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-clang on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-clang-ide on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-macos-m1 on macOS Ventura 13.x

foundationdb-ci commented 2 months ago

Result of foundationdb-pr on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-macos on macOS Ventura 13.x

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-cluster-tests on Linux CentOS 7

foundationdb-ci commented 2 months ago

Result of foundationdb-pr-clang on Linux CentOS 7