Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

FUSE SUPPORT#184

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
demonolock merged 5 commits intomasterfromfuse-helpers
Mar 19, 2025
Merged

FUSE SUPPORT#184

demonolock merged 5 commits intomasterfromfuse-helpers
Mar 19, 2025

Conversation

dura0ok
Copy link
Collaborator

No description provided.

@dura0okdura0ok changed the titleadd change data dir optionFUSE SUPPORTFeb 20, 2025
@dura0okdura0okforce-pushed thefuse-helpers branch 2 times, most recently fromca2bf88 to032f142CompareFebruary 20, 2025 12:34
defdata_dir(self):
# NOTE: we can't run initdb without user's args
returnos.path.join(self.base_dir,DATA_DIR)
ifhasattr(self,'_data_dir'):
Copy link
Contributor

Choose a reason for hiding this comment

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

как-то путанно выходит, может через DATA_DIR, только проверять абсолютный или относительный путь там указан? Есть абсолютный, то не подставлять base_dir

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Не, я создаю просто пустую директорию куда буду монтировать fuse и хочу потом сменить data_dir у ноды на нее, чтобы можно было ноду запустить с новой директорией.
У директория куда монтируется не обязательно называется data.
Какая разница.

Copy link
Collaborator

@dmitry-lipetskdmitry-lipetskFeb 20, 2025
edited
Loading

Choose a reason for hiding this comment

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

Привет.

Я с подозрением отношусь к этой фиче со сменой директории у ноды. Ноду нужно сразу создать с указанием нужной директории и после этого не давать её менять. То, что это (как я понимаю) сейчас невозможно - это другой вопрос.

У нас есть base_dir. От неё мы "наследуем" data_dir и log_dir.

Нужно иметь возможность явно указать эти data_dir и base_dir. Это будет уже совсем другой тип ноды, у которой нет base_dir.

По хорошему тут нужен другой вариант, который, в упрощенной форме, выглядит так:

  • Нужно соорудить базовый класс для PostgresNode - PostgresNodeBase.
  • У PostgresNodeBase будет два "абстрактных" свойства - data_dir и log_dir.
  • Туда же, в PostgresNodeBase, перенесем функционал PostgresNode.
  • Текущий PostgresNode наследует этот PostgresNodeBase и завязывает data_dir и log_dir на base_dir
  • Вариант ноды, в которой можно указывать data_dir и log_dir делаем другим классом. Скажем - PostgresNode2. В его конструктор будут передаваться явные значения для data_dir и log_dir.

demonolock reacted with thumbs up emoji
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Как идея может просто тогда давать возможность задавать DataDir при конструкции ноды?

Copy link
Contributor

Choose a reason for hiding this comment

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

можно, но тогда нужно custom_data_dir задавать, чтобы не конфликтовало с def data_dir(self). а вот в data_dir определять в зависимости от того задан custom_data_dir или нет.

Copy link
CollaboratorAuthor

@dura0okdura0okMar 12, 2025
edited
Loading

Choose a reason for hiding this comment

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

@demonolock@dmitry-lipetsk
Подумал и переделал это в корне по другому. Теперь можно указать при старте ноды и ее остановке custom_data_dir.
Так ок?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

@demonolock@dmitry-lipetsk убрал сеттер вовсе, обошелся без него пустой нодой. Таки сообразил как. Вы правы. Аппрув?

defrun(self,command,gdb=False,old_binary=False,return_id=True,env=None,
skip_log_directory=False,expect_error=False,use_backup_dir=True):
skip_log_directory=False,expect_error=False,use_backup_dir=True,daemonize=False):
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Это будет раз на команду задаваться или на весь тестовый прогон?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Раз на команду, нужно для того чтобы мочь запустить команду в фоновом режиме. В моем случае чтобы запустить пробэкап с опцией fuse в фоне.

logging.info(f"Process started in background with PID:{self.process.pid}")

ifself.process.stdoutandself.process.stderr:
stdout_thread=threading.Thread(target=stream_output,args=(self.process.stdout,))
Copy link
Contributor

Choose a reason for hiding this comment

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

, daemon=True?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Да, кажется разумно, поправлю.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Поправлено

stderr=subprocess.STDOUT,
env=env
).decode('utf-8',errors='replace')
ifdaemonize:
Copy link
Contributor

Choose a reason for hiding this comment

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

часть в daemonize можно вынести в функцию например такую form_daemon_process

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Сделаю, разумно

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Поправлено

ifdaemonize:

defstream_output(stream:subprocess.PIPE)->None:
forlineiniter(stream.readline,''):
Copy link
Contributor

Choose a reason for hiding this comment

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

что если в цикле ошибка будет? Кажется нужен try - finally

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Разумно, сделаю

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Поправлено

returnself

defstop(self,params=[],wait=True):
defstop(self,params=[],wait=True,custom_data_dir=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

Может быть проблема при внезапной остановке теста. В местах с вызовом stop(), например _try_shutdown. На cleanup еще пожалуйста посмотри, как он должен отработать, обе директории custom_data_dir и data_dir зачищать или только одну?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Хм, а как быть? Сохранять custom_data_dir в self и в try shutdown смотреть и убивать?
Вот если бы не в with force, то он просто бы по пиду убивал и все..
cleanup я бы оставил на откуп внешнего пользователя..

Copy link
Collaborator

Choose a reason for hiding this comment

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

Как быть - не знаю.

Но выглядит так, как будто код пошел вразнос ))

dura0ok reacted with confused emoji
Copy link
Collaborator

@dmitry-lipetskdmitry-lipetskMar 12, 2025
edited
Loading

Choose a reason for hiding this comment

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

Думаю, что все таки надо будет реализовывать ту идею, которую я предложил с самого начала.

Там еще под раздачу попадает os_ops.

В текущем варианте реализована своеобразная логика выбора os_ops для PostgresNode у которой есть проблемы.

@dmitry-lipetsk
Copy link
Collaborator

Насчет data_dir.

Посмотрите#222.

Я пока не добавлял производный класс с поддержкой явных data_dir и logs_dir.


@property
defdata_dir(self):
# NOTE: we can't run initdb without user's args
Copy link
Contributor

Choose a reason for hiding this comment

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

Верни пожалуйста комментарий

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Поправил

@demonolockdemonolock merged commit81a5eb4 intomasterMar 19, 2025
1 of 2 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@dmitry-lipetskdmitry-lipetskdmitry-lipetsk approved these changes

@demonolockdemonolockdemonolock approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@dura0ok@dmitry-lipetsk@demonolock

[8]ページ先頭

©2009-2025 Movatter.jp