You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by "hubcio (via GitHub)" <gi...@apache.org> on 2026/01/10 11:15:23 UTC
[PR] refactor(server): add metadata module foundation [iggy]
hubcio opened a new pull request, #2551:
URL: https://github.com/apache/iggy/pull/2551
Add new metadata module with ArcSwap wrapping SegmentedSlab collections. Refactor PersonalAccessToken to use Arc<str> instead of Arc<String>. Module compiles but is not yet wired into the system.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(server): add metadata module foundation [iggy]
Posted by "hubcio (via GitHub)" <gi...@apache.org>.
hubcio merged PR #2551:
URL: https://github.com/apache/iggy/pull/2551
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] refactor(server): add metadata module foundation [iggy]
Posted by "numinnex (via GitHub)" <gi...@apache.org>.
numinnex commented on code in PR #2551:
URL: https://github.com/apache/iggy/pull/2551#discussion_r2687405928
##########
core/server/src/metadata/snapshot.rs:
##########
Review Comment:
rename this file to inner
##########
core/server/src/metadata/writer.rs:
##########
@@ -0,0 +1,597 @@
+// 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
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// 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.
+
+use crate::metadata::ops::MetadataOp;
+use crate::metadata::shared::Metadata;
+use crate::metadata::snapshot::InnerMetadata;
+use crate::metadata::{
+ ConsumerGroupId, ConsumerGroupMeta, PartitionId, PartitionMeta, StreamId, StreamMeta, TopicId,
+ TopicMeta, UserId, UserMeta,
+};
+use crate::streaming::partitions::partition::{ConsumerGroupOffsets, ConsumerOffsets};
+use crate::streaming::stats::{PartitionStats, StreamStats, TopicStats};
+use iggy_common::{
+ CompressionAlgorithm, Identifier, IggyError, IggyExpiry, IggyTimestamp, MaxTopicSize,
+ Permissions, PersonalAccessToken, UserStatus,
+};
+use left_right::WriteHandle;
+use slab::Slab;
+use std::sync::Arc;
+use std::sync::atomic::{AtomicUsize, Ordering};
+
+pub struct MetadataWriter {
+ inner: WriteHandle<InnerMetadata, MetadataOp>,
+ revision: u64,
+}
+
+impl MetadataWriter {
+ pub fn new(handle: WriteHandle<InnerMetadata, MetadataOp>) -> Self {
+ Self {
+ inner: handle,
+ revision: 0,
+ }
+ }
+
+ fn next_revision(&mut self) -> u64 {
+ self.revision += 1;
+ self.revision
+ }
+
+ pub fn append(&mut self, op: MetadataOp) {
+ self.inner.append(op);
+ }
+
+ pub fn publish(&mut self) {
+ self.inner.publish();
+ }
+
+ pub fn initialize(&mut self, initial: InnerMetadata) {
+ self.append(MetadataOp::Initialize(Box::new(initial)));
+ self.publish();
+ }
+
+ pub fn add_stream(&mut self, meta: StreamMeta) -> StreamId {
+ let assigned_id = Arc::new(AtomicUsize::new(0));
+ self.append(MetadataOp::AddStream {
+ meta,
+ assigned_id: assigned_id.clone(),
+ });
+ self.publish();
+ assigned_id.load(Ordering::Acquire)
+ }
+
+ pub fn update_stream(&mut self, id: StreamId, new_name: Arc<str>) {
+ self.append(MetadataOp::UpdateStream { id, new_name });
+ self.publish();
+ }
+
+ pub fn delete_stream(&mut self, id: StreamId) {
+ self.append(MetadataOp::DeleteStream { id });
+ self.publish();
+ }
+
+ pub fn add_topic(&mut self, stream_id: StreamId, meta: TopicMeta) -> Option<TopicId> {
+ let assigned_id = Arc::new(AtomicUsize::new(usize::MAX));
+ self.append(MetadataOp::AddTopic {
+ stream_id,
+ meta,
+ assigned_id: assigned_id.clone(),
+ });
+ self.publish();
+ let id = assigned_id.load(Ordering::Acquire);
+ if id == usize::MAX { None } else { Some(id) }
+ }
+
+ #[allow(clippy::too_many_arguments)]
+ pub fn update_topic(
+ &mut self,
+ stream_id: StreamId,
+ topic_id: TopicId,
+ new_name: Arc<str>,
+ message_expiry: IggyExpiry,
+ compression_algorithm: CompressionAlgorithm,
+ max_topic_size: MaxTopicSize,
+ replication_factor: u8,
+ ) {
+ self.append(MetadataOp::UpdateTopic {
+ stream_id,
+ topic_id,
+ new_name,
+ message_expiry,
+ compression_algorithm,
+ max_topic_size,
+ replication_factor,
+ });
+ self.publish();
+ }
+
+ pub fn delete_topic(&mut self, stream_id: StreamId, topic_id: TopicId) {
+ self.append(MetadataOp::DeleteTopic {
+ stream_id,
+ topic_id,
+ });
+ self.publish();
+ }
+
+ /// Add partitions to a topic. Returns the assigned partition IDs (sequential from current count).
+ pub fn add_partitions(
+ &mut self,
+ reader: &Metadata,
+ stream_id: StreamId,
+ topic_id: TopicId,
+ partitions: Vec<PartitionMeta>,
+ ) -> Vec<PartitionId> {
+ if partitions.is_empty() {
+ return Vec::new();
+ }
+
+ let count_before = reader
+ .get_partitions_count(stream_id, topic_id)
+ .unwrap_or(0);
Review Comment:
This will fail silently when stream_id or topic_id does not exist, I'd rather have this panic.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org