Merge branch 'hotfixes-v0.11.0-r2' of github.com:matrix-org/synapse
This commit is contained in:
commit
f9d9bd6aa0
|
@ -1,3 +1,8 @@
|
||||||
|
Changes in synapse v0.11.0-r2 (2015-11-19)
|
||||||
|
==========================================
|
||||||
|
|
||||||
|
* Fix bug in database port script (PR #387)
|
||||||
|
|
||||||
Changes in synapse v0.11.0-r1 (2015-11-18)
|
Changes in synapse v0.11.0-r1 (2015-11-18)
|
||||||
==========================================
|
==========================================
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,7 @@ APPEND_ONLY_TABLES = [
|
||||||
"state_groups_state",
|
"state_groups_state",
|
||||||
"event_to_state_groups",
|
"event_to_state_groups",
|
||||||
"rejections",
|
"rejections",
|
||||||
|
"event_search",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -229,19 +230,51 @@ class Porter(object):
|
||||||
if rows:
|
if rows:
|
||||||
next_chunk = rows[-1][0] + 1
|
next_chunk = rows[-1][0] + 1
|
||||||
|
|
||||||
self._convert_rows(table, headers, rows)
|
if table == "event_search":
|
||||||
|
# We have to treat event_search differently since it has a
|
||||||
|
# different structure in the two different databases.
|
||||||
|
def insert(txn):
|
||||||
|
sql = (
|
||||||
|
"INSERT INTO event_search (event_id, room_id, key, sender, vector)"
|
||||||
|
" VALUES (?,?,?,?,to_tsvector('english', ?))"
|
||||||
|
)
|
||||||
|
|
||||||
def insert(txn):
|
rows_dict = [
|
||||||
self.postgres_store.insert_many_txn(
|
dict(zip(headers, row))
|
||||||
txn, table, headers[1:], rows
|
for row in rows
|
||||||
)
|
]
|
||||||
|
|
||||||
self.postgres_store._simple_update_one_txn(
|
txn.executemany(sql, [
|
||||||
txn,
|
(
|
||||||
table="port_from_sqlite3",
|
row["event_id"],
|
||||||
keyvalues={"table_name": table},
|
row["room_id"],
|
||||||
updatevalues={"rowid": next_chunk},
|
row["key"],
|
||||||
)
|
row["sender"],
|
||||||
|
row["value"],
|
||||||
|
)
|
||||||
|
for row in rows_dict
|
||||||
|
])
|
||||||
|
|
||||||
|
self.postgres_store._simple_update_one_txn(
|
||||||
|
txn,
|
||||||
|
table="port_from_sqlite3",
|
||||||
|
keyvalues={"table_name": table},
|
||||||
|
updatevalues={"rowid": next_chunk},
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
self._convert_rows(table, headers, rows)
|
||||||
|
|
||||||
|
def insert(txn):
|
||||||
|
self.postgres_store.insert_many_txn(
|
||||||
|
txn, table, headers[1:], rows
|
||||||
|
)
|
||||||
|
|
||||||
|
self.postgres_store._simple_update_one_txn(
|
||||||
|
txn,
|
||||||
|
table="port_from_sqlite3",
|
||||||
|
keyvalues={"table_name": table},
|
||||||
|
updatevalues={"rowid": next_chunk},
|
||||||
|
)
|
||||||
|
|
||||||
yield self.postgres_store.execute(insert)
|
yield self.postgres_store.execute(insert)
|
||||||
|
|
||||||
|
|
|
@ -16,4 +16,4 @@
|
||||||
""" This is a reference implementation of a Matrix home server.
|
""" This is a reference implementation of a Matrix home server.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__version__ = "0.11.0-r1"
|
__version__ = "0.11.0-r2"
|
||||||
|
|
|
@ -25,18 +25,29 @@ class ConfigError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# We split these messages out to allow packages to override with package
|
||||||
|
# specific instructions.
|
||||||
|
MISSING_REPORT_STATS_CONFIG_INSTRUCTIONS = """\
|
||||||
|
Please opt in or out of reporting anonymized homeserver usage statistics, by
|
||||||
|
setting the `report_stats` key in your config file to either True or False.
|
||||||
|
"""
|
||||||
|
|
||||||
|
MISSING_REPORT_STATS_SPIEL = """\
|
||||||
|
We would really appreciate it if you could help our project out by reporting
|
||||||
|
anonymized usage statistics from your homeserver. Only very basic aggregate
|
||||||
|
data (e.g. number of users) will be reported, but it helps us to track the
|
||||||
|
growth of the Matrix community, and helps us to make Matrix a success, as well
|
||||||
|
as to convince other networks that they should peer with us.
|
||||||
|
|
||||||
|
Thank you.
|
||||||
|
"""
|
||||||
|
|
||||||
|
MISSING_SERVER_NAME = """\
|
||||||
|
Missing mandatory `server_name` config option.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
class Config(object):
|
class Config(object):
|
||||||
|
|
||||||
stats_reporting_begging_spiel = (
|
|
||||||
"We would really appreciate it if you could help our project out by"
|
|
||||||
" reporting anonymized usage statistics from your homeserver. Only very"
|
|
||||||
" basic aggregate data (e.g. number of users) will be reported, but it"
|
|
||||||
" helps us to track the growth of the Matrix community, and helps us to"
|
|
||||||
" make Matrix a success, as well as to convince other networks that they"
|
|
||||||
" should peer with us."
|
|
||||||
"\nThank you."
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def parse_size(value):
|
def parse_size(value):
|
||||||
if isinstance(value, int) or isinstance(value, long):
|
if isinstance(value, int) or isinstance(value, long):
|
||||||
|
@ -215,7 +226,7 @@ class Config(object):
|
||||||
if config_args.report_stats is None:
|
if config_args.report_stats is None:
|
||||||
config_parser.error(
|
config_parser.error(
|
||||||
"Please specify either --report-stats=yes or --report-stats=no\n\n" +
|
"Please specify either --report-stats=yes or --report-stats=no\n\n" +
|
||||||
cls.stats_reporting_begging_spiel
|
MISSING_REPORT_STATS_SPIEL
|
||||||
)
|
)
|
||||||
if not config_files:
|
if not config_files:
|
||||||
config_parser.error(
|
config_parser.error(
|
||||||
|
@ -290,6 +301,10 @@ class Config(object):
|
||||||
yaml_config = cls.read_config_file(config_file)
|
yaml_config = cls.read_config_file(config_file)
|
||||||
specified_config.update(yaml_config)
|
specified_config.update(yaml_config)
|
||||||
|
|
||||||
|
if "server_name" not in specified_config:
|
||||||
|
sys.stderr.write("\n" + MISSING_SERVER_NAME + "\n")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
server_name = specified_config["server_name"]
|
server_name = specified_config["server_name"]
|
||||||
_, config = obj.generate_config(
|
_, config = obj.generate_config(
|
||||||
config_dir_path=config_dir_path,
|
config_dir_path=config_dir_path,
|
||||||
|
@ -299,11 +314,8 @@ class Config(object):
|
||||||
config.update(specified_config)
|
config.update(specified_config)
|
||||||
if "report_stats" not in config:
|
if "report_stats" not in config:
|
||||||
sys.stderr.write(
|
sys.stderr.write(
|
||||||
"Please opt in or out of reporting anonymized homeserver usage "
|
"\n" + MISSING_REPORT_STATS_CONFIG_INSTRUCTIONS + "\n" +
|
||||||
"statistics, by setting the report_stats key in your config file "
|
MISSING_REPORT_STATS_SPIEL + "\n")
|
||||||
" ( " + config_path + " ) " +
|
|
||||||
"to either True or False.\n\n" +
|
|
||||||
Config.stats_reporting_begging_spiel + "\n")
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if generate_keys:
|
if generate_keys:
|
||||||
|
|
Loading…
Reference in New Issue