Skip to content

Contribute Threadsave#15

Draft
nitaicaro wants to merge 39 commits into
JimB123:jims-forklessfrom
nitaicaro:nitai-forkless
Draft

Contribute Threadsave#15
nitaicaro wants to merge 39 commits into
JimB123:jims-forklessfrom
nitaicaro:nitai-forkless

Conversation

@nitaicaro
Copy link
Copy Markdown

No description provided.

@nitaicaro nitaicaro force-pushed the nitai-forkless branch 3 times, most recently from 12bb64b to 0208ae0 Compare February 17, 2026 21:48
Comment thread src/server.c Outdated
}

int isSaveInProgress(void) {
return server.rdb_child_type != RDB_CHILD_TYPE_NONE;
Copy link
Copy Markdown
Author

@nitaicaro nitaicaro Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JimB123 - I took this from EC but am wondering whether we should rethink this. If threadsave is running, server.child_type is NONE, which I feel should imply server.rdb_child_type should also be NONE. But it is actually set to DISK/SOCKET in this case.

Copy link
Copy Markdown
Author

@nitaicaro nitaicaro Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current state is a little confusing as we have multiple checks around the code such as:

  • isSaveInProgress() - checks server.rdb_child_type - disk or socket
  • checking server.rdb_child_type directly
  • hasActiveChildProcess() - works on all types of rdb child (such as RDB, AOF, ...)
  • server.child_type == CHILD_TYPE_RDB - is specifically a fork bgsave running?
  • server.cur_bgsave_type

So I'm thinking whether this can be a good opportunity to clean this up.
I'm thinking no direct checks on server vars - only function calls such as

isThreadBgsaveInProgress(){
...
}
isForkBgsaveInProgress(){
...
}
isBgsaveInProgress(){
 return isThreadBgsaveInProgress() || isForkBgsaveInProgress()
}
isDiskBasedSaveInProgress(){
return server.rdb_child_type == TYPE_DISK
}
hasActiveChildProcess(){
   return server.child_pid != -1
}
...
...

also rename rdb_child_type to something like rdb_save_target

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that some cleanup may be warranted. The code you're looking at is very old.
Amzsave (before my time) may have overloaded some of the OSS variables. Threadsave just tried to maintain compatibility with Amzsave.

A concern I'd have about renaming things is that if these show in INFO - it's considered a breaking change. And if you rename the variable internally, but show it in INFO with the old (compatible) change, it may be confusing.

I think you have a lot of latitude in changing threadsave - but less latitude in changing the OSS INFO fields.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. In the last few commits

@nitaicaro nitaicaro force-pushed the nitai-forkless branch 7 times, most recently from 67a6c6b to c6f529b Compare February 18, 2026 23:39
Copy link
Copy Markdown
Author

@nitaicaro nitaicaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

@nitaicaro nitaicaro changed the title Nitai forkless Contribute Threadsave Feb 18, 2026
@nitaicaro nitaicaro force-pushed the nitai-forkless branch 5 times, most recently from 4aec5e0 to 885d2aa Compare February 24, 2026 20:11
Nitai Caro and others added 26 commits March 10, 2026 19:41
…ation, test_store_key_deletion_by_georadius
…r) (valkey-io#3349)

This is pre-submission into the `forkless-pre-bgiterator` branch for
client blocking mechanism. The actual PR review for this is here:
valkey-io#3341 Submitting to this branch
to enable PR review for bgIterator.

Signed-off-by: harrylin98 <harrylin980107@gmail.com>
…ll be overriden by the one saved when valkey is killed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants