-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: transaction files and commit conflict resolution (#1127)
* wip: outline conflict resolution impl * wip: make transaction serialize * wip: make transaction a separate file * docs: write basic format docs for transactions * get existing tests passing * cleanup * minor pr feedback * fix: handle indices properly * more fixes and tests * merge changes * handle params better
- Loading branch information
Showing
14 changed files
with
1,355 additions
and
165 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
syntax = "proto3"; | ||
|
||
import "format.proto"; | ||
|
||
package lance.format.pb; | ||
|
||
// A transaction represents the changes to a dataset. | ||
// | ||
// This has two purposes: | ||
// 1. When retrying a commit, the transaction can be used to re-build an updated | ||
// manifest. | ||
// 2. When there's a conflict, this can be used to determine whether the other | ||
// transaction is compatible with this one. | ||
message Transaction { | ||
// The version of the dataset this transaction was built from. | ||
// | ||
// For example, for a delete transaction this means the version of the dataset | ||
// that was read from while evaluating the deletion predicate. | ||
uint64 read_version = 1; | ||
|
||
// The UUID that unique identifies a transaction. | ||
string uuid = 2; | ||
|
||
// Optional version tag. | ||
string tag = 3; | ||
|
||
// Add new rows to the dataset. | ||
message Append { | ||
// The new fragments to append. | ||
// | ||
// Fragment IDs are not yet assigned. | ||
repeated DataFragment fragments = 1; | ||
} | ||
|
||
// Mark rows as deleted. | ||
message Delete { | ||
// The fragments to update | ||
// | ||
// The fragment IDs will match existing fragments in the dataset. | ||
repeated DataFragment updated_fragments = 1; | ||
// The fragments to delete entirely. | ||
repeated uint64 deleted_fragment_ids = 2; | ||
// The predicate that was evaluated | ||
// | ||
// This may be used to determine whether the delete would have affected | ||
// files written by a concurrent transaction. | ||
string predicate = 3; | ||
} | ||
|
||
// Create or overwrite the entire dataset. | ||
message Overwrite { | ||
// The new fragments | ||
// | ||
// Fragment IDs are not yet assigned. | ||
repeated DataFragment fragments = 1; | ||
// The new schema | ||
repeated Field schema = 2; | ||
// Schema metadata. | ||
map<string, bytes> schema_metadata = 3; | ||
} | ||
|
||
// Add a new secondary index. | ||
message CreateIndex { | ||
repeated IndexMetadata new_indices = 1; | ||
} | ||
|
||
// An operation that rewrites but does not change the data in the table. These | ||
// kinds of operations just rearrange data. | ||
message Rewrite { | ||
// The old fragments that are being replaced | ||
// | ||
// These should all have existing fragment IDs. | ||
repeated DataFragment old_fragments = 1; | ||
// The new fragments | ||
// | ||
// These fragments IDs are not yet assigned. | ||
repeated DataFragment new_fragments = 2; | ||
} | ||
|
||
// An operation that merges in a new column, altering the schema. | ||
message Merge { | ||
// The updated fragments | ||
// | ||
// These should all have existing fragment IDs. | ||
repeated DataFragment fragments = 1; | ||
// The new schema | ||
repeated Field schema = 2; | ||
// Schema metadata. | ||
map<string, bytes> schema_metadata = 3; | ||
} | ||
|
||
// The operation of this transaction. | ||
oneof operation { | ||
Append append = 100; | ||
Delete delete = 101; | ||
Overwrite overwrite = 102; | ||
CreateIndex create_index = 103; | ||
Rewrite rewrite = 104; | ||
Merge merge = 105; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.