Commit Graph

210 Commits

Author SHA1 Message Date
Botond Dénes
41de340d93 Merge 'Update get_description.py script' from Amnon Heiman
get_description.py script is a document related script that looks for metrics description in the code.
Its configuration needs to address changes in the code.

This series contains a configuration change and a code fix that allows it to run as a standalone script, and not as a library.

No need to backport, this a documentation related script.

Closes scylladb/scylladb#19950

* github.com:scylladb/scylladb:
  scripts/get_description.py: param_mapping was missing
  scripts/metrics-config.yml: no need to get metrics from the tests
2024-10-22 08:42:15 +03:00
Amnon Heiman
09fa625672 scripts/get_description.py: param_mapping was missing
get_description.py was moved from a standalone script to a library.
During the transition, param_mapping was not included in the script
option.

This patch makes it possible to use the file as a standalone script
again.
2024-10-18 08:58:04 +03:00
Amnon Heiman
10af854ec4 scripts/metrics-config.yml: no need to get metrics from the tests 2024-10-18 08:57:53 +03:00
Yaron Kaikov
ab964bcd5a [script/pull_github_pr.sh] Check Gating status before merging
Maintainers use scripts/pull_github_pr.sh from scylladb.git when merging PRs and before pushing to the next. We want to prevent merges from piling up on top of unstable builds. This change will check Gating's current status and notify the maintainers

Related to scylladb/scylla-pkg#3644

Closes scylladb/scylladb#20742
2024-10-01 14:46:29 +03:00
Pavel Emelyanov
c17d353718 Revert "[script/pull_github_pr.sh] Check Gating status before merging"
This reverts commit fac682df7e.

Again, this patch broke maintainer workflows, it needs even more care.
2024-09-27 19:12:18 +03:00
Yaron Kaikov
fac682df7e [script/pull_github_pr.sh] Check Gating status before merging
Maintainers use scripts/pull_github_pr.sh from scylladb.git when merging PRs and before pushing to the next. We want to prevent merges from piling up on top of unstable builds. This change will check Gating's current status and notify the maintainers

Related to scylladb/scylla-pkg#3644

Closes scylladb/scylladb#20742
2024-09-26 08:44:06 +03:00
Botond Dénes
24ac408a08 Revert "[script/pull_github_pr.sh] Check Gating status before merging"
This reverts commit ec0bb42b45.

This patch broke maintainer workflows, it needs more work before it can
land.
2024-09-24 16:53:02 +03:00
Yaron Kaikov
ec0bb42b45 [script/pull_github_pr.sh] Check Gating status before merging
Maintainers use scripts/pull_github_pr.sh from scylladb.git when merging PRs and before pushing to the next. We want to prevent merges from piling up on top of unstable builds. This change will check Gating's current status and notify the maintainers

Related to https://github.com/scylladb/scylla-pkg/issues/3644

Closes scylladb/scylladb#20742
2024-09-24 08:39:47 +03:00
Botond Dénes
79567c1c98 scripts/open-coredump.sh: allow complete bypass of S3 server
In some cases, the S3 server will not know about a certain build and
any attempt to open a coredump which was generated by this build will
fail, because the S3 server returns an empty/illegal response.
There is already a bypass for missing package-url in the S3 server
response, but this doesn't help in the case when the response is also
missing other metadata, like build-id and version info.
Extend this existig mechanism with a new --scylla-package-url flag,
which provides complete bypass. When provided, the S3 server will not be
queried at all, instead the package is downloaded from the link and
version metadata is extracted from the package itself.

Closes scylladb/scylladb#19769
2024-07-18 21:43:53 +03:00
Kefu Chai
ad649be1bf treewide: drop thrift support
thrift support was deprecated since ScyllaDB 5.2

> Thrift API - legacy ScyllaDB (and Apache Cassandra) API is
> deprecated and will be removed in followup release. Thrift has
> been disabled by default.

so let's drop it. in this change,

* thrift protocol support is dropped
* all references to thrift support in document are dropped
* the "thrift_version" column in system.local table is
  preserved for backward compatibility, as we could load
  from an existing system.local table which still contains
  this clolumn, so we need to write this column as well.
* "/storage_service/rpc_server" is only preserved for
  backward compatibility with java-based nodetool.
* `rpc_port` and `start_rpc` options are preserved, but
  they are marked as "Unused". so that the new release
  of scylladb can consume existing scylla.yaml configurations
  which might contain these settings. by making them
  deprecated, user will be able get warned, and update
  their configurations before we actually remove them
  in the next major release.

Fixes #3811
Fixes #18416
Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2024-06-07 06:44:59 +08:00
Botond Dénes
7cbe5c78b4 install.sh: use the native nodetool directly
* tools/java b810e8b00e...4ee15fd9ea (1):
  > install.sh: don't install nodetool into /usr/bin

Add a bin/nodetool and install it to bin/ in install.sh. This script
simply forwards to scylla nodetool and it is the replacement for the
Java nodetool, which is dropped from the java-tools's install.sh, in the
submodule update also included in this patch.
With this change, we now hardwire the usage of the native nodetool, as
*the* nodetool, with the intermediary nodetool wrapper script removed
from the picture.
Bash completion was copied from the java tools repository and it is now
installed by the scylla package, together with nodetool.

The Java nodetool is still available as as a fall-back, in case the
native nodetool has problems, at the path of
/opt/scylladb/share/cassandra/bin/nodetool.

Testing

I tested upgrades on a DEB and RPM distro: Ubuntu and Fedora.
First I installed scylla-5.4, then I installed the packages for this PR.
On Ubuntu, I had to use dpkg -i --auto-deconfigure, otherwise, dpkg would
refuse to install the new packages because they break the old ones. No
extra flags were required on Fedora.
In both cases, /usr/bin/nodetool was changed from a thunk calling the
Java nodetool (from 5.4) to the native launcher script from this PR.
/opt/scylladb/share/cassandra/bin/nodetool remained in place and still
works after the upgrade.

I also verified that --nonroot installs also work. Nodetool works both
when called with an absolute path, or when ~/scylladb/bin is added to
$PATH.

Fixes: #18226
Fixes: #17412

Closes scylladb/scylladb#18255

[avi: reset submodule to actual hash we ended up with]
2024-04-25 22:52:00 +03:00
Tomasz Grabiec
2ceef1d600 scripts: tablet-mon.py: Support for annotating tablets by table id
Closes scylladb/scylladb#18225
2024-04-15 15:19:59 +02:00
Amnon Heiman
803d414896 get_description.py: Make the Script a library
This patch makes the get_description.py script easier to use by the
documentation automation:
1. The script is now a library.
2. You can choose the output of the script, currently supported pipee
   and yml.

You can still call the from the command line, like before, but you can
also calls it from another python script.

For example the folowing python script would generate the documentation
for the metrics description of the ./alternator/ttl.cc file.
```

import get_description

metrics = get_description.get_metrics_from_file("./alternator/ttl.cc", "scylla", get_description.get_metrics_information("metrics-config.yml"))
get_description.write_metrics_to_file("out.yaml", metrics, "yml")
```

Signed-off-by: Amnon Heiman <amnon@scylladb.com>

Closes scylladb/scylladb#18136
2024-04-02 10:07:11 +03:00
Botond Dénes
ea8478a3e7 scripts/open-coredump.sh: introduce --ci
Coredumps coming from CI are produced by a commit, which is not
available in the scylla.git repository, as CI runs on a merge commit
between the main branch (master or enterprise) and the tested PR branch.
Currently the script will attempt to checkout this commit and will fail
as the commit hash is unrecognized.
To work around this, add a --ci flag, which when used, will force the
main branch to be checked out, instead of the commit hash.

Closes scylladb/scylladb#18023
2024-04-02 09:27:52 +03:00
Michał Chojnowski
75864e18a2 open-coredump.sh: respect http redirects
downloads.scylladb.com recently started redirecting from http to https
(via `301 Moved Permanently`).
This broke package downloading in open-coredump.sh.

To fix this, we have to instruct curl to follow redirects.

Closes scylladb/scylladb#17759
2024-03-13 08:57:04 +02:00
Botond Dénes
88a76245ba Merge 'Get metrics description' from Amnon Heiman
This series adds a Python script that searches the code for metrics definition and their description.
Because part of the code uses a nonstandard way of definition, it uses a configuration file to resolve parameter values.

The script supports the code that uses string format and string concatenation with variables.

The documentation team will use the results to both document the existing metrics and to get the metrics changes between releases.

Replaces #16328

Closes scylladb/scylladb#17479

* github.com:scylladb/scylladb:
  Adding scripts/metrics-config.yml
  Adding scripts/get_description.py to fetch metrics description
2024-03-06 10:37:35 +02:00
Kefu Chai
d93b018bcf create-relocatable-package.py: add --debian-dir option
before this change, we assume that debian packaging directory is
always located under `build/debian/debian`. which is hardwired by
`configure.py`. but this could might hold anymore, if we want to
have a self-contained build, in the sense that different builds do
not share the same build directory. this could be a waste for the
non-mult-config build, but `configure.py` uses mult-config generator
when building with CMake. so in that case, all builds still share the
same $build_dir/debian/ directory.

in order to work with the out-of-source build, where the build
directory is not necessarily "build", a new option is added to
`create-relocatable-package.py`, this allows us to specify the directory
where "debian" artifacts are located.

Refs #15241

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes scylladb/scylladb#17558
2024-03-06 10:18:00 +02:00
Benny Halevy
08b0426318 scripts/open-coredump.sh: calculate MAIN_BRANCH before cloning repo
We need MAIN_BRANCH calculated earlier so we can use it
to checkout the right branch when cloning the src repo
(either `master` or `enterprise`, based on the detected `PRODUCT`)

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>

Closes scylladb/scylladb#17647
2024-03-06 09:46:30 +02:00
Amnon Heiman
8859b4d991 Adding scripts/metrics-config.yml
The scripts/metrics-config.yml is a configuration file used by
get_description.py. It covers the places in the code that uses
non-standard way of defining metrics.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2024-02-22 17:15:30 +02:00
Amnon Heiman
4e67a98a21 Adding scripts/get_description.py to fetch metrics description
The get_description script parse a c++ file and search of metrics
decleration and their description.

It create a pipe delimited file with the metric name, metric family
name,description and location in file.

To find all description in all files:
find . -name "*.cc" -exec grep -l '::description' {} \; | xargs -i ./get_description.py {}

While many of the metrics define in the form of
_metrics.add_group("hints_manager", {
        sm::make_gauge("size_of_hints_in_progress", _stats.size_of_hints_in_progress,
                        sm::description("Size of hinted mutations that are scheduled to be written.")),

Some metrics decleration uses variable and string format.
The script uses a configuration file to translate parameters and
concatenations to the actual names.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
2024-02-22 17:06:26 +02:00
Yaniv Kaul
0b0a3ee7fc Typos: fix typos in code
Last batch, hopefully, sing codespell, went over the docs and fixed some typos.

Refs: https://github.com/scylladb/scylladb/issues/16255
Signed-off-by: Yaniv Kaul <yaniv.kaul@scylladb.com>

Closes scylladb/scylladb#16388
2023-12-13 10:45:21 +02:00
Kefu Chai
1b57ba44eb scripts/coverage.py: s/exit/sys.exit/
the former is supposed to be used in "the interactive interpreter
shell and should not be used in programs.". this function
prints out its argument, and the exit code is 1. so just
print the error message using sys.exit()

see also
https://docs.python.org/3/library/sys.html#sys.exit and
https://docs.python.org/3/library/constants.html#exit

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-12-13 10:50:00 +08:00
Kefu Chai
7600b68d5c scripts/coverage.py: do not inherit Value from argparse.Action
as Value is not an argparse.Action, and it is not passed as the argument
of the "action" parameter. neither does it implement the `__call__`
function. so just derive it from object.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-12-13 10:41:52 +08:00
Kefu Chai
9c112dacc4 scripts/coverage.py: use is not None
`is not None` is the more idiomatic Python way to check if an
expression evaluates to not None. and it is more readable.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-12-13 10:41:52 +08:00
Kefu Chai
0d15fc57d5 scripts/coverage.py: correct the formatted string in error message
the formatted string should be `basename`. `input_file` is not defined
in that context.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-12-13 10:41:52 +08:00
Kefu Chai
bc94b7bc04 scripts/coverage.py: do not use f-string when nothing to format
there is no string interpolation in this case, so drop the "f" prefix.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-12-13 10:41:52 +08:00
Kefu Chai
c3c715236d scripts/coverage.py: use raw string to avoid escaping "\"
we use "\." to escape "." in a regular expression. but "\" should
be escaped as well, CPython accepts "\." after trying to find
an escaped character of "\."  but failed, and leave "\." as it is.
but it complains:

```
/home/kefu/dev/scylladb/scripts/coverage.py:107: SyntaxWarning: invalid escape sequence '\.'
  input_file_re_str = f"(.+)\.profraw(\.{__DISTINCT_ID_RE})?"
```

in this change, we use raw string to avoid escaping "\" in
the regular expression.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-12-13 10:41:52 +08:00
Kefu Chai
50332f796e script/base36-uuid.py: interpret timestamp with Gregorian calendar
UUID v1 uses an epoch derived frmo Gregorian calendar. but
base36-uuid.py interprets the timestamp with the UNIX epoch time.
that's why it prints a UUID like

```console
$ ./scripts/base36-uuid.py -d 3gbi_0mhs_4sjf42oac6rxqdsnyx
date = 2411-02-16 16:05:52
decimicro_seconds = 0x7ad550
lsb = 0xafe141a195fe0d59
```

even this UUID is generated on nov 30, 2023. so in this change,
we shift the time with the timestamp of UNIX epoch derived from
the Gregorian calendar's day 0. so, after this change, we have:

```console
$ ./scripts/base36-uuid.py -d 3gbi_0mhs_4sjf42oac6rxqdsnyx
date = 2023-11-30 16:05:52
decimicro_seconds = 0x7ad550
lsb = 0xafe141a195fe0d59
```

see https://datatracker.ietf.org/doc/html/rfc4122#section-4.1.4

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes scylladb/scylladb#16235
2023-12-05 07:39:34 +02:00
Yaniv Kaul
c658bdb150 Typos: fix typos in comments
Fixes some typos as found by codespell run on the code.
In this commit, I was hoping to fix only comments, not user-visible alerts, output, etc.
Follow-up commits will take care of them.

Refs: https://github.com/scylladb/scylladb/issues/16255
Signed-off-by: Yaniv Kaul <yaniv.kaul@scylladb.com>
2023-12-02 22:37:22 +02:00
Tomasz Grabiec
c64ae7b733 scripts: Introduce tablet-mon.py
Closes scylladb/scylladb#15512
2023-11-30 19:15:36 +02:00
Kefu Chai
50c937439b reloc: strip.sh: always generate symbol list with posix format
we compare the symbols lists of stripped ELF file ($orig.stripped) and
that of the one including debugging symbols ($orig.debug) to get a
an ELF file which includes only the necessary bits as the debuginfo
($orig.minidebug).

but we generate the symbol list of stripped ELF file using the
sysv format, while generate the one from the unstripped one using
posix format. the former is always padded the symbol names with spaces
so that their the length at least the same as the section name after
we split the fields with "|".

that's why the diff includes the stuff we don't expect. and hence,
we have tons of warnings like:

```
objcopy: build/node_exporter/node_exporter.keep_symbols:4910: Ignoring rubbish found on this line
```

when using objcopy to filter the ELF file to keep only the
symbols we are interested in.

so, in this change

* use the same format when dumping the symbols from unstripped ELF
  file
* include the symbols in the text area -- the code, by checking
  "T" and "t" in the dumped symbols. this was achieved by matching
  the lines with "FUNC" before this change.
* include the the symbols in .init data section -- the global
  variables which are initialized at compile time. they could
  be also interesting when debugging an application.

Fixes #15513
Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes scylladb/scylladb#15514
2023-09-26 17:59:40 +03:00
Botond Dénes
b97778e4b2 Merge 'create-relocatable-package.py: do not assume "build" build directory' from Kefu Chai
in this series, we do not assume the existence of "build" build directory. and prefer using the version files located under the directory specified with the `--build-dir` option.

Refs #15241

Closes scylladb/scylladb#15402

* github.com:scylladb/scylladb:
  create-relocatable-package.py: prefer $build_dir/SCYLLA-RELEASE-FILE
  create-relocatable-package.py: create SCYLLA-RELOCATABLE-FILE with tempfile
2023-09-18 09:07:37 +03:00
Avi Kivity
4eb4ac4634 scripts: pull_gitgub_pr.sh: absolutize project reference
pull_gitgub_pr.sh adds a "Closes #xyz" tag so github can close
the pull request after next promotion. Convert it to an absolute
refefence (scylladb/scylladb#xyz) so the commit can be cherry-picked
into another repository without the reference dangling.

Closes #15424
2023-09-15 19:29:50 +03:00
Kefu Chai
16eea4569d create-relocatable-package.py: prefer $build_dir/SCYLLA-RELEASE-FILE
similar to d9dcda9dd5, we need to
use the version files located under $build_dir instead "build".
so let's check the existence of $build_dir/SCYLLA-RELEASE-FILE,
and then fallback to the ones under "build".

Refs #15241

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-09-14 12:45:40 +08:00
Kefu Chai
6dc6b39609 create-relocatable-package.py: create SCYLLA-RELOCATABLE-FILE with tempfile
this change serves two purposes:

1. so we don't assume the existence of '$PWD/build' directory. we should
   not assume this. as the build directory could be any diectory, it
   does not have to be "build".
2. we don't have to actually create a file under $build_dir. what we
   need is but an empty file. so tempfile serves this purpose just well.

Refs #15241

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-09-14 12:45:15 +08:00
Kefu Chai
e1d08d888a create-relocatable-package.py: add --node-exporter-dir option
before this change, we assume that node_exporter artifacts are
always located under `build/node_exporter`. but this could might
hold anymore, if we want to have a self-contained build, in the sense
that different builds do not share the same set of node_exporter
artifacts. this could be a waste as the node_exporter artifacts
are identical across different builds, but this makes things
a lot simpler -- different builds do not have to hardwire to
a certain directory.

so, a new option is added to `create-relocatable-package.py`, this
allows us to specify the directory where node_export artifacts
are located.

Refs #15241
Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-09-06 20:52:07 +08:00
Kefu Chai
8bd9645d1d build: specify the build dir instead mode
instead of specifying the build "mode", and assuming that
the build directory is always located at "build/${mode}", specify
the build directory explicitly. this allows us to use
`create-relocatable-package.py` to package artifacts built
at build directory whose path does not comply to the
naming convention, for instance, we might want to build
scylla in `build/yet-another-super-feature/release`.

so, in this change, we trade `--mode` for an option named
`--build-dir` and update `configure.py` accordingly.

Refs #15241
Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-09-06 20:47:42 +08:00
Kefu Chai
dd59b90999 open-coredump: pass the content of "image" file not its path to dbuild
in a4eb3c6e0f, we passed the path of
"image" to `dbuild`, but that was wrong. we should pass its content
to this script. so in this change, it is fixed.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes #15247
2023-09-04 07:34:44 +03:00
Kefu Chai
a4eb3c6e0f open-coredump: use the dbuild script in current branch
the dbuild script provided by the branch being debugged might not
include the recent fixes included by current branch from which
`open-coredump.sh` is launched.

so, instead of using the dbuild script in the repo being debugged,
let's use the dbuild provided by current branch. also, wrap the
dbuild command line. for better readability.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes #15240
2023-09-01 07:27:21 +03:00
Kefu Chai
3bdbe620aa open-coredump: do not assume remote repo name
open-coredump.sh allows us to specify --scylla-repo-path, but
developer's remote repo name is not always "origin" -- the
"origin" could be his/her own remote repo. not the one from which
we want to pull from.

so, in this change, assuming that the remote repo to be pulled
from has been added to the local repo, we query the local repo
for its name and pull using that name instead.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes #15220
2023-08-31 08:04:28 +03:00
Kefu Chai
a47dcb29d5 open-coredump: add selinux label to shared volume
before this change, we don't configure the selinux label when
binding shared volume, but this results in permission denied
when accessing `/opt/scylladb` in the container when the selinux
is enabled. since we are not likely to share the volume with
other containers, we can use `Z` to indicate that the bind
mount is private and unshared. this allows the launched container
to access `/opt/scylladb` even if selinux is enabled.

since selinux is enabled by default on a installation of fedora 38.
this change should improve the user experience of open-coredump
when developer uses fedora distributions.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes #15229
2023-08-31 08:03:40 +03:00
Kefu Chai
17c1b15c81 create-relocatable-package.py: add version file with tempfile
before this change, we build multiple relocatable package for
different builds in parallel using ninja. all these relocatable
packages are built using the same script of
`create-relocatable-package.py`. but this script always use the
same directory and file for the `.relocatable_package_version`
file.

so there are chances that these jobs building the relocatable
package can race and writing / accessing the same file at the same
time. so, in this change, instead of using a fixed file path
for this temporary file, we use a NamedTemporaryFile for this purpose.
this should helps us avoid the build failures like

```
[2023-08-10T09:38:00.019Z] FAILED: build/debug/dist/tar/scylla-unstripped-5.4.0~dev-0.20230810.116c10a2b0c6.x86_64.tar.gz
[2023-08-10T09:38:00.019Z] scripts/create-relocatable-package.py --mode debug 'build/debug/dist/tar/scylla-unstripped-5.4.0~dev-0.20230810.116c10a2b0c6.x86_64.tar.gz'
[2023-08-10T09:38:00.019Z] Traceback (most recent call last):
[2023-08-10T09:38:00.019Z]   File "/jenkins/workspace/scylla-master/scylla-ci/scylla/scripts/create-relocatable-package.py", line 130, in <module>
[2023-08-10T09:38:00.019Z]     os.makedirs(f'build/{SCYLLA_DIR}')
[2023-08-10T09:38:00.019Z]   File "<frozen os>", line 225, in makedirs
[2023-08-10T09:38:00.019Z] FileExistsError: [Errno 17] File exists:
'build/scylla-package'
```

Fixes #15018
Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes #15007
2023-08-11 12:57:28 +03:00
Botond Dénes
ed025890e5 scripts/coverage.py: --run: swallow KeyboardInterrupt
It is quite common to stop a tested scylla process with ^C, which will
raise KeyboardInterrupt from subprocess.run(). Catch and swallow this
exception, allowing the post-processing to continue.
The interrupted process has to handle the interrupt correctly too --
flush the coverage data even on premature exit -- but this is for
another patch.

Closes #14815
2023-07-25 12:29:22 +03:00
Pavel Emelyanov
ec292721d6 open_coredump: Add --scylla-build-id CLI option
The script gets the build id on its own but eu-unstrip-ing the core file
and searching for the necessary value in the output. This can be
somewhat lenghthy operation especially on huge core files. Sometimes
(e.g. in tests) the build id is known and can be just provided as an
argument.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>

Closes #14574
2023-07-10 11:17:54 +03:00
Kefu Chai
c3d2f0cd81 script: add base36-uuid.py
this script provides a tool to decode a base36 encoded timeuuid
to the underlying msb and lsb bits, and to encode msb and lsb
to a string with base36.

Both scylla and Cassandra 4.x support this new SSTable identifier used
in SSTable names. like "nb-3fw2_0tj4_46w3k2cpidnirvjy7k-big-Data.db".
Since this is a new way to print timeuuid, and unlike the representation
defined by RFC4122, it is not straightforward to connect the the
in-memory representation (0x6636ac00da8411ec9abaf56e1443def0) to its
string representation of SSTable identifiers, like
"3fw2_0tj4_46w3k2cpidnirvjy7k". It would be handy to have this
tool to encode/decode the number/string for debugging purpose.

For more context on the new SSTable identifier, please
see
https://cassandra.apache.org/_/blog/Apache-Cassandra-4.1-New-SSTable-Identifiers.html
and https://issues.apache.org/jira/browse/CASSANDRA-17048

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes #14374
2023-06-27 16:56:31 +03:00
Nadav Har'El
59f331c4e1 Merge 'create-relocatable-package.py: package build/node_export only for stripped version' from Kefu Chai
because we build stripped package and non-stripped package in parallel
using ninja. there are chances that the non-stripped build job could
be adding build/node_exporter directory to the tarball while the job
building stripped package is using objcopy to extract the symbols from
the build/node_exporter/node_exporter executable. but objcopy creates
temporary files when processing the executables. and the temporary
files can be spotted by the non-stripped build job. there are two
consequences:

1. non-stripped build job includes the temporary files in its tarball,
   even they are not supposed to be distributed
2. non-stripped build job fails to include the temporary file(s), as
   they are removed after objcopy finishes its job. but the job did spot
   them when preparing the tarball. so when the tarfile python module
   tries to include the previous found temporary file(s), it throws.

neither of these consequences is expected. but fortunately, this only
happens when packaging the non-stripped package. when packaging the
stripped package, the build/node_exported directory is not in flux
anymore. as ninja ensures the dependencies between the jobs.

so, in this change, we do not add the whole directory when packaging
the non-stripped version. as all its ingredients have been added
separately as regular files. and when packaing the stripped version,
we still use the existing step, as we don't have to list all the
files created by strip.sh:

node_exporter{,.debug,.dynsyms,.funcsyms,.keep_symbols,.minidebug.xz}

we could do so in this script, but the repeatings is unnecessary and
error-prune. so, let's keep including the whole directory recursively,
so all the debug symbols are included.

Fixes https://github.com/scylladb/scylladb/issues/14079

Closes #14081

* github.com:scylladb/scylladb:
  create-relocatable-package.py: package build/node_export only for stripped version
  create-relocatable-package.py: use positive condition when possible
2023-06-12 10:39:10 +03:00
Pavel Emelyanov
577cd96da8 scripts: Fix options iteration in open-coredump.sh
When run like 'open-coredump.sh --help' the options parsing loop doesn't
run because $# == 1 and [ $# -gt 1 ] evaluates to false.

The simplest fix is to parse -h|--help on its own as the options parsing
loop assumes that there's core-file argument present.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>

Closes #14075
2023-05-30 12:25:01 +03:00
Kefu Chai
024b96a211 create-relocatable-package.py: package build/node_export only for stripped version
because we build stripped package and non-stripped package in parallel
using ninja. there are chances that the non-stripped build job could
be adding build/node_exporter directory to the tarball while the job
building stripped package is using objcopy to extract the symbols from
the build/node_exporter/node_exporter executable. but objcopy creates
temporary files when processing the executables. and the temporary
files can be spotted by the non-stripped build job. there are two
consequences:

1. non-stripped build job includes the temporary files in its tarball,
   even they are not supposed to be distributed
2. non-stripped build job fails to include the temporary file(s), as
   they are removed after objcopy finishes its job. but the job did spot
   them when preparing the tarball. so when the tarfile python module
   tries to include the previous found temporary file(s), it throws.

neither of these consequences is expected. but fortunately, this only
happens when packaging the non-stripped package. when packaging the
stripped package, the build/node_exported directory is not in flux
anymore. as ninja ensures the dependencies between the jobs.

so, in this change, we do not add the whole directory when packaging
the non-stripped version. as all its ingredients have been added
separately as regular files. and when packaing the stripped version,
we still use the existing step, as we don't have to list all the
files created by strip.sh:

node_exporter{,.debug,.dynsyms,.funcsyms,.keep_symbols,.minidebug.xz}

we could do so in this script, but the repeatings is unnecessary and
error-prune. so, let's keep including the whole directory recursively,
so all the debug symbols are included.

Fixes #14079
Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-05-30 14:00:02 +08:00
Kefu Chai
665a747fab create-relocatable-package.py: use positive condition when possible
to reduce the programmer's cognitive load.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-05-30 14:00:02 +08:00
Kefu Chai
a0b8aa9b13 create-relocatable-package.py: raise if rmtree fails
occasionally, we are observing build failures like:
```
17:20:54  FAILED: build/release/dist/tar/scylla-debuginfo-5.4.0~dev-0.20230522.5b2687e11800.x86_64.tar.gz
17:20:54  dist/debuginfo/scripts/create-relocatable-package.py --mode release 'build/release/dist/tar/scylla-debuginfo-5.4.0~dev-0.20230522.5b2687e11800.x86_64.tar.gz'
17:20:54  Traceback (most recent call last):
17:20:54    File "/jenkins/workspace/scylla-master/scylla-ci/scylla/dist/debuginfo/scripts/create-relocatable-package.py", line 60, in <module>
17:20:54      os.makedirs(f'build/{SCYLLA_DIR}')
17:20:54    File "<frozen os>", line 225, in makedirs
17:20:54  FileExistsError: [Errno 17] File exists: 'build/scylla-debuginfo-package'
```

to understand the root cause better, instead of swallowing the error,
let's raise the exception it is not caused by non-existing directory.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes #13978
2023-05-29 23:03:24 +03:00