Skip to content

Commit 1286424

Browse files
committed
m
1 parent 1966765 commit 1286424

File tree

3 files changed

+45
-36
lines changed

3 files changed

+45
-36
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ format_net-check:
4747
format_java_misc: setup_prettier
4848
npx prettier --plugin=prettier-plugin-java . --write
4949

50+
format_spec: setup_prettier
51+
npx prettier --plugin=prettier-plugin-java specification --write
52+
5053
format_java_misc-check: setup_prettier
5154
npx prettier --plugin=prettier-plugin-java . --check
5255

specification/changes/2025-08-25-bucket-beacons/background.md

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ with four of the queries returning nothing.
6262
Maybe you need a different number of buckets for different standard beacons.
6363

6464
For example, maybe
65-
* `LastName` has a terribly uneven distribution, and so needs 5 buckets.
66-
* `Phone` is pretty much unique in each item, and so only needs on bucket.
67-
* `Precinct` is just a little bit uneven, and so needs two beacons.
65+
66+
- `LastName` has a terribly uneven distribution, and so needs 5 buckets.
67+
- `Phone` is pretty much unique in each item, and so only needs on bucket.
68+
- `Precinct` is just a little bit uneven, and so needs two beacons.
6869

6970
To accomplish this, you set the number of buckets for the whole table to `5`,
7071
and then constrain the number of buckets for the other two beacons.
@@ -75,13 +76,14 @@ The ensures that the values are reasonably well distributed among the constraine
7576
while still guaranteeing that, given the bucket for the item,
7677
we can uniquely identify the bucket for the constrained beacon.
7778

78-
***WARNING*** Adding or changing the constraint on a beacon is difficult, sometimes impossible;
79+
**_WARNING_** Adding or changing the constraint on a beacon is difficult, sometimes impossible;
7980
once any items have been written.
8081

8182
The only situation in which you might consider adding a constraint to a beacon is if **all** of the following apply
82-
* You're going to use that beacon in an index (GSI)
83-
* The queries you make against that index are expected to return a very small number of results
84-
* Your security people have agreed that reducing the number of buckets for this beacon is acceptable.
83+
84+
- You're going to use that beacon in an index (GSI)
85+
- The queries you make against that index are expected to return a very small number of results
86+
- Your security people have agreed that reducing the number of buckets for this beacon is acceptable.
8587

8688
### Behind the scenes
8789

@@ -170,9 +172,10 @@ This would allow one to set `numberOfBuckets = 5` on the LastName beacon as abov
170172
and then choose the bucket for each item explicitly, based on the LastName value.
171173
Perhaps "Smith" would be divided among all 5 buckets, while "Svaboda" was always placed in bucket zero.
172174
This has two benefits
173-
* This can do a much better job of overcoming the [shortcoming of Beacons](#a-shortcoming-of-beacons),
174-
by only splitting the popular names, making the distribution of hashes ven more regular.
175-
* When querying on the LastName "Svaboda", only one query is needed, rather than five.
175+
176+
- This can do a much better job of overcoming the [shortcoming of Beacons](#a-shortcoming-of-beacons),
177+
by only splitting the popular names, making the distribution of hashes ven more regular.
178+
- When querying on the LastName "Svaboda", only one query is needed, rather than five.
176179

177180
## Changing Beacon Constraints
178181

@@ -188,16 +191,16 @@ Why not? Because when we write, the item has a bucket, and each beacon calculate
188191
When we Query, the query has a bucket and each beacon calculates its bucket from the query's bucket.
189192
If you change a constraint, then the beacon bucket calculation at query time will not produce the same results as were used when the item was written. For example:
190193

191-
* `maximumNumberOfBuckets` for a table is 5
192-
* Beacon A has no constraint
193-
* Beacon B is constrained to 2 buckets.
194-
* We write an item. Its bucket is 4.
195-
* Beacon A is put in bucket 4, beacon B is put in bucket `4 % 2` or 0.
196-
* We search with ":aws_dbe_bucket = 4". We look for beacon A in bucket 4 and beacon B in bucket 0
197-
* We find the item.
198-
* Now we change the constraint to `3`.
199-
* We search with ":aws_dbe_bucket = 4". We look for beacon A in bucket 4 and beacon B in bucket `4 % 3` or 1
200-
* We do not find the item.
194+
- `maximumNumberOfBuckets` for a table is 5
195+
- Beacon A has no constraint
196+
- Beacon B is constrained to 2 buckets.
197+
- We write an item. Its bucket is 4.
198+
- Beacon A is put in bucket 4, beacon B is put in bucket `4 % 2` or 0.
199+
- We search with ":aws_dbe_bucket = 4". We look for beacon A in bucket 4 and beacon B in bucket 0
200+
- We find the item.
201+
- Now we change the constraint to `3`.
202+
- We search with ":aws_dbe_bucket = 4". We look for beacon A in bucket 4 and beacon B in bucket `4 % 3` or 1
203+
- We do not find the item.
201204

202205
### Long answer
203206

@@ -213,8 +216,9 @@ then all of the items can still be found.
213216
and include both plain standard beacons and standard beacons used as part of a compound beacon.
214217

215218
Compatible in this context means that, for any ":aws_dbe_bucket = N",
216-
* before the change, all involved beacons were put in the same bucket
217-
* after the change, all involved beacons are put in the same bucket
219+
220+
- before the change, all involved beacons were put in the same bucket
221+
- after the change, all involved beacons are put in the same bucket
218222

219223
but the bucket before might be different than the bucket after.
220224

specification/changes/2025-08-25-bucket-beacons/change.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77

88
### BucketCount
99

10-
* An integer in the range 1..255
11-
* The number of possible buckets in some context
12-
* For customers not using BucketBeacons, this is always `1`
10+
- An integer in the range 1..255
11+
- The number of possible buckets in some context
12+
- For customers not using BucketBeacons, this is always `1`
1313

1414
### BucketNumber
1515

16-
* An integer in the range 0..254
17-
* The number of the bucket currently under consideration in some context
18-
* For customers not using BucketBeacons, this is always `1`
19-
* Range can also be considered : `0 <= BucketNumber < BucketCount`
16+
- An integer in the range 0..254
17+
- The number of the bucket currently under consideration in some context
18+
- For customers not using BucketBeacons, this is always `1`
19+
- Range can also be considered : `0 <= BucketNumber < BucketCount`
2020

2121
### BucketSelector
2222

@@ -73,15 +73,17 @@ Examines the [query](https://docs.aws.amazon.com/amazondynamodb/latest/APIRefere
7373
dynamoClient.query(query)
7474

7575
In many situations, one already knows the number of queries,
76-
* `1` if buckets are not being used,
77-
* `maximumNumberOfBuckets` if buckets are being used, and nothing else is overridden
78-
* `numberOfBuckets` if a single bucketed beacon is involved.
76+
77+
- `1` if buckets are not being used,
78+
- `maximumNumberOfBuckets` if buckets are being used, and nothing else is overridden
79+
- `numberOfBuckets` if a single bucketed beacon is involved.
7980

8081
The actual value of GetNumberOfQueries is the minimum of
81-
* maximumNumberOfBuckets
82-
* The Least Common Multiple of the numbers of buckets in each
83-
[Standard Beacon](../../searchable-encryption/beacons.md#standard-beacon) involved,
84-
including those that are part of a [Compound Beacon](../../searchable-encryption/beacons.md#compound-beacon).
82+
83+
- maximumNumberOfBuckets
84+
- The Least Common Multiple of the numbers of buckets in each
85+
[Standard Beacon](../../searchable-encryption/beacons.md#standard-beacon) involved,
86+
including those that are part of a [Compound Beacon](../../searchable-encryption/beacons.md#compound-beacon).
8587

8688
It is an error to set `:aws_dbe_bucket` to a number greater than or equal to the value of `GetNumberOfQueries`.
8789

0 commit comments

Comments
 (0)