Skip to content

Commit

Permalink
Comments and format
Browse files Browse the repository at this point in the history
  • Loading branch information
rroelke committed Feb 14, 2025
1 parent 33a61a5 commit 6d7ac9e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
28 changes: 26 additions & 2 deletions test/src/unit-sparse-global-order-reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2784,11 +2784,16 @@ TEST_CASE_METHOD(
tiledb_query_free(&query);
}

/**
* Test that we get "repeatable reads" when multiple fragments
* are written at the same timestamp. That is, for a fixed array
* A, reading the contents of A should always produce the same results.
*/
TEST_CASE_METHOD(
CSparseGlobalOrderFx,
"Sparse global order reader: consistent read order for sub-millisecond "
"Sparse global order reader: repeatable reads for sub-millisecond "
"fragments",
"[sparse-global-order][sub-millisecond]") {
"[sparse-global-order][sub-millisecond][rest][rapidcheck]") {
auto doit = [this]<typename Asserter>(
const std::vector<uint64_t> fragment_same_timestamp_runs) {
uint64_t num_fragments = 0;
Expand All @@ -2799,6 +2804,15 @@ TEST_CASE_METHOD(
FxRun2D instance;
instance.allow_dups = false;

/*
* Each fragment (T, F) writes its fragment index into both (1, 1)
* and (2 + T, 2 + F).
*
* (1, 1) is the coordinate where they must be de-duplicated.
* The other coordinate is useful for ensuring that all fragments
* are included in the result set, and for debugging by inspecting tile
* MBRs.
*/
for (uint64_t t = 0; t < fragment_same_timestamp_runs.size(); t++) {
for (uint64_t f = 0; f < fragment_same_timestamp_runs[t]; f++) {
FxRun2D::FragmentType fragment;
Expand All @@ -2816,6 +2830,11 @@ TEST_CASE_METHOD(

DeleteArrayGuard arrayguard(context(), array_name_.c_str());

/*
* Write each fragment at a fixed timestamp.
* Opening for write at timestamp `t` causes all the fragments to have `t`
* as their start and end timestamps.
*/
for (uint64_t i = 0, t = 0; t < fragment_same_timestamp_runs.size(); t++) {
tiledb_array_t* raw_array;
TRY(context(),
Expand All @@ -2834,7 +2853,12 @@ TEST_CASE_METHOD(

CApiArray array(context(), array_name_.c_str(), TILEDB_READ);

// Value from (1, 1).
// Because all the writes are at the same timestamp we make no guarantee
// of ordering. `attvalue` may be the value from any of the fragments,
// but it must be the same value each time we read.
std::optional<int> attvalue;

for (uint64_t f = 0; f < num_fragments; f++) {
int dim1[instance.fragments.size() * 4] = {0};
int dim2[instance.fragments.size() * 4] = {0};
Expand Down
1 change: 0 additions & 1 deletion tiledb/sm/fragment/fragment_identifier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ FragmentID::FragmentID(const std::string_view& path)
}

std::string_view FragmentID::uuid() const {
// Set UUID
constexpr size_t UUID_PRINT_LEN = 32;
if (name_version_ == FragmentNameVersion::ONE) {
return std::string_view(
Expand Down
1 change: 0 additions & 1 deletion tiledb/storage_format/uri/test/unit_uri_format.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,3 @@ TEST_CASE(
"start timestamp cannot be after end timestamp"));
}
}

0 comments on commit 6d7ac9e

Please sign in to comment.