591 Commits (956d3beb53771d2862caf02fbe3b9bd186e4aea9)
 

Author SHA1 Message Date
Sayan 956d3beb53
Bump up version, add changelog and update scripts (#159)
* Bump up version, add changelog and update scripts

* Fix actiondoc

* Drop all `since` keys

Since our docs are now well versioned and doesn't read these keys
anymore, we can safely remove them.
3 years ago
Sayan Nandan eea0f86c97 Upgrade skytable client driver version 3 years ago
Sayan 6c9a36d397
Improve compat to use storage formats for upgrades (#158) 3 years ago
Sayan Nandan 260b336bf6 Add tests for races and synchronized unlocks 3 years ago
Sayan a1320da52b
Migrate to using `Coremap` (#156)
* Upgrade all interfaces to use new HTable

* Document `HTable`
3 years ago
Sayan 67ee1046a6
Merge pull request #155 from skytable/lskeys
Implement `lskeys`
3 years ago
Sayan Nandan 966c2594bf Fix `lskeys` tests 3 years ago
Sayan Nandan da69c62f43 Add lskeys actiondoc 3 years ago
Sayan Nandan b77b783064 Add tests for lskeys 3 years ago
Sayan Nandan 24c8548912 Improve printing of flat arrays 3 years ago
Sayan Nandan ea7891fba7 Implement lskeys 3 years ago
Sayan c764459d2d
Merge pull request #154 from skytable/htablesd
Implement ser/de for `HTable` and add compat module
3 years ago
Sayan Nandan 449da56308 Upgrade all interfaces to use new in-memory table 3 years ago
Sayan Nandan 975e953426 Add compat module for upgrading old files 3 years ago
Sayan Nandan c2a20d4476 Implement serialize/deserialize for `HTable` 3 years ago
Sayan Nandan ac969ba7b2 Mark EOL for versions < 0.3.1 [skip ci] 3 years ago
Sayan Nandan a7f5d84ef4 Bump dependencies
Also use `tokio::join` in-place of `futures::join`
3 years ago
Sayan Nandan 20383c6e16 Terminate skyd instantly [skip ci] 3 years ago
Sayan 790558d2c7
Improve reliability, simplicity and recoverability of BGSAVE (#153)
* Create a new file on writing to flock-ed file

This fix is a very important one in two ways. Say we have an user A.
They go ahead and launch skyd. skyd creates a data.bin file. Now A just
deletes the data.bin file for fun. Funny enough, this never causes flock
to error!
Why? Well because the descriptor/handle is still valid and was just
unlinked from the current directory. But this might seem silly since
the user exits with a 'successfully saved notice' only to find that the
file never existed and all of their data was lost. That's bad.
There's a hidden problem in our current approach too, apart from this.
Our writing process begins by truncating the old file and then writing
to it by placing the cursor at 0. Nice, but what if this operation just
crashes. So we lost the current data AND the old data. Not good.

This commit does a better thing: it creates a new temporary file, locks
it before writing and then flushes the current data to the temporary
file. Once that succeeds, it replaces the old data.bin file with the
newly created file.

This solves both the problems mentioned here for us:
1. No more of the silly error
2. If BGSAVE crashes in between, we can be sure that at least the last
data.bin file is in proper shape and not half truncated or so.

This commit further moves the background services into their
own module(s) for easy management.

* Fix CI scripts

Fixes:
1. Our custom runner (drone/.ci.yml) was modified to kill the skyd
process once done since this pipeline is not ephemeral.
2. GHA for some reason ignores any error in the test step and proceeds
to kill the skyd process without erroring. Since GHA runners are
ephemeral, we don't need to do this manually.
3 years ago
Sayan Nandan b4c44e4684 Merge branch 'fix-bg-services' into next 3 years ago
Sayan Nandan 85616544ef Ensure that the entire file is locked
Although this is barely documented, setting the nNumberOfBytesToLockLow
and nNumberOfBytesToLockHigh to MAXDWORD apparently locks the entire
file
3 years ago
Sayan Nandan 42ad5680ff Fix missing imports on Windows
I'm not on a Windows machine, so I don't get these errors reported!
3 years ago
Sayan Nandan 03e241902f Ensure that duplicated handle has same permissions
This is particularly relevant for Windows
3 years ago
Sayan Nandan ba53e5160b Use unlocks to ensure that file is readable 3 years ago
Sayan Nandan 76d184663a Add test for BGSAVE 3 years ago
Sayan Nandan d7cd1bfb70 Use different byte count for test
This test simply makes sure that the 0s written while truncating don't
reappear (they should never do)
3 years ago
Sayan Nandan 93ef949bac Manually unlock file after complete termination
The cloned flock might attempt to call the unlock but it is a cloned
descriptor!
3 years ago
Sayan Nandan 893cf1d741 Fix `FileLock::write` impl and make snaps blocking
This commit implements a tokio blocking task for mksnap and also fixes
FileLock's write method and adds a test for the same
3 years ago
Sayan Nandan b5865e500b Use Terminator for termination of all bg services
What we did in the old implementation was pure over-engineering.
We relied on CoreDB's `Drop` impl to terminate the background services.
Now this is absolutely unreliable due to the nature of async functions.
We also relied on the bgsave scheduler to release the lock upon exit
which is also unreliable because we left the service to the mercy of the
runtime. We spawned the task and didn't hold as much as a `JoinHandle`
to it. That's bad because the runtime can just abort these tasks which
may result in the lock never being released. Even though it is designed
to release the lock on Drop, the destructor may however not be called at
all.

This commit fixes all those issues by simplifying the entire impl to
use Terminator. Now the background save and snapshot services run
independently, in their own tasks. Whenever the user passes a SIGINT,
we tell everyone to quit. The listeners understand that this is the
last query they'll process and the background save tasks exit almost
immediately. But what if some data was modified by this last query...?

No worries, that is completely handled by main(). The lock that BGSAVE
leaves is immediately (almost) returned to main and main will attempt
to flush the data almost immediately. That's how we maintain reliability
3 years ago
Sayan Nandan 78e9441564 Spawn blocking I/O tasks on a dedicated thread 3 years ago
Sayan Nandan 7d1b44a57f The snapshot service had similar bugs that were
fixed
3 years ago
Sayan Nandan 5a7f17db14 Fix strong count calculation logic
See the added comment for more context
3 years ago
Sayan Nandan 5d4650712f Fix BGSAVE running right on service start
This fixes another flaw with the previous implementation: running BGSAVE
right when the service is started which causes unnecessary disk I/O
3 years ago
Sayan Nandan 77f4b6e7be Make BGSAVE optimistic and fix BGSAVE bugs
This commit ensures that BGSAVE is optimistic in doing what it is doing:
If BGSAVE fails once, it will immediately poison the table. Now let's
say that some amazing sysadmin managed to SSH into the server and was
able to fix the storage issue; BGSAVE would be able to succeed.
The current implementation was flawed: firstly it prevented that and
secondly even if it succeeded in running BGSAVE, the server would refuse
to accept writes. This commit fixes this behavior.
3 years ago
Sayan Nandan a61ab02cd9
Fix disk storage on termination (#151)
See #150 for more information
3 years ago
Sayan Nandan 3616793554 Update versioning and support information [skip ci] 3 years ago
Sayan Nandan 8d3d878b81 Build binary before attempting to run it
The background process may or may not complete before the testing begins
3 years ago
Sayan Nandan 246b974bd6
Merge pull request #147 from skytable/skyhash
Implement, stabilize and migrate to Skyhash
3 years ago
Sayan Nandan 34134aa29b Fix using old binary for testing on Windows 3 years ago
Sayan Nandan 53a0082890 Make sure skyd is killed after testing on Windows 3 years ago
Sayan Nandan 6b47279b1b Fix CI script and improve terminal artwork 3 years ago
Sayan Nandan bb4637c1e3 Fix string arguments in sky-bench 3 years ago
Sayan Nandan 5847cf1da9 Upgrade sky-bench to use client driver 3 years ago
Sayan Nandan f55fa85174 Upgrade server to use client driver's `RespCode`s 3 years ago
Sayan Nandan 870c6f560d Upgrade CLI to use the client driver 3 years ago
Sayan Nandan 57d2883218 Fix SSET not skipping action name 3 years ago
Sayan Nandan d9bd911768 Fix segfault due to not skipping the action name
All the strong actions operate on the raw vector of args and hence need
to skip the action name (which is the first argument just like shell
commands)
3 years ago
Sayan Nandan 75f46c9235 Fix DBSIZE writing header when already written 3 years ago
Sayan Nandan 758baf1eb8 Use single thread for tests (drone) [skip ci] 3 years ago
Sayan Nandan ba0a67a179 Fix queries returning full responses
They should return groups instead
3 years ago