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

Support for custom settings for Reindexer #19

Merged
merged 139 commits into from
Dec 16, 2024

Conversation

AlexAUtkin
Copy link
Contributor

@AlexAUtkin AlexAUtkin commented Dec 12, 2024

  • dsn (string): The connection string which contains a protocol
    Examples: 'builtin:///tmp/pyrx', 'cproto://127.0.0.1:6534/pyrx'

  • cproto options:

    • fetch_amount (int): The number of items that will be fetched by one operation
    • reconnect_attempts (int): Number of reconnection attempts when connection is lost
    • net_timeout (int): Connection and database login timeout value [milliseconds]
    • enable_compression (bool): Flag enable/disable traffic compression
    • start_special_thread (bool): Determines whether to request a special thread of execution on the server for this connection
    • client_name (string): Proper name of the application (as a client for Reindexer-server)
    • sync_rxcoro_count (int): Client concurrency per connection
  • built-in options:

    • max_replication_updates_size (int): Max pended replication updates size in bytes
    • allocator_cache_limit (int): Recommended maximum free cache size of tcmalloc memory allocator in bytes
    • allocator_cache_part (float): Recommended maximum free cache size of tcmalloc memory allocator in relation to total Reindexer allocated memory size, in units

Alexander.A.Utkin added 30 commits October 8, 2024 20:08
# Conflicts:
#	pyreindexer/lib/include/queryresults_wrapper.h
#	pyreindexer/lib/src/rawpyreindexer.cc
#	pyreindexer/lib/src/rawpyreindexer.h
Alexander.A,Utkin and others added 21 commits December 3, 2024 10:50
# Conflicts:
#	README.md
#	pyreindexer/example/main.py
#	pyreindexer/lib/include/queryresults_wrapper.h
#	pyreindexer/lib/include/transaction_wrapper.h
#	pyreindexer/lib/src/rawpyreindexer.cc
#	pyreindexer/lib/src/rawpyreindexer.h
#	pyreindexer/lib/src/reindexerinterface.cc
#	pyreindexer/lib/src/reindexerinterface.h
#	pyreindexer/query_results.py
#	pyreindexer/raiser_mixin.py
#	pyreindexer/rx_connector.py
#	pyreindexer/tests/tests/test_transaction.py
#	pyreindexer/transaction.py
#	readmegen.sh
…g_support

# Conflicts:
#	pyreindexer/example/main.py
#	pyreindexer/lib/src/reindexerinterface.h
#	pyreindexer/rx_connector.py
# Conflicts:
#	README.md
#	pyreindexer/example/main.py
#	pyreindexer/lib/include/pyobjtools.cc
#	pyreindexer/lib/include/pyobjtools.h
#	pyreindexer/lib/include/query_wrapper.cc
#	pyreindexer/lib/include/query_wrapper.h
#	pyreindexer/lib/include/transaction_wrapper.h
#	pyreindexer/lib/src/rawpyreindexer.cc
#	pyreindexer/lib/src/rawpyreindexer.h
#	pyreindexer/lib/src/reindexerinterface.cc
#	pyreindexer/lib/src/reindexerinterface.h
#	pyreindexer/rx_connector.py
#	pyreindexer/transaction.py
@AlexAUtkin AlexAUtkin added the enhancement New feature or request label Dec 12, 2024
@AlexAUtkin AlexAUtkin self-assigned this Dec 12, 2024

template <>
ReindexerInterface<reindexer::client::CoroReindexer>::ReindexerInterface() {
ReindexerInterface<reindexer::client::CoroReindexer>::ReindexerInterface(const ReindexerConfig& cfg)
: db_(reindexer::client::ReindexerConfig(4, 1, cfg.fetchAmount, 0, cfg.connectTimeout, cfg.requestTimeout,
Copy link
Contributor

Choose a reason for hiding this comment

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

Вот у этого конфига, как я вижу, на v3 и v4 отличаются конструкторы. Для совместимости с обеими версиями, чтобы не ждать полного переезда на v4, можно сейчас сделать что-то типа такого:

static reindexer::client::ReindexerConfig makeClientConfig(const ReindexerConfig& cfg) {
  reindexer::client::ReindexerConfig cfg;
  cfg.FetchAmout = cfg.fetchAmount;
  // ... для остальных опций - аналогично
  return cfg;
}

И в конструкторе тогда инициализировать db_ вот так:

db_{makeClientConfig(cfg)}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Можно, но толку немного. Есть важный параметр в v4: milliseconds _NetTimeout = milliseconds(0), а в v3:

seconds _ConnectTimeout = seconds(0),
seconds _RequestTimeout = seconds(0),

И получится для совместимости без него\их нужно работать

Alexander.A,Utkin added 3 commits December 16, 2024 10:21
@MadSchemas MadSchemas merged commit 3f01d6e into master Dec 16, 2024
3 checks passed
@AlexAUtkin AlexAUtkin deleted the feature/reindexer_config_support branch December 17, 2024 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants