Skip to content

Commit 2e52324

Browse files
authored
Merge pull request #681 from splitgraph/fix-lq-surrogate-pk-ordering-cu-2jech8y
Fix surrogate PK ordering
2 parents 77b3fc9 + 0efabcf commit 2e52324

File tree

6 files changed

+169
-80
lines changed

6 files changed

+169
-80
lines changed

examples/push-to-object-storage/docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ services:
3434
- 5432
3535

3636
objectstorage:
37-
image: minio/minio
37+
image: minio/minio:RELEASE.2022-05-19T18-20-59Z.fips
3838
ports:
3939
- '0.0.0.0:9000:9000'
4040
environment:

splitgraph/core/fragment_manager.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1367,8 +1367,8 @@ def generate_surrogate_pk(
13671367
return_shape=ResultShape.MANY_ONE,
13681368
)
13691369
)
1370-
object_pks = list(zip(result[::2], result[1::2]))
1371-
return object_pks
1370+
object_pks = [tuple(sorted(t)) for t in zip(result[::2], result[1::2])]
1371+
return cast(List[Tuple[Any, Any]], object_pks)
13721372

13731373
def _add_overlapping_objects(
13741374
self, table: "Table", all_objects: List[str], filtered_objects: List[str]

splitgraph/core/image.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,17 @@ def get_table(self, table_name: str) -> Table:
129129
)
130130

131131
@manage_audit
132-
def checkout(self, force: bool = False, layered: bool = False) -> None:
132+
def checkout(
133+
self, force: bool = False, layered: bool = False, ddn_layout: bool = False
134+
) -> None:
133135
"""
134136
Checks the image out, changing the current HEAD pointer. Raises an error
135137
if there are pending changes to its checkout.
136138
137139
:param force: Discards all pending changes to the schema.
138140
:param layered: If True, uses layered querying to check out the image (doesn't materialize tables
139141
inside of it).
142+
:param ddn_layout: Determines whether to rotate the name prefix of lower and overlay table/view
140143
"""
141144
target_schema = self.repository.to_schema()
142145
if len(target_schema) > POSTGRES_MAX_IDENTIFIER:
@@ -166,7 +169,7 @@ def checkout(self, force: bool = False, layered: bool = False) -> None:
166169
self.object_engine.delete_table(target_schema, table)
167170

168171
if layered:
169-
self.lq_checkout()
172+
self.lq_checkout(ddn_layout=ddn_layout)
170173
else:
171174
for table in self.get_tables():
172175
self.get_table(table).materialize(table)

test/architecture/data/objectstorage/entrypoint.sh

-9
This file was deleted.

test/architecture/docker-compose.core.yml

+8-9
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,15 @@ services:
4949
- 5431
5050
# Name without an underscore because Minio client really wants to be compliant with the RFC
5151
objectstorage:
52-
image: minio/minio
52+
image: minio/minio:RELEASE.2022-05-19T18-20-59Z.fips
5353
ports:
5454
- '0.0.0.0:9000:9000'
5555
environment:
56-
MINIO_ACCESS_KEY: minioclient
57-
MINIO_SECRET_KEY: supersecure
56+
MINIO_ROOT_USER: minioclient
57+
MINIO_ROOT_PASSWORD: supersecure
5858
volumes:
59-
# Mount a "bucket" with some CSV files into our object storage
60-
# https://github.com/minio/minio/issues/8949
61-
# As always, Minio is very opinionated and doesn't allow "cross-device mounts" even in dev
62-
# so we copy this in on startup.
63-
- ./data/objectstorage:/objectstorage
64-
entrypoint: /objectstorage/entrypoint.sh
59+
- ./data/objectstorage:/data
60+
command:
61+
- minio
62+
- server
63+
- /data

0 commit comments

Comments
 (0)