Skip to content

Commit 8f4eadd

Browse files
cneiraclaude
andcommitted
Add batchupdateobjects RPC for per-vnode atomic batch updates
New Fast RPC endpoint that accepts multiple UpdateObjectPayload items, groups them by vnode, and executes each vnode group within a single PostgreSQL transaction. Objects in the same vnode succeed or fail atomically; cross-vnode failures are isolated. Changes: - object/batch_update.rs: payload types, decode, action handler, vnode grouping, per-vnode transaction orchestration - lib.rs: register batchupdateobjects in handle_msg dispatch - object.rs: add batch_update module - sql.rs: add ObjectBatchUpdate method variant === AI-METADATA === AI-Tool: Claude Code AI-Model: claude-opus-4-6 AI-Role: boilerplate code generation Human-Role: code review, implementation guidance, design decisions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b689241 commit 8f4eadd

9 files changed

Lines changed: 1415 additions & 201 deletions

File tree

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#
22
# Copyright 2020 Joyent, Inc.
33
# Copyright 2023 MNX Cloud, Inc.
4+
# Copyright 2026 Edgecast Cloud LLC.
45
#
56

67
NAME = manta-buckets-mdapi
@@ -104,12 +105,16 @@ build-buckets-mdapi: | $(CARGO_EXEC)
104105
$(CARGO) build --release
105106

106107
.PHONY: test
107-
test: test-unit
108+
test: test-unit test-integration
108109

109110
.PHONY: test-unit
110111
test-unit: | $(CARGO_EXEC)
111112
$(CARGO) test --lib
112113

114+
.PHONY: test-integration
115+
test-integration: | $(CARGO_EXEC)
116+
$(CARGO) test --test rpc_handlers -- --nocapture
117+
113118
include ./deps/eng/tools/mk/Makefile.deps
114119
include ./deps/eng/tools/mk/Makefile.agent_prebuilt.targ
115120
include ./deps/eng/tools/mk/Makefile.smf.targ

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,10 @@ The functional tests require that postgresql is installed as well as
128128
and configure a temporary postgres database and once the test has completed the
129129
temporary database is removed within a few seconds. The tests use the same code
130130
used by the `schema-manager` to prepare the database for use by the test suite.
131+
132+
To build `ephemeralpg` from source on SmartOS, the socket library must be linked
133+
explicitly:
134+
135+
```
136+
LDFLAGS=-lsocket make
137+
```

buckets-mdapi/src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Copyright 2020 Joyent, Inc.
2+
// Copyright 2026 Edgecast Cloud LLC.
23

34
#![allow(clippy::module_name_repetitions)]
45

@@ -123,6 +124,17 @@ pub mod util {
123124
metrics,
124125
log,
125126
),
127+
"batchupdateobjects" => handle_request(
128+
msg.id,
129+
method,
130+
object::batch_update::decode_msg(
131+
&msg.data.d,
132+
),
133+
&mut conn,
134+
&object::batch_update::action,
135+
metrics,
136+
log,
137+
),
126138
"deleteobject" => handle_request(
127139
msg.id,
128140
method,

buckets-mdapi/src/object.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright 2020 Joyent, Inc.
22
// Copyright 2023 MNX Cloud, Inc.
3+
// Copyright 2026 Edgecast Cloud LLC.
34

45
use std::error::Error;
56
use std::vec::Vec;
@@ -16,6 +17,7 @@ use crate::conditional;
1617
use crate::error::BucketsMdapiError;
1718
use crate::types::{HasRequestId, Hstore, RowSlice, Timestamptz};
1819

20+
pub mod batch_update;
1921
pub mod create;
2022
pub mod delete;
2123
pub mod get;

0 commit comments

Comments
 (0)