Skip to content
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

[Backport to 5.7] postgres performance improvements - Write path #6717

Merged
merged 4 commits into from
Aug 25, 2021

Conversation

dannyzaken
Copy link
Contributor

Explain the changes

  1. backport of postgres performance improvements - Write path #6601

Issues: Fixed #xxx / Gap #xxx

Testing Instructions:

in key is omitted the bucket is listed and the object list is iterated with getObject

Signed-off-by: Danny Zaken <dannyzaken@gmail.com>
(cherry picked from commit 19dffca)
Signed-off-by: Danny Zaken <dannyzaken@gmail.com>
(cherry picked from commit 2cf4050)
* Added option to enable query logging. this will print for each query
  the time it took and if enabled the EXPLAIN result of the query
* fixes in encode_json and handle_ops_encoding
  * encode mongo id as string to match indexes
  * handle multiple ops in one query
  * handle comparison ops
* in md_store - pass $exists in some queries to match indexes
* in system_server - cache result of list_undeletable_buckets
  to avoid calling it on each read system

* postgres_client - fix sorts to use indexes
  * access _id as text
  * remove NULLS FIRST\LAST and use default as we do in the indexes
* added datachunk index by _id descending for iterate_all_chunks
* added $exists in MDStore.load_parts_objects_for_chunks

Signed-off-by: Danny Zaken <dannyzaken@gmail.com>

encode mongo.objectid as string in postgres_client encode_json

when mongo object id is passed as object to imongo-to-postgres lib, it will convert the query to access data->_id as a jsonb struct. this causes queries to not hit the indexes

Signed-off-by: Danny Zaken <dannyzaken@gmail.com>

added {$exists: true} to chunks query in load_blocks_for_chunks

this will cause the postgres query to match the filter in the index

Signed-off-by: Danny Zaken <dannyzaken@gmail.com>

added $exists for dedup_keys in find_chunks_by_dedup_key

* without the $exists the query does not hit the index

Signed-off-by: Danny Zaken <dannyzaken@gmail.com>

modified handle_ops_encoding to handle multiple ops

Signed-off-by: Danny Zaken <dannyzaken@gmail.com>

fixed find_all_parts_of_object to hit index

* added {$exists: true } to obj
* fixes handle_ops_encoding for comparison operators ($eq etc.)

Signed-off-by: Danny Zaken <dannyzaken@gmail.com>

cache results of bucket_server.list_undeletable_buckets() in read_system

Signed-off-by: Danny Zaken <dannyzaken@gmail.com>

db query log changes

Signed-off-by: Danny Zaken <dannyzaken@gmail.com>

Update postgres_client.js

Signed-off-by: Danny Zaken <dannyzaken@gmail.com>

use {disableContainmentQuery: true} option when calling mongo_to_pg

Signed-off-by: Danny Zaken <dannyzaken@gmail.com>

more postgres improvements

* postgres_client - fix sorts to use indexes
  * access _id as text
  * remove NULLS FIRST\LAST and use default as we do in the indexes
* added datachunk index by _id descending for iterate_all_chunks
* added $exists in MDStore.load_parts_objects_for_chunks

Signed-off-by: Danny Zaken <dannyzaken@gmail.com>

mark some indexes as postgres only and skip in mongo_client

Update postgres_client.js

Signed-off-by: Danny Zaken <dannyzaken@gmail.com>

Update md_store.js

(cherry picked from commit e5f4b6b)
Copy link
Contributor

@liranmauda liranmauda left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Danny Zaken <dannyzaken@gmail.com>
@dannyzaken dannyzaken merged commit 98e8a6c into noobaa:5.7 Aug 25, 2021
@dannyzaken dannyzaken deleted the danny_backport_to_5_7 branch August 25, 2021 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants