-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RDS PostgreSQL dump not ordered correctly preventing restore. #208
Comments
@davidbruce , can you show me your Replibyte config .yaml, please? Can you also confirm that you are using the latest version of Replibyte? |
@davidbruce, @evoxmusic, I am having the same problem when dumping some tables that are over 100MB. I think this could be related to the order in which the dumped chunks are being restored. To keep parameters more flexible and as a workaround I added a PR to make it possible to set the buffer size: #234. When restoring a 160MB table with
When restoring the same table using I still don't know 100% how this chunk order is being messed up when restoring but if you can share a little more info on that I can try to help out with a solution 😃 |
From what you describe, I feel that the issue could come from this function. Replibyte/replibyte/src/datastore/s3.rs Line 555 in da8cd34
@gugacavalieri can you show me your replibyte |
@evoxmusic , looks like it is only happening when I run with source:
connection_uri: $SOURCE_DATABASE_URL
transformers: []
only_tables: # optional - dumps only specified tables.
- database: staging
table: added_stickers
datastore:
local_disk:
dir: ./storage
destination:
connection_uri: $DESTINATION_DATABASE_URL When running with {"v":"0.10.0","dumps":[{"directory_name":"dump-1667763130600","size":10603029,"created_at":1667763242581,"compressed":true,"encrypted":false}]} When restoring to local file ( INSERT INTO `added_stickers` (`id`, ...) VALUES (511158, ...); So ID count is at INSERT INTO `added_stickers` (`id`, ...) VALUES (813513, ...);
/*!40000 ALTER TABLE `added_stickers` ENABLE KEYS */;
UNLOCK TABLES;
SET @@SESSION.SQL_LOG_BIN = @MYSQLDUMP_TEMP_LOG_BIN;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2022-11-06 12:32:44
-- MySQL dump 10.13 Distrib 8.0.31, for macos12.6 (arm64)
--
-- Host: xxx Database: staging
-- ------------------------------------------------------
-- Server version 5.7.38-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; If I set |
Probably this
|
Yes, a sort is necessary. Otherwise, it can not work. We can't rely on |
Would something like this do the trick? let dump_directory_name = format!("{}/{}", self.dir, dump.directory_name);
let mut sorted_entries: Vec<_> = read_dir(dump_directory_name).unwrap()
.map(|r| r.unwrap())
.collect();
sorted_entries.sort_by_key(|dir| dir.path());
for entry in sorted_entries {
// ...
} |
I think it should be ok, we can write a test function. I will just make sure that the |
Sounds good! You probably have better Rust skills for this one :) |
When I create a dump from a database over the network it does not order the dump properly. Because of this I am unable to restore the dump preventing me from using Replibyte.
Idea of what the dump.sql from Replibyte looks like:
Even the insert statements themselves are not ordered properly so I cannot simply move the DDL to the top of the file.
This isn't an issue with a database that is in a local docker instance.
The text was updated successfully, but these errors were encountered: