mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
6ec18be4d00db07faea74e486e4bc76e46bd8ed2
16671
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
6ec18be4d0 |
mq logstore: read every offset candidate, not a binary-searched suffix
An offset read binary-searched its candidate files by offset range and dropped those before the hit, assuming name order matched offset order. A directory written under clock skew holds a file that sorts before files with lower offsets, and the search skipped it even on a full listing. The listing already drops files whose range ends before the offset, so in an ordered directory the search removed nothing but offset-less legacy files, which are filtered per entry anyway. The search is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
e2c3ea385b |
mq: bound a log file by its first message time, not its name
Now that a window can be named after a later second than its messages to keep names in offset order, the disk reader's stop filter, which dropped every file whose name second was after the stop time, missed windows whose messages were inside a time-bounded read. A flush now records the window's first message timestamp on the log file as ts_min, the attribute parquet files already carry, and the stop filter compares that when present. Files without it were written before names could be moved later, so their name still bounds them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
b9cb0999e8 |
mq broker: never name a log file before the newest one in its partition
A log file is named by its window's start second, taken from the writing broker's clock. A new leader whose clock is behind the previous one's wrote windows whose names sorted before older files holding lower offsets, so names no longer followed offsets. An offset read listing from an indexed file then skipped the new windows, and a read starting below such a file passed over it without notice; no reader-side check can see a file that sorts before where it starts listing. The partition fence now carries the newest log file time: the leader seeds it from the listing it already pages to continue the partition's offsets, which now also reports the newest log file name, legacy names included and compacted files, the fence and directories excluded. Each flush names its window no earlier than that time and advances it. Files sharing a second still sort by their min offset suffix. Timestamp reads resuming past the old leader's names now list such windows too, though entries timestamped before the resume point are still filtered out by timestamp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
29c6325bb9 |
mq logstore: start an offset read at the indexed file holding the offset
A disk read by offset listed the whole partition directory on every call and filtered the files by their offset ranges, so a lagging consumer paid for the partition's entire history on each read. The reader's sparse index of log file names now also keeps each mark's first offset, and an offset read lists from the last mark starting at or before its offset; offsets grow with names, so no earlier file can hold it. The index is extended by every listing past the last name it has seen, so after the first read a call lists at most one stride of files before its own plus the files after it. When no mark with an offset range is at or before the offset, as with files that record none, the read still lists from the first file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
e780127b08 |
mq logstore: read a log file's offset range in one place
The disk reader decoded offset_min and offset_max inline in three places, by string literal rather than the mq constants. A single logFileOffsets helper now reads both, so the reader and the offset index added next agree on what a file records. No behavior change: the flush writes both attributes together. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
62692badec |
mq logstore: resume a timestamp read inside the file that holds the resume point
A disk read by timestamp listed the partition from the file named after the resume second and dropped every earlier name, so the file that started before that second but still held messages after the resume point was skipped and its remaining messages were never delivered. The reader now keeps a sparse index of the partition's log file names, starts listing at the last mark before the resume second, and reads the last file starting before that second along with every later one; its entries up to the resume point are already filtered by timestamp. This covers names with and without the offset suffix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
43556b3a3c |
mq: publishers re-look up and resend when a partition's leader changes (#13195)
* mq client: dial brokers with the publisher's dial option The publisher dialed every broker with insecure credentials, and the per-partition connection added the configured option on top of them, so a publisher could not reach a broker that requires TLS. That connection was also never closed. PublisherConfiguration now takes the dial option, insecure only when none is given, the agent passes its own, and the partition connection is closed when its publish job ends. * mq client: resend unacked messages when a partition's publish stream fails A publisher sent each message once and kept no record of it. Acks were only logged, a broker error on the stream was written to a field nobody read, and the scheduler's wait loop broke out of its select instead of the loop, so after the first stream failure it never looked the partitions up again. Losing a partition leader silently dropped every unacked message and stopped that partition for good. Each partition now keeps its queue and the messages it sent but has not had acked across streams. When a stream fails, or the broker answers with an error or error code, the job ends, the scheduler looks the topic up again with a short backoff, and the replacement stream resends the unacked messages in order before draining the queue. Acks remove messages up to the acked timestamp, so timestamps are made strictly increasing per publisher. A partition holds at most 1024 queued or unacked messages, and Publish blocks beyond that instead of growing without bound. FinishPublish and Shutdown stop the input, Publish then fails, and Shutdown returns once everything queued is acked. * mq client: bound how long a closed publisher keeps resending Once its input is closed, a publisher kept retrying a partition until every message was acked, so Shutdown never returned while no broker could take the partition, and a publisher that was only finished kept looking the topic up forever. Resending now stops a minute after FinishPublish or Shutdown, the open streams are cancelled, and Shutdown reports how many messages were left unacknowledged. * mq/kafka: replace a publish session whose call failed or was cancelled PublishRecord ran Send and Recv in goroutines and returned when the request context ended, leaving them on the stream. A leftover Recv then took the ack meant for the next call on that partition, so acks and offsets drifted apart, and a session whose stream had failed or whose broker answered with an error stayed cached until the topic was deleted. A call that fails, is cancelled, or gets an error response now drops its session and cancels the stream, so the next call opens a fresh one. PublishRecordValue shares the same path. * mq/kafka: publish to the partition's current leader The gateway opened every publish stream on the one broker it was configured with, and a broker answers a publish for a partition it does not lead with not-leader, so with more than one broker most partitions could not be produced to, and none could after its leader moved. The gateway now opens the stream on the leader named by the partition lookup it already caches. A not-leader or connection failure drops the session and the cached lookup and comes back as ErrNotLeaderOrFollower, so the next attempt finds the new leader. * mq/kafka: answer a produce that lost its partition leader with NOT_LEADER_OR_FOLLOWER Every failed produce went back to the client as UNKNOWN_SERVER_ERROR, which Kafka clients do not retry, so a partition leader change surfaced as failed sends. A publish that failed because the leader moved or could not be reached now answers NOT_LEADER_OR_FOLLOWER, and the client refreshes its metadata and sends again. * mq client: let the flush timeout cancel a stalled partition lookup A lookup after a stream failure used context.Background, so a broker that accepted LookupTopicBrokers and never answered kept the scheduler inside it after the flush timeout, and Shutdown never returned. Lookups now run under a context cancelled when the publisher stops, and each broker attempt is bounded so a stalled one does not hold up the next. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq client: stop each test publisher and release held acks on cancel A test that never shut its publisher down left the scheduler retrying lookups against the stopped fake broker for the rest of the package run, and a fake ack worker held on the gate could not exit when its stream was cancelled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq client: do not restart a partition whose stream finished during the switch A re-lookup that moved a partition's leader cancelled its stream and waited for it, then started a new one. If that stream had just finished cleanly, the replacement ran for a job already counted as done, and the scheduler could exit with it still running. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq client: count only data messages as unacknowledged at Shutdown The count added the in-flight list and the queue length, so the close marker FinishPublish queues counted as a lost message: an empty publisher whose marker went unacked reported one unacknowledged message. Every data message holds a slot until it is acked, so the slots are the count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq/kafka: let a produce's deadline bound opening its publish stream Opening a session ran under the gateway's own context and waited for the leader's hello, so a leader that took the init and never answered held the produce, and every produce to that partition queued on the creation lock, past their deadlines. Setup now also ends when the caller's context does, without invalidating the assignment for a caller timeout, and the stream outlives the call once open. A call whose context ended while it waited for a dropped session no longer opens another one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq/kafka: cancel the held publish only once the broker holds its data The test cancelled on a 200 ms timer. A slow session setup let that deadline pass before the data went out, leaving the first stream open for the next call, which then waited on the held ack. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq/kafka: fetch and read offsets from the partition's leader Produces go to the leader, but fetches and the high water mark and log start offset reads still went to the gateway's own broker, which answers partition not found for a partition it does not lead. Reads now use the leader the assignment lookup returns, as the publish path does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq agent: report unacknowledged messages when a publish session closes ClosePublishSession returned success right after FinishPublish, which only queues the close marker, so a message the brokers never acked was lost without an error. The close now waits for Shutdown, which returns once everything is acked or reports what was not after the flush timeout, and no longer holds the session map lock while it waits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq/kafka: look the leader up again after a read it cannot serve Reads used the cached assignment until its TTL, so after a leader died or gave the partition up, every fetch for the next 30 seconds went to it. A connection failure or a partition-not-found answer from the leader now drops the cached assignment, unless the caller's own context ended. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq client: leave a Publish still waiting to enqueue out of the Shutdown count Publish takes a slot before it checks that the input is open, so a Publish paused between the two still held its slot when Shutdown counted, and Shutdown reported a message the caller was then told was rejected. Each job now counts the data messages it accepted and has not had acked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq/kafka: cancel the silent-leader publish once its hello is withheld The test cancelled on a 200 ms timer, which could fire before the call opened a stream; the retry then opened the withheld stream with no deadline and hung the suite. It now cancels once the fixture holds the hello and bounds the retry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq: retain the original publisher payload for replay * mq agent: flush accepted records when the publish stream closes * mq client: isolate bootstrap RPCs by publisher credentials * mq/kafka: honor publish cancellation during lookup and partition waits * mq/kafka: read a partition's offset range from its leader GetHighWaterMark and GetEarliestOffset asked the gateway's configured broker, which answers from its own log buffer. Publishes now go to the partition's leader, so a non-leader gateway broker reported a high water mark that missed the leader's unflushed records. Send the range query to the leader and drop the cached assignment when that broker fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq agent client: bound the wait for the agent to finish a session CloseSession waited in Recv until the agent answered EOF. An agent blocked enqueueing to a partition whose broker stopped acknowledging never reads the close, so it never starts its bounded flush and the close hung. After two minutes, cancel the stream: the agent then stops accepting and flushes, and the close reports the timeout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq agent: wait for both closers to reach the flush in the close test The duplicate-close test slept 100 ms to let the second close start. A late goroutine then found the session already removed and the test failed. Wait until both closers are inside finishPublisher instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq: answer a partition's offset range only from its leader A broker answered GetPartitionRangeInfo from its offset manager even after the partition moved away, so the gateway kept reading the old leader's range until its assignment cache expired. The broker now checks ownership the way FetchMessage does, and the gateway drops the cached assignment when the range request fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
29eebd7bb2 | docs: regenerate star history chart | ||
|
|
e3e3bacf10 |
mount: read an open file's extended attributes under its entry lock (#13194)
* mount: read an open file's extended attributes under its entry lock getxattr and listxattr on an open file read the Extended map of the handle's live entry with no lock, while setxattr and removexattr change that map in place. Go ends the process on a concurrent map read and write, so weed mount exits with "fatal error: concurrent map read and map write" (GetXAttr) or "concurrent map iteration and map write" (ListXAttr), and every file open on the mount returns ENOTCONN. The kernel asks for security.capability on each write(), so a program that writes a file while another process sets or removes its attributes reaches this. The entry's own lock, LockedEntry.RWMutex, is the one every other writer of the handle's entry takes: truncate to zero, the metadata merges of a flush, SetEntry and the acknowledged-attribute retention. setxattr and removexattr changed the map under the handle lock and entryLock only. They now also take the entry lock, in the documented order after those two, and re-read the handle's entry under it, as SetAttr does, in case SetEntry swapped it. GetXAttr and ListXAttr read the handle's current entry under the entry's read lock and copy what they return before releasing it. The read lock is a leaf: it waits for no other lock and does not wait for the handle lock, so a getxattr is not held up by a write in progress. TestXAttrReadsAgainstSetAndRemoveOnOpenFile and TestXAttrReadsAgainstTruncateToZeroOnOpenFile abort the test binary with the fatal errors above without the change, and all three race tests report data races under -race. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: remove the attributes the xattr race test sets The writer of TestXAttrReadsAgainstSetAndRemoveOnOpenFile set even keys and removed odd ones, so every RemoveXAttr found no key and returned ENOATTR before deleting anything. Each name is now set and then removed, and both calls must succeed. With RemoveXAttr's entry lock taken out, -race reports its delete against GetXAttr's read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
24951dbfe7 |
mq: one offset assigner per partition, continued from disk (#13191)
* mq: assign publish offsets inside the partition's log buffer A publish took its offset from the offset manager under one lock and appended it to the log buffer under another, so two publishers on one partition could append offsets out of order. The buffer now assigns the offset under its own lock when the entry asks for one, and an entry that already carries an offset moves the buffer's next offset past it instead of bumping it by one. * mq: give the entry that rolls a window over to the new window Both append paths widened the window's offset range before checking for a rollover. The sealed window then claimed the entry that started the next one, and the new window's range started without it, so a window holding only that entry was flushed as offsets 0..0 and readers skipped it. The range is now widened after the rollover. * mq: seed a partition's offsets from all of its own files A loading partition continued its offsets from the highest offset recorded on disk, but the scan listed without a limit, so the filer returned only its default page (1000 entries under weed server and mini) and offsets below the real maximum were handed out again. It also read the newest version directory rather than the partition's own, and a filer error left the partition counting from 0. The broker and the Kafka gateway now share mq.ReadOffsetRange, which lists every file, the broker reads the partition's own directory, and a partition whose stored offsets cannot be read is not loaded, so the publish fails and is retried. * mq: reload a partition only after its retired copy has flushed Idle cleanup and a drain retire a partition and return while its last flush is still queued. A publish right behind them created a new copy, which read the stored offsets before that flush landed and handed out its offsets again. Loading a partition now waits for a retired copy of the same range, outside the broker's access lock that the flush takes. * mq broker: report a partition's high water mark from its buffer The range reported to the Kafka gateway took the larger of the offset manager's count and the buffer's, so it followed the manager's checkpoint rather than what the partition had assigned. It now comes from the loaded partition's buffer, which assigns the offsets, or from the ranges stored on disk when this broker has not loaded the partition. * mq: drop the offset manager's assignment, checkpoint and subscription code Publish offsets now come from each partition's log buffer and its high water mark from that buffer or the stored ranges, so the separate assigner, its checkpoint.offset writer and the offset subscription layer built on it have no callers left. Only consumer-group positions remain in BrokerOffsetManager. Existing checkpoint.offset files are left alone; readers already skip them. * mq broker: recheck a retiring partition under the lock when assigning AssignTopicPartitions waited for a retiring copy before taking the access lock, so a drain in between could retire the partition and the assignment then seeded a replacement before that flush landed. The check now runs under the lock, which is released only to wait. * mq topic: mark a partition retiring before it leaves the list RemoveLocalPartition took the partition out of the active list before recording it as retiring, so a replacement loaded in between saw neither and read the stored offsets before the last flush landed. The partition is now recorded as retiring first. * mq topic: gate the retired-flush test on a channel instead of a sleep The test relied on a 200ms flush delay to observe the partition as pending, which a paused test goroutine could outlast. * mq topic: remove a partition by its instance under one lock RemoveLocalPartition looked the partition up, marked it retiring and then removed by range in separate steps. A second remover of the same copy could take out a replacement loaded in between, leaving it neither listed nor retiring, and a removal that found nothing still left a stale retiring entry. Callers now pass the copy they hold; it is marked retiring and taken out of the list under the partition lock, and only if it is still listed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: look a partition up once per assignment pass The retirement wait checked one lookup and the load used a second one, so idle cleanup retiring the partition between them let the assignment load a replacement from stored offsets before the retired copy's last flush landed. The wait and the load now use the same lookup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: let a cancelled assignment leave the retirement wait AssignTopicPartitions waited for a retired copy's last flush without watching its request, so while that flush kept failing a cancelled call still held its handler. WaitRetired now takes a context and returns its error, leaving the retirement pending; the publish and subscribe loader keeps waiting as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq topic: share one flush signal per retirement A cancelled WaitRetired left its goroutine blocked on the retired buffer's flush, so repeated cancelled assignments piled up goroutines until that flush finished. The retirement now owns one channel, closed after its last flush, and every waiter selects on it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: load the assigned generation for any request of its range Subscribe and fetch pass the partition from the request, and the loader built the local partition from it after matching only the range. A stale or zero generation then scanned a directory the broker was not assigned, found no offsets, and registered a partition that restarted at zero over stored data. The loader now takes the assignment's partition. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
de76148f54 |
mount: fail the flush when dirty pages cannot be read back from the swap file (#13198)
* mount: fail the flush when dirty pages cannot be read back from the swap file Dirty pages that weed mount buffers in the swap file (non-sequential writes, or when the memory chunks run out) are read back when they upload. SwapFileChunk.SaveContent ignored the error of that read: an interval it could not read in full was uploaded short, or not at all, and flush, fsync and close still succeeded. The writes the application had been told succeeded became a hole in the stored file, with no error anywhere. A read error on the cache disk, or a swap file truncated by an outside cleanup, is enough. SaveContent now hands the upload a reader that fails with the read error. The upload fails like any other failed chunk upload: the handle records it, rejects further writes, and flush, fsync and close return EIO without publishing the entry. The remaining intervals of that chunk are not saved, since the handle cannot flush cleanly. The chunk, its write budget and its swap slot are released as before. The test in weed/mount cuts the swap file after the write was acknowledged: on master fsync returns OK and the filer is never told. The pipeline tests cover a closed and a truncated swap file, and a swap file cut inside the second of two intervals. SwapFileChunk.ReadDataAt, which serves reads of pages not yet uploaded, still logs a read error and returns what it has read so far; that is left for a follow-up since it needs an error path through the read side. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: require a failed fsync to leave the filer entry unchanged TestFsyncFailsWhenSwapFileCannotBeReadBack accepted any filer entry backed by stored bytes that left out the lost range, so an entry published with the readable interval (the original 256 bytes plus the "A" write) would also have passed. It now records the filer's entry before the writes and requires the same entry and the same 256 bytes after the failed fsync. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
265b3aae0f |
mount: take the two handle locks of CopyFileRange in one order (#13197)
CopyFileRange locked the destination handle exclusively and then the source handle shared. Two copy_file_range calls in opposite directions between the same pair of files (A to B and B to A, which coreutils cp issues by default) each held their destination and waited for their source, and neither could go on. Every operation that needs either handle's lock then waits behind them: reads, writes, flush, release, and the invalidation of the handle by a metadata event. The processes using the two files hang until the mount is restarted. The two locks are now taken in ascending FileHandleId order, whichever of the two handles is the destination; the destination is still locked exclusive and the source shared. A copy whose source and destination are the same handle takes the one lock exclusive, as before. CopyFileRange is the only place that holds the fhLockTable locks of two handles at once, which the nested lock order comment in filehandle.go now says. The test queues the first copy behind a handle lock held by the test and starts the opposite copy while it waits; the lock order is the only thing that lets both finish. It fails on master with both copies parked in the lock queue. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
9cea13b9fc |
mq broker: fenced flushes, one file per window (#13192)
* mq: number partition leaderships with an epoch A partition assignment named its leader but nothing told one leadership from the next, so a broker that lost a partition could not be told apart from the one that replaced it. BrokerPartitionAssignment now carries an epoch that the balancer bumps whenever it picks a different leader, including the first leader of a new partition, so a fresh allocation starts at epoch 1. Follower changes and re-spelled addresses of the same leader keep the epoch. * mq broker: take a partition fence before leading a partition Nothing stopped a broker that had lost a partition from writing to it, so two brokers flushing one partition overwrote each other's files. Each partition directory now holds a .fence entry naming its writer and the assignment epoch. A broker generating a partition as leader reads the fence and rewrites it with one filer ObjectTransaction, routed to the fence's owner filer and conditioned on the fence being absent or unchanged since the read, before it reads the partition's existing offsets. A fence stored at a higher epoch or sealed is refused, and the partition is not served when the fence cannot be taken. The broker keeps the fence entry as stored so later writes can present it. Topic configuration now passes each assignment's epoch to the broker it assigns. * mq broker: flush each window to its own fenced file A flush uploaded a chunk on every attempt and appended it to the chunk list of the file named by the window's start second with an unconditional CreateEntry. A lost response duplicated the window, every retry orphaned the previous chunk, and two brokers writing one partition overwrote each other's chunk lists. Each window now becomes a new file named by its start second and its first offset, uploaded once and written with one filer ObjectTransaction conditioned on the partition fence the broker holds. Only the transaction is retried, under a single request id, so a replay cannot apply twice. buffer_start now records the window's first offset instead of the next-offset counter. A failed fence condition means another broker took the partition: the window is dropped, later windows drop without an upload, and the publish path answers not-leader so publishers move on. The follower's stream-end write of its leftover windows now goes through the same fenced writer, which refuses it because a follower holds no fence. That write only ever produced offset-less duplicates of what the leader flushed, so the follower now drops those windows. * mq: read flushed windows named with an offset suffix Flushed windows are now named by start second and first offset, which the readers did not expect. The disk reader dropped every file whose name sorted after the stop second, which a window starting in that very second now does, and log compaction parsed the whole name as a time and skipped the new files. Both now look only at the start-second part, so files with either naming are read. The partition fence that sorts first in a listing is skipped by the disk reader and the query engine's live-log scans, and topic truncation keeps it. * mq broker: retry a recorded flush failure under a new request id The filer records a failed mutation under its request id and replays it for two minutes, so retrying the same id stalled the partition's flush. Putting the same window entry again is harmless, so a recorded failure now retries under a fresh id; a lost response still retries under the same one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: hold the partition fence by a token, not a read-back entry Taking the fence read the written entry back through the broker's filer, which may lag the fence's owner filer; a successful take then looked lost and the new leader did not load. The fence entry now carries a fresh token as its etag, and later writes require that etag on the owner, so nothing is read back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: bound the fence take's filer calls A partition is loaded under accessLock, and the fence take's lookups and transaction had no deadline, so a filer that accepted a call and never answered held every partition operation on the broker. A take that runs out of time leaves the partition unserved for a later attempt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq: name compacted files and skip compacted windows by their source logs Now that several windows can start in one second, compaction named every output after its first message's second, so groups starting in the same second overwrote each other, and it skipped any window whose start second was not after the newest compacted row, so a later window in that second was never compacted. A parquet file is now named after its first source log, which is unique, and a window is skipped when a parquet file lists it as a source; the start-second rule remains only for windows named by their second alone. * mq broker: reload a partition whose fence another broker took A partition that lost its fence stayed registered until its last client left, and both partition load paths reused it, so a broker made leader again at a newer epoch kept answering not-leader, or wrote until its next flush was refused. A fenced partition is now dropped and the partition loaded again under the current assignment's epoch. * mq broker: reload a partition held under an older epoch A copy whose fence was taken is reloaded only once a refused flush marks it lost. Until then a broker made leader again at a newer epoch kept the copy and accepted publishes that the next flush dropped against the other broker's fence. A copy whose fence epoch is older than the assignment's is now reloaded too. Its last flush lands under its own fence before the reload reads the stored offsets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq: start a new compaction group only after the current one has a file A first log file larger than the group size left an empty first group, and naming a parquet file after its group's first log then indexed past the end. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq: remove a partition by its instance, not its range A publisher or subscriber of a copy that was replaced removed the partition by range on its way out, which shut down the replacement instead. Removal now takes the copy itself and leaves a copy that has replaced it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: keep a stale copy registered until its last flush lands A reload removed the stale copy and then waited for its last flush without accessLock. A concurrent lookup or assignment found no copy, took the new fence first, and the pending flush was refused and its window dropped. The copy is now shut down where it is registered, so every loader finds it and waits for the same flush, and it is removed only afterwards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: refuse an assignment once a reload waited out a shutdown start The stopping check ran before the stale-copy reload, which releases accessLock while the copy flushes. A Shutdown starting then left the retired copy in place and the assignment reported success for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: bound the concurrent reload test's waits Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq: describe fenced writes and the follower loss window in the failover notes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: release the upload gate when the reload test times out A first upload starting just after the deadline check stayed blocked on the gate, so the test server's Close waited on it and cleanup hung. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
d4910b70cf |
s3api: classify the GetPart part key in the route-key test (#13193)
s3api: classify the GetPart part key as an uploadId modifier The GetPart route added a `part` query key that TestRouteQueryKeysAreClassified did not know, failing the s3api tests on master. `part` only narrows an uploadId request from ListParts to GetPart, like partNumber does for UploadPart, so it must not count toward the ambiguity guard: counting it would reject every `?part&uploadId` request. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
139c1d6d04 |
mq broker: survive startup, non-balancer brokers, and restarts (#13181)
* mq broker: turn a panic in an RPC into an error The broker's gRPC servers had no recovery, so a nil dereference in any handler took the whole process down. Once the broker runs inside another server, that process is the host. * mq broker: guard the filer set The master's peer updates and the startup peer listing both write the filers map and currentFiler from different goroutines, and every filer call reads currentFiler. Two writers on the map at startup is a fatal concurrent map write. * mq broker: answer balancer requests before the balancer lock exists The balancer lock is created only once the broker has found a filer, while the gRPC server already serves. Every lookup, configure, publish and balance request dereferenced it, so an early request crashed the broker. Those requests now answer Unavailable until a balancer is elected. Ownership is the lock's unexpired lease instead of the owner name it last saw, so a broker whose renewals have failed stops acting as balancer once the lease runs out. A lapsed lease can still name this broker, so proxying refuses to send a request to itself. * mq broker: follow the filer lock ring The balancer lock client was seeded with the first filer the broker found and never given the ring, so it kept dialing that filer after it left and no broker could become balancer. The broker now takes the master's lock ring updates the way S3 gateways and mounts do, and the master sends brokers the ring snapshot on connect. * mq: never pick a partition's leader as its follower pickBrokersExcluded ignored the leader it was told to exclude. With one broker, the first assignment repair made that broker its own follower, and it then replicated every publish to itself. A dead follower that has no replacement is now dropped and counted as a change, so the cleared name is saved; picking the leader had hidden that. * mq: keep a partition's leader unless a live broker replaces it The repair cleared the leader of any partition whose leader it did not see, even with no broker to take over, and the cleared assignment was cached. With an empty broker set every leader went blank. A leader now moves only to a live broker, the only live follower is promoted when it is all that is left, and a follower that names its own leader is replaced. * mq broker: only a settled balancer repairs assignments Every broker repaired topic assignments on a cache miss, but only the balancer tracks which brokers are live. Any other broker saw an empty set, cleared the topic's leaders, and could not load a partition it did own, so a publish to it dereferenced a nil partition. A newly elected balancer also waits 30 seconds, long enough for every broker to notice the change and reconnect, before it treats a broker it has not heard from as gone. * mq broker: refuse a publish for a partition not assigned here When the balancer named this broker as leader but its own copy of the topic config did not, the partition lookup returned nil and the publish dereferenced it. It now answers not-leader, and the publisher looks the partition up again. * mq broker: compare the publish leader as an address The leader check built "ip:port" with Sprintf and compared strings, while broker addresses are joined with JoinHostPort. On IPv6 the brackets never matched and every publish was refused as not-leader. * mq broker: flush partitions on stop The broker had no Stop. Its loops ran on context.Background, and the standalone command registered nothing for SIGTERM, so every restart dropped the publishes still in the open flush window. Stop now cancels the broker's loops, releases the balancer lock, and waits until every partition has flushed. The command calls it on interrupt before stopping its gRPC servers. The startup peer listing, which blocked the constructor until a master answered, now runs in the background with the balancer election. * mq topic: flush partitions added or retired while stopping Shutdown took one snapshot of the partition list, so a partition a publish created after the snapshot was never flushed, and one that idle cleanup had just retired was not waited on. Adding a partition now fails once Shutdown starts, Shutdown waits out an idle cleanup pass in progress, and every retired partition is waited on until its last flush. * mq broker: release the balancer lock once on stop Stop and the balancer election could both release the lock when a stop landed just as the lock was published, and a second LiveLock.Stop closes its channel again and panics. Each path now takes the lock out with Swap, so only one releases it. * mq broker: forget the buffered ring version on a master change Before the balancer lock client exists, the broker keeps the last ring it got. A master change then reset nothing, so the client attached with the old master's version and refused the new master's lower one. * mq broker: restart the settle window when the balancer lease is regained The window started when the lock owner's name changed. A balancer that lost a renewal and got the lease back still had the same name, so it skipped the wait and could repair assignments before brokers reconnected. The window now counts from the first sight of the lease's generation, which changes on every fresh acquisition and stays put on renewal. * mq broker: expire configs cached while the balancer settles A balancer reading a topic during its settle window skipped the repair and then cached the config for the full 30 seconds, so a dead leader was served well past the window. Those entries now expire at the settle deadline. * mq topic: wait for drained partitions on shutdown A partition removed by a drain or by its last client leaving was shut down but not tracked, so a stop right after a resize could exit before its final flush. Every removal now retires the partition through the manager, and Shutdown waits on the set of retiring partitions instead of a WaitGroup that a late removal could Add to while Wait ran. * mq broker: update the settle window's lease and start together The lease generation and its start were two atomics written one after the other, so a concurrent reader could pair a regained lease's new generation with the old start and see the window as already over. They are now read and written under one lock. * mq broker: refuse an assignment while stopping A partition assigned after shutdown started was shut down, but the handler still answered success, so the balancer recorded an assignment this broker never installed. It now answers Unavailable. * mq topic: signal a subscriber to stop only once Shutdown leaves partitions registered, so a drain that arrives while the broker flushes shuts the same partition down again, and closing a still registered subscriber's stop channel a second time panicked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: bound flush retries once stopping Stop waits for every partition's last flush, and a flush retried a failing write forever, so a broker whose filer or volumes were unreachable never exited on SIGTERM. In weed server it also held back the filer and volume shutdown hooks, which run after it. Like the filer's metadata log, a flush now gives up 15s into Stop and drops the window instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq.broker: flush before closing the localhost listener too The localhost server's stop hook was registered after the broker's, so it ran first and cut loopback clients before the partitions flushed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq topic: gofmt local_manager.go Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: end a shutdown flush stalled in a filer call The shutdown budget was checked only after a failed append returned, and the entry lookup and update ran under context.Background(), so a filer that accepted the call and never answered still held Stop open. Flushes now append under a context that Stop cancels once the budget runs out, as the filer does for its metadata log. Every window after a dropped one then drops too, so a later success cannot advance the watermark or tell the follower to discard a window that never reached the filer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq topic: leave a partition to Shutdown once it starts RemoveLocalPartition detached a partition before registering it as retiring, so a Shutdown snapshot taken in between missed it and returned before its last flush. Once Shutdown starts, removal now reports false and the partition stays registered for Shutdown to retire, as idle cleanup already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: refuse an assignment for a hosted partition while stopping Only a new partition was refused once Shutdown started. A partition the broker already hosted stays registered after Shutdown retires it, so its assignment was acknowledged although the broker no longer serves it. Both paths now answer Unavailable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: expire a settling balancer's config from when it was validated The expiry was computed when the config was cached. A lookup that skipped validation just before the settle deadline and cached the config just after it kept the unrepaired assignments for the full TTL. The expiry now counts from the time of validation, so such a config expires at the deadline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mq broker: stop waiting on an upload once the flush budget ends Cancelling the flush context ended retries and the filer metadata calls, but not a volume assignment or upload already in flight. Those ran on their own timeouts and retries, so a filer or volume server that never answered held Stop past the budget, for minutes in the worst case. The upload now runs on its own copy of the window, and the flush stops waiting for it when the context ends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
394e9d247e |
mount: keep assignment proofs until the filer stores their chunks (#13186)
* operation: return the assignment proof of an upload A filer serving a scoped token returns an assignment proof with AssignVolume and stores a new chunk in an entry only when the request presents that proof in chunk_auth. UploadWithRetry dropped it, so a client had no way to commit the chunks it uploaded. UploadResult.AssignAuth now carries the proof of the assignment the data was finally stored under. A proof from an assignment the upload abandoned after a failed attempt is never returned. The field is not serialized and stays empty when the filer sends none, so existing callers are unchanged. * mount: keep assignment proofs until the filer stores their chunks A mount with a scoped filer token was refused whenever it wrote new chunks: the filer asks for the assignment proof of every chunk the stored entry does not hold, and the mount never kept it. The mount now keeps the proof of every chunk it uploads and attaches the proofs of the chunks a request names to each create, update and append it sends, over the mutation stream and over unary calls, on every attempt. A proof is released only once a filer acknowledged an entry that names the chunk, or a manifest that holds it. A failed, refused or timed out commit releases nothing, since it may have been stored: the retry still carries the proof, and a filer ignores proofs for chunks it holds. Proofs are stateless, so a commit retried on another filer of the cluster is accepted there. The store is bounded. When it is full an upload waits for commits to make room before it is assigned a file id, and fails after a minute instead of evicting a proof a pending commit still needs. Only proofs well past their expiry, which a filer refuses anyway, are dropped to make room. Without a filer token the mount keeps no store: its requests and chunk lists are as before. A token without path grants is given no proofs, so nothing is attached either. * mount: keep chunk lists flat with a filer token file A filer serving a scoped token stores no new chunk in an entry that holds manifests, so once a mount folded a file's small chunks into a manifest, every later write to that file was refused. A mount with a filer token now keeps chunk lists flat; mounts without one fold as before. * mount: test the unscoped-token path with a signed token GenJwtForFilerScope returns an empty token when it is given no path grants, so both cases of TestUnscopedMountRequestsCarryNoProofs ran a tokenless mount. Sign an unscoped filer token instead and check that it is not empty, so the test covers a mount holding a token the filer issues no proofs for. * mount: fold chunk lists unless the filer scopes the mount's token A mount with -filer.tokenFile kept every chunk list flat, also when the token is an unscoped one the filer issues no proofs for. Such a mount stopped folding chunks into manifests, so its small-chunk runs were never folded and, on FoundationDB, a file past about 1000 chunks no longer fit its entry. Keep lists flat only while the current token has path grants or a method list, which the filer scopes; fold as before otherwise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
aeca7a9a8a |
master: keep writes available when the replica placement cannot be satisfied (#13178)
* master: keep writes available when the replica placement cannot be satisfied With a placement such as 200 on exactly three data centers, losing one data center stops all writes: every volume misses a copy and leaves the writable list, and volume growth cannot find three data centers. Add master.replication.degraded_growth_min_copies (0 = off). When the topology no longer has enough data centers, racks or servers for a placement, the master grows volumes with fewer copies, never below that number. A lack of free space never triggers it. These volumes keep the requested placement in their super block and are writable while the master flags them as degraded; lookups report the copies they need, so volume servers accept writes to them. Once the topology can hold the placement again the flag is cleared: they turn read-only until volume.fix.replication adds the missing copies. The flag is in memory only, so a master restart has the same safe effect. Refs #13177 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: tighten degraded volume growth after review - A degraded volume is writable only with exactly the copies it was grown with: losing one turns it read-only, so a copy that comes back has missed no write, and it is not writable before all its copies are registered. - Use the first relaxed placement the topology can hold and stop there when it lacks free slots, so full disks never drop more copies. - Try every relaxed placement, ordered by copies, then data centers, then racks (011 can fall back to 010, not only 001). - Data nodes in maintenance mode do not count when checking the topology. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: tie degraded writability to the original servers - A degraded volume is writable only on exactly the servers it was grown on: a replacement copy no longer stands in for a missing original one. - Lookups report the degraded copy count only in that exact state, so a volume server never relaxes its check when the layout would not. - When a relaxed placement fails to find slots, try the other placements with as many copies (for example in the requested data center) before giving up, still never dropping copies for lack of space. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: copy min_writable_copies into the master.proto copy Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: let a degraded volume replicate with the master's min_writable_copies Mirrors getRemoteReplications: lookup_volume also returns the lookup's min_writable_copies, and do_replicated_request uses it instead of the placement's copy count when it is lower. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seaweed-volume: test the degraded replicated write through the admin router Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: grow degraded volumes without a setting Degraded growth no longer needs master.replication.degraded_growth_min_copies: it always applies when the topology cannot hold a placement, never below two copies. Lookups skip the degraded scan until a volume was grown degraded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: leave refused servers out of the degraded slot search findDegradedSlots cleared option.refused, so a retry could pick the server that just refused the allocation. Search without the refused servers first and fall back to them only when nothing else fits, as findAndGrow does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: document that a degraded volume losing every copy stays read-only Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: warn about under-replicated and misplaced volumes on the dashboard The dashboard health line now counts the volumes volume.fix.replication would repair, using the same placement checks, so volumes grown degraded while a data center is down show up until they are repaired. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: spread degraded copies over racks and servers when data centers are missing A 200 volume with a single data center left found no degraded placement: only per-dimension reductions were tried, and 100 needs two data centers. Try every placement with fewer copies and no more data centers, so the remaining copies go to other racks or servers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * master: report min_writable_copies only for the locations it is returned with LookupVolume read the locations and the degraded minimum in two steps, so a replica set change in between could pair the minimum with locations it does not hold for. Count the minimum only when the returned locations are exactly the servers the volume was grown on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> |
||
|
|
5815d13881 |
mount: keep in-place updates at a listed entry's commit stamp (follow-up to #13152) (#13189)
* mount: keep an entry whose in-place update is already reflected A listed entry carries its own commit stamp, so the update event that made it arrives at exactly that stamp. The removal half passed the strict check while the write half was fenced, and the entry was deleted and tombstoned. An in-place update is one change: when its write is fenced, so is the removal of the same path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: report a cached entry's own commit as its version FindEntry still versioned a listed entry at the listing floor, below the commit it carries. An open handle compares invalidations against that version, so a delayed event the cache fenced out could still replace the handle's content with the older state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
501cf6b760 |
mq: read a recorded offset range that ends at offset 0 (#13190)
The broker and the Kafka gateway each scanned a partition's files for the high water mark and counted a maximum only when it was above 0, so a partition holding one message still read as empty. Both now share mq.OffsetRange, which tracks whether a range was found apart from its value. |
||
|
|
4830ae5e96 |
feat: set GOMEMLIMIT from cgroup memory limit via automemlimit (#13188)
* feat: set GOMEMLIMIT from cgroup memory limit via automemlimit * weed: set the memory limit before dispatch and report it through glog The blank import ran memlimit.Set in an init with slog.Default, so every weed command, including weed version and weed shell, wrote to stderr outside glog, and macOS and Windows printed "failed to set GOMEMLIMIT: cgroups is not supported" each time. Call memlimit.Set before running the command instead, and log the resulting limit or a bad AUTOMEMLIMIT value next to the transparent huge page line of long-running commands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * mount: log the -memoryLimitMB override and document the automatic limit weed mount now starts with 90% of the cgroup memory limit unless GOMEMLIMIT is set, so -memoryLimitMB=0 no longer means unlimited inside a container. Say so in the flag help and log the override, which replaces the limit the startup line reported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Rajesh Kannapalli <rajesh.kannapalli@broadcom.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
54f0c7ca5b | fix(filer): clip chunk group reads at EOF (#13182) | ||
|
|
81b83b155f |
fix(mq): copy flush buffers before queuing follower data (#13183)
* fix(mq): copy flush buffers before queuing follower data * fix(buffered_queue): release references after dequeue |
||
|
|
df2fa630c1 |
mount: fence events below a cached entry's own commit stamp (#13152)
A listing snapshot capped at the peers' delivery watermark can trail entries already in the store. A delayed event older than the listed version then rolled the entry back, e.g. a completed file to its empty create, until the newer event arrived. A live entry now counts as versioned at least at its CommitTsNs. Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
0d09c87281 |
fix(master): handle capacity changes during volume placement (#13185)
* fix(master): handle capacity changes during volume placement * topology: test capacity changes during placement deterministically The maintenance-toggling loops ran for seconds and could pass without reaching either guard. Drain the secondary rack or data center right before its slot draw, and feed PickNodesByWeight a node whose reported capacity changes between reads. Each case fails on the code before the fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
d807dbfcbc |
fix(s3): preserve logical part layouts on multipart completion (#13184)
* fix(s3): preserve logical part layouts on multipart completion * s3api: accept a multipart part that is entirely a hole UploadPartCopy of a range that overlaps no source chunk stores a part with no chunks but a non-zero size. Completion rejected any chunkless non-last part as empty, so the upload failed with InvalidPart even though the part copy succeeded. Reject only parts whose logical size is zero; the all-hole part now completes as zeros at its position. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: refuse a multipart completion made only of holes When every completed part is a hole, the object gets a positive size and no chunks, and GET answers it with InternalError as a data integrity failure. Reject that completion with InvalidPart instead of committing an object that cannot be read. Uploads that mix hole-only parts with data parts still complete. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
480a1baa20 |
s3api: GetPart, reading parts of in-progress and completed multipart uploads (#13174)
* s3api: GetPart reads one part of a multipart upload GET /key?part&partNumber=N&uploadId=X serves the latest attempt of an open upload's part, or the bytes that part became in the object a completed upload assembled, including a version that is no longer latest. x-amz-multipart-upload-status says which. A Range counts within the part, and a whole part answers 200 even though a completed part is served as a range of the object. The route sits ahead of ListParts and claims any ?part request, so a missing partNumber is InvalidArgument rather than a listing, and the request resolves to s3:GetObject, not the ListParts grant. * s3api: reading an open upload's part needs s3:GetIncompleteUpload AWS gates GetPart on an upload that has not completed behind s3:GetIncompleteUpload on top of s3:GetObject, so a plain read grant does not start exposing data its writer has not committed yet. The action is its own legacy grant too; Read alone does not carry it, Admin does. A completed upload's part needs only the read grant, plus s3:GetObjectVersion when it lives in a version. * s3api: a GetPart request carrying ?uploads is not a multipart listing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: GetPart answers a completed empty part with an empty 200 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
ac2efbac01 |
fix(buffered_queue): synchronize enqueue with input closure (#13168)
Check isClosed while holding the queue mutex so the check and insertion are atomic with respect to CloseInput. This prevents a producer from successfully enqueueing after a consumer has exited a closed, empty queue. Add concurrent enqueue, close, and drain coverage with a bounded wait, plus checks for both sequential close orderings. The concurrent regression reproduces the original data race and stranded item under the race detector. Co-authored-by: Master <Master@node0.8m510.lpad-pg0.utah.cloudlab.us> |
||
|
|
10381075f3 |
mq: record the offset range of a partition's first window (#13180)
The flush wrote offset_min/offset_max only when minOffset > 0, using 0 as "no range given". A partition's first window starts at offset 0, so its file never got a range. A restarted broker derives the high water mark from those ranges, so a partition whose data was all in its first file read as empty. |
||
|
|
51d591e060 |
cluster: read a LiveLock's owner atomically (#13179)
The renewal goroutine rewrites the owner on every attempt while other goroutines read it through LockOwner. The MQ broker reads it on every request it proxies to the balancer. |
||
|
|
0964dd7713 |
filer: put a finished download on the budget's idle list before waking readers (#13147)
A download closed done and then moved its reservation to the budget's
idle list, so a reader woken by done could ask the budget for room
before the chunk it had just read was evictable.
TestReaderCacheBudgetLendsScratchToHedges failed this way about 1 in
1000 runs under -race ("hedge buffers did not evict the idle chunks").
The download now completes in the budget first.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
411e9a8542 |
filer: keep a copy of the entry in the path-specific test store (#13146)
The stub store kept the caller's entry, which the path translator changes back after the insert, so TestNameInAPathSpecificStoreCreatedTwiceIsCountedOnce raced with a lookup under -race. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
68072eff8a |
webdav: set mtime when a file is created (#13144)
* webdav: set mtime when a file is created OpenFile created the entry with Mtime 0 and only Close after a Write set the real time, so an empty PUT, or one truncating a file to empty, left it at 1970. The "new entry" marker for a failed first upload is now a field on the file. * webdav: keep a failed upload from removing another writer's version With every new entry carrying an mtime, a failed first upload removed whatever the path held at the first Write, including a version another writer stored after this open created it. The open now records the commit stamp of the entry it created, and the first Write keeps the removal only when the loaded entry still has that stamp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * webdav: check the entry's commit stamp when the upload fails The first Write's lookup left a gap: a version another writer stored after it was still removed by a later failed flush. Flushes only append chunks locally, so the stored entry keeps the create's stamp until Close; the failed flush now reads it then and removes it only while it still has that stamp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
53206f16be |
fix: reject NaN minimum free-space percentages (#13153)
Signed-off-by: guagucai <guagucai@outlook.com> |
||
|
|
0025e7177f | fix(filer): preserve chunk ordering on 32-bit systems (#13175) | ||
|
|
1a2be918bf |
s3api: reset the circuit breaker when its config is deleted (#13148)
* s3api: reset the circuit breaker when its config is deleted The delete handler parsed an empty file, which always fails, so the old limits stayed in place. It now loads an empty config. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: read and swap the circuit breaker limits under its lock A config change or delete replaced Enabled and the limitations map while requests read them without a lock. The swap now holds the breaker's write lock, and requests read both under the read lock that loadCounterAndCompare already took for the counters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> |
||
|
|
c637d60dfc |
filer.sync: keep an informational replay cursor on the source, and let the log purge honor it (#13176)
* filer.sync: save the sync position on the source filer as a replay cursor The position stays authoritative on the target. The source copy holds the last position the target checkpoint stored (a fresh sync without one holds just before the first event it received) and is rewritten hourly while the sync runs, even when the position does not move. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer.sync: do not replicate the sync cursors of the source A target never holds cursors that describe the source's log. A rename into or out of the cursor directory replicates the ordinary side. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * metadata log purge: keep the logs a filer.sync still needs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer.sync: describe the sync in its source cursor The source cursor is informational: besides the position it records the source and target filers and paths, exclusions, host, version, when the sync started, whether the position is a target checkpoint, and the processed and failed event times, for display in admin tools. The target checkpoint stays authoritative. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer.sync: save the first sync cursor when the first event arrives and retry failed saves A fresh sync only saved its cursor on the next minute tick, and a failed save still pushed the next attempt out by an hour, leaving the purge without a cursor while the sync replayed old log days. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer.backup: do not seed the source's sync cursors in the initial snapshot Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * metadata log purge: say that a position not saved for 7 days stops holding the log Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer.backup test: lock the recording sink for concurrent snapshot workers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer.sync: leave the sync cursors out of the metadata log gap check Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
bcd678271e |
mount: authorize filer calls with a pre-issued token file (#13118)
* security: filer token source read from a file FilerTokenFile is the token source of a client that holds a pre-issued filer token rather than a signing key. It reads the file on every call, so an atomic replacement that keeps size and mtime takes effect on the next attempt, and trims surrounding whitespace. A missing, unreadable, empty or malformed file fails the call: there is no fallback to anonymous or admin authority, and errors name the path but not the contents. FilerTokenClaims decodes a token's claims without a key, and FilerTokenGrantCovers compares two grants, so a client can plan reconnects before expiry and know when a replacement narrows what it may see. * mount: -filer.tokenFile authorizes filer calls with a pre-issued token A mount that should not hold a filer signing key can now present a token issued for it. -filer.tokenFile (or -o filer.tokenFile=) names the file; it is read for every filer gRPC attempt, so a replaced file takes effect on the next call or retry without a restart, and a missing or empty file fails the call locally. The source reaches every filer client the mount builds: the startup handshake, each attempt of WithFilerClient, the volume location client, the SSE-S3 reader's configuration call, the peer registrar dial and the lock client. It is attached per call, never to the cached channel, and never to master, volume or peer mount RPCs. The filer refuses MountRegister, MountList and distributed locks to scoped tokens, so the mount refuses to start when -filer.tokenFile is combined with -peer.enable or -dlm instead of failing at run time. Server-side copy_file_range signs its filer HTTP request with the HTTP key, not this token, and is unsupported with it. Without the flag the mount behaves as before. * mount: resubscribe metadata with a replaced filer token A metadata subscription keeps the authority it opened with, so a mount reading -filer.tokenFile would follow with the old token until the filer ended the stream at expiry, and every such end took the gap path that distrusts all cached listings. SubscribeMetaEvents now takes the credentials of each attempt. The mount opens each subscription with the token current at that moment and watches the file; once it holds a different token the attempt ends and the follow resubscribes at once from its checkpoint. This planned resubscribe is not a gap: cached listings stay, unless the new grant may show less than the old one or either token cannot be decoded, in which case they are read again so nothing the old grant showed outlives it. The filer walk treats a resubscribe like a stopped follow, so the same attempt is not replayed on the next filer. Without a token file nothing changes. * mount: hand the mutation stream over to a replaced filer token The mutation stream keeps the token it opened with, and a filer refuses to send on a scoped stream once that token has expired. A mutation applied at that moment loses its reply, the mount reads that as a transport failure, and the unary fallback sends it again. The stream now opens with a snapshot of the token source. Before admitting a request it checks the source: when the file holds another token, or the stream's token would expire before a reply could come back, the stream is retired. New requests wait while the admitted ones are answered, the stream is half-closed so the filer finishes it, and a successor opens with the new token. The waits give up only after filerRPCWait without a response, so a rename that keeps answering is not cut short. A request is never resent by the handover: one still unanswered when the wait gives up fails as on any lost stream, as before. A token too close to expiry to open a stream with is refused before anything is sent, so the request goes out once as a unary call, which the filer checks when it starts. Without a token file nothing changes. * mount: review fixes for the filer token file - A distrust of cached listings now also discards the directory builds in flight, in the meta cache's apply loop: such a build publishes nothing, its entries are wiped and the visit lists the directory again, so a listing read under a grant that has since narrowed is never cached after the distrust. The cached flags are reset again in the loop, after any build that completed before it. - Retiring the mutation stream runs in the background, and a request that waits for the retirement gives up on its own context, unadmitted. - With a token file and no filer signing key, server-side whole-file copy is not tried: its filer HTTP request would go out unsigned and fail as ambiguous. The copy streams through the chunk path instead. - On Windows the token file is opened with delete sharing, so a renewer can replace it by rename while a read holds it open; the missing-file test checks os.ErrNotExist instead of Unix wording. * mount: review fixes for the mutation stream handover A request admitted to the mutation stream with just over one RPC wait left on its token could wait behind a slow send until that margin was gone; its reply could then be refused at expiry and the request was resent over unary. The send loop now checks the margin again right before sending and holds back a request that no longer has it, which is safe to send over unary because the filer never saw it. A sent request whose reply is lost while the token has one RPC wait or less left now fails with EIO instead of a transport error: the filer may have applied it, so it is not resent. Losses with the margin intact fall back to unary as before. A newly opened stream now admits its first request through the same checks as an open one, so a token file replaced, or a token that neared expiry, while the stream opened is caught before anything is sent. A retirement keeps a cancel handle for its stream. Close uses it, so unmount no longer waits for admitted requests to be answered, and a waiter that gives up on a retiring stream stops it as it would stop an open one, so a request still queued there is never sent after that waiter fell back to unary. An ordinary rotation still drains admitted requests. * mount: drop kernel listings when the filer token's grant narrows A replacement token whose grant may not cover the old one already distrusts the mount's own cached listings. The kernel kept its own copy: OpenDir sets FOPEN_CACHE_DIR | FOPEN_KEEP_CACHE, so a directory still reachable under the new grant was listed again from the page cache with names the new grant may hide, until something else invalidated it. On a narrowed or undecodable grant the mount now also notifies the kernel for every directory inode it holds, from the subscription goroutine as the metadata apply path already does, so the next readdir reaches the mount. A readdir already under way on an open handle still finishes from what it read. * mount: drop kernel listings after a subscription gap too distrustCachedListings serves both the narrowed-grant path and the gap path. A gap can lose the very events that would have dropped the kernel's cached listings one directory at a time, and with FOPEN_KEEP_CACHE on OpenDir the kernel then serves those listings on every reopen. Move the kernel drop into distrustCachedListings so both paths get it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
05d9242f3c |
s3api: answer NoSuchBucket to a denied authenticated request on a missing bucket (#13139)
* s3api: optionally answer NoSuchBucket to a denied signed request on a missing bucket ## Problem AWS S3 answers 404 NoSuchBucket to an authenticated caller that is denied on a bucket that does not exist. SeaweedFS answers 403 AccessDenied. S3-compatibility test suites run by data platforms (which create, probe and clean up buckets with a scoped key) flag the difference, and a client that maps 404 to "create it" or "skip it" takes the 403 for a permissions problem instead. Answering 404 tells every authenticated identity whether a bucket name exists, which a multi-tenant deployment may not want, so the default stays 403. ## Fix A new option, off by default: `-s3.noSuchBucketWhenDenied` on `weed server`, `weed filer` and `weed mini`, `-noSuchBucketWhenDenied` on `weed s3` (`S3ApiServerOption.NoSuchBucketWhenDenied`). With it set, `refineDenial` extends `refineDenialForBucketName` (400 InvalidBucketName) with the NoSuchBucket answer, in `Auth`, `AuthPostPolicy` and the POST policy handler: - only after authentication succeeded with a signature or a token (signed, presigned, V2, streaming signed, streaming-unsigned with a signed header, JWT). The anonymous identity keeps 403 under any auth type, so an anonymous caller still learns nothing about which buckets exist; - a bucket-level PUT (CreateBucket, configuring a bucket) keeps 403, as AWS answers a refused create; - the lookup goes through the bucket config cache, which the authorization path has usually just filled, so a denied request rarely costs a filer lookup; a failed lookup is "unknown" and keeps 403; - an allowed request never looks a bucket up. `Auth` now keeps the auth type it used to discard; the POST policy handler, which verifies the form signature itself, passes `authTypeSigned`. With the option off nothing changes. ## Tests `weed/s3api/auth_no_such_bucket_test.go`: - `TestRefineDenialThroughAuth`: through `iam.Auth`, a signed caller denied on another identity's existing bucket gets 403 and on a missing bucket 404 (GET, PUT, a signed streaming-unsigned PUT); a bucket-level PUT stays 403; the caller's own bucket is allowed with no lookup. - `TestRefineDenialAnonymousLearnsNothing`: anonymous requests answer 403 for a missing and an existing bucket alike and never drive a lookup. - `TestRefineDenialRules`: presigned and JWT callers, failed authentication, allowed requests, a missing bucket name, a failed lookup, and the option off (no lookup wired) all keep their answer. - `TestPostPolicyDeniedNoSuchBucket`: a verified browser POST form denied on a missing bucket answers NoSuchBucket; a bad signature stays SignatureDoesNotMatch; an existing bucket stays AccessDenied. `TestRefineDenialThroughAuth`, `TestRefineDenialRules` and `TestPostPolicyDeniedNoSuchBucket` fail without the NoSuchBucket answer. `go vet` reports nothing in the touched files; `go test ./weed/s3api/ ./weed/command/`: ok. `go build ./weed`: ok. * s3api: count streaming-unsigned as signed only with a SigV4 or JWT credential A client-certificate identity that streamed its body unsigned answered NoSuchBucket on a denied missing bucket, while the same request without the body-encoding header answered 403. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: tell the anonymous identity by name, without the unlocked pointer read isAnonymousIdentity compared against iam.identityAnonymous without iam.m, racing a configuration reload. The configured anonymous identity always has the anonymous name and account, which the check already covers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * command: keep allowBackslashInKeyUsage's doc comment on its const Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: answer NoSuchBucket to a denied request on a missing bucket by default AWS S3 answers it this way, so drop the -s3.noSuchBucketWhenDenied flag and always wire the bucket lookup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: answer NoSuchBucket to a client-certificate identity too The AWS answer now goes to every authenticated identity, so it no longer depends on how the caller authenticated. The anonymous identity keeps 403, as anonymous object reads mask a missing bucket. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * s3api: fold the NoSuchBucket answer into refineDenialForBucketName One refinement for the bucket a denied request names: 400 for a malformed name, 404 for a missing one. The anonymous read paths keep their answer, since the anonymous identity never gets the 404. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
2b0bff0135 |
filer.sync: warn when the source metadata log no longer covers the sync (#13143)
* filer.sync: warn when the source metadata log no longer covers the sync A sync replays the source's metadata log from its saved position, or from the oldest log file when it has none. Once older log days are purged, a position older than the log silently skips the purged changes, and a fresh sync never copies entries whose last change was purged, so the target ends up incomplete without any sign of it. At start, compare the position with the oldest log file the source keeps; for a fresh sync, look for a child of the source path whose last change (commit time, or mtime for entries without one) predates the log, and log a warning naming it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer.sync: skip excluded and multipart upload entries in the log gap check Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer.sync: run the log gap check without delaying the subscription Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
50f7c73101 |
s3 backend: HTTP/1.1 client defaults for disable_http2 (#13126)
* s3 backend: HTTP/1.1 client defaults for disable_http2 ## Problem `disable_http2` (#11897) keeps the cloud tier's S3 client on HTTP/1.1, so every tier upload and range read gets a connection of its own. The rest of the client still has the defaults sized for one multiplexed HTTP/2 connection: - Go's idle pool keeps only 2 connections per host, so a burst of concurrent range reads redials TLS for almost every request once the burst is over and the next one starts; - the wait for response headers is the 60 s bound every tier client has; - the SDK retries 3 times. On a Ceph RGW-based S3 service, HTTP/2's small flow-control window held tier uploads at 18 MB/s and made 24 concurrent cold scans take 52 s each; on HTTP/1.1 they took 3.7 s each, but only with a larger idle pool, a shorter header bound and more retries for the 503 SlowDown answers that the extra parallelism draws. ## Fix With `disable_http2 = true` the tier client also gets: - an idle pool of 100 (`MaxIdleConns` and `MaxIdleConnsPerHost`); - `ResponseHeaderTimeout` of 30 s; - `MaxRetries` 5, so the SDK's retryer backs off on 5xx, SlowDown and throttling. `max_connections` and `idle_connection_timeout_seconds` apply as before. Without `disable_http2` the client is unchanged. The scaffold `master.toml` mentions the defaults. ## Tests `TestS3BackendHTTP1ClientDefaults` in `weed/storage/backend/s3_backend/s3_sessions_test.go`: with `disable_http2` the transport has the idle pool and the 30 s header bound, and the client 5 retries; without it (and with `max_connections` set) the client keeps the SDK's retries, the default idle pool and `s3ReadTimeout`. It fails without the change. `go vet ./weed/storage/backend/s3_backend/` and `go test ./weed/storage/backend/s3_backend/`: ok. `go build ./weed`: ok. * s3 backend: keep the larger idle pool for every tier client A tier client on a plain http:// endpoint, or on a TLS service that offers no HTTP/2, speaks HTTP/1.1 without disable_http2 and had the same 2 idle connections per host, so each burst of concurrent reads redialed. HTTP/2 keeps one connection, so the pool size does not change it. The header bound and retries stay with disable_http2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
faffb0d291 |
build(deps): bump github.com/jackc/pgx/v5 from 5.10.0 to 5.13.0 (#13164)
Bumps [github.com/jackc/pgx/v5](https://github.com/jackc/pgx) from 5.10.0 to 5.13.0. - [Release notes](https://github.com/jackc/pgx/releases) - [Changelog](https://github.com/jackc/pgx/blob/master/CHANGELOG.md) - [Commits](https://github.com/jackc/pgx/compare/v5.10.0...v5.13.0) --- updated-dependencies: - dependency-name: github.com/jackc/pgx/v5 dependency-version: 5.13.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> |
||
|
|
5f65cd0859 |
build(deps): bump go.mongodb.org/mongo-driver from 1.17.9 to 1.17.10 (#13163)
Bumps [go.mongodb.org/mongo-driver](https://github.com/mongodb/mongo-go-driver) from 1.17.9 to 1.17.10. - [Release notes](https://github.com/mongodb/mongo-go-driver/releases) - [Commits](https://github.com/mongodb/mongo-go-driver/compare/v1.17.9...v1.17.10) --- updated-dependencies: - dependency-name: go.mongodb.org/mongo-driver dependency-version: 1.17.10 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
184860a4c3 |
build(deps): bump golang.org/x/oauth2 from 0.37.0 to 0.38.0 (#13165)
Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from 0.37.0 to 0.38.0. - [Commits](https://github.com/golang/oauth2/compare/v0.37.0...v0.38.0) --- updated-dependencies: - dependency-name: golang.org/x/oauth2 dependency-version: 0.38.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
1924ce9f06 |
build(deps): bump github.com/aws/aws-sdk-go-v2 from 1.48.0 to 1.48.1 (#13166)
Bumps [github.com/aws/aws-sdk-go-v2](https://github.com/aws/aws-sdk-go-v2) from 1.48.0 to 1.48.1. - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/v1.48.0...v1.48.1) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go-v2 dependency-version: 1.48.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
3993cb38c3 |
build(deps): bump github.com/jhump/protoreflect from 1.18.1 to 1.19.0 (#13167)
Bumps [github.com/jhump/protoreflect](https://github.com/jhump/protoreflect) from 1.18.1 to 1.19.0. - [Release notes](https://github.com/jhump/protoreflect/releases) - [Commits](https://github.com/jhump/protoreflect/compare/v1.18.1...v1.19.0) --- updated-dependencies: - dependency-name: github.com/jhump/protoreflect dependency-version: 1.19.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
62d6127d6e |
build(deps): bump actions/download-artifact from 7 to 8 (#13169)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 7 to 8. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v7...v8) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-version: '8' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
a07f774e6f |
build(deps): bump github/codeql-action from 4.39.4 to 4.39.5 (#13170)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.39.4 to 4.39.5. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/v4.39.4...v4.39.5) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 4.39.5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
b066c31172 |
build(deps): bump sigstore/cosign-installer from 4.1.3 to 4.1.4 in /.github/actions/sign-image (#13171)
build(deps): bump sigstore/cosign-installer Bumps [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) from 4.1.3 to 4.1.4. - [Release notes](https://github.com/sigstore/cosign-installer/releases) - [Commits](https://github.com/sigstore/cosign-installer/compare/v4.1.3...v4.1.4) --- updated-dependencies: - dependency-name: sigstore/cosign-installer dependency-version: 4.1.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
|
|
672ba10b2b |
iceberg: parse each table metadata version once and encode the load response once (#13129)
* iceberg: parse each table metadata version once and encode the load response once Under an Iceberg commit load, about half of the S3/Iceberg server's CPU went into the JSON of the same metadata document. A writer loads a table and then commits to it, and each request parsed the stored metadata again (`table.ParseMetadataBytes`, 17% of CPU in a profile). The load then marshalled it, `json.Marshal` compacted and validated the whole document again around the `json.RawMessage` inside `MarshalJSON`, and the response encoder did that once more around the result (8%). The cost grows with a table's snapshot history. Changes: - `tableMetadataCache` keeps the parsed form (and, lazily, the rendered response form) of recently read metadata documents, keyed by bucket and metadata location and bounded at 64 MiB (an entry is charged 6x its source size; a document over a quarter of the bound is never cached). An entry is used only when the stored bytes are byte-identical to the bytes it was parsed from, so a hit returns exactly what parsing would; the key only finds the candidate, and a parse error is never cached. Load table, commit table and commit transaction read through it. - The parsed metadata is shared read-only between requests: iceberg-go guards its lazily decoded snapshots with its own `sync.Once` and lock, and the metadata builder copies what it changes (`TestMetadataCacheSharedEntryUnderConcurrency`, run with `-race`). - A table commit remembers the version it stored (parsed from exactly those bytes), so the next load of it is a hit, and drops the version it replaced; a transaction commit drops the versions it replaced. - `LoadTableResult.MarshalJSON` assembles the response around the rendered metadata instead of re-encoding it as a `RawMessage`, and `writeLoadResult` writes those bytes without the encoder's extra pass. The rendering is used only while `Metadata` is still the cache entry's own parsed metadata; a filtered (`?snapshots=refs`) or replaced `Metadata` is marshalled as before. An encoding failure is now a 500 rather than an empty 200. The response bytes are the same as before: `TestLoadTableResultMarshalBytes` compares them with the previous encoding, including HTML and U+2028 escaping, with and without a metadata location, config and storage credentials. `TestMetadataCacheHitsOnlyIdenticalBytes` covers the byte check, parse errors, eviction and the commit remember/forget path. Measured on one server at 8 concurrent writers, about 20 commits/s, CPU sampled over 20 s: 30.0 s before, 21.7 s after. `go vet ./weed/s3api/iceberg`, `go test ./weed/s3api/iceberg` and `go test -race -run 'MetadataCache|LoadTableResult' ./weed/s3api/iceberg` pass; `go build ./weed` builds. * iceberg: the shared-entry concurrency test shares one entry The test started from an empty cache, so each worker could miss and parse its own copy, and it passed without readers and builders ever sharing an object. The entry is now parsed before the workers start, and each worker checks that it was handed that entry. A cache that returns a fresh copy now fails the test. * iceberg: keep the snapshots=refs check inline and log the parse error directly Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * iceberg: shorten the metadata cache comments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
a2d6b07d3c |
filer: refuse a non-recursive delete of a bucket that has children (#13122)
* filer: refuse a non-recursive delete of a bucket that has children A non-recursive delete of a folder that has children fails with ErrNonEmptyFolder: doBatchDeleteFolderMetaAndData lists the folder's first page and refuses. For a bucket on a store that keeps each bucket apart (leveldb3, the SQL stores with bucket tables, ArangoDB, YDB with bucket tables), it skipped that listing, because such a store drops a deleted bucket's children in one call and a recursive delete needs no walk. The non-recursive delete then went through: DeleteFolderChildren dropped the bucket's objects, the bucket entry was deleted, and DeleteEntryMetaAndData deleted the bucket's collection, so the objects' volumes went with them. rmdir on a weed mount, fs.rm without -r and a filer HTTP DELETE without recursive=true each send such a delete. On the other stores the same request is refused. A non-recursive delete now lists a bucket on these stores the way it lists any other folder, and is refused when the bucket has children. An empty bucket is still dropped by the store, which frees what the store keeps per bucket, and a recursive delete still drops a bucket without a walk. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * filer: say why a non-recursive bucket delete still sweeps Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> |