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

Percona telemetry #5243

Merged

Conversation

kamil-holubicki
Copy link
Contributor

No description provided.

components/percona_telemetry/CMakeLists.txt Show resolved Hide resolved
components/percona_telemetry/common.h Outdated Show resolved Hide resolved
REQUIRES_SERVICE_PLACEHOLDER_AS(component_sys_variable_unregister,
component_sys_variable_unregister_srv);

static std::unique_ptr<PerconaTelemetryComponent> percona_telemetry_component;
Copy link
Collaborator

Choose a reason for hiding this comment

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

anonymous namespace can be used for a group of static declarations

namespace {
...
} // anonymous namespace

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what is the advantage?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just stylistic.
Instead of

static int a;
static int b;
...

you can write

namespace {
  int a;
  int b;
  ...
}

Basically, you don't have to put static keyword on each declaration.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm still not fully convinced, but let's do it in modern way as you said :)

  1. Symbols in unnamed namespaces are exported from the library anyway, but their names are randomly mangled. This can cause the linker to do its job longer.
  2. Maybe I'm old-school, but when I see static, I exactly know, what it means in all possible contexts. Having an unnamed namespace it is not instantly clear what the function scope is.
  3. If there is only one static variable/function, wrapping it with an anonymous namespace seems to be too verbose. Using static in such a case seems to be violating rules: we should use one or another way of limiting the scope, not mixing to avoid mess.
  4. Looks like C++ committee undepreciated use of static

components/percona_telemetry/component.cc Show resolved Hide resolved
components/percona_telemetry/component.cc Outdated Show resolved Hide resolved
components/percona_telemetry/storage.cc Outdated Show resolved Hide resolved
components/percona_telemetry/storage.cc Show resolved Hide resolved
components/percona_telemetry/worker.cc Outdated Show resolved Hide resolved
mysql-test/suite/innodb/t/tablespace_encrypt_9.test Outdated Show resolved Hide resolved
mysql-test/suite/innodb/t/log_first_rec_group.test Outdated Show resolved Hide resolved
REQUIRES_SERVICE_PLACEHOLDER_AS(component_sys_variable_unregister,
component_sys_variable_unregister_srv);

static std::unique_ptr<PerconaTelemetryComponent> percona_telemetry_component;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just stylistic.
Instead of

static int a;
static int b;
...

you can write

namespace {
  int a;
  int b;
  ...
}

Basically, you don't have to put static keyword on each declaration.

components/percona_telemetry/component.cc Show resolved Hide resolved
components/percona_telemetry/config.cc Outdated Show resolved Hide resolved
components/percona_telemetry/config.cc Outdated Show resolved Hide resolved
components/percona_telemetry/config.h Outdated Show resolved Hide resolved
components/percona_telemetry/data_provider.cc Outdated Show resolved Hide resolved
components/percona_telemetry/logger.h Outdated Show resolved Hide resolved
components/percona_telemetry/storage.cc Outdated Show resolved Hide resolved
std::filesystem::path::preferred_separator;

// Let's keep it as std::string, because there is no way to string + string_vew
static const std::string TMP_FILE_EXTENSION(".tmp");
Copy link
Collaborator

Choose a reason for hiding this comment

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

could be std::string_view

Copy link
Contributor Author

Choose a reason for hiding this comment

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

// history_keep_interval
// 2. This is someone's else file, but it is older than the highest
// possible history_keep_interval
if (our_file && (file_timestamp < oldest_timestamp)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Up to you but a few comments:

  1. std::time_t is an unspecified type, so it may not be long.
  2. Even if it is long, this is a SIGNED type which may not be what you expect (as you may have already noticed I don't like signed types :) )
  3. For instance a difference between 2 timestamps may be negative (in case of clock change / ntp adjustments).

Copy link
Collaborator

@percona-ysorokin percona-ysorokin left a comment

Choose a reason for hiding this comment

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

LGTM

@kamil-holubicki kamil-holubicki changed the base branch from 8.0 to release-8.0.37-29 June 13, 2024 06:56
TEL-46: MySql telemetry component creates telemetry files with not sufficient r/w privileges for TA

Problem:
Depending on OS configuration, MySql component can create telemetry
files with permissions not enough for TA to read their content
(e.g. 600).

It is required to have permissions mask at least 644.

TA deletes files after processing, but deletion permission is a matter
of the directory mask, not the file itself.

Solution:
Storage component adds needed permissions after file creation.
@kamil-holubicki kamil-holubicki merged commit 2cdd70f into percona:release-8.0.37-29 Jun 14, 2024
5 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants